diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98bc007a5a..73c25c02e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,7 +156,7 @@ jobs: name: Windows (${{ matrix.platform_name }}) using mingw runs-on: ubuntu-latest needs: check-code-formatting - container: openrct2/openrct2-build:13-mingw + container: openrct2/openrct2-build:14-mingw strategy: fail-fast: false matrix: @@ -293,7 +293,7 @@ jobs: echo 'Not going to push build' fi linux-portable: - name: Linux (${{ matrix.platform }}, ${{ matrix.distro }}, portable) + name: ${{ matrix.distro }} Linux (${{ matrix.release }}, ${{ matrix.platform }}, portable) runs-on: ubuntu-latest needs: check-code-formatting container: ${{ matrix.image }} @@ -302,23 +302,21 @@ jobs: matrix: include: # Use `-fno-var-tracking-assignments` to reduce amount of produced debug information. This is necessary due to 100MiB limit of GitHub / openrct2.org API. - # For focal the debug information still takes too much space, so reduce amount of debug info to minimum using `-g1` (`-g` means `-g2`), which is enough for backtraces only. - platform: x86_64 - distro: focal - image: openrct2/openrct2-build:13-focal - build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g1 -gz" -DWITH_TESTS=off - - platform: x86_64 - distro: jammy - image: openrct2/openrct2-build:13-jammy + distro: Ubuntu + release: jammy + image: openrct2/openrct2-build:14-jammy build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" - platform: x86_64 - distro: bullseye - image: openrct2/openrct2-build:13-bullseye + distro: Debian + release: bullseye + image: openrct2/openrct2-build:14-bullseye build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" -DWITH_TESTS=off - platform: i686 - distro: focal - image: openrct2/openrct2-build:13-focal32 - build_flags: -DFORCE32=ON -DENABLE_SCRIPTING=OFF -DCMAKE_CXX_FLAGS="-m32 -g1 -gz" -DWITH_TESTS=off + distro: Ubuntu + release: jammy + image: openrct2/openrct2-build:14-jammy32 + build_flags: -DFORCE32=ON -DENABLE_SCRIPTING=OFF -DCMAKE_CXX_FLAGS="-m32 -g -gz" -DWITH_TESTS=off steps: - name: Checkout uses: actions/checkout@v4 @@ -353,10 +351,10 @@ jobs: echo 'Not going to push build' fi linux-appimage: - name: Linux (x86_64, AppImage) + name: Ubuntu Linux (AppImage, x86_64) runs-on: ubuntu-latest needs: check-code-formatting - container: openrct2/openrct2-build:13-focal + container: openrct2/openrct2-build:14-jammy steps: - name: Checkout uses: actions/checkout@v4 @@ -386,7 +384,7 @@ jobs: echo 'Not going to push build' fi linux-docker: - name: Linux (docker) + name: Ubuntu Linux (Docker) needs: check-code-formatting if: github.repository == 'OpenRCT2/OpenRCT2' runs-on: ubuntu-latest @@ -411,10 +409,10 @@ jobs: echo 'Image not pushed' fi linux-clang: - name: Linux (Debug, [http, network, flac, vorbis OpenGL] disabled) using clang + name: Ubuntu Linux (jammy, debug, [http, network, flac, vorbis OpenGL] disabled) using clang runs-on: ubuntu-latest needs: check-code-formatting - container: openrct2/openrct2-build:13-jammy + container: openrct2/openrct2-build:14-jammy steps: - name: Checkout uses: actions/checkout@v4 @@ -427,10 +425,10 @@ jobs: - name: Build OpenRCT2 run: . scripts/setenv && build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DDISABLE_NETWORK=ON -DDISABLE_HTTP=ON -DDISABLE_FLAC=ON -DDISABLE_VORBIS=ON -DDISABLE_OPENGL=ON linux-clang-tests: - name: Linux (Debug) using clang, coverage enabled + name: Ubuntu Linux (debug) using clang, coverage enabled runs-on: ubuntu-latest needs: check-code-formatting - container: openrct2/openrct2-build:13-jammy + container: openrct2/openrct2-build:14-jammy steps: - name: Checkout uses: actions/checkout@v4 @@ -471,7 +469,7 @@ jobs: name: Android runs-on: ubuntu-latest needs: check-code-formatting - container: openrct2/openrct2-build:13-android + container: openrct2/openrct2-build:14-android steps: - name: Checkout uses: actions/checkout@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f62a0bb62..b309dc5a99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,9 +64,9 @@ set(TITLE_SEQUENCE_VERSION "0.4.6") set(TITLE_SEQUENCE_URL "https://github.com/OpenRCT2/title-sequences/releases/download/v${TITLE_SEQUENCE_VERSION}/title-sequences.zip") set(TITLE_SEQUENCE_SHA1 "80fefc6ebbabc42a6f4703412daa5c62f661420d") -set(OBJECTS_VERSION "1.4.0") +set(OBJECTS_VERSION "1.4.3") set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip") -set(OBJECTS_SHA1 "f512e230ffa2f16109209e4f30e7d7bf4fe21fc0") +set(OBJECTS_SHA1 "ac78210ef46465c0f51bbffd6fe21845092af48e") set(OPENSFX_VERSION "1.0.5") set(OPENSFX_URL "https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${OPENSFX_VERSION}/opensound.zip") @@ -277,7 +277,7 @@ if (MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244") # C4244: 'conversion_type': conversion from 'type1' to 'type2', possible loss of data set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4068") # C4068: unknown pragma - # Enable char8_t<->char conversion :( + # Enable char8_t<->char conversion set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:char8_t-") add_definitions(-D_CRT_SECURE_NO_WARNINGS) @@ -334,7 +334,7 @@ else () set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas -Wno-missing-braces -Wno-comment -Wnonnull -Wno-unused-parameter -Wno-attributes") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG=${DEBUG_LEVEL}") - # Enable char8_t<->char conversion :( + # Enable char8_t<->char conversion set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-char8_t -Wno-deprecated-declarations") if(APPLE) diff --git a/contributors.md b/contributors.md index a50932ed55..91018072cb 100644 --- a/contributors.md +++ b/contributors.md @@ -121,6 +121,7 @@ Appreciation for contributors who have provided substantial work, but are no lon * Alex Parisi (alex-parisi) - Added API for returning metadata from all registered plugins. ## Bug fixes & Refactors +* Claudio Tiecher (janclod) * (KirilAngelov) * (halfbro) * (Myrtle) @@ -234,6 +235,8 @@ Appreciation for contributors who have provided substantial work, but are no lon * Michael Bernardi (mrmbernardi) * Aram Kazorian (aramk-hub) * Harry Hopkinson (Harry-Hopkinson) +* Jan Kelemen (jan-kelemen) +* Cory Ye (CoryfY) ## Toolchain * (Balletie) - macOS diff --git a/data/language/ar-EG.txt b/data/language/ar-EG.txt index bf23259e13..44c718effe 100644 --- a/data/language/ar-EG.txt +++ b/data/language/ar-EG.txt @@ -1740,12 +1740,12 @@ STR_2382 :Land STR_2383 :Water STR_2384 :{WINDOW_COLOUR_2}Your objective: STR_2385 :{BLACK}None -STR_2386 :{BLACK}To have at least {COMMA16} guests in your park at the end of {MONTHYEAR}, with a park rating of at least 600 +STR_2386 :{BLACK}To have at least {COMMA32} guests in your park at the end of {MONTHYEAR}, with a park rating of at least 600 STR_2387 :{BLACK}To achieve a park value of at least {POP16}{POP16}{CURRENCY} at the end of {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Have Fun! STR_2389 :{BLACK}Build the best {STRINGID} you can! STR_2390 :{BLACK}To have 10 different types of roller coasters operating in your park, each with an excitement value of at least 6.00 -STR_2391 :{BLACK}To have at least {COMMA16} guests in your park. You must not let the park rating drop below 700 at any time! +STR_2391 :{BLACK}To have at least {COMMA32} guests in your park. You must not let the park rating drop below 700 at any time! STR_2392 :{BLACK}To achieve a monthly income from ride tickets of at least {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}To have 10 different types of roller coasters operating in your park, each with a minimum length of {LENGTH}, and an excitement rating of at least 7.00 STR_2394 :{BLACK}To finish building all 5 of the partially built roller coasters in this park, designing them to achieve excitement ratings of at least {POP16}{POP16}{COMMA2DP32} each @@ -2326,7 +2326,7 @@ STR_3305 :{WINDOW_COLOUR_2}Monthly income: STR_3306 :{WINDOW_COLOUR_2}Monthly profit: STR_3307 :{WINDOW_COLOUR_2}Minimum length: STR_3308 :{WINDOW_COLOUR_2}Excitement rating: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Rides/attractions under a preservation order: diff --git a/data/language/ca-ES.txt b/data/language/ca-ES.txt index 2830536c36..8aec349c7e 100644 --- a/data/language/ca-ES.txt +++ b/data/language/ca-ES.txt @@ -1740,12 +1740,12 @@ STR_2382 :Terra STR_2383 :Aigua STR_2384 :{WINDOW_COLOUR_2}El vostre objectiu: STR_2385 :{BLACK}Cap -STR_2386 :{BLACK}Tenir almenys {COMMA16} visitants al parc al final de {MONTHYEAR}, amb una valoració del parc d’almenys 600. +STR_2386 :{BLACK}Tenir almenys {COMMA32} visitants al parc al final de {MONTHYEAR}, amb una valoració del parc d’almenys 600. STR_2387 :{BLACK}Aconseguir una valoració del parc d’almenys {POP16}{POP16}{CURRENCY} al final de {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR}. STR_2388 :{BLACK}Divertiu-vos! STR_2389 :{BLACK}Construïu el millor {STRINGID} que pugueu! STR_2390 :{BLACK}Tenir 10 tipus diferents de muntanyes russes operant al parc, cadascuna d’elles amb un valor d’emoció d’almenys 6,00. -STR_2391 :{BLACK}Tenir almenys {COMMA16} visitants al parc. No podeu deixar que la valoració del parc caigui per sota de 700 en cap moment! +STR_2391 :{BLACK}Tenir almenys {COMMA32} visitants al parc. No podeu deixar que la valoració del parc caigui per sota de 700 en cap moment! STR_2392 :{BLACK}Aconseguir uns ingressos mensuals amb les entrades d’atraccions d’almenys {POP16}{POP16}{CURRENCY}. STR_2393 :{BLACK}Tenir 10 tipus diferents de muntanyes russes operant al parc, cadascuna amb una longitud mínima de {LENGTH} i un valor d’emoció d’almenys 7,00. STR_2394 :{BLACK}Acabar de construir les cinc muntanyes russes que s’havien començat a construir al parc, dissenyant-les per a aconseguir un nivell d’emoció d’almenys {POP16}{POP16}{COMMA2DP32} per cada una d’elles. @@ -2326,7 +2326,7 @@ STR_3305 :{WINDOW_COLOUR_2}Ingressos mensuals: STR_3306 :{WINDOW_COLOUR_2}Beneficis mensuals: STR_3307 :{WINDOW_COLOUR_2}Longitud mínima: STR_3308 :{WINDOW_COLOUR_2}Nivell d’emoció: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Atraccions protegides: @@ -3687,6 +3687,10 @@ STR_6610 :L’element de camí no s’ha trobat STR_6611 :L’element de mur no s’ha trobat STR_6612 :L’element de text de cartell no s’ha trobat STR_6613 :Recarrega l’objecte +STR_6614 :El preu de l’entrada al parc no es pot canviar +STR_6615 :La via d'aquesta casella necessita aigua +STR_6616 :L’acció no és vàlida per a aquest tipus d’empleat +STR_6617 :No es pot intercanviar l’element de la casella amb si mateix ############# # Scenarios # diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt index b85810866e..6028999ee5 100644 --- a/data/language/cs-CZ.txt +++ b/data/language/cs-CZ.txt @@ -1742,12 +1742,12 @@ STR_2382 :Země STR_2383 :Vodní plochy STR_2384 :{WINDOW_COLOUR_2}Cíl scénáře: STR_2385 :{BLACK}žádný -STR_2386 :{BLACK}Mít v parku alespoň {COMMA16} návštěvníků na konci {MONTHYEAR}, s hodnocením parku alespoň 600 +STR_2386 :{BLACK}Mít v parku alespoň {COMMA32} návštěvníků na konci {MONTHYEAR}, s hodnocením parku alespoň 600 STR_2387 :{BLACK}Dosáhnout hodnoty parku alespoň {POP16}{POP16}{CURRENCY} na konci {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Příjemnou zábavu! STR_2389 :{BLACK}Postav ten nejlepší {STRINGID}! STR_2390 :{BLACK}Mít v parku 10 druhů kolotočů v provozu, každý s hodnotou zábavnosti alespoň 6.00 -STR_2391 :{BLACK}Mít v parku alespoň {COMMA16} návštěvníků a zároveň nikdy nenechat hodnocení parku spadnout pod 700! +STR_2391 :{BLACK}Mít v parku alespoň {COMMA32} návštěvníků a zároveň nikdy nenechat hodnocení parku spadnout pod 700! STR_2392 :{BLACK}Dosáhnout měsíčního příjmu z lístků na atrakce alespoň {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}{BLACK}Mít v parku 10 druhů kolotočů v provozu, každý s hodnotou zábavnosti alespoň 7.00 a délkou alespoň {LENGHT} STR_2394 :{BLACK}Dokončit všech 5 rozestavěných horských drah tak, aby každá dosahovala hodnocení vzrušení alespoň {POP16}{POP16}{COMMA2DP32} @@ -2328,7 +2328,7 @@ STR_3305 :{WINDOW_COLOUR_2}Měsíční příjem: STR_3306 :{WINDOW_COLOUR_2}Měsíční zisk: STR_3307 :{WINDOW_COLOUR_2}Minimální délka: STR_3308 :{WINDOW_COLOUR_2}Nadšení: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Atrakce, které je nutno zachovat: diff --git a/data/language/da-DK.txt b/data/language/da-DK.txt index ad640a48f3..77bf3f5baf 100644 --- a/data/language/da-DK.txt +++ b/data/language/da-DK.txt @@ -1737,12 +1737,12 @@ STR_2382 :Land STR_2383 :Vand STR_2384 :{WINDOW_COLOUR_2}Dit mål: STR_2385 :{BLACK}Ingen -STR_2386 :{BLACK}At have mindst {COMMA16} gæster i parken, ved udgangen af {MONTHYEAR}, og med en park vurdering på mindst 600 +STR_2386 :{BLACK}At have mindst {COMMA32} gæster i parken, ved udgangen af {MONTHYEAR}, og med en park vurdering på mindst 600 STR_2387 :{BLACK}At opnå en Parkværdi på mindst {POP16}{POP16}{CURRENCY} ved udgangen af {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Hav det sjovt! STR_2389 :{BLACK}Byg den bedste {STRINGID} du kan! STR_2390 :{BLACK}At have 10 forskellige typer rutschebaner i gang i parken på samme tid, Hver med en spændings vurdering over 6.00 -STR_2391 :{BLACK}At have mindst {COMMA16} gæster i parken. Du må ikke lade park vurderingen flade under 700 på noget tidspunkt! +STR_2391 :{BLACK}At have mindst {COMMA32} gæster i parken. Du må ikke lade park vurderingen flade under 700 på noget tidspunkt! STR_2392 :{BLACK}At opnå en månedlig indkomst fra forlystelser på mindst {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}At have 10 forskellige typer rutschebaner i gang i parken på samme tid, hver med en minimums længde på {LENGTH}, og en spændings vurdering på mindst 7.00 STR_2394 :{BLACK}At færdiggøre alle 5 af de delvist færdige byggede rutschebaner i denne park, design dem til at have at opnå en spændings vurdering på mindst {POP16}{POP16}{COMMA2DP32} hver @@ -2323,7 +2323,7 @@ STR_3305 :{WINDOW_COLOUR_2}Månedsinkomst: STR_3306 :{WINDOW_COLOUR_2}Månedsprofit: STR_3307 :{WINDOW_COLOUR_2}Minimum længde: STR_3308 :{WINDOW_COLOUR_2}Spændings vurdering: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}forlystelser/attraktioner under bevaringsordre: diff --git a/data/language/de-DE.txt b/data/language/de-DE.txt index dd66892156..c3d431c1b5 100644 --- a/data/language/de-DE.txt +++ b/data/language/de-DE.txt @@ -1738,12 +1738,12 @@ STR_2382 :Land STR_2383 :Wasser STR_2384 :{WINDOW_COLOUR_2}Ihr Ziel: STR_2385 :{BLACK}Keins -STR_2386 :{BLACK}Mindestens {COMMA16} Parkbesucher bis {MONTHYEAR} und eine Parkbewertung von mindestens 600 zu haben +STR_2386 :{BLACK}Mindestens {COMMA32} Parkbesucher bis {MONTHYEAR} und eine Parkbewertung von mindestens 600 zu haben STR_2387 :{BLACK}Einen Verkehrswert von mindestens {POP16}{POP16}{CURRENCY} zu erreichen bis {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Viel Spaß! STR_2389 :{BLACK}Bauen Sie Ihre(n) beste(n) {STRINGID}! STR_2390 :{BLACK}Mindestens 10 verschiedene Achterbahntypen in Ihrem Park zu betreiben, wobei jeder einen Nervenkitzelwert von mindestens 6,00 aufweisen muss -STR_2391 :{BLACK}Mindestens {COMMA16} Parkbesucher zu erreichen. Die Parkbewertung darf zu keinem Zeitpunkt unter 700 fallen! +STR_2391 :{BLACK}Mindestens {COMMA32} Parkbesucher zu erreichen. Die Parkbewertung darf zu keinem Zeitpunkt unter 700 fallen! STR_2392 :{BLACK}Monatliche Einkünfte durch Fahrttickets von mindestens {POP16}{POP16}{CURRENCY} zu erreichen STR_2393 :{BLACK}Mindestens 10 verschiedene Achterbahntypen in Ihrem Park zu betreiben, wobei jeder eine Mindestlänge von {LENGTH} und einen Nervenkitzelwert von mindestens 7,00 aufweisen muss STR_2394 :{BLACK}Alle 5 bereits teilweise gebauten Achterbahnen fertigzustellen, damit sie jeweils einen Nervenkitzelwert von {POP16}{POP16}{COMMA2DP32} erzielen @@ -2325,7 +2325,7 @@ STR_3305 :{WINDOW_COLOUR_2}Monatliche Einkünfte: STR_3306 :{WINDOW_COLOUR_2}Monatlicher Gewinn: STR_3307 :{WINDOW_COLOUR_2}Mindestlänge: STR_3308 :{WINDOW_COLOUR_2}Nervenkitzelwert: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Attraktionen unter Beibehaltungsauftrag: @@ -3678,6 +3678,16 @@ STR_6609 :Streckenblock konnte nicht gefunden werden STR_6610 :Wegelement konnte nicht gefunden werden STR_6611 :Wandelement konnte nicht gefunden werden STR_6612 :Bannerelement konnte nicht gefunden werden +STR_6613 :Objekt neu laden +STR_6614 :Parkeintrittsgeld kann nicht geändert werden +STR_6615 :Streckenabschnitt auf dieser Kachel benötigt Wasser +STR_6616 :Aktion ungültig für diesen Personaltyp +STR_6617 :Kachelelement kann nicht mit sich selbst vertauscht werden +STR_6618 :Objekt kann weder eingeschränkt werden noch kann die Einschränkung zurückgenommen werden … +STR_6619 :Objekttyp kann nicht eingeschränkt werden! +STR_6620 :Objekt nicht gefunden! +STR_6621 :Einschränken +STR_6622 :Objekt auf den Szenario-Editor und dem Sandkastenmodus einschränken ############# # Scenarios # diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 47d8e0a254..ff5d99048e 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -98,6 +98,7 @@ STR_0093 :Hybrid Coaster STR_0094 :Single Rail Roller Coaster STR_0095 :Alpine Coaster STR_0096 :Classic Wooden Roller Coaster +STR_0097 :Classic Stand-up Roller Coaster STR_0512 :A compact roller coaster with a spiral lift hill and smooth, twisting drops. STR_0513 :A looping roller coaster where the riders ride in a standing position STR_0514 :Trains suspended beneath the roller coaster track swing out to the side around corners @@ -181,6 +182,7 @@ STR_0603 :A wooden style roller coaster with a steel track, allowing for stee STR_0604 :Riders ride single file on a narrow monorail track, as they race through tight inversions and direction changes STR_0605 :Riders toboggan down a meandering steel track, braking to control their speed STR_0606 :An older-style wooden roller coaster with a fast and rough ride, with plenty of air-time, some lateral G’s, and designed to feel ‘out-of-control’ +STR_0607 :An intense, older-style steel looping roller coaster where the riders ride in a standing position STR_0767 :Guest {INT32} STR_0768 :Handyman {INT32} STR_0769 :Mechanic {INT32} @@ -1737,12 +1739,12 @@ STR_2382 :Land STR_2383 :Water STR_2384 :{WINDOW_COLOUR_2}Your objective: STR_2385 :{BLACK}None -STR_2386 :{BLACK}To have at least {COMMA16} guests in your park at the end of {MONTHYEAR}, with a park rating of at least 600 +STR_2386 :{BLACK}To have at least {COMMA32} guests in your park at the end of {MONTHYEAR}, with a park rating of at least 600 STR_2387 :{BLACK}To achieve a park value of at least {POP16}{POP16}{CURRENCY} at the end of {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Have Fun! STR_2389 :{BLACK}Build the best {STRINGID} you can! STR_2390 :{BLACK}To have 10 different types of roller coasters operating in your park, each with an excitement value of at least 6.00 -STR_2391 :{BLACK}To have at least {COMMA16} guests in your park. You must not let the park rating drop below 700 at any time! +STR_2391 :{BLACK}To have at least {COMMA32} guests in your park. You must not let the park rating drop below 700 at any time! STR_2392 :{BLACK}To achieve a monthly income from ride tickets of at least {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}To have 10 different types of roller coasters operating in your park, each with a minimum length of {LENGTH}, and an excitement rating of at least 7.00 STR_2394 :{BLACK}To finish building all 5 of the partially built roller coasters in this park, designing them to achieve excitement ratings of at least {POP16}{POP16}{COMMA2DP32} each @@ -2323,7 +2325,7 @@ STR_3305 :{WINDOW_COLOUR_2}Monthly income: STR_3306 :{WINDOW_COLOUR_2}Monthly profit: STR_3307 :{WINDOW_COLOUR_2}Minimum length: STR_3308 :{WINDOW_COLOUR_2}Excitement rating: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Rides/attractions under a preservation order: @@ -3692,6 +3694,9 @@ STR_6619 :Object type cannot be restricted! STR_6620 :Object not found! STR_6621 :Restrict STR_6622 :Restrict object to the Scenario Editor and Sandbox mode. +STR_6623 :Type ‘help’ for a list of available commands. Type ‘hide’ to hide the console. +STR_6624 :Tile Inspector: Sort elements +STR_6625 :Invalid colour ############# # Scenarios # diff --git a/data/language/en-US.txt b/data/language/en-US.txt index 3424f63ee6..719c210383 100644 --- a/data/language/en-US.txt +++ b/data/language/en-US.txt @@ -7,12 +7,11 @@ # Vanilla strings. Only change strings that differ from UK English! STR_0007 :Miniature Railroad STR_0015 :Bobsled Coaster +STR_0027 :Bumper Cars STR_0035 :Carousel STR_0038 :Restroom -STR_0041 :3D Theater STR_0045 :Elevator STR_0047 :ATM -STR_0052 :Tunnel Of Horror STR_0517 :Passengers ride in miniature trains along a narrow-gauge railroad track STR_0529 :Mine train themed roller coaster trains career along steel roller coaster track made to look like old railroad track STR_0537 :Guests bump into each other in self-driven electric bumper cars @@ -203,7 +202,7 @@ STR_3102 :Re-paint colored scenery on landscape STR_3122 :{WINDOW_COLOUR_2}Favorite ride of: {BLACK}{COMMA32} guest STR_3123 :{WINDOW_COLOUR_2}Favorite ride of: {BLACK}{COMMA32} guests -STR_3372 :{BLACK}= A.T.M. +STR_3372 :{BLACK}= ATM STR_3373 :{BLACK}= Restroom # Strings added by OpenRCT2. Only add strings that differ from UK English! diff --git a/data/language/eo-ZZ.txt b/data/language/eo-ZZ.txt index 078dbfb778..6aafd0d779 100644 --- a/data/language/eo-ZZ.txt +++ b/data/language/eo-ZZ.txt @@ -1737,12 +1737,12 @@ STR_2382 :Tero STR_2383 :Akvo STR_2384 :{WINDOW_COLOUR_2}Via celo: STR_2385 :{BLACK}Neniu -STR_2386 :{BLACK}Havi almenaŭ {COMMA16} gastojn en via parko al la fino de {MONTHYEAR}, kun pritakso de parko ne malpli ol 600 +STR_2386 :{BLACK}Havi almenaŭ {COMMA32} gastojn en via parko al la fino de {MONTHYEAR}, kun pritakso de parko ne malpli ol 600 STR_2387 :{BLACK}Atingi parkvaloron ne malpli ol {POP16}{POP16}{CURRENCY} al la fino de {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Amuzi Vin! STR_2389 :{BLACK}Konstrui je la plej bona {STRINGID}, kiun vi povas konstrui! STR_2390 :{BLACK}Havi 10 malsamajn tipojn de ondaj fervojoj funkciantajn en via parko, kiuj havas po pritakson de eksciteco ne malpli ol 6.00 -STR_2391 :{BLACK}Havi almenaŭ {COMMA16} gastojn en via parko. Ankaŭ, necesas ke la pritakso de la parko neniam falu sub 700! +STR_2391 :{BLACK}Havi almenaŭ {COMMA32} gastojn en via parko. Ankaŭ, necesas ke la pritakso de la parko neniam falu sub 700! STR_2392 :{BLACK}Atingi enspezon monatan ne malpli ol {POP16}{POP16}{CURRENCY}, pro la vendado de biletoj de atrakcioj STR_2393 :{BLACK}Havi 10 malsamajn tipojn de ondaj fervojoj funkciantajn en via parko, kiuj havas po mimimuman longecon de {LENGTH} kaj pritakson de eksciteco ne malpli ol 7.00 STR_2394 :{BLACK}Fini la konstruadon de la tutaj 5 ondaj fervojoj konstruitaj parte. Desegni ilin, por atingi po pritakson de eksciteco ne malpli ol {POP16}{POP16}{COMMA2DP32} @@ -2323,7 +2323,7 @@ STR_3305 :{WINDOW_COLOUR_2}Enspezo monata: STR_3306 :{WINDOW_COLOUR_2}Profito monata: STR_3307 :{WINDOW_COLOUR_2}Minimuma longeco: STR_3308 :{WINDOW_COLOUR_2}Pritakso de eksciteco: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Atrakcioj, kiujn oni ne eblas ŝanĝi dum la scenaro: @@ -3686,6 +3686,11 @@ STR_6614 :Ne povas ŝanĝi enirpagon de parko STR_6615 :Trako sur ĉi tiu bloko bezonas akvon STR_6616 :Ago estas nevalida por tiu dungitotipo STR_6617 :Ne povas permuti blokelementon kun si mem +STR_6618 :Ne povas limigi aŭ mallimigi objekton… +STR_6619 :Objekotipo ne povas esti limigita! +STR_6620 :Objekto ne troviĝis! +STR_6621 :Limigi +STR_6622 :Limigi objekton al la Scenaroredaktilo kaj Provejo-reĝimo. ############# # Scenarios # diff --git a/data/language/es-ES.txt b/data/language/es-ES.txt index 4c55911e29..3272aba042 100644 --- a/data/language/es-ES.txt +++ b/data/language/es-ES.txt @@ -1738,12 +1738,12 @@ STR_2382 :Tierra STR_2383 :Agua STR_2384 :{WINDOW_COLOUR_2}Tu objetivo: STR_2385 :{BLACK}Ninguno -STR_2386 :{BLACK}Tener al menos {COMMA16} visitantes en tu parque a finales de {MONTHYEAR}, con una valoración del parque de al menos 600 +STR_2386 :{BLACK}Tener al menos {COMMA32} visitantes en tu parque a finales de {MONTHYEAR}, con una valoración del parque de al menos 600 STR_2387 :{BLACK}Conseguir un valor del parque {POP16}{POP16}{CURRENCY} a final de {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}¡Diviértete! STR_2389 :{BLACK}¡Construye el mejor {STRINGID} que puedas! STR_2390 :{BLACK}Tener al menos 10 tipos de montañas rusas distintas operando en el parque, cada una con un valor de emoción de al menos 6.00 -STR_2391 :{BLACK}Tener al menos {COMMA16} visitantes en tu parque. ¡No dejes que la valoración baje de 700 en ningún momento! +STR_2391 :{BLACK}Tener al menos {COMMA32} visitantes en tu parque. ¡No dejes que la valoración baje de 700 en ningún momento! STR_2392 :{BLACK}Conseguir unos ingresos mensuales por venta de entradas a atracciones de al menos {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}Tener al menos 10 tipos de montañas rusas distintas operando en el parque, cada una con una longitud mínima de {LENGTH}, y un valor de emoción de al menos 7.00 STR_2394 :{BLACK}Terminar de construir 5 de las montañas rusas no terminadas en este parque, diseñándolas de modo que tengan un valor de emoción de al menos {POP16}{POP16}{COMMA2DP32} cada una @@ -2324,7 +2324,7 @@ STR_3305 :{WINDOW_COLOUR_2}Ingreso mensual: STR_3306 :{WINDOW_COLOUR_2}Ganancia mensual: STR_3307 :{WINDOW_COLOUR_2}Longitud mínima: STR_3308 :{WINDOW_COLOUR_2}Rango Satisfacción: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Atracciones/Juegos con orden de preservación: @@ -3686,6 +3686,15 @@ STR_6610 :Elemento de camino no encontrado STR_6611 :Elemento de muro no encontrado STR_6612 :Elemento de banner no encontrado STR_6613 :Recargar objeto +STR_6614 :No se puede cambiar el precio de la entrada al parque +STR_6615 :La vía en esta casilla necesita agua +STR_6616 :Acción no válida para ese tipo de trabajador +STR_6617 :No se puede intercambiar el elemento de la casilla consigo mismo +STR_6618 :No se puede poner ni quitar restricción al objeto… +STR_6619 :¡Este tipo de objeto no puede ser restringido! +STR_6620 :¡Objeto no encontrado! +STR_6621 :Restringir +STR_6622 :Restringir objeto al Editor de Escenarios y el modo Sandbox. ############## # Escenarios # diff --git a/data/language/fi-FI.txt b/data/language/fi-FI.txt index edcbdc6224..2d3fee1693 100644 --- a/data/language/fi-FI.txt +++ b/data/language/fi-FI.txt @@ -1743,12 +1743,12 @@ STR_2382 :Maa STR_2383 :Vesi STR_2384 :{WINDOW_COLOUR_2}Tavoitteesi: STR_2385 :{BLACK}Ei mitään -STR_2386 :{BLACK}Puistossasi tulee olla vähintään {COMMA16} kävijää {MONTHYEAR} loppuun mennessä, ja puiston tason tulee olla vähintään 600 +STR_2386 :{BLACK}Puistossasi tulee olla vähintään {COMMA32} kävijää {MONTHYEAR} loppuun mennessä, ja puiston tason tulee olla vähintään 600 STR_2387 :{BLACK}Saavuta puiston arvoksi vähintään {POP16}{POP16}{CURRENCY} {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} loppuun mennessä STR_2388 :{BLACK}Pidä hauskaa! STR_2389 :{BLACK}Rakenna niin hyvä {STRINGID} kuin voit! STR_2390 :{BLACK}Puistossasi tulee olla 10 eri tyyppistä toiminnassa olevaa vuoristorataa joiden huvitustaso on vähintään 6.00 -STR_2391 :{BLACK}Puistossasi tulee olla vähintään {COMMA16} kävijää, eikä puiston taso saa pudota hetkeksikään alle 700:n! +STR_2391 :{BLACK}Puistossasi tulee olla vähintään {COMMA32} kävijää, eikä puiston taso saa pudota hetkeksikään alle 700:n! STR_2392 :{BLACK}Sinun tulee ansaita {POP16}{POP16}{CURRENCY} kuukausituloja laitteiden lipputuloista STR_2393 :{BLACK}Puistossasi tulee olla 10 eri tyyppistä toiminnassa olevaa vuoristorataa, joiden pitää olla vähintään {LENGTH} pitkiä ja joiden huvitustaso on vähintään 7.00 STR_2394 :{BLACK}Viimeistele puiston 5 osittain rakennettua vuoristorataa niin, että jokaisen huvitustaso on vähintään {POP16}{POP16}{COMMA2DP32} @@ -2329,7 +2329,7 @@ STR_3305 :{WINDOW_COLOUR_2}Kuukausittainen tulo: STR_3306 :{WINDOW_COLOUR_2}Kuukausittainen tuotto: STR_3307 :{WINDOW_COLOUR_2}Vähimmäispituus: STR_3308 :{WINDOW_COLOUR_2}Huvitustaso: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Laitteet suojelumääräyksen alla: diff --git a/data/language/fr-FR.txt b/data/language/fr-FR.txt index 8dfbbccb13..d207faa6c4 100644 --- a/data/language/fr-FR.txt +++ b/data/language/fr-FR.txt @@ -1744,12 +1744,12 @@ STR_2382 :Terrain STR_2383 :Eau STR_2384 :{WINDOW_COLOUR_2}Votre objectif : STR_2385 :{BLACK}Aucun -STR_2386 :{BLACK}Avoir au moins {COMMA16} visiteurs dans votre parc à la fin {MONTHYEAR}, avec une évaluation de parc d’au moins 600 +STR_2386 :{BLACK}Avoir au moins {COMMA32} visiteurs dans votre parc à la fin {MONTHYEAR}, avec une évaluation de parc d’au moins 600 STR_2387 :{BLACK}Atteindre une valeur de parc d’au moins {POP16}{POP16}{CURRENCY} à la fin {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Amusez-vous ! STR_2389 :{BLACK}Construisez la meilleure attraction {STRINGID} possible ! STR_2390 :{BLACK}Avoir construit au moins 10 montagnes russes différentes dans votre parc, chacune d’entre elles atteignant un indice d’engouement d’au moins 6.00 -STR_2391 :{BLACK}Avoir reçu au moins {COMMA16} visiteurs dans votre parc. L’évaluation du parc ne doit jamais descendre en dessous des 700 ! +STR_2391 :{BLACK}Avoir reçu au moins {COMMA32} visiteurs dans votre parc. L’évaluation du parc ne doit jamais descendre en dessous des 700 ! STR_2392 :{BLACK}Obtenir un revenu mensuel avec les tickets d’attraction d’au moins {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}Avoir construit au moins 10 montagnes russes différentes dans votre parc, chacune d’entre elles atteignant une longueur d’au moins {LENGTH}, avec un indice d’engouement d’au moins 7.00 STR_2394 :{BLACK}Terminer la construction des 5 montagnes russes entamées dans ce parc, avec une conception leur permettant d’atteindre un indice d’engouement d’au moins {POP16}{POP16}{COMMA2DP32} chacune @@ -2330,7 +2330,7 @@ STR_3305 :{WINDOW_COLOUR_2}Revenu mensuel : STR_3306 :{WINDOW_COLOUR_2}Bénéfice mensuel : STR_3307 :{WINDOW_COLOUR_2}Longueur minimum : STR_3308 :{WINDOW_COLOUR_2}Indice d’engouement : -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Attractions protégées : @@ -3691,6 +3691,15 @@ STR_6610 :Élément de chemin introuvable STR_6611 :Élément de mur introuvable STR_6612 :Élément de bannière introuvable STR_6613 :Recharger l’objet +STR_6614 :Impossible de changer le prix d’entrée du parc +STR_6615 :La voie a besoin d’eau sur cette case +STR_6616 :Action invalide pour ce type de personnel +STR_6617 :Impossible de permuter un élément de case avec lui-même +STR_6618 :Impossible de restreindre ou dé-restreindre l’objet… +STR_6619 :Ce type d’objet ne peut pas être restreint ! +STR_6620 :Objet introuvable ! +STR_6621 :Restreindre +STR_6622 :Restreint l’objet à l’éditeur de scénario et au mode bac à sable ############# # Scenarios # diff --git a/data/language/hu-HU.txt b/data/language/hu-HU.txt index 71e0bb05fd..073180f41c 100644 --- a/data/language/hu-HU.txt +++ b/data/language/hu-HU.txt @@ -14,7 +14,7 @@ STR_0009 :Mini felfüggesztett hullámvasút STR_0010 :Csónakkölcsönző STR_0011 :Fa vadegér STR_0012 :Akadályverseny -STR_0013 :Autós utazás +STR_0013 :Autós játék STR_0014 :Kilövéses szabadesés STR_0015 :Bobpálya hullámvasút STR_0016 :Megfigyelőtorony @@ -27,7 +27,7 @@ STR_0022 :Útvesztő STR_0023 :Spirál csúszda STR_0024 :Gokart STR_0025 :Faúsztató -STR_0026 :Vadvízi utazás +STR_0026 :Vadvízi játék STR_0027 :Dodzsem STR_0028 :Hajóhinta STR_0029 :Fejreálló hajóhinta @@ -81,7 +81,7 @@ STR_0076 :Vízi hullámvasút STR_0077 :Léghajtású függőleges hullámvasút STR_0078 :Fordított hajtű hullámvasút STR_0079 :Varázsszőnyeg -STR_0080 :Tengeralattjáró-utazás +STR_0080 :Tengeralattjáró-játék STR_0081 :Folyami tutajok STR_0082 :Ismeretlen játék (50) STR_0083 :Enterprise @@ -326,7 +326,7 @@ STR_0934 :A játék bejárata útban van STR_0935 :A játék kijárata útban van STR_0936 :A park bejárata útban van STR_0937 :Nézet beállítások -STR_0938 :A föld magasságának és lejtésének módosítása +STR_0938 :A talaj magasságának és lejtésének módosítása STR_0939 :Földalatti/belső nézet STR_0940 :Alaptalaj elrejtése STR_0941 :Függőleges felületek elrejtése @@ -543,7 +543,7 @@ STR_1150 :Háromnegyed terhelés STR_1151 :Teljes terhelés STR_1152 :Bármekkora terhelés STR_1153 :Magasságjelzők a játékpályákon -STR_1154 :Magasságjelzők a terepen +STR_1154 :Magasságjelzők a talajon STR_1155 :Magasságjelzők az utakon STR_1156 :{MOVE_X}{10}{STRINGID} STR_1157 :✓{MOVE_X}{10}{STRINGID} @@ -1256,12 +1256,12 @@ STR_1875 :{BLACK} {SPRITE}{BLACK} {STRINGID} STR_1876 :{WINDOW_COLOUR_2}{INLINE_SPRITE}{251}{19}{00}{00}Játékok ellenőrzése STR_1877 :{WINDOW_COLOUR_2}{INLINE_SPRITE}{252}{19}{00}{00}Játékok javítása STR_1878 :{WINDOW_COLOUR_2}Ellenőrzés: -STR_1879 :Minden 10. percben -STR_1880 :Minden 20. percben -STR_1881 :Minden 30. percben -STR_1882 :Minden 45. percben -STR_1883 :Minden órában -STR_1884 :Minden második órában +STR_1879 :10 percenként +STR_1880 :20 percenként +STR_1881 :30 percenként +STR_1882 :45 percenként +STR_1883 :Óránként +STR_1884 :Kétóránként STR_1885 :Soha STR_1886 :Ezt ellenőrzi: {STRINGID} STR_1887 :{WINDOW_COLOUR_2}Legutóbbi ellenőrzés óta eltelt idő: {BLACK}{COMMA16} perc @@ -1279,9 +1279,9 @@ STR_1900 :{WINDOW_COLOUR_2}Tereprendezés STR_1901 :{WINDOW_COLOUR_2}Park belépőjegyek STR_1902 :{WINDOW_COLOUR_2}Játék jegyek STR_1903 :{WINDOW_COLOUR_2}Bolti eladások -STR_1904 :{WINDOW_COLOUR_2}Bolti készletek +STR_1904 :{WINDOW_COLOUR_2}Bolti árufeltöltés STR_1905 :{WINDOW_COLOUR_2}Étel/ital eladások -STR_1906 :{WINDOW_COLOUR_2}Étel/ital készletek +STR_1906 :{WINDOW_COLOUR_2}Étel/ital árufeltöltés STR_1907 :{WINDOW_COLOUR_2}Alkalmazottak bére STR_1908 :{WINDOW_COLOUR_2}Marketing STR_1909 :{WINDOW_COLOUR_2}Kutatás @@ -1652,7 +1652,7 @@ STR_2291 :Válassz pályát az új játékhoz STR_2292 :{WINDOW_COLOUR_2}Az alábbi játékokon volt: STR_2293 :{BLACK} Semmi STR_2294 :A talajtípus megváltoztatása -STR_2295 :A föld függőleges széleinek megváltoztatása +STR_2295 :A talaj függőleges széleinek megváltoztatása STR_2296 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} kiadás {BLACK}park belépőre STR_2297 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} kiadás {BLACK}{COMMA16} játékra STR_2298 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} kiadás {BLACK}{COMMA16} játékra @@ -1737,19 +1737,19 @@ STR_2382 :Föld STR_2383 :Víz STR_2384 :{WINDOW_COLOUR_2}A célod: STR_2385 :{BLACK}Nincs -STR_2386 :{BLACK}Legyen legalább {COMMA16} vendég a parkodban {MONTHYEAR}végére, a parkod értékelése pedig legyen legalább 600 +STR_2386 :{BLACK}Legyen legalább {COMMA32} vendég a parkodban {MONTHYEAR}végére, a parkod értékelése pedig legyen legalább 600 STR_2387 :{BLACK}Legyen legalább {POP16}{POP16}{CURRENCY} a parkod értéke {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR}végére STR_2388 :{BLACK}Érezd jól magad! STR_2389 :{BLACK}A lehető legjobb {STRINGID} építése! STR_2390 :{BLACK}Építs 10 különböző, egyenként legalább 6,00 izgalmi értékű hullámvasutat a parkodban -STR_2391 :{BLACK}Legyen legalább {COMMA16} vendég a parkodban. A park értékelése soha nem eshet 700 alá! +STR_2391 :{BLACK}Legyen legalább {COMMA32} vendég a parkodban. A park értékelése soha nem eshet 700 alá! STR_2392 :{BLACK}A játékok belépési díja utáni havi bevételed legyen legalább {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}Működjön 10 különböző, egyenként legalább {LENGTH} hosszú hullámvasút a parkodban, amelyek izgalmi értéke legalább 7,00 STR_2394 :{BLACK}Fejezd be az 5 félkész hullámvasút építését, úgy, hogy mindegyik izgalmi értéke legalább {POP16}{POP16}{COMMA2DP32} legyen STR_2395 :{BLACK}Fizesd vissza a kölcsönödet és a park értéke legyen legalább {POP16}{POP16}{CURRENCY} STR_2396 :{BLACK}Az ételek, italok és szuvenírek utáni havi bevételed legyen legalább {POP16}{POP16}{CURRENCY} STR_2397 :Nincs -STR_2398 :A vendégek száma +STR_2398 :Vendégek száma STR_2399 :A park értéke egy meghatározott időpontban STR_2400 :Érezd jól magad STR_2401 :Építsd meg a lehető legjobb játékot @@ -1850,7 +1850,7 @@ STR_2507 :Láthatatlan emberek be/ki STR_2508 :Magasságjelek a talajon be/ki STR_2509 :Magasságjelek a játékok pályáin be/ki STR_2510 :Magasságjelek az utakon be/ki -STR_2511 :Föld módosítása +STR_2511 :Talaj módosítása STR_2512 :Víz módosítása STR_2513 :Díszlet építése STR_2514 :Utak építése @@ -1921,11 +1921,11 @@ STR_2694 :Generálás STR_2695 :Véletlenszerű táj STR_2696 :Rakjon le fákat STR_2700 :Automatikus mentés: -STR_2701 :Minden percben -STR_2702 :Minden 5. percben -STR_2703 :Minden 15. percben -STR_2704 :Minden 30. percben -STR_2705 :Minden órában +STR_2701 :Percenként +STR_2702 :5 percenként +STR_2703 :15 percenként +STR_2704 :30 percenként +STR_2705 :Óránként STR_2706 :Soha STR_2707 :Rendszer fájlkezelőjének használata STR_2708 :{WINDOW_COLOUR_1}Biztos, hogy felül akarod írni ezt: {STRINGID}? @@ -1947,7 +1947,7 @@ STR_2730 :{UINT16} óra {UINT16} perc STR_2731 :{UINT16} óra {UINT16} perc STR_2732 :{COMMA32} láb STR_2733 :{COMMA32} m -STR_2734 :{COMMA16} mph +STR_2734 :{COMMA16} mi/h STR_2735 :{COMMA16} km/h STR_2736 :{POP16}{COMMA16}. év {PUSH16}{PUSH16}{MONTH} STR_2737 :{POP16}{POP16}{COMMA16}. év {PUSH16}{PUSH16}{MONTH} {PUSH16}{PUSH16}{STRINGID} @@ -1988,9 +1988,9 @@ STR_2786 :Kattints a parancs leírására új gyorsbillentyű megadásához STR_2787 :{WINDOW_COLOUR_2}A park értéke: {BLACK}{CURRENCY} STR_2788 :{WINDOW_COLOUR_2}Gratulálunk !{NEWLINE}{BLACK}Sikeresen teljesítetted a kitűzött célt egy {CURRENCY} értékű vállalattal ! STR_2789 :{WINDOW_COLOUR_2}Nem sikerült teljesítened a kitűzött célt ! -STR_2790 :Írd be a neved az eredménytáblába -STR_2791 :Írd be a neved -STR_2792 :Kérlek írd be a neved az eredménytáblába: +STR_2790 :Név beírása az eredménytáblába +STR_2791 :Név beírása +STR_2792 :Írd be a neved az eredménytáblába: STR_2793 :(Teljesítette: {STRINGID}) STR_2794 :{BLACK}{STRINGID} {WINDOW_COLOUR_2}teljesítette{NEWLINE}{WINDOW_COLOUR_2}egy {BLACK}{CURRENCY} {WINDOW_COLOUR_2}értékű vállalattal STR_2795 :Rendezés @@ -2169,7 +2169,7 @@ STR_3130 :Mentés STR_3131 :Mégse STR_3132 :{BLACK}Klikkelj azokra a díszletelemekre, amelyeket a játéktervvel együtt el akarsz menteni… STR_3133 :Nem építhető lejtőre -STR_3134 :{RED}(A terv el nem érhető díszletet tartalmaz) +STR_3134 :{RED}(A terv olyan díszletet tartalmaz, amely nem elérhető) STR_3135 :{RED}(A járműterv nem elérhető - Befolyásolhatja a játék teljesítményét) STR_3136 :Figyelmeztetés: A terv alternatív járműtípussal lesz megépítve és lehet, hogy nem az elvártnak megfelelően fog teljesíteni STR_3137 :Közeli díszletek kiválasztása @@ -2196,7 +2196,7 @@ STR_3176 :Az objektum nem választható ki STR_3177 :Az objektum kiválasztása nem vonható vissza STR_3179 :Legalább egy játék járművet/játékot ki kell választani STR_3180 :Érvénytelen objektumkijelölés -STR_3181 :Objektum kiválasztás - {STRINGID} +STR_3181 :Objektumok kiválasztása - {STRINGID} STR_3182 :A parkbejárat típusát ki kell választani STR_3183 :A víz típusát ki kell választani STR_3184 :Játékok és járműveik @@ -2253,7 +2253,7 @@ STR_3235 :Pénzügyi beállítások STR_3236 :A vendégek beállításai STR_3237 :A park beállításai STR_3238 :Nem kell pénz -STR_3239 :Legyen ez a park egy pénzügyi korlátok nélküli, ’nem kell pénz’ park +STR_3239 :Legyen ez a park egy „pénz nélküli” park, pénzügyi korlátozások nélkül STR_3240 :{WINDOW_COLOUR_2}Kezdőtőke: STR_3241 :{WINDOW_COLOUR_2}Kezdeti kölcsön: STR_3242 :{WINDOW_COLOUR_2}Maximális kölcsönösszeg: @@ -2308,7 +2308,7 @@ STR_3290 :Hűvös és nedves STR_3291 :Meleg STR_3292 :Forró és száraz STR_3293 :Hideg -STR_3294 :Változtatás… +STR_3294 :Változtat… STR_3295 :A park nevének megváltoztatása STR_3296 :A pálya nevének megváltoztatása STR_3297 :A park / pálya részletes leírásának megváltoztatása @@ -2323,7 +2323,7 @@ STR_3305 :{WINDOW_COLOUR_2}Havi bevétel: STR_3306 :{WINDOW_COLOUR_2}Havi nyereség: STR_3307 :{WINDOW_COLOUR_2}Minimum hosszúság: STR_3308 :{WINDOW_COLOUR_2}Izgalmi érték: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Műemlékvédelmi játékok/épületek: @@ -2392,7 +2392,7 @@ STR_3380 :A játékterv nem telepíthető… STR_3381 :A fájl nem kompatibilis, vagy érvénytelen adatokat tartalmaz STR_3382 :A fájl másolása meghiúsult STR_3383 :Válassz egy új nevet a játékterv számára -STR_3384 :Már létezik egy játékterv ezen a néven - Kérlek válassz egy új nevet a terv számára: +STR_3384 :Már létezik egy játékterv ezen a néven - Válassz egy új nevet a terv számára: STR_3389 :Nem választható ki több díszletelem… STR_3390 :Túl sok elem van kiválasztva STR_3437 :Nagy földterületek megtisztítása a díszletektől @@ -2408,7 +2408,7 @@ STR_5122 :A játékok pályatípus szerinti kiválasztása (mint az RCT1-ben) STR_5123 :Játékok felújítása STR_5125 :Minden rombolható STR_5126 :Véletlenszerű főcímzene -STR_5127 :Húzás közben tájképfestés a magasságváltoztatás helyett +STR_5127 :Húzás közben a táj festése, magasságváltoztatás helyett STR_5128 :Kiválasztás mérete STR_5129 :Add meg a kiválasztás méretét {COMMA16} és {COMMA16} között STR_5130 :Térkép mérete @@ -2460,7 +2460,7 @@ STR_5189 :Kutatás STR_5190 :Térkép STR_5191 :Látkép STR_5192 :Friss hírek -STR_5193 :Föld +STR_5193 :Talaj STR_5194 :Víz STR_5195 :Díszlet törlése STR_5196 :Földjogok @@ -2477,7 +2477,7 @@ STR_5206 :Vendéglista STR_5207 :Személyzet STR_5208 :Személyzeti lista STR_5209 :Hirdetőtábla -STR_5210 :Objektum választás +STR_5210 :Objektumok kiválasztása STR_5211 :Találmányok listája STR_5212 :Pályabeállítások STR_5213 :Cél beállítások @@ -2609,7 +2609,7 @@ STR_5365 :{BLACK}Dolgozók sebessége: STR_5366 :Normál STR_5367 :Gyors STR_5368 :Ütközés törlése -STR_5371 :Objektum választás +STR_5371 :Objektumok kiválasztása STR_5372 :Jobb egérgombos húzás invertálása STR_5373 :Név {STRINGID} STR_5374 :Dátum {STRINGID} @@ -2717,7 +2717,7 @@ STR_5547 :Világos rózsaszín STR_5548 :Minden működési mód megjelenítése STR_5549 :Év/hónap/nap STR_5550 :{POP16}{POP16}{COMMA16}. év {PUSH16}{PUSH16}{MONTH} {PUSH16}{PUSH16}{STRINGID} -STR_5551 :év/nap/hónap +STR_5551 :Év/nap/hónap STR_5552 :{POP16}{POP16}{COMMA16}. év {PUSH16}{PUSH16}{PUSH16}{STRINGID} {MONTH} STR_5553 :Játék megállítása, ha a Steam Átfedés nyitva van STR_5554 :A hegy-eszköz bekapcsolása @@ -2726,7 +2726,7 @@ STR_5556 :Játékos kirúgása STR_5557 :Kapcsolat fenntartása hiba esetén (többjátékos mód) STR_5558 :A beállítás érvénybe lépéséhez az OpenRCT2 újraindítása szükséges STR_5559 :10 perces ellenőrzés -STR_5560 :Az ellenőrzési időt „minden 10. percben”-re állítja az összes játékon +STR_5560 :Az ellenőrzési időt „10 percenként”-re állítja az összes játékon STR_5561 :A nyelv betöltése sikertelen STR_5562 :FIGYELMEZTETÉS! STR_5563 :Ez a funkció jelenleg instabil, legyél rendkívül elővigyázatos. @@ -2800,7 +2800,7 @@ STR_5633 :CMD + STR_5634 :OPTION + STR_5635 :{WINDOW_COLOUR_2}Elköltött pénz: {BLACK}{CURRENCY2DP} STR_5636 :{WINDOW_COLOUR_2}Futtatott parancsok: {BLACK}{COMMA16} -STR_5637 :Ezt nem csinálhatod… +STR_5637 :Nem lehet megtenni… STR_5638 :Engedély megtagadva STR_5639 :Játékosok listája STR_5640 :Csoportok kezelése @@ -3053,7 +3053,7 @@ STR_5930 :Nagy díszlet részletei STR_5931 :Hirdetőtábla részletei STR_5932 :Sérült elem részletei STR_5933 :Tulajdonságok -STR_5934 :Terep textúrája: {BLACK}{STRINGID} +STR_5934 :Talaj textúrája: {BLACK}{STRINGID} STR_5935 :Terepszegély: {BLACK}{STRINGID} STR_5936 :Földtulajdon: {BLACK}{STRINGID} STR_5937 :Nincs tulajdonban és nem eladó @@ -3154,7 +3154,7 @@ STR_6031 :Szerver leírása: STR_6032 :Szerver üdvözlés: STR_6033 :Az RCT1 telepítési útvonala: STR_6034 :{BLACK}{STRING} -STR_6035 :Kérlek válaszd ki az RCT1 mappádat +STR_6035 :Válaszd ki az RCT1 mappádat STR_6036 :Törlés STR_6037 :A kiválasztott könyvtár nem tartalmaz érvényes RollerCoaster Tycoon 1 telepítést. STR_6038 :Ha az RCT1 telepítve van, itt add meg a mappája helyét, hogy betölthesd a pályákat, zenét stb. @@ -3162,7 +3162,7 @@ STR_6039 :Játék/épület gyors lerombolása STR_6040 :Pályabeállítások módosítása STR_6041 :{BLACK}Nem vettél fel gépészt! STR_6042 :Magasságtérkép betöltése -STR_6043 :Magasságtérkép kiválasztása +STR_6043 :Magasságtérkép választása STR_6044 :Magasságtérkép simítása STR_6045 :Erősség STR_6046 :Magasságtérkép normalizálása @@ -3243,7 +3243,7 @@ STR_6129 :Másolás STR_6130 :Összes másolása STR_6131 :Objektum forrása STR_6132 :Kutatási állapot figyelmen kívül hagyása -STR_6133 :Hozzáférés a még fel nem fedezett játékokhoz és díszletekhez +STR_6133 :Hozzáférés a még felfedezetlen játékokhoz és díszletekhez STR_6134 :Díszlet törlése STR_6135 :A kliens érvénytelen kérést küldött STR_6136 :A szerver érvénytelen kérést küldött @@ -3265,7 +3265,7 @@ STR_6151 :A főszerver nem tudja listázni a szervereket STR_6152 :Érvénytelen válasz a főszervertől (nincs JSON-tömb) STR_6153 :Fizetős parkbelépő / Fizetős játékok STR_6154 :Biztonsági okokból nem javasolt az OpenRCT2 emelt jogosultságokkal történő futtatása. -STR_6155 :Se a KDialog, se a Zenity nincs telepítve. Kérlek telepítsd valamelyiket, vagy konfiguráld a parancssorból. +STR_6155 :Se a KDialog, se a Zenity nincs telepítve. Telepítsd valamelyiket, vagy konfiguráld a parancssorból. STR_6156 :A név le van foglalva STR_6157 :Konzol STR_6160 :{WINDOW_COLOUR_2}Rendelkezésre álló járművek: {BLACK}{STRING} @@ -3281,7 +3281,7 @@ STR_6169 :Pályaválasztás STR_6170 :Felület finomhangolása STR_6171 :Keresés STR_6172 :Keresés -STR_6173 :Kérlek add meg a keresendő nevet: +STR_6173 :Add meg a keresendő nevet: STR_6188 :Hányás STR_6189 :Kacsa STR_6191 :Felület @@ -3349,7 +3349,7 @@ STR_6266 :Egyedi tartalmak mappájának megnyitása STR_6267 :Mezővizsgáló megnyitása STR_6268 :Megállított játék léptetése STR_6269 :Érvénytelen éghajlati ID -STR_6270 :Terepfelületek +STR_6270 :Talajfelületek STR_6271 :Terepszegélyek STR_6272 :Állomások STR_6273 :Zene @@ -3419,7 +3419,7 @@ STR_6346 :Mezővizsgáló: Elem magasságának csökkentése STR_6347 :Úti extrák nem helyezhetőek útátjárókra! STR_6348 :Előbb távolítsd el az útátjárót! STR_6349 :Véletlenszerű főcím -STR_6350 :Szórás +STR_6350 :Szétszórás STR_6351 :Díszletszóró eszköz STR_6352 :Sűrűség STR_6353 :Alacsony sűrűség @@ -3459,25 +3459,25 @@ STR_6386 :Hóvihar STR_6387 :Nem süllyeszthető itt le az elem… STR_6388 :Nem emelhető itt meg az elem… STR_6389 :Érvénytelen űrszelvény -STR_6390 :Az OpenRCT2 működéséhez szükség van az eredeti RollerCoaster Tycoon 2 fájljaira. Kérlek add meg a mappát, ahova telepítetted a RollerCoaster Tycoon 2-t. -STR_6391 :Kérlek válaszd ki az RCT2 mappádat +STR_6390 :Az OpenRCT2 működéséhez szükség van az eredeti RollerCoaster Tycoon 2 fájljaira. Add meg a mappát, ahova telepítetted a RollerCoaster Tycoon 2-t. +STR_6391 :Válaszd ki az RCT2 mappádat STR_6392 :A(z) {STRING} nem található ezen az útvonalon. STR_6393 :Cél kiválasztása STR_6394 :Cél STR_6395 :Karbantartás STR_6396 :Képernyővédő és a monitor energiagazdálkodása ki STR_6397 :Ha ki van választva, szüneteltetve lesz a képernyővédő és a monitor egyéb energiagazdálkodási funkciói, amíg az OpenRCT2 fut. -STR_6398 :A fájl nem támogatott játék-típusokat tartalmaz. Kérlek frissíts egy újabb OpenRCT2 verzióra. -STR_6399 :Az OpenRCT2 működéséhez szükség van az eredeti RollerCoaster Tycoon 2 fájljaira. Kérlek állítsd be a „game_path” változót a config.ini-ben arra a mappára, amelybe telepítetted a RollerCoaster Tycoon 2-t, majd indítsd újra az OpenRCT2-t. +STR_6398 :A fájl nem támogatott játék-típusokat tartalmaz. Frissíts egy újabb OpenRCT2 verzióra. +STR_6399 :Az OpenRCT2 működéséhez szükség van az eredeti RollerCoaster Tycoon 2 fájljaira. Állítsd be a „game_path” változót a config.ini-ben arra a mappára, amelybe telepítetted a RollerCoaster Tycoon 2-t, majd indítsd újra az OpenRCT2-t. STR_6400 :Letöltöttem a GOG RollerCoaster Tycoon 2 offline telepítőjét, de nincs telepítve STR_6401 :Már telepítettem a RollerCoaster Tycoon 2-t STR_6402 :OpenRCT2 adatok megadása STR_6403 :Válaszd ki a számodra legmegfelelőbbet -STR_6404 :Kérlek válaszd ki a GOG RollerCoaster Tycoon 2 telepítőjét. +STR_6404 :Válaszd ki a GOG RollerCoaster Tycoon 2 telepítőjét. STR_6405 :GOG telepítő kiválasztása STR_6406 :GOG RollerCoaster Tycoon 2 telepítő STR_6407 :Ez eltarthat pár percig. -STR_6408 :Kérlek rakd fel az “innoextract”-ot a GOG telepítő kitömörítéséhez, majd indítsd újra az OpenRCT2-t. +STR_6408 :Rakd fel az „innoextract”-ot a GOG telepítő kitömörítéséhez, majd indítsd újra az OpenRCT2-t. STR_6409 :A kiválasztott fájl nem a GOG RollerCoaster Tycoon 2 offline telepítője. Lehet, hogy a GOG Galaxy letöltő stub-ját töltötted le, vagy rossz fájlt választottál. STR_6410 :Kicsinyítés/nagyítás STR_6411 :A kicsinyítés és nagyítás gombjainak megjelenítése az eszköztáron @@ -3521,7 +3521,7 @@ STR_6448 :Nem támogatott objektumformátum STR_6449 :{WINDOW_COLOUR_2}Számok: STR_6450 :{BLACK}„{STRING}” STR_6451 :{BLACK}„{STRING}” - {STRING} -STR_6452 :{WINDOW_COLOUR_2}Árul: {BLACK}{STRING} +STR_6452 :{WINDOW_COLOUR_2}Ezeket árulja: {BLACK}{STRING} STR_6453 :Verzió infó másolása STR_6454 :A hirdetőtábla nem nevezhető át… STR_6455 :A felirat nem nevezhető át… @@ -3572,7 +3572,7 @@ STR_6500 :A játékterv formátum által nem támogatott pályaelemek STR_6501 :Véletlenszerű szín STR_6502 :Írj be egy értéket {COMMA16} és {COMMA16} között STR_6503 :Legalább egy állomásobjektumot ki kell választani -STR_6504 :Legalább egy terepfelületet ki kell választani +STR_6504 :Legalább egy talajfelületet ki kell választani STR_6505 :Legalább egy terepszegélyt ki kell választani STR_6506 :Nagy fél dugóhúzó (balra) STR_6507 :Nagy fél dugóhúzó (jobbra) @@ -3686,6 +3686,11 @@ STR_6614 :Nem változtatható meg a park belépési díja STR_6615 :A pályának ezen a mezőn vízre van szüksége STR_6616 :Az adott személyzettípus számára érvénytelen akció STR_6617 :Nem lehet önmagával cserélni mezőelemet +STR_6618 :Nem lehet korlátozni vagy feloldani az objektumot... +STR_6619 :Az objektumtípus nem korlátozható! +STR_6620 :Az objektum nem található! +STR_6621 :Korlátozás +STR_6622 :Objektum korlátozása a pályaszerkesztőre és a homokozó módra. ############# # Scenarios # @@ -3713,9 +3718,9 @@ STR_PARK :Gyémánt-fennsík STR_DTLS :Gyémánt-fennsík már egy sikeres vidámpark, remek játékokkal - fejleszd, hogy megduplázd az értékét -STR_SCNR :Örökzöld Kertek -STR_PARK :Örökzöld Kertek -STR_DTLS :Alakítsd át a csodaszép Örökzöld Kerteket egy virágzó vidámparkká +STR_SCNR :Örökzöld Kert +STR_PARK :Örökzöld Kert +STR_DTLS :Alakítsd át a csodaszép Örökzöld Kertet egy virágzó vidámparkká STR_SCNR :Suta Strand @@ -3949,8 +3954,8 @@ STR_PARK :Városi Park STR_DTLS :Egy apró park egyezséget kötött a közeli várossal, amelynek értelmében magán a városon keresztül terjeszkedhet -STR_SCNR :Geoffrey Kertek -STR_PARK :Geoffrey Kertek +STR_SCNR :Geoffrey Kert +STR_PARK :Geoffrey Kert STR_DTLS :Egy nagy kertnek arra van szüksége, hogy sikeres vidámpark legyen belőle @@ -4218,9 +4223,9 @@ STR_PARK :Szellemváros STR_DTLS :Egy nagy vidámparklánc felbérelt, hogy építs nekik óriási hullámvasútparkot egy elhagyatott bányászváros köré -STR_SCNR :Gravitációs Kertek -STR_PARK :Gravitációs Kertek -STR_DTLS :A kihívásod az, hogy építs egy hullámvasútparkot a gyönyörű Gravitációs Kertekben. Semmi más játékot, csak hullámvasutakat! +STR_SCNR :Gravitációs Kert +STR_PARK :Gravitációs Kert +STR_DTLS :A kihívásod az, hogy építs egy hullámvasútparkot a gyönyörű Gravitációs Kertben. Semmi más játékot, csak hullámvasutakat! STR_SCNR :Pokoli Kilátások diff --git a/data/language/it-IT.txt b/data/language/it-IT.txt index fffc50513a..42d434a58e 100644 --- a/data/language/it-IT.txt +++ b/data/language/it-IT.txt @@ -1740,12 +1740,12 @@ STR_2382 :Terreno STR_2383 :Acqua STR_2384 :{WINDOW_COLOUR_2}Il tuo obiettivo: STR_2385 :{BLACK}Nessuno -STR_2386 :{BLACK}Avere almeno {COMMA16} visitatori nel parco entro la fine di {MONTHYEAR}, con una valutazione del parco di almeno 600 +STR_2386 :{BLACK}Avere almeno {COMMA32} visitatori nel parco entro la fine di {MONTHYEAR}, con una valutazione del parco di almeno 600 STR_2387 :{BLACK}Far raggiungere al parco un valore di almeno {POP16}{POP16}{CURRENCY} entro la fine di {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Divertirsi! STR_2389 :{BLACK}Costruire il migliore {STRINGID} si possa! STR_2390 :{BLACK}Avere 10 tipi diversi di ottovolante nel parco, ognuno con un livello di divertimento di almeno 6.00 -STR_2391 :{BLACK}Avere almeno {COMMA16} visitatori nel parco. E non devi mai avere una valutazione del parco inferiore a 700! +STR_2391 :{BLACK}Avere almeno {COMMA32} visitatori nel parco. E non devi mai avere una valutazione del parco inferiore a 700! STR_2392 :{BLACK}Incassare mensilmente tramite i biglietti delle attrazioni almeno {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}Avere 10 tipi diversi di ottovolante nel parco, ognuno della lunghezza minima di {LENGTH} e un livello di divertimento di almeno 7.00 STR_2394 :{BLACK}Finire di costruire tutti e cinque gli ottovolanti parzialmente costruiti in questo parco, facendo loro raggiungere un livello di divertimento di almeno {POP16}{POP16}{COMMA2DP32} ciascuno @@ -2325,7 +2325,7 @@ STR_3305 :{WINDOW_COLOUR_2}Entrate mensili: STR_3306 :{WINDOW_COLOUR_2}Profitto mensile: STR_3307 :{WINDOW_COLOUR_2}Lunghezza minima: STR_3308 :{WINDOW_COLOUR_2}Liv. divertimento: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Attrazioni sotto ordine di protezione: diff --git a/data/language/ja-JP.txt b/data/language/ja-JP.txt index 89e0647747..ee841f3986 100644 --- a/data/language/ja-JP.txt +++ b/data/language/ja-JP.txt @@ -1729,12 +1729,12 @@ STR_2382 :地形 STR_2383 :水 STR_2384 :{WINDOW_COLOUR_2}あなたの目標: STR_2385 :{BLACK}なし -STR_2386 :{BLACK}{POP16}{MONTHYEAR}の終わりに、 パークの内に{PUSH16}{PUSH16}{COMMA16}以上人の来客し、600以上のパーク評価値を取得する必要があります。 +STR_2386 :{BLACK}{POP16}{MONTHYEAR}の終わりに、 パークの内に{PUSH16}{PUSH16}{COMMA32}以上人の来客し、600以上のパーク評価値を取得する必要があります。 STR_2387 :{BLACK}{POP16}{MONTHYEAR}の終わりに、 {CURRENCY}以上のパーク評価額を取得する必要があります。 STR_2388 :{BLACK}楽しんで下さい! STR_2389 :{BLACK}最高の{STRINGID}を建設してください! STR_2390 :{BLACK}パークで10タイプのジェットコースターを稼働させるには、それぞれ少なくとも6.00以上の興奮度が必要です。 -STR_2391 :{BLACK}パークに少なくとも{COMMA16}ゲストを入れてを取得する必要があります。パークの評価額がいつでも700以下にならないようにしてはいけません! +STR_2391 :{BLACK}パークに少なくとも{COMMA32}ゲストを入れてを取得する必要があります。パークの評価額がいつでも700以下にならないようにしてはいけません! STR_2392 :{BLACK}ライドの月次総収入の{POP16}{POP16}{CURRENCY}を取得する必要があります。 STR_2393 :{BLACK}パークで10タイプのジェットコースターを操作しますし、それぞれ所定の長さの{LENGTH}し, 7.00以上の興奮度が必要です。 STR_2394 :{BLACK}パークであるの5ジェットコースターの建設を仕上げますし、 それぞれ{POP16}{POP16}{COMMA2DP32}以上の興奮度が必要です。 @@ -2315,7 +2315,7 @@ STR_3305 :{WINDOW_COLOUR_2}月売上: STR_3306 :{WINDOW_COLOUR_2}月利益: STR_3307 :{WINDOW_COLOUR_2}最小長: STR_3308 :{WINDOW_COLOUR_2}興奮度: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}保全命令のライド: diff --git a/data/language/ko-KR.txt b/data/language/ko-KR.txt index 0a6f409f0a..97562400e1 100644 --- a/data/language/ko-KR.txt +++ b/data/language/ko-KR.txt @@ -1741,12 +1741,12 @@ STR_2382 :땅 STR_2383 :물 STR_2384 :{WINDOW_COLOUR_2}목표: STR_2385 :{BLACK}없음 -STR_2386 :{BLACK}공원에 최소 {COMMA16}명 이상의 손님을 {MONTHYEAR}까지 유치하고, 공원 등급을 600 이상으로 유지하세요 +STR_2386 :{BLACK}공원에 최소 {COMMA32}명 이상의 손님을 {MONTHYEAR}까지 유치하고, 공원 등급을 600 이상으로 유지하세요 STR_2387 :{BLACK}최소 {POP16}{POP16}{CURRENCY} 이상의 공원 가치를 {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR}까지 달성하세요 STR_2388 :{BLACK}즐기세요! STR_2389 :{BLACK}최고의 {STRINGID}(을)를 건설하세요! STR_2390 :{BLACK}흥미도가 최소 6.00을 넘는 10종의 다른 롤러코스터를 공원에 운용하세요 -STR_2391 :{BLACK}공원에 최소 {COMMA16}명 이상의 손님을 유치하세요. 단 한 순간이라도 공원 등급을 700 아래로 떨어뜨려서는 안 됩니다! +STR_2391 :{BLACK}공원에 최소 {COMMA32}명 이상의 손님을 유치하세요. 단 한 순간이라도 공원 등급을 700 아래로 떨어뜨려서는 안 됩니다! STR_2392 :{BLACK}놀이기구 탑승 수익만으로 월 수익을 최소 {POP16}{POP16}{CURRENCY} 이상 달성하세요 STR_2393 :{BLACK}최소 길이가 {LENGTH} 이상이고 흥미도가 최소 7.00을 넘는 10개의 다른 종류의 롤러코스터를 공원에 운용하세요 STR_2394 :{BLACK}이 공원에 미완성된 5대의 롤러코스터를 각각의 흥미도가 최소 {POP16}{POP16}{COMMA2DP32} 이상이 되도록 완성하세요 @@ -2327,7 +2327,7 @@ STR_3305 :{WINDOW_COLOUR_2}월 수익: STR_3306 :{WINDOW_COLOUR_2}월 순이익: STR_3307 :{WINDOW_COLOUR_2}최소 길이: STR_3308 :{WINDOW_COLOUR_2}흥미도: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}수정·파괴할 수 없는 놀이기구/시설: @@ -2585,7 +2585,7 @@ STR_5335 :놀이기구 입구 STR_5336 :놀이기구 출구 STR_5337 :공원 입구 STR_5338 :요소 종류 -STR_5339 :기본 고도 +STR_5339 :기본 높이 STR_5340 :최상단 높이 STR_5343 :직원 자동 배치 STR_5344 :변경기록 @@ -2783,9 +2783,9 @@ STR_5612 :유령 플래그 STR_5613 :B STR_5614 :깨짐 플래그 STR_5615 :L -STR_5616 :타일 플래그의 마지막 요소 -STR_5617 :선택한 요소를 위로 이동합니다. -STR_5618 :선택한 요소를 아래로 이동합니다. +STR_5616 :이 칸의 마지막 요소 +STR_5617 :선택한 요소를 위로 이동합니다 +STR_5618 :선택한 요소를 아래로 이동합니다 STR_5619 :롤러코스터 타이쿤 STR_5620 :애디드 어트랙션 STR_5621 :루피 랜드스케이프 @@ -3689,6 +3689,11 @@ STR_6614 :공원 입장료를 변경할 수 없습니다 STR_6615 :이 칸에 있는 트랙은 물이 있어야 합니다 STR_6616 :그 직원에 대한 잘못된 행동입니다 STR_6617 :칸 요소를 자기 자신과 바꿀 수는 없습니다 +STR_6618 :오브젝트를 제한하거나 제한 해제할 수 없습니다… +STR_6619 :오브젝트 종류를 제한할 수 없습니다! +STR_6620 :오브젝트를 찾을 수 없습니다! +STR_6621 :제한 +STR_6622 :시나리오 에디터 및 모래상자 모드에서 선택한 오브젝트를 사용할 수 없도록 제한합니다. ############# # Scenarios # diff --git a/data/language/nb-NO.txt b/data/language/nb-NO.txt index da94496576..387fe4884c 100644 --- a/data/language/nb-NO.txt +++ b/data/language/nb-NO.txt @@ -1737,12 +1737,12 @@ STR_2382 :Land STR_2383 :Vann STR_2384 :{WINDOW_COLOUR_2}Ditt oppdrag: STR_2385 :{BLACK}Ingen -STR_2386 :{BLACK}Å ha minst {COMMA16} gjester i din park ved slutten av {MONTHYEAR}, med en parkvurdering på minst 600 +STR_2386 :{BLACK}Å ha minst {COMMA32} gjester i din park ved slutten av {MONTHYEAR}, med en parkvurdering på minst 600 STR_2387 :{BLACK}Å oppnå en parkverdi på minst {POP16}{POP16}{CURRENCY} ved slutten av {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Ha det Gøy! STR_2389 :{BLACK}Bygg den beste {STRINGID} du kan! STR_2390 :{BLACK}Å ha 10 forskjellige typer berg-og-dal-baner i drift i din park, hver med et spenningsnivå på minst 6.00 -STR_2391 :{BLACK}Å ha minst {COMMA16} gjester i din park. Du må ikke la parkvurderingen falle under 700 på noe tidspunkt! +STR_2391 :{BLACK}Å ha minst {COMMA32} gjester i din park. Du må ikke la parkvurderingen falle under 700 på noe tidspunkt! STR_2392 :{BLACK}Å oppnå en månedlig inntekt fra attraksjons-billetter på minst {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}Å ha 10 forskjellige typer berg-og-dal-baner i drift i din park, hver med en minimumslengde på {LENGTH}, og med spenningsnivå på minst 7.00 STR_2394 :{BLACK}Å bygge ferdig alle 5 halvferdige berg-og-dal-baner i denne parken og designe hver av de for å oppnå spenningsnivå på minst {POP16}{POP16}{COMMA2DP32} @@ -2323,7 +2323,7 @@ STR_3305 :{WINDOW_COLOUR_2}Månedlig inntekt: STR_3306 :{WINDOW_COLOUR_2}Månedlig profitt: STR_3307 :{WINDOW_COLOUR_2}Minimum lengde: STR_3308 :{WINDOW_COLOUR_2}Spenningsnivå: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Attraksjoner som blir bevart: @@ -3687,6 +3687,11 @@ STR_6614 :Kan ikke endre inngangsavgift til parken STR_6615 :Spor på denne ruten trenger vann STR_6616 :Handling ugyldig for denne personaltypen STR_6617 :Kan ikke bytte ut rute-element med seg selv +STR_6618 :Kan ikke begrense eller frigjøre objekt... +STR_6619 :Objekt-type kan ikke bli begrenset! +STR_6620 :Kunne ikke finne objekt! +STR_6621 :Begrens +STR_6622 :Begrens objekt til Scenario-redigerer og Sandkassemodus. ############# # Scenarios # diff --git a/data/language/nl-NL.txt b/data/language/nl-NL.txt index 3ec708da80..b73fa5899a 100644 --- a/data/language/nl-NL.txt +++ b/data/language/nl-NL.txt @@ -1738,12 +1738,12 @@ STR_2382 :Land STR_2383 :Water STR_2384 :{WINDOW_COLOUR_2}Je doelstelling: STR_2385 :{BLACK}Geen -STR_2386 :{BLACK}Om ten minste {COMMA16} bezoekers in je park te hebben aan het einde van {MONTHYEAR}, met een parkwaardering van ten minste 600 +STR_2386 :{BLACK}Om ten minste {COMMA32} bezoekers in je park te hebben aan het einde van {MONTHYEAR}, met een parkwaardering van ten minste 600 STR_2387 :{BLACK}Om een parkwaarde van ten minste {POP16}{POP16}{CURRENCY} te hebben aan het einde van {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Om plezier te hebben! STR_2389 :{BLACK}Om de beste {STRINGID} te bouwen! STR_2390 :{BLACK}Om 10 verschillende typen achtbanen in je park te hebben, elk met een plezierwaarde van ten minste 6,00 -STR_2391 :{BLACK}Om ten minste {COMMA16} bezoekers in je park te hebben. Je parkwaardering mag geen moment onder de 700 komen! +STR_2391 :{BLACK}Om ten minste {COMMA32} bezoekers in je park te hebben. Je parkwaardering mag geen moment onder de 700 komen! STR_2392 :{BLACK}Om in één maand ten minste {POP16}{POP16}{CURRENCY} aan attractiekaartjes te verdienen STR_2393 :{BLACK}Om 10 verschillende typen achtbanen in je park te hebben, elk met een lengte van ten minste {LENGTH} en een plezierwaarde van ten minste 7,00 STR_2394 :{BLACK}Om alle 5 deels gebouwde achtbanen in je park af te maken, elk met een plezierwaarde van ten minste {POP16}{POP16}{COMMA2DP32} @@ -2322,7 +2322,7 @@ STR_3305 :{WINDOW_COLOUR_2}Maandelijkse inkomsten: STR_3306 :{WINDOW_COLOUR_2}Maandelijkse winst: STR_3307 :{WINDOW_COLOUR_2}Minimumlengte: STR_3308 :{WINDOW_COLOUR_2}Plezierwaarde: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Attracties met een monumentenstatus: @@ -3685,6 +3685,11 @@ STR_6614 :Kan de toegangsprijs niet aanpassen STR_6615 :Dit baantype vereist water STR_6616 :Ongeldige actie voor dit type werknemer STR_6617 :Kan een kaartelement niet met zichzelf verwisselen +STR_6618 :Kan de beperkingen van dit object niet aanpassen… +STR_6619 :Dit objecttype kan niet worden beperkt! +STR_6620 :Object niet gevonden! +STR_6621 :Beperken +STR_6622 :Maakt het object enkel beschikbaar in de scenariobewerker en zandbakmodus. ############# # Scenarios # diff --git a/data/language/pl-PL.txt b/data/language/pl-PL.txt index f412e273a8..31cd82bfce 100644 --- a/data/language/pl-PL.txt +++ b/data/language/pl-PL.txt @@ -1735,12 +1735,12 @@ STR_2382 :Teren STR_2383 :Woda STR_2384 :{WINDOW_COLOUR_2}Twój cel: STR_2385 :{BLACK}Brak -STR_2386 :{BLACK}Miej przynajmniej {COMMA16} gości w parku na koniec roku {MONTHYEAR} przy ocenie parku wynoszącej przynajmniej 600 +STR_2386 :{BLACK}Miej przynajmniej {COMMA32} gości w parku na koniec roku {MONTHYEAR} przy ocenie parku wynoszącej przynajmniej 600 STR_2387 :{BLACK}Uzyskaj wartość parku nie mniejszą niż {POP16}{POP16}{CURRENCY} na koniec {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Baw się dobrze! STR_2389 :{BLACK}Wybuduj tę atrakcję ({STRINGID}) najlepiej jak potrafisz! STR_2390 :{BLACK}Zbuduj w parku 10 różnych działających kolejek górskich, każda o współczynniku emocji wynoszącym przynajmniej 6.00 -STR_2391 :{BLACK}Miej przynajmniej {COMMA16} gości w swoim parku. Nie pozwól aby ocena parku spadła poniżej 700 nawet na chwilę! +STR_2391 :{BLACK}Miej przynajmniej {COMMA32} gości w swoim parku. Nie pozwól aby ocena parku spadła poniżej 700 nawet na chwilę! STR_2392 :{BLACK}Uzyskaj miesięczny przychód ze sprzedaży biletów na atrakcje w wysokości przynajmniej {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}Zbuduj w parku 10 różnych działających kolejek górskich, każda o współczynniku emocji wynoszącym przynajmniej 7.00 i nie krótsza niż {LENGTH} STR_2394 :{BLACK}Dokończ budowę 5 częściowo już wybudowanych kolejek górskich, projektując je tak aby współczynnik emocji każdej z nich nie był mniejszy niż {POP16}{POP16}{COMMA2DP32} @@ -2321,7 +2321,7 @@ STR_3305 :{WINDOW_COLOUR_2}Miesięczny przychód: STR_3306 :{WINDOW_COLOUR_2}Miesięczny zysk: STR_3307 :{WINDOW_COLOUR_2}Minimalna długość: STR_3308 :{WINDOW_COLOUR_2}Wskaźnik emocji: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Przejażdżki/atrakcje według następującej kolejności: diff --git a/data/language/pt-BR.txt b/data/language/pt-BR.txt index 8416d192a4..e191ed56d9 100644 --- a/data/language/pt-BR.txt +++ b/data/language/pt-BR.txt @@ -1737,12 +1737,12 @@ STR_2382 :Terreno STR_2383 :Água STR_2384 :{WINDOW_COLOUR_2}Seu objetivo: STR_2385 :{BLACK}Nenhum -STR_2386 :{BLACK}Ter pelo menos {COMMA16} visitantes em seu parque até o fim de {MONTHYEAR}, com classificação de parque de pelo menos 600 +STR_2386 :{BLACK}Ter pelo menos {COMMA32} visitantes em seu parque até o fim de {MONTHYEAR}, com classificação de parque de pelo menos 600 STR_2387 :{BLACK}Alcançar um valor do parque de pelo menos {POP16}{POP16}{CURRENCY} até o fim de {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Divirta-se! STR_2389 :{BLACK}Construir o melhor {STRINGID} que puder! STR_2390 :{BLACK}Ter 10 tipos de montanha-russa diferentes operando em seu parque, cada uma com um valor de emoção de pelo menos 6.00 -STR_2391 :{BLACK}Ter pelo menos {COMMA16} visitantes em seu parque. Você não pode deixar a classificação de parque abaixo de 700 em momento algum! +STR_2391 :{BLACK}Ter pelo menos {COMMA32} visitantes em seu parque. Você não pode deixar a classificação de parque abaixo de 700 em momento algum! STR_2392 :{BLACK}Alcançar uma receita mensal de ingressos de atrações de pelo menos {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}Ter 10 tipos de montanha-russa diferentes operando em seu parque, cada uma com um comprimento mínimo de {LENGTH}, e um valor de emoção de no mínimo 7.00 STR_2394 :{BLACK}Terminar de construir todas as 5 montanhas-russas parcialmente construídas neste parque, projetando-as para alcançar um valor de emoção de pelo menos {POP16}{POP16}{COMMA2DP32} cada @@ -2323,7 +2323,7 @@ STR_3305 :{WINDOW_COLOUR_2}Receita Mensal: STR_3306 :{WINDOW_COLOUR_2}Lucro Mensal: STR_3307 :{WINDOW_COLOUR_2}Comprimento Mínimo: STR_3308 :{WINDOW_COLOUR_2}Classificação de emoção: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Atrações em ordem de preservação: @@ -3686,6 +3686,11 @@ STR_6614 :Não é possível mudar o preço de entrada do parque STR_6615 :A pista nesse azulejo precisa de água STR_6616 :Ação inválida para esse tipo de funcionário STR_6617 :Não é possível trocar o elemento do azulejo com ele mesmo +STR_6618 :Não é possível restringir ou liberar o objeto… +STR_6619 :Tipo de objeto não pode ser restringido! +STR_6620 :Objeto não encontrado! +STR_6621 :Restringir +STR_6622 :Restringir objeto ao Editor de Cenário e ao modo sandbox. ############# # Scenarios # diff --git a/data/language/ru-RU.txt b/data/language/ru-RU.txt index d89d47dddd..513605995b 100644 --- a/data/language/ru-RU.txt +++ b/data/language/ru-RU.txt @@ -1737,12 +1737,12 @@ STR_2382 :Земля STR_2383 :Вода STR_2384 :{WINDOW_COLOUR_2}Ваша задача: STR_2385 :{BLACK}Нет -STR_2386 :{BLACK}Иметь не менее {COMMA16} гостей в парке к концу {MONTHYEAR}, и рейтинг парка не менее 600 +STR_2386 :{BLACK}Иметь не менее {COMMA32} гостей в парке к концу {MONTHYEAR}, и рейтинг парка не менее 600 STR_2387 :{BLACK}Поднять стоимость парка до {POP16}{POP16}{CURRENCY} к концу {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Удачи! STR_2389 :{BLACK}Постройте самый лучший {STRINGID} что сможете! STR_2390 :{BLACK}Завести 10 различных типов американских горок, каждую с рейтингом волнения не менее 6.00 -STR_2391 :{BLACK}Иметь не менее {COMMA16} гостей в парке. Нельзя допустить падения рейтинга ниже 700! +STR_2391 :{BLACK}Иметь не менее {COMMA32} гостей в парке. Нельзя допустить падения рейтинга ниже 700! STR_2392 :{BLACK}Довести ежемесячный доход от продажи билетов на аттракционы до {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}Завести 10 различных типов Американских горок, каждая не короче {LENGTH}, и рейтингом волнения не менее 7.00 STR_2394 :{BLACK}Закончить строительство всех 5 недостроенных горок, разработав тематику и добившись рейтинга волнения не ниже {POP16}{POP16}{COMMA2DP32} на каждой @@ -2323,7 +2323,7 @@ STR_3305 :{WINDOW_COLOUR_2}Месячный доход: STR_3306 :{WINDOW_COLOUR_2}Месячная прибыль: STR_3307 :{WINDOW_COLOUR_2}Миним. длина: STR_3308 :{WINDOW_COLOUR_2}Рейтинг волнения: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Аттракционы в зарезервированном порядке: diff --git a/data/language/sv-SE.txt b/data/language/sv-SE.txt index 62ab02f321..d0771b89d3 100644 --- a/data/language/sv-SE.txt +++ b/data/language/sv-SE.txt @@ -1738,12 +1738,12 @@ STR_2382 :Land STR_2383 :Vatten STR_2384 :{WINDOW_COLOUR_2}Ditt uppdrag: STR_2385 :{BLACK}Inget -STR_2386 :{BLACK}Att ha minst {COMMA16} besökare i parken tills {MONTHYEAR}, med ett parkomdöme över 600 +STR_2386 :{BLACK}Att ha minst {COMMA32} besökare i parken tills {MONTHYEAR}, med ett parkomdöme över 600 STR_2387 :{BLACK}Att uppnå ett parkvärde över {POP16}{POP16}{CURRENCY} tills {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Ha kul! STR_2389 :{BLACK}Bygg den bästa {STRINGID} du kan! STR_2390 :{BLACK}Att ha tio olika sorters berg- och dalbanor i din park, alla med en glädjenivå över 6.00 -STR_2391 :{BLACK}Att ha minst {COMMA16} besökare i din park. Du får aldrig låta parkomdömet gå under 700! +STR_2391 :{BLACK}Att ha minst {COMMA32} besökare i din park. Du får aldrig låta parkomdömet gå under 700! STR_2392 :{BLACK}Att få en månadsinkomst från åktursbiljetter på minst {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}Att ha tio olika sorters berg- och dalbanor i din park, alla ska vara längre än {LENGTH}, och med en glädjenivå över 7.00 STR_2394 :{BLACK}Att bygga klart alla fem delvis byggda berg- och dalbanor i parken, designade så att de alla får en glädjenivå över {POP16}{POP16}{COMMA2DP32} @@ -2326,7 +2326,7 @@ STR_3305 :{WINDOW_COLOUR_2}Månadsinkomst: STR_3306 :{WINDOW_COLOUR_2}Månadsvinst: STR_3307 :{WINDOW_COLOUR_2}Minimilängd: STR_3308 :{WINDOW_COLOUR_2}Glädjenivå: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Åkturer och attraktioner som måste bevaras: diff --git a/data/language/tr-TR.txt b/data/language/tr-TR.txt index 8c6a9947c2..9f2280f67d 100644 --- a/data/language/tr-TR.txt +++ b/data/language/tr-TR.txt @@ -1731,12 +1731,12 @@ STR_2382 :Arazi/Zemin STR_2383 :Su STR_2384 :{WINDOW_COLOUR_2}Hedefiniz: STR_2385 :{BLACK}Yok -STR_2386 :{BLACK}Parkınızda en az {COMMA16} müşteri {MONTHYEAR} sonuna kadar bulunması ve park değerlendirmesinin en az 600 olması gerekli +STR_2386 :{BLACK}Parkınızda en az {COMMA32} müşteri {MONTHYEAR} sonuna kadar bulunması ve park değerlendirmesinin en az 600 olması gerekli STR_2387 :{BLACK}Park değeri en az {POP16}{POP16}{CURRENCY} {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} kadar olmalı STR_2388 :{BLACK}Iyi eğlenceler! STR_2389 :{BLACK}Kendinize göre en iyi {STRINGID} inşa ediniz! STR_2390 :{BLACK}Parkınızda heyecan oranı en az 6.00 olan, 10 çesitli hız treni inşa edilmeli -STR_2391 :{BLACK}Parkınızda en az {COMMA16} müşteri bulunması ve park değerlendirmesinin hiç bir zaman 700’den aşağı düşmemesi gerekli +STR_2391 :{BLACK}Parkınızda en az {COMMA32} müşteri bulunması ve park değerlendirmesinin hiç bir zaman 700’den aşağı düşmemesi gerekli STR_2392 :{BLACK}Alet bileti satışlarından aylık en az {POP16}{POP16}{CURRENCY} geliriniz olmalı STR_2393 :{BLACK}Parkınızda heyecan oranı en az 7.00 ve uzunluğu en az {LENGTH} olan 10 çeşitli hız treni inşa edilmeli STR_2394 :{BLACK}Parkınızda bulunan 5 kısmen inşa edilmiş hız trenlerinin inşasını en az {POP16}{POP16}{COMMA2DP32} heyecan oranı ile tamamlayınız @@ -2317,7 +2317,7 @@ STR_3305 :{WINDOW_COLOUR_2}Aylık gelir: STR_3306 :{WINDOW_COLOUR_2}Aylık kâr: STR_3307 :{WINDOW_COLOUR_2}En az uzunluk: STR_3308 :{WINDOW_COLOUR_2}Heyecan oranı: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Koruma altına almak istediğiniz aletleri seçiniz diff --git a/data/language/uk-UA.txt b/data/language/uk-UA.txt index 4bbe57b9d0..815bb807be 100644 --- a/data/language/uk-UA.txt +++ b/data/language/uk-UA.txt @@ -1737,12 +1737,12 @@ STR_2382 :Ділянка STR_2383 :Вода STR_2384 :{WINDOW_COLOUR_2}Ваша мета: STR_2385 :{BLACK}Немає -STR_2386 :{BLACK}Мати щонайменше {COMMA16} гостей у парку наприкінці {MONTHYEAR}, з рейтингом парку не менше 600 +STR_2386 :{BLACK}Мати щонайменше {COMMA32} гостей у парку наприкінці {MONTHYEAR}, з рейтингом парку не менше 600 STR_2387 :{BLACK}Досягти вартості парку щонайменше {POP16}{POP16}{CURRENCY} наприкінці {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Розважатися! STR_2389 :{BLACK}Збудувати найкращий {STRINGID}, який можете! STR_2390 :{BLACK}Мати 10 різних типів американських гірок, що працюють у парку, кожна з яких має коефіцієнт захоплення не менше 6.00 -STR_2391 :{BLACK}Мати щонайменше {COMMA16} гостей у парку. Ви не повинні допустити, щоб рейтинг парку опустився нижче 700 в будь-який час! +STR_2391 :{BLACK}Мати щонайменше {COMMA32} гостей у парку. Ви не повинні допустити, щоб рейтинг парку опустився нижче 700 в будь-який час! STR_2392 :{BLACK}Досягти щомісячного доходу від продажу квитків на атракціон у розмірі щонайменше {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}To have 10 different types of roller coasters operating in your park, each with a minimum length of {LENGTH}, and an excitement rating of at least 7.00 STR_2394 :{BLACK}Завершити будівництво всіх 5 частково побудованих американських гірок у цьому парку, спланувавши їх так, щоб досягти оцінки захоплення не менше {POP16}{POP16}{COMMA2DP32} для кожної з них @@ -2356,7 +2356,7 @@ STR_3305 :{WINDOW_COLOUR_2}Щомісячний дохід: STR_3306 :{WINDOW_COLOUR_2}Щомісячний прибуток: STR_3307 :{WINDOW_COLOUR_2}Мінімальна довжина: STR_3308 :{WINDOW_COLOUR_2}Оцінка захоплення: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Rides/attractions under a preservation order: @@ -3695,6 +3695,36 @@ STR_6589 :Показати кнопки вікна зліва STR_6590 :Показати кнопки вікна (напр. для закриття вікна) ліворуч від рядка заголовка. STR_6591 :Не можна звільнити поки працівник лагодить атракціон. STR_6592 :Не можна звільнити поки працівник тестує атракціон. +STR_6593 :Прибрати паркани +STR_6594 :Інспектор тайлів: Увімк./Вимк. нахили стін +STR_6595 :{WINDOW_COLOUR_2}Автор: {BLACK}{STRING} +STR_6596 :{WINDOW_COLOUR_2}Автори: {BLACK}{STRING} +STR_6597 :Невірний параметр +STR_6598 :Значення поза діапазону +STR_6599 :Примарний елемент не знайдено +STR_6600 :Кулю не знайдено +STR_6601 :Персонал не знайдено +STR_6602 :Атракціон не знайдено +STR_6603 :Ride object entry not found +STR_6604 :Гравця не знайдено +STR_6605 :Елемент входу не знайдено +STR_6606 :Елемент поверхні не знайдено +STR_6607 :Елемент тайлу не знайдено +STR_6608 :Елемент рейки не знайдено +STR_6609 :Блок рейки не знайдено +STR_6610 :Елемент стежки не знайдено +STR_6611 :Елемент стіни не знайдено +STR_6612 :Елемент воріт не знайдено +STR_6613 :Перезавантажити об'єкт +STR_6614 :Не можна змінити ціну на вхід +STR_6615 :Доріжка на цьому тайлі потребує води +STR_6616 :Цьому типу персоналу дія недопустима +STR_6617 :Неможливо замінити елемент тайлу тим же елементом +STR_6618 :Не вдається обмежити/зняти обмеження об'єкту... +STR_6619 :Тип об'єкту неможливо обмежити! +STR_6620 :Об'єкт не знайдено! +STR_6621 :Обмежити +STR_6622 :Обмежити використання об'єкта лише в Редакторі Сценаріїв та в режимі пісочниці. ############# # Scenarios # @@ -4527,4 +4557,4 @@ STR_DTLS :Привіт, дітки! Нумо розважатися!{NEWLINE} STR_SCNR :Піщана дюна STR_PARK :Піщана дюна -STR_DTLS :Як власник невеликого парку, ви купили велику ділянку землі вздовж пляжу, щоб розширити його і привабити більше гостей до прекрасних піщаних дюн, але будьте обережні: ви не можете порушувати ці екологічно крихкі піщані дюни.{NEWLINE}Автор: rbarclay \ No newline at end of file +STR_DTLS :Як власник невеликого парку, ви купили велику ділянку землі вздовж пляжу, щоб розширити його і привабити більше гостей до прекрасних піщаних дюн, але будьте обережні: ви не можете порушувати ці екологічно крихкі піщані дюни.{NEWLINE}Автор: rbarclay diff --git a/data/language/vi-VN.txt b/data/language/vi-VN.txt index dbfd941711..acf1caf529 100644 --- a/data/language/vi-VN.txt +++ b/data/language/vi-VN.txt @@ -1734,12 +1734,12 @@ STR_2382 :Land STR_2383 :Water STR_2384 :{WINDOW_COLOUR_2}Mục tiêu: STR_2385 :{BLACK}Không -STR_2386 :{BLACK}Có ít nhất {COMMA16} khách vào cuối tháng {MONTHYEAR}, với đánh giá công viên từ 600 trở lên +STR_2386 :{BLACK}Có ít nhất {COMMA32} khách vào cuối tháng {MONTHYEAR}, với đánh giá công viên từ 600 trở lên STR_2387 :{BLACK}Đạt giá trị công viên ít nhất {POP16}{POP16}{CURRENCY} vào cuối {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Have Fun! STR_2389 :{BLACK}Build the best {STRINGID} you can! STR_2390 :{BLACK}Có 10 loại tàu lượn khác nhau trong công viên, mỗi cái có chỉ số phấn khích ít nhất 6.00 -STR_2391 :{BLACK}Có ít nhất {COMMA16} khách. Không được để đánh giá công viên thấp hơn 700 ở bất kỳ thời điểm nào! +STR_2391 :{BLACK}Có ít nhất {COMMA32} khách. Không được để đánh giá công viên thấp hơn 700 ở bất kỳ thời điểm nào! STR_2392 :{BLACK}To achieve a monthly income from ride tickets of at least {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}To have 10 different types of roller coasters operating in your park, each with a minimum length of {LENGTH}, and an excitement rating of at least 7.00 STR_2394 :{BLACK}To finish building all 5 of the partially built roller coasters in this park, designing them to achieve excitement ratings of at least {POP16}{POP16}{COMMA2DP32} each @@ -2321,7 +2321,7 @@ STR_3305 :{WINDOW_COLOUR_2}Monthly income: STR_3306 :{WINDOW_COLOUR_2}Monthly profit: STR_3307 :{WINDOW_COLOUR_2}Minimum length: STR_3308 :{WINDOW_COLOUR_2}Độ phấn khích: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}Rides/attractions under a preservation order: diff --git a/data/language/zh-CN.txt b/data/language/zh-CN.txt index 41064f4c98..7d36ed4f6e 100644 --- a/data/language/zh-CN.txt +++ b/data/language/zh-CN.txt @@ -1737,12 +1737,12 @@ STR_2382 :土地 STR_2383 :水面 STR_2384 :{WINDOW_COLOUR_2}你的目标: STR_2385 :{BLACK}无 -STR_2386 :{BLACK}在{POP16}{MONTHYEAR}末乐园内至少有{NEWLINE}{PUSH16}{PUSH16}{COMMA16}游客,并且乐园评分不低于600 +STR_2386 :{BLACK}在{POP16}{MONTHYEAR}末乐园内至少有{NEWLINE}{PUSH16}{PUSH16}{COMMA32}游客,并且乐园评分不低于600 STR_2387 :{BLACK}在{POP16}{MONTHYEAR}末乐园价值不低于{CURRENCY} STR_2388 :{BLACK}尽情玩吧! STR_2389 :{BLACK}建造你的最佳{STRINGID}吧! STR_2390 :{BLACK}在你的乐园中运营10种类型的过山车,并且每一个的兴奋度不低于6.00 -STR_2391 :{BLACK}乐园内至少有{COMMA16}游客,并且在任何时候你都不能让公园评分低于700! +STR_2391 :{BLACK}乐园内至少有{COMMA32}游客,并且在任何时候你都不能让公园评分低于700! STR_2392 :{BLACK}每个月的门票收入至少{NEWLINE}{POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}在你的乐园中运营10种类型的过山车,每一个的长度至少{LENGTH},并且每一个的兴奋度不低于7.00 STR_2394 :{BLACK}建造好五座未完成的过山车,将他们每座设计成兴奋度至少达到{POP16}{POP16}{COMMA2DP32} @@ -2323,7 +2323,7 @@ STR_3305 :{WINDOW_COLOUR_2}每月收入: STR_3306 :{WINDOW_COLOUR_2}每月利润: STR_3307 :{WINDOW_COLOUR_2}最少长度: STR_3308 :{WINDOW_COLOUR_2}兴奋度: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}请选取要保留的游乐设施/店铺: diff --git a/data/language/zh-TW.txt b/data/language/zh-TW.txt index 95f355fdb1..a26004c2dc 100644 --- a/data/language/zh-TW.txt +++ b/data/language/zh-TW.txt @@ -1741,12 +1741,12 @@ STR_2382 :土地 STR_2383 :水塘 STR_2384 :{WINDOW_COLOUR_2}你的目標: STR_2385 :{BLACK}無 -STR_2386 :{BLACK}在{POP16}{MONTHYEAR}尾之前, 樂園裡至少有{PUSH16}{PUSH16}{COMMA16}個遊客, 而且樂園評價並不低於600 +STR_2386 :{BLACK}在{POP16}{MONTHYEAR}尾之前, 樂園裡至少有{PUSH16}{PUSH16}{COMMA32}個遊客, 而且樂園評價並不低於600 STR_2387 :{BLACK}在{POP16}{MONTHYEAR}尾之前, 樂園價值必需達到{CURRENCY} STR_2388 :{BLACK}盡情玩吧! STR_2389 :{BLACK}建造你的最佳{STRINGID}吧! STR_2390 :{BLACK}樂園必需建造十種不同種類的雲霄飛車, 而且每座的興奮度不低於6.00 -STR_2391 :{BLACK}樂園裡至少有{COMMA16}個遊客. 任何時間下, 你並不可以令樂園評價跌至700以下! +STR_2391 :{BLACK}樂園裡至少有{COMMA32}個遊客. 任何時間下, 你並不可以令樂園評價跌至700以下! STR_2392 :{BLACK}遊樂設施的門票收入至少要達到每月{POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}樂園必需建造十種不同種類的雲霄飛車, 每座的長度至少需要{LENGTH}, 而且興奮度都不低於7.00 STR_2394 :{BLACK}建造好五座未完成的雲霄飛車, 將他們每座設計成興奮度至少達到{POP16}{POP16}{COMMA2DP32} @@ -2327,7 +2327,7 @@ STR_3305 :{WINDOW_COLOUR_2}每月收入: STR_3306 :{WINDOW_COLOUR_2}每月利潤: STR_3307 :{WINDOW_COLOUR_2}最少長度: STR_3308 :{WINDOW_COLOUR_2}興奮度: -STR_3309 :{WINDOW_COLOUR_2}{COMMA16} +STR_3309 :{WINDOW_COLOUR_2}{COMMA32} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} STR_3312 :{WINDOW_COLOUR_2}請選取要保留的遊樂設施/店鋪: diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 22c041996b..905b3beec4 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,3 +1,44 @@ +0.4.10 (in development) +------------------------------------------------------------------------ +- Feature: [#18171] Add port of the RCT1 Stand-Up Roller Coaster. +- Feature: [#21590] [Plugin] Plugins can now read and write banner properties of tile elements. +- Feature: [#21636] Add shortcut key for sorting tile elements. +- Feature: [objects#294] Add scenery versions of wooden truss supports. +- Feature: [objects#295] Flipped version of wooden post. +- Improved: [#21424] Extra viewports can now rotate independently from the main viewport. +- Improved: [#21561, #21631] Enable more features in Android build (plugins, networking, multiplayer, audio formats). +- Improved: [#21599] Currency signs now use non-breaking spaces. +- Improved: [objects#157] Added sloped images for many walls. +- Improved: [objects#288] Better map colours and more sensible prices for RCT1 land surfaces. +- Improved: [objects#292] Vehicle colour cleanups for WW/TT vehicles. +- Improved: [objects#299] More accurate ratings modifiers for RCT1 vehicles. +- Improved: [objects#309] Updated names for dodgems and flying saucers vehicles. +- Improved: [objects#313] buildMenuPriority for dodgems and flying saucers vehicles. +- Change: [#21529] Classify “Southern Sands”, “Tiny Towers”, “Nevermore Park”, “Pacifica” as expert scenarios. +- Change: [#21545] Reorder Wacky Worlds scenarios and adjust their difficulty classification. +- Fix: [#910] Extra viewport does not preserve the location when rotating. +- Fix: [#18413] Crash when mouse over a hacked train. +- Fix: [#20338] Cannot select Scenery Picker or Scatter Tool when the scenery recolouring tool is active. +- Fix: [#21317] Track designer allows proceeding without an object selected. +- Fix: [#21360] If the object selection is missing certain types, the Object Selection window will switch to an incorrect tab. +- Fix: [#21419] Cannot place walls underground beneath sloped tiles with clearance checks disabled. +- Fix: [#21434] Number of guests overflows in objective text. +- Fix: [#21522] Supports for 3×3 turns and 45 degree turns on the Hybrid Coaster and Wooden Roller Coaster not drawn correctly. +- Fix: [#21543] Crash with creating a TrackIterator with invalid arguments. +- Fix: [#21635] Tile inspector hotkey can set wall slope for non-slopeable objects. +- Fix: [#21641] Crash when creating track iterator from an invalid tile element. +- Fix: [#21652] Dialog window to confirm overwriting files does not apply the theme colours correctly. +- Fix: [#21654] No sound effects when using RCT Classic as an asset base. +- Fix: [#21654] Extraneous reports of an object conflict between `rct2.audio.base` and `rct2.audio.base.rctc`. +- Fix: [#21664] Crash when switching between languages that use TTF. +- Fix: [#21668] Crash when on null ride in Guest::UpdateRideLeaveExit. +- Fix: [#21691] Crash when validating rides which can't contain banked track. +- Fix: [objects#290] “Haunted Mansion” cars have a non-functional third remap colour. +- Fix: [objects#296] Incorrect wall placement around large Kremlin/drab pieces. +- Fix: [objects#300] Incorrect Colosseum and volcano corner clearances. +- Fix: [objects#319] Incorrect diagonal slope images used for RCT1 corkscrew. +- Fix: [objects#320] Incorrect Mandarin Duck boats capacity. + 0.4.9 (2024-03-02) ------------------------------------------------------------------------ - Feature: [#20376] Add Ukrainian language. @@ -24,6 +65,7 @@ - Fix: [#21220] When creating a new park from a SC4 file, the localised park name is not applied. - Fix: [#21286] Cannot build unbanking turns with RCT1 vehicles. - Fix: [#21288] Text overlaps in the “About ‘OpenRCT2’” window for Arabic, Chinese, Japanese, Korean and Vietnamese. +- Fix: [#21289] Text overlaps and overflows in the map window for some languages. - Fix: [#21310] Some half loop elements require more clearance than their upward/downward counterparts. - Fix: [#21318] Virtual Floor for building scenery is not properly invalidated. - Fix: [#21330] Tooltips from dropdown widgets have the wrong position. @@ -57,7 +99,7 @@ - Fix: [#21039] Text rendering bleeds pixels through windows. - Fix: [#21054] “No entrance” style is selected by default in the track designer. - Fix: [#21145] [Plugin] setInterval/setTimeout handle conflict. -- Fix: [#21157] [Plugin] Widgets do not redraw correctly when updating disabled or visibility state. +- Fix: [#21157] [Plugin] Widgets do not redraw correctly when updating disabled or visibility state. - Fix: [#21158] [Plugin] Potential crash using setInterval/setTimeout within the callback. - Fix: [#21171] [Plugin] Crash creating entities with no more entity slots available. - Fix: [#21178] Inca Lost City’s scenario description incorrectly states there are height restrictions. diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts index 4b7e5f28d7..c09138fa6c 100644 --- a/distribution/openrct2.d.ts +++ b/distribution/openrct2.d.ts @@ -1503,12 +1503,12 @@ declare global { edges: number; corners: number; - slopeDirection: number | null; + slopeDirection: Direction | null; isBlockedByVehicle: boolean; isWide: boolean; isQueue: boolean; - queueBannerDirection: number | null; + queueBannerDirection: Direction | null; ride: number | null; station: number | null; @@ -1558,10 +1558,14 @@ declare global { direction: Direction; object: number; primaryColour: number; + /** If the element is a banner, this is the text colour. */ secondaryColour: number; tertiaryColour: number; - bannerIndex: number | null; slope: Direction; + /** Writing to bannerIndex is deprecated and may result in uncontrolled behaviour. */ + readonly bannerIndex: number | null; + /** If the element is a banner, this is its text. */ + bannerText: string | null; } interface EntranceElement extends BaseTileElement { @@ -1582,16 +1586,28 @@ declare global { direction: Direction; object: number; primaryColour: number; + /** If the element is a banner, this is the text colour. */ secondaryColour: number; tertiaryColour: number; - bannerIndex: number | null; sequence: number; + /** Writing to bannerIndex is deprecated and may result in uncontrolled behaviour. */ + readonly bannerIndex: number | null; + /** If the element is a banner, this is its text. */ + bannerText: string | null; } interface BannerElement extends BaseTileElement { type: "banner"; + direction: Direction; - bannerIndex: number; + object: number; + primaryColour: number; + /** This is the text colour. */ + secondaryColour: number; + /** Writing to bannerIndex is deprecated and may result in uncontrolled behaviour. */ + readonly bannerIndex: number; + bannerText: string; + isNoEntry: boolean; } /** @@ -3612,8 +3628,9 @@ declare global { /** * The amount of funding currently spent on research. + * 0: none, 1: minimum, 2: normal, 3: maximum */ - funding: ResearchFundingLevel; + funding: number; /** * The categories of research which should be prioritised. @@ -3663,7 +3680,7 @@ declare global { * E.g. gentle rides, thrill rides, shops etc. * Note: Any updates to this field are ignored by OpenRCT2, the category will be derived from the ride type. */ - readonly category?: ResearchCategory; + readonly category: RideResearchCategory; /** * The ride type. Each vehicle can have a seperate invention for each ride type. @@ -3677,7 +3694,7 @@ declare global { } interface SceneryResearchItem { - readonly category?: "scenery_group"; + readonly category: "scenery"; readonly type: "scenery"; /** @@ -3686,23 +3703,15 @@ declare global { readonly object: number; } - type ResearchItemType = "scenery" | "ride"; - - type ResearchCategory = + type RideResearchCategory = "transport" | "gentle" | "rollercoaster" | "thrill" | "water" | - "shop" | - "scenery"; + "shop"; - enum ResearchFundingLevel { - None, - Minimum, - Normal, - Maximum - } + type ResearchCategory = RideResearchCategory | "scenery"; type ResearchFundingStage = "initial_research" | diff --git a/openrct2.proj b/openrct2.proj index 05ee7c1376..7cd2c43a3a 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -45,8 +45,8 @@ bd338aa3da9a357fb996dcaa6cea02c4f906718c https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.6/title-sequences.zip 80fefc6ebbabc42a6f4703412daa5c62f661420d - https://github.com/OpenRCT2/objects/releases/download/v1.4.0/objects.zip - f512e230ffa2f16109209e4f30e7d7bf4fe21fc0 + https://github.com/OpenRCT2/objects/releases/download/v1.4.3/objects.zip + ac78210ef46465c0f51bbffd6fe21845092af48e https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.5/opensound.zip b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb https://github.com/OpenRCT2/OpenMusic/releases/download/v1.5/openmusic.zip diff --git a/resources/g2/sprites.json b/resources/g2/sprites.json index 297c9b520f..d2f4bd51f3 100644 --- a/resources/g2/sprites.json +++ b/resources/g2/sprites.json @@ -136,13 +136,13 @@ }, { "path": "icons/eyedropper.png", - "x_offset": 5, - "y_offset": 5 + "x": 5, + "y": 5 }, { "path": "icons/chat.png", - "x_offset": 2, - "y_offset": 1 + "x": 2, + "y": 1 }, { "path": "icons/map_north.png" @@ -182,8 +182,8 @@ }, { "path": "icons/simulate.png", - "x_offset": 2, - "y_offset": 2 + "x": 2, + "y": 2 }, { "path": "icons/rct1_simulate_off.png" @@ -203,18 +203,18 @@ }, { "path": "tool/normal_selection_6x6.png", - "x_offset": 1, - "y_offset": 4 + "x": 1, + "y": 4 }, { "path": "tool/mountain_tool_even.png", - "x_offset": 1, - "y_offset": 4 + "x": 1, + "y": 4 }, { "path": "tool/mountain_tool_odd.png", - "x_offset": 1, - "y_offset": 5 + "x": 1, + "y": 5 }, { "path": "tool/scenery_scatter_low.png" @@ -230,38 +230,38 @@ }, { "path": "icons/path_railings.png", - "x_offset": 1, - "y_offset": 1 + "x": 1, + "y": 1 }, { "path": "icons/legacy_paths.png", - "x_offset": 1, - "y_offset": 1 + "x": 1, + "y": 1 }, { "path": "icons/path_surfaces.png", - "x_offset": 1, - "y_offset": 1 + "x": 1, + "y": 1 }, { "path": "icons/ride_stations.png", - "x_offset": 5, - "y_offset": 1 + "x": 5, + "y": 1 }, { "path": "icons/terrain_edges.png", - "x_offset": 1, - "y_offset": 1 + "x": 1, + "y": 1 }, { "path": "icons/hide_vegetation.png", - "x_offset": 1, - "y_offset": 1 + "x": 1, + "y": 1 }, { "path": "icons/hide_scenery.png", - "x_offset": 1, - "y_offset": 1 + "x": 1, + "y": 1 }, { "path": "icons/hide_vehicles.png" @@ -271,18 +271,18 @@ }, { "path": "icons/hide_partial.png", - "x_offset": 4, - "y_offset": 2 + "x": 4, + "y": 2 }, { "path": "icons/hide_full.png", - "x_offset": 4, - "y_offset": 2 + "x": 4, + "y": 2 }, { "path": "icons/link_chain.png", - "x_offset": 2, - "y_offset": 2 + "x": 2, + "y": 2 }, { "path": "sideways-tab.png" @@ -292,18 +292,18 @@ }, { "path": "icons/arrow_up.png", - "x_offset": 5, - "y_offset": 5 + "x": 5, + "y": 5 }, { "path": "icons/arrow_down.png", - "x_offset": 5, - "y_offset": 5 + "x": 5, + "y": 5 }, { "path": "icons/reload.png", - "x_offset": 2, - "y_offset": 2 + "x": 2, + "y": 2 }, { "path": "icons/colour_invisible.png" @@ -314,2228 +314,2228 @@ { "path": "palette_map/palette_map_dark_olive_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_dark_olive_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_saturated_brown_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_bordeaux_red_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_bordeaux_red_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_grass_green_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_grass_green_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_olive_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_olive_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_saturated_green_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_tan_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_tan_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_dull_purple_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_dull_green_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_dull_green_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_saturated_purple_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_saturated_purple_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_orange_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_aqua_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_magenta_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_dull_brown_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_dull_brown_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_invisible.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_void.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_dark_olive_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_dark_olive_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_saturated_brown_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_bordeaux_red_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_bordeaux_red_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_grass_green_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_grass_green_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_olive_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_olive_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_saturated_green_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_tan_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_tan_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_dull_purple_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_dull_green_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_dull_green_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_saturated_purple_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_saturated_purple_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_orange_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_aqua_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_magenta_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_dull_brown_dark.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_dull_brown_light.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_invisible.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "palette_map/palette_map_glass_void.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "surface/glassy_recolourable.png", - "x_offset": -32, - "y_offset": -1, + "x": -32, + "y": -1, "palette": "keep" }, { "path": "surface/selection_edge_nw.png", - "x_offset": -32, - "y_offset": -1 + "x": -32, + "y": -1 }, { "path": "surface/selection_edge_ne.png", - "x_offset": 0, - "y_offset": -1 + "x": 0, + "y": -1 }, { "path": "surface/selection_edge_sw.png", - "x_offset": -32, - "y_offset": 15 + "x": -32, + "y": 15 }, { "path": "surface/selection_edge_se.png", - "x_offset": 0, - "y_offset": 15 + "x": 0, + "y": 15 }, { "path": "font/latin/ae-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/ae-small.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-stroke-uc-small.png", - "x_offset": -1, - "y_offset": 0, + "x": -1, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-stroke-small.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1028-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1041-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1043-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1044-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1046-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1047-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1048-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1049-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1051-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1055-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1059-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1060-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1062-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1063-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1064-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1065-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1066-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1067-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1068-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1069-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1070-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1071-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1073-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1074-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1075-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1076-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1078-small.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1079-small.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1080-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1081-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1082-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1083-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1084-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1085-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1087-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1090-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1092-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1094-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1095-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1096-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1097-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1099-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1100-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1101-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1102-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1103-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1108-small.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1168-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1169-small.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/german-openquotes-small.png", - "y_offset": 6, + "y": 6, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/guilder-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-breve-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/i-with-dot-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-cedilla-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-breve-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/i-without-dot-small.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-cedilla-small.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/interpunct-small.png", - "y_offset": 3, + "y": 3, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/a-breve-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-comma-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-comma-small.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/ellipsis-small.png", - "y_offset": 6, + "y": 6, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-caron-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-caron-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-acute-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-acute-small.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-double-acute-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-double-acute-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/oe-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/oe-small.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-double-acute-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-double-acute-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/d-caron-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/d-caron-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/e-caron-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/e-caron-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/n-caron-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/n-caron-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/r-caron-uc-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/r-caron-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-caron-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-caron-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-caron-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-caron-small.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-ring-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-ring-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/w-circumflex-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/w-circumflex-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-circumflex-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-circumflex-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/z-caron-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/z-caron-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/rouble-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/j-small.png", - "x_offset": -1, + "x": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/l-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-circumflex-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-circumflex-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-circumflex-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-circumflex-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/h-circumflex-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/h-circumflex-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/j-circumflex-uc-small.png", - "x_offset": -1, - "y_offset": -1, + "x": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/j-circumflex-small.png", - "x_offset": -1, + "x": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-circumflex-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-circumflex-small.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-breve-uc-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-breve-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/left-brace-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/vertical-bar-small.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/right-brace-small.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/tilde-small.png", - "y_offset": 3, + "y": 3, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/eye.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/ae-uc-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/ae-bold.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-stroke-uc-bold.png", - "x_offset": -1, - "y_offset": -1, + "x": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-stroke-bold.png", - "x_offset": 0, - "y_offset": 2, + "x": 0, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1028-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1041-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1043-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1044-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1046-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1047-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1048-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1049-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1051-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1055-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1059-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1060-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1062-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1063-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1064-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1065-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1066-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1067-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1068-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1069-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1070-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1071-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1073-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1074-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1075-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1076-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1078-bold.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1079-bold.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1080-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1081-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1082-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1083-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1084-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1085-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1087-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1090-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1092-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1094-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1095-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1096-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1097-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1099-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1100-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1101-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1102-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1103-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1108-bold.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1168-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1169-bold.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/german-openquotes-bold.png", - "y_offset": 5, + "y": 5, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/guilder-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-breve-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/i-with-dot-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-cedilla-uc-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-breve-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/i-without-dot-bold.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-cedilla-bold.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/interpunct-bold.png", - "y_offset": 3, + "y": 3, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/a-breve-uc-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-comma-uc-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-comma-bold.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/ellipsis-bold.png", - "y_offset": 6, + "y": 6, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-caron-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-caron-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-acute-uc-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-acute-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-double-acute-uc-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-double-acute-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/oe-uc-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/oe-bold.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-double-acute-uc-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-double-acute-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/d-caron-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/d-caron-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/e-caron-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/e-caron-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/n-caron-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/n-caron-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/r-caron-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/r-caron-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-caron-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-caron-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-caron-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-caron-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-ring-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-ring-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/w-circumflex-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/w-circumflex-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-circumflex-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-circumflex-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/z-caron-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/z-caron-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/rouble-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/j-bold.png", - "x_offset": -1, + "x": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/l-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-circumflex-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-circumflex-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-circumflex-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-circumflex-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/h-circumflex-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/h-circumflex-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/j-circumflex-uc-bold.png", - "x_offset": -1, - "y_offset": -1, + "x": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/j-circumflex-bold.png", - "x_offset": -1, + "x": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-circumflex-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-circumflex-bold.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-breve-uc-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-breve-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/left-brace-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/vertical-bar-bold.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/right-brace-bold.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/tilde-bold.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/eye.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/ae-uc-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/ae-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-stroke-uc-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-stroke-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1028-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1041-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1043-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1044-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1046-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1047-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1048-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1049-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1051-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1055-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1059-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1060-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1062-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1063-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1064-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1065-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1066-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1067-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1068-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1069-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1070-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1071-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1073-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1074-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1075-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1076-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1078-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1079-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1080-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1081-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1082-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1083-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1084-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1085-tiny.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1087-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1090-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1092-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1094-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1095-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1096-tiny.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1097-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1099-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1100-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1101-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1102-tiny.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1103-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1108-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1168-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/cyrillic/U1169-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/german-openquotes-tiny.png", - "y_offset": 4, + "y": 4, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/guilder-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-breve-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/i-with-dot-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-cedilla-uc-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-breve-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/i-without-dot-tiny.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-cedilla-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/interpunct-tiny.png", - "y_offset": 2, + "y": 2, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/a-breve-uc-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-comma-uc-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-comma-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/ellipsis-tiny.png", - "y_offset": 4, + "y": 4, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-caron-uc-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-caron-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-acute-uc-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-acute-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-double-acute-uc-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/o-double-acute-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/oe-uc-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/oe-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-double-acute-uc-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-double-acute-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/d-caron-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/d-caron-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/e-caron-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/e-caron-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/n-caron-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/n-caron-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/r-caron-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/r-caron-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-caron-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-caron-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-caron-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/t-caron-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-ring-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-ring-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/w-circumflex-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/w-circumflex-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-circumflex-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/y-circumflex-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/z-caron-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/z-caron-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/rouble-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/j-tiny.png", - "x_offset": 0, + "x": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/l-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-circumflex-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/c-circumflex-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-circumflex-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/g-circumflex-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/h-circumflex-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/h-circumflex-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/j-circumflex-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/j-circumflex-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-circumflex-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/s-circumflex-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-breve-uc-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/latin/u-breve-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/left-brace-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/vertical-bar-tiny.png", - "y_offset": -1, + "y": -1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/right-brace-tiny.png", "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/tilde-tiny.png", - "y_offset": 1, + "y": 1, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "font/eye-tiny.png", - "y_offset": 0, + "y": 0, "palette": "keep", - "forceBmp": true + "format": "raw" }, { "path": "track/junior/flat_to_steep_1.png" @@ -2611,22314 +2611,22314 @@ }, { "path": "track/junior/booster_1.png", - "x_offset": -21, - "y_offset": 0 + "x": -21, + "y": 0 }, { "path": "track/junior/booster_2.png", - "x_offset": -22, - "y_offset": 1 + "x": -22, + "y": 1 }, { "path": "track/junior/brake_horizontal.png", - "x_offset": -32, - "y_offset": 7, + "x": -32, + "y": 7, "palette": "keep" }, { "path": "track/junior/brake_vertical.png", - "x_offset": -9, - "y_offset": -4, + "x": -9, + "y": -4, "palette": "keep" }, { "path": "track/junior/blockbrake_horizontal_closed.png", - "x_offset": -32, - "y_offset": 7, + "x": -32, + "y": 7, "palette": "keep" }, { "path": "track/junior/blockbrake_horizontal_open.png", - "x_offset": -32, - "y_offset": 7, + "x": -32, + "y": 7, "palette": "keep" }, { "path": "track/junior/blockbrake_vertical_closed.png", - "x_offset": -9, - "y_offset": -4, + "x": -9, + "y": -4, "palette": "keep" }, { "path": "track/junior/blockbrake_vertical_open.png", - "x_offset": -9, - "y_offset": -4, + "x": -9, + "y": -4, "palette": "keep" }, { "path": "track/intamin/booster_1.png", - "x_offset": -22, - "y_offset": -4 + "x": -22, + "y": -4 }, { "path": "track/intamin/booster_2.png", - "x_offset": -22, - "y_offset": -4 + "x": -22, + "y": -4 }, { "path": "track/intamin/brake_horizontal_background_open.png", - "x_offset": -32, - "y_offset": -5, + "x": -32, + "y": -5, "palette": "keep" }, { "path": "track/intamin/brake_horizontal_background_closed.png", - "x_offset": -32, - "y_offset": -5, + "x": -32, + "y": -5, "palette": "keep" }, { "path": "track/intamin/brake_horizontal_foreground.png", - "x_offset": -30, - "y_offset": 8, + "x": -30, + "y": 8, "palette": "keep" }, { "path": "track/intamin/brake_vertical_background.png", - "x_offset": -14, - "y_offset": -10, + "x": -14, + "y": -10, "palette": "keep" }, { "path": "track/intamin/brake_vertical_foreground_open.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/intamin/brake_vertical_foreground_closed.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/intamin/liftbooster_0.png", - "x_offset": -21, - "y_offset": -20, + "x": -21, + "y": -20, "palette": "keep" }, { "path": "track/intamin/liftbooster_1.png", - "x_offset": -21, - "y_offset": -4, + "x": -21, + "y": -4, "palette": "keep" }, { "path": "track/intamin/liftbooster_2.png", - "x_offset": -22, - "y_offset": -4, + "x": -22, + "y": -4, "palette": "keep" }, { "path": "track/intamin/liftbooster_3.png", - "x_offset": -22, - "y_offset": -20, + "x": -22, + "y": -20, "palette": "keep" }, { "path": "track/intamin/steep_to_vertical_up_1.png", - "x_offset": -21, - "y_offset": -54, + "x": -21, + "y": -54, "palette": "keep" }, { "path": "track/intamin/steep_to_vertical_up_2.png", - "x_offset": -21, - "y_offset": -53, + "x": -21, + "y": -53, "palette": "keep" }, { "path": "track/intamin/steep_to_vertical_up_3.png", - "x_offset": -10, - "y_offset": -53, + "x": -10, + "y": -53, "palette": "keep" }, { "path": "track/intamin/steep_to_vertical_up_4.png", - "x_offset": -10, - "y_offset": -54, + "x": -10, + "y": -54, "palette": "keep" }, { "path": "track/intamin/vertical_to_steep_up_1.png", - "x_offset": -6, - "y_offset": -60, + "x": -6, + "y": -60, "palette": "keep" }, { "path": "track/intamin/vertical_to_steep_up_2.png", - "x_offset": -6, - "y_offset": -44, + "x": -6, + "y": -44, "palette": "keep" }, { "path": "track/intamin/vertical_to_steep_up_3.png", - "x_offset": -25, - "y_offset": -44, + "x": -25, + "y": -44, "palette": "keep" }, { "path": "track/intamin/vertical_to_steep_up_4.png", - "x_offset": -25, - "y_offset": -61, + "x": -25, + "y": -61, "palette": "keep" }, { "path": "track/intamin/vertical_1.png", - "x_offset": -6, - "y_offset": -30, + "x": -6, + "y": -30, "palette": "keep" }, { "path": "track/intamin/vertical_2.png", - "x_offset": -6, - "y_offset": -29, + "x": -6, + "y": -29, "palette": "keep" }, { "path": "track/intamin/vertical_3.png", - "x_offset": -10, - "y_offset": -29, + "x": -10, + "y": -29, "palette": "keep" }, { "path": "track/intamin/vertical_4.png", - "x_offset": -10, - "y_offset": -30, + "x": -10, + "y": -30, "palette": "keep" }, { "path": "track/intamin/vertical_twist_left_up_1.png", - "x_offset": -10, - "y_offset": -95, + "x": -10, + "y": -95, "palette": "keep" }, { "path": "track/intamin/vertical_twist_left_up_2_1.png", - "x_offset": -6, - "y_offset": -94, + "x": -6, + "y": -94, "palette": "keep" }, { "path": "track/intamin/vertical_twist_left_up_2_2.png", - "x_offset": -6, - "y_offset": -45, + "x": -6, + "y": -45, "palette": "keep" }, { "path": "track/intamin/vertical_twist_left_up_3.png", - "x_offset": -10, - "y_offset": -93, + "x": -10, + "y": -93, "palette": "keep" }, { "path": "track/intamin/vertical_twist_left_up_4_1.png", - "x_offset": -13, - "y_offset": -44, + "x": -13, + "y": -44, "palette": "keep" }, { "path": "track/intamin/vertical_twist_left_up_4_2.png", - "x_offset": -13, - "y_offset": -93, + "x": -13, + "y": -93, "palette": "keep" }, { "path": "track/intamin/vertical_twist_right_up_1_1.png", - "x_offset": -6, - "y_offset": -45, + "x": -6, + "y": -45, "palette": "keep" }, { "path": "track/intamin/vertical_twist_right_up_1_2.png", - "x_offset": -6, - "y_offset": -93, + "x": -6, + "y": -93, "palette": "keep" }, { "path": "track/intamin/vertical_twist_right_up_2.png", - "x_offset": -10, - "y_offset": -93, + "x": -10, + "y": -93, "palette": "keep" }, { "path": "track/intamin/vertical_twist_right_up_3_1.png", - "x_offset": -13, - "y_offset": -94, + "x": -13, + "y": -94, "palette": "keep" }, { "path": "track/intamin/vertical_twist_right_up_3_2.png", - "x_offset": -13, - "y_offset": -45, + "x": -13, + "y": -45, "palette": "keep" }, { "path": "track/intamin/vertical_twist_right_up_4.png", - "x_offset": -10, - "y_offset": -94, + "x": -10, + "y": -94, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_1_1.png", - "x_offset": -22, - "y_offset": 4, + "x": -22, + "y": 4, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_1_2.png", - "x_offset": -17, - "y_offset": 4, + "x": -17, + "y": 4, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_1_3.png", - "x_offset": -22, - "y_offset": 3, + "x": -22, + "y": 3, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_1_4.png", - "x_offset": -20, - "y_offset": -21, + "x": -20, + "y": -21, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_1_5.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_1_6.png", - "x_offset": -11, - "y_offset": -31, + "x": -11, + "y": -31, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_2_1.png", - "x_offset": -22, - "y_offset": -4, + "x": -22, + "y": -4, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_2_2.png", - "x_offset": -20, - "y_offset": 4, + "x": -20, + "y": 4, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_2_3.png", - "x_offset": -28, - "y_offset": -5, + "x": -28, + "y": -5, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_2_4.png", - "x_offset": -28, - "y_offset": -8, + "x": -28, + "y": -8, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_2_5.png", - "x_offset": 10, - "y_offset": -1, + "x": 10, + "y": -1, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_2_6.png", - "x_offset": -32, - "y_offset": -21, + "x": -32, + "y": -21, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_3_1.png", - "x_offset": -29, - "y_offset": -4, + "x": -29, + "y": -4, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_3_2.png", - "x_offset": 10, - "y_offset": 8, + "x": 10, + "y": 8, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_3_3.png", - "x_offset": -26, - "y_offset": -16, + "x": -26, + "y": -16, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_3_4.png", - "x_offset": -28, - "y_offset": -13, + "x": -28, + "y": -13, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_3_5.png", - "x_offset": -1, - "y_offset": -16, + "x": -1, + "y": -16, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_3_6.png", - "x_offset": -22, - "y_offset": -29, + "x": -22, + "y": -29, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_4_1.png", - "x_offset": -15, - "y_offset": -15, + "x": -15, + "y": -15, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_4_2.png", - "x_offset": 13, - "y_offset": 23, + "x": 13, + "y": 23, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_4_3.png", - "x_offset": -12, - "y_offset": -23, + "x": -12, + "y": -23, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_4_4.png", - "x_offset": -10, - "y_offset": -31, + "x": -10, + "y": -31, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_4_5.png", - "x_offset": -12, - "y_offset": -16, + "x": -12, + "y": -16, "palette": "keep" }, { "path": "track/intamin/barrel_roll_left_4_6.png", - "x_offset": -22, - "y_offset": -31, + "x": -22, + "y": -31, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_1_1.png", - "x_offset": -22, - "y_offset": -15, + "x": -22, + "y": -15, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_1_2.png", - "x_offset": -17, - "y_offset": 22, + "x": -17, + "y": 22, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_1_3.png", - "x_offset": -26, - "y_offset": -23, + "x": -26, + "y": -23, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_1_4.png", - "x_offset": -15, - "y_offset": -31, + "x": -15, + "y": -31, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_1_5.png", - "x_offset": -22, - "y_offset": -12, + "x": -22, + "y": -12, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_1_6.png", - "x_offset": -26, - "y_offset": -31, + "x": -26, + "y": -31, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_2_1.png", - "x_offset": -22, - "y_offset": -4, + "x": -22, + "y": -4, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_2_2.png", - "x_offset": -17, - "y_offset": 9, + "x": -17, + "y": 9, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_2_3.png", - "x_offset": -7, - "y_offset": -15, + "x": -7, + "y": -15, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_2_4.png", - "x_offset": 14, - "y_offset": -12, + "x": 14, + "y": -12, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_2_5.png", - "x_offset": -7, - "y_offset": -16, + "x": -7, + "y": -16, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_2_6.png", - "x_offset": -6, - "y_offset": -28, + "x": -6, + "y": -28, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_3_1.png", - "x_offset": -2, - "y_offset": -4, + "x": -2, + "y": -4, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_3_2.png", - "x_offset": -4, - "y_offset": 4, + "x": -4, + "y": 4, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_3_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_3_4.png", - "x_offset": 0, - "y_offset": -8, + "x": 0, + "y": -8, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_3_5.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_3_6.png", - "x_offset": -22, - "y_offset": -21, + "x": -22, + "y": -21, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_4_1.png", - "x_offset": -12, - "y_offset": 4, + "x": -12, + "y": 4, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_4_2.png", - "x_offset": -25, - "y_offset": 5, + "x": -25, + "y": 5, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_4_3.png", - "x_offset": 8, - "y_offset": 14, + "x": 8, + "y": 14, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_4_4.png", - "x_offset": -28, - "y_offset": -21, + "x": -28, + "y": -21, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_4_5.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/barrel_roll_right_4_6.png", - "x_offset": -22, - "y_offset": -31, + "x": -22, + "y": -31, "palette": "keep" }, { "path": "track/intamin/half_loop_1_1.png", - "x_offset": -28, - "y_offset": -22, + "x": -28, + "y": -22, "palette": "keep" }, { "path": "track/intamin/half_loop_1_2.png", - "x_offset": -23, - "y_offset": -40, + "x": -23, + "y": -40, "palette": "keep" }, { "path": "track/intamin/half_loop_1_3.png", - "x_offset": -13, - "y_offset": -92, + "x": -13, + "y": -92, "palette": "keep" }, { "path": "track/intamin/half_loop_1_4.png", - "x_offset": -22, - "y_offset": 13, + "x": -22, + "y": 13, "palette": "keep" }, { "path": "track/intamin/half_loop_2_1.png", - "x_offset": -16, - "y_offset": -18, + "x": -16, + "y": -18, "palette": "keep" }, { "path": "track/intamin/half_loop_2_2.png", - "x_offset": 1, - "y_offset": -37, + "x": 1, + "y": -37, "palette": "keep" }, { "path": "track/intamin/half_loop_2_3.png", - "x_offset": -38, - "y_offset": -114, + "x": -38, + "y": -114, "palette": "keep" }, { "path": "track/intamin/half_loop_2_4.png", - "x_offset": -22, - "y_offset": 1, + "x": -22, + "y": 1, "palette": "keep" }, { "path": "track/intamin/half_loop_3_1.png", - "x_offset": -29, - "y_offset": -9, + "x": -29, + "y": -9, "palette": "keep" }, { "path": "track/intamin/half_loop_3_2.png", - "x_offset": -30, - "y_offset": -33, + "x": -30, + "y": -33, "palette": "keep" }, { "path": "track/intamin/half_loop_3_3.png", - "x_offset": -2, - "y_offset": -121, + "x": -2, + "y": -121, "palette": "keep" }, { "path": "track/intamin/half_loop_3_4.png", - "x_offset": -29, - "y_offset": -7, + "x": -29, + "y": -7, "palette": "keep" }, { "path": "track/intamin/half_loop_4_1.png", - "x_offset": -13, - "y_offset": -22, + "x": -13, + "y": -22, "palette": "keep" }, { "path": "track/intamin/half_loop_4_2.png", - "x_offset": -14, - "y_offset": -44, + "x": -14, + "y": -44, "palette": "keep" }, { "path": "track/intamin/half_loop_4_3.png", - "x_offset": 4, - "y_offset": -101, + "x": 4, + "y": -101, "palette": "keep" }, { "path": "track/intamin/half_loop_4_4.png", - "x_offset": 1, - "y_offset": 4, + "x": 1, + "y": 4, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_1_1.png", - "x_offset": -28, - "y_offset": -25, + "x": -28, + "y": -25, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_1_2.png", - "x_offset": -26, - "y_offset": -111, + "x": -26, + "y": -111, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_1_3.png", - "x_offset": -22, - "y_offset": -84, + "x": -22, + "y": -84, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_1_4.png", - "x_offset": -32, - "y_offset": 9, + "x": -32, + "y": 9, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_2_1.png", - "x_offset": -15, - "y_offset": -26, + "x": -15, + "y": -26, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_2_2.png", - "x_offset": 1, - "y_offset": -32, + "x": 1, + "y": -32, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_2_3.png", - "x_offset": -34, - "y_offset": -114, + "x": -34, + "y": -114, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_2_4.png", - "x_offset": -6, - "y_offset": -3, + "x": -6, + "y": -3, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_3_1.png", - "x_offset": -25, - "y_offset": -110, + "x": -25, + "y": -110, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_3_2.png", - "x_offset": -19, - "y_offset": -51, + "x": -19, + "y": -51, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_3_3.png", - "x_offset": 11, - "y_offset": -94, + "x": 11, + "y": -94, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_3_4.png", - "x_offset": -22, - "y_offset": 3, + "x": -22, + "y": 3, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_4_1.png", - "x_offset": -15, - "y_offset": -20, + "x": -15, + "y": -20, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_4_2.png", - "x_offset": -20, - "y_offset": -41, + "x": -20, + "y": -41, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_4_3.png", - "x_offset": -4, - "y_offset": -87, + "x": -4, + "y": -87, "palette": "keep" }, { "path": "track/intamin/left_vertical_loop_4_4.png", - "x_offset": -13, - "y_offset": 17, + "x": -13, + "y": 17, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_1_1.png", - "x_offset": -27, - "y_offset": -20, + "x": -27, + "y": -20, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_1_2.png", - "x_offset": -27, - "y_offset": -41, + "x": -27, + "y": -41, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_1_3.png", - "x_offset": -20, - "y_offset": -86, + "x": -20, + "y": -86, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_1_4.png", - "x_offset": -21, - "y_offset": 16, + "x": -21, + "y": 16, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_2_1.png", - "x_offset": -16, - "y_offset": -9, + "x": -16, + "y": -9, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_2_2.png", - "x_offset": -7, - "y_offset": -51, + "x": -7, + "y": -51, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_2_3.png", - "x_offset": -23, - "y_offset": -100, + "x": -23, + "y": -100, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_2_4.png", - "x_offset": -16, - "y_offset": 5, + "x": -16, + "y": 5, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_3_1.png", - "x_offset": -46, - "y_offset": -26, + "x": -46, + "y": -26, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_3_2.png", - "x_offset": -41, - "y_offset": -32, + "x": -41, + "y": -32, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_3_3.png", - "x_offset": 8, - "y_offset": -114, + "x": 8, + "y": -114, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_3_4.png", - "x_offset": -27, - "y_offset": 0, + "x": -27, + "y": 0, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_4_1.png", - "x_offset": -10, - "y_offset": -25, + "x": -10, + "y": -25, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_4_2.png", - "x_offset": -11, - "y_offset": -111, + "x": -11, + "y": -111, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_4_3.png", - "x_offset": 1, - "y_offset": -83, + "x": 1, + "y": -83, "palette": "keep" }, { "path": "track/intamin/right_vertical_loop_4_4.png", - "x_offset": -9, - "y_offset": 9, + "x": -9, + "y": 9, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_1_1.png", - "x_offset": -18, - "y_offset": -55, + "x": -18, + "y": -55, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_1_2.png", - "x_offset": 0, - "y_offset": -43, + "x": 0, + "y": -43, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_1_3.png", - "x_offset": -22, - "y_offset": -23, + "x": -22, + "y": -23, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_2_1.png", - "x_offset": -24, - "y_offset": -79, + "x": -24, + "y": -79, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_2_2.png", - "x_offset": -32, - "y_offset": -66, + "x": -32, + "y": -66, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_2_3.png", - "x_offset": -22, - "y_offset": -31, + "x": -22, + "y": -31, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_3_1.png", - "x_offset": -10, - "y_offset": -78, + "x": -10, + "y": -78, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_3_2.png", - "x_offset": -21, - "y_offset": -68, + "x": -21, + "y": -68, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_3_3.png", - "x_offset": -11, - "y_offset": -31, + "x": -11, + "y": -31, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_4_1.png", - "x_offset": -10, - "y_offset": -56, + "x": -10, + "y": -56, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_4_2.png", - "x_offset": -28, - "y_offset": -43, + "x": -28, + "y": -43, "palette": "keep" }, { "path": "track/intamin/quarter_loop_up_4_3.png", - "x_offset": -32, - "y_offset": -23, + "x": -32, + "y": -23, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_1_1.png", - "x_offset": -22, - "y_offset": -71, + "x": -22, + "y": -71, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_1_2.png", - "x_offset": -20, - "y_offset": -36, + "x": -20, + "y": -36, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_1_3.png", - "x_offset": -22, - "y_offset": -31, + "x": -22, + "y": -31, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_2_1.png", - "x_offset": -22, - "y_offset": -4, + "x": -22, + "y": -4, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_2_2.png", - "x_offset": -32, - "y_offset": -36, + "x": -32, + "y": -36, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_2_3.png", - "x_offset": -21, - "y_offset": -31, + "x": -21, + "y": -31, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_3_1.png", - "x_offset": -31, - "y_offset": -9, + "x": -31, + "y": -9, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_3_2.png", - "x_offset": -3, - "y_offset": -24, + "x": -3, + "y": -24, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_3_3.png", - "x_offset": -19, - "y_offset": -19, + "x": -19, + "y": -19, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_4_1.png", - "x_offset": -32, - "y_offset": -39, + "x": -32, + "y": -39, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_4_2.png", - "x_offset": -34, - "y_offset": -21, + "x": -34, + "y": -21, "palette": "keep" }, { "path": "track/intamin/corkscrew_left_4_3.png", - "x_offset": -22, - "y_offset": -22, + "x": -22, + "y": -22, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_1_1.png", - "x_offset": -22, - "y_offset": -39, + "x": -22, + "y": -39, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_1_2.png", - "x_offset": -8, - "y_offset": -22, + "x": -8, + "y": -22, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_1_3.png", - "x_offset": -20, - "y_offset": -22, + "x": -20, + "y": -22, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_2_1.png", - "x_offset": -22, - "y_offset": -9, + "x": -22, + "y": -9, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_2_2.png", - "x_offset": -13, - "y_offset": -24, + "x": -13, + "y": -24, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_2_3.png", - "x_offset": -22, - "y_offset": -19, + "x": -22, + "y": -19, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_3_1.png", - "x_offset": -7, - "y_offset": -4, + "x": -7, + "y": -4, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_3_2.png", - "x_offset": -22, - "y_offset": -36, + "x": -22, + "y": -36, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_3_3.png", - "x_offset": -22, - "y_offset": -31, + "x": -22, + "y": -31, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_4_1.png", - "x_offset": -27, - "y_offset": -65, + "x": -27, + "y": -65, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_4_2.png", - "x_offset": -3, - "y_offset": -36, + "x": -3, + "y": -36, "palette": "keep" }, { "path": "track/intamin/corkscrew_right_4_3.png", - "x_offset": -26, - "y_offset": -31, + "x": -26, + "y": -31, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_1_1.png", - "x_offset": -22, - "y_offset": -12, + "x": -22, + "y": -12, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_1_2.png", - "x_offset": -21, - "y_offset": -72, + "x": -21, + "y": -72, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_1_3.png", - "x_offset": -28, - "y_offset": -40, + "x": -28, + "y": -40, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_1_4.png", - "x_offset": -23, - "y_offset": -52, + "x": -23, + "y": -52, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_1_5.png", - "x_offset": -22, - "y_offset": -39, + "x": -22, + "y": -39, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_2_1.png", - "x_offset": -22, - "y_offset": -4, + "x": -22, + "y": -4, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_2_2.png", - "x_offset": -32, - "y_offset": -15, + "x": -32, + "y": -15, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_2_3.png", - "x_offset": -23, - "y_offset": -50, + "x": -23, + "y": -50, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_2_4.png", - "x_offset": -18, - "y_offset": -56, + "x": -18, + "y": -56, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_2_5.png", - "x_offset": -14, - "y_offset": -39, + "x": -14, + "y": -39, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_3_1.png", - "x_offset": -16, - "y_offset": -4, + "x": -16, + "y": -4, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_3_2.png", - "x_offset": -19, - "y_offset": -17, + "x": -19, + "y": -17, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_3_3.png", - "x_offset": 10, - "y_offset": -33, + "x": 10, + "y": -33, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_3_4.png", - "x_offset": -8, - "y_offset": -38, + "x": -8, + "y": -38, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_3_5.png", - "x_offset": -16, - "y_offset": -30, + "x": -16, + "y": -30, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_4_1.png", - "x_offset": -24, - "y_offset": -11, + "x": -24, + "y": -11, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_4_2.png", - "x_offset": -23, - "y_offset": -27, + "x": -23, + "y": -27, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_4_3.png", - "x_offset": -14, - "y_offset": -13, + "x": -14, + "y": -13, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_4_4.png", - "x_offset": -29, - "y_offset": -36, + "x": -29, + "y": -36, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_left_4_5.png", - "x_offset": -22, - "y_offset": -33, + "x": -22, + "y": -33, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_1_1.png", - "x_offset": -22, - "y_offset": -11, + "x": -22, + "y": -11, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_1_2.png", - "x_offset": -22, - "y_offset": -27, + "x": -22, + "y": -27, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_1_3.png", - "x_offset": -20, - "y_offset": -13, + "x": -20, + "y": -13, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_1_4.png", - "x_offset": -28, - "y_offset": -37, + "x": -28, + "y": -37, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_1_5.png", - "x_offset": -32, - "y_offset": -33, + "x": -32, + "y": -33, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_2_1.png", - "x_offset": -22, - "y_offset": -4, + "x": -22, + "y": -4, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_2_2.png", - "x_offset": -16, - "y_offset": -17, + "x": -16, + "y": -17, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_2_3.png", - "x_offset": -24, - "y_offset": -32, + "x": -24, + "y": -32, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_2_4.png", - "x_offset": -16, - "y_offset": -38, + "x": -16, + "y": -38, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_2_5.png", - "x_offset": -22, - "y_offset": -30, + "x": -22, + "y": -30, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_3_1.png", - "x_offset": -29, - "y_offset": -4, + "x": -29, + "y": -4, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_3_2.png", - "x_offset": -16, - "y_offset": -15, + "x": -16, + "y": -15, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_3_3.png", - "x_offset": -25, - "y_offset": -50, + "x": -25, + "y": -50, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_3_4.png", - "x_offset": -28, - "y_offset": -56, + "x": -28, + "y": -56, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_3_5.png", - "x_offset": -22, - "y_offset": -39, + "x": -22, + "y": -39, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_4_1.png", - "x_offset": -26, - "y_offset": -12, + "x": -26, + "y": -12, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_4_2.png", - "x_offset": -11, - "y_offset": -68, + "x": -11, + "y": -68, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_4_3.png", - "x_offset": 10, - "y_offset": -40, + "x": 10, + "y": -40, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_4_4.png", - "x_offset": -17, - "y_offset": -52, + "x": -17, + "y": -52, "palette": "keep" }, { "path": "track/intamin/large_corkscrew_right_4_5.png", - "x_offset": -24, - "y_offset": -39, + "x": -24, + "y": -39, "palette": "keep" }, { "path": "track/intamin/small_turn_left_bank_to_gentle_up_1_1.png", - "x_offset": -26, - "y_offset": -20, + "x": -26, + "y": -20, "palette": "keep" }, { "path": "track/intamin/small_turn_left_bank_to_gentle_up_1_2.png", - "x_offset": -16, - "y_offset": -15, + "x": -16, + "y": -15, "palette": "keep" }, { "path": "track/intamin/small_turn_left_bank_to_gentle_up_2_1.png", - "x_offset": 3, - "y_offset": -5, + "x": 3, + "y": -5, "palette": "keep" }, { "path": "track/intamin/small_turn_left_bank_to_gentle_up_2_2.png", - "x_offset": -17, - "y_offset": -7, + "x": -17, + "y": -7, "palette": "keep" }, { "path": "track/intamin/small_turn_left_bank_to_gentle_up_2_3.png", - "x_offset": -38, - "y_offset": -15, + "x": -38, + "y": -15, "palette": "keep" }, { "path": "track/intamin/small_turn_left_bank_to_gentle_up_3_1.png", - "x_offset": -18, - "y_offset": -11, + "x": -18, + "y": -11, "palette": "keep" }, { "path": "track/intamin/small_turn_left_bank_to_gentle_up_3_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/intamin/small_turn_left_bank_to_gentle_up_4_1.png", - "x_offset": -26, - "y_offset": -12, + "x": -26, + "y": -12, "palette": "keep" }, { "path": "track/intamin/small_turn_left_bank_to_gentle_up_4_2.png", - "x_offset": -28, - "y_offset": 1, + "x": -28, + "y": 1, "palette": "keep" }, { "path": "track/intamin/small_turn_right_bank_to_gentle_up_1_1.png", - "x_offset": -29, - "y_offset": -12, + "x": -29, + "y": -12, "palette": "keep" }, { "path": "track/intamin/small_turn_right_bank_to_gentle_up_1_2.png", - "x_offset": -26, - "y_offset": 1, + "x": -26, + "y": 1, "palette": "keep" }, { "path": "track/intamin/small_turn_right_bank_to_gentle_up_2_1.png", - "x_offset": -13, - "y_offset": -11, + "x": -13, + "y": -11, "palette": "keep" }, { "path": "track/intamin/small_turn_right_bank_to_gentle_up_2_2.png", - "x_offset": -28, - "y_offset": -4, + "x": -28, + "y": -4, "palette": "keep" }, { "path": "track/intamin/small_turn_right_bank_to_gentle_up_3_1.png", - "x_offset": -38, - "y_offset": -6, + "x": -38, + "y": -6, "palette": "keep" }, { "path": "track/intamin/small_turn_right_bank_to_gentle_up_3_2.png", - "x_offset": -38, - "y_offset": -6, + "x": -38, + "y": -6, "palette": "keep" }, { "path": "track/intamin/small_turn_right_bank_to_gentle_up_3_3.png", - "x_offset": -16, - "y_offset": -15, + "x": -16, + "y": -15, "palette": "keep" }, { "path": "track/intamin/small_turn_right_bank_to_gentle_up_4_1.png", - "x_offset": -6, - "y_offset": -20, + "x": -6, + "y": -20, "palette": "keep" }, { "path": "track/intamin/small_turn_right_bank_to_gentle_up_4_2.png", - "x_offset": -18, - "y_offset": -15, + "x": -18, + "y": -15, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_1_1.png", - "x_offset": -22, - "y_offset": -34, + "x": -22, + "y": -34, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_1_2.png", - "x_offset": -21, - "y_offset": -51, + "x": -21, + "y": -51, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_1_3.png", - "x_offset": -29, - "y_offset": -100, + "x": -29, + "y": -100, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_1_4.png", - "x_offset": -44, - "y_offset": -128, + "x": -44, + "y": -128, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_1_5.png", - "x_offset": -21, - "y_offset": -37, + "x": -21, + "y": -37, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_2_1.png", - "x_offset": -22, - "y_offset": -12, + "x": -22, + "y": -12, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_2_2.png", - "x_offset": 0, - "y_offset": -34, + "x": 0, + "y": -34, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_2_3.png", - "x_offset": 0, - "y_offset": -87, + "x": 0, + "y": -87, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_2_4.png", - "x_offset": -30, - "y_offset": -148, + "x": -30, + "y": -148, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_2_5.png", - "x_offset": -22, - "y_offset": -47, + "x": -22, + "y": -47, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_3_1.png", - "x_offset": -23, - "y_offset": -7, + "x": -23, + "y": -7, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_3_2.png", - "x_offset": 0, - "y_offset": -13, + "x": 0, + "y": -13, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_3_3.png", - "x_offset": -3, - "y_offset": -59, + "x": -3, + "y": -59, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_3_4.png", - "x_offset": -32, - "y_offset": -154, + "x": -32, + "y": -154, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_3_5.png", - "x_offset": -17, - "y_offset": -47, + "x": -17, + "y": -47, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_4_1.png", - "x_offset": -23, - "y_offset": -19, + "x": -23, + "y": -19, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_4_2.png", - "x_offset": -25, - "y_offset": -26, + "x": -25, + "y": -26, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_4_3.png", - "x_offset": -30, - "y_offset": -31, + "x": -30, + "y": -31, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_4_4.png", - "x_offset": -10, - "y_offset": -129, + "x": -10, + "y": -129, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_left_4_5.png", - "x_offset": -28, - "y_offset": -40, + "x": -28, + "y": -40, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_1_1.png", - "x_offset": -22, - "y_offset": -19, + "x": -22, + "y": -19, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_1_2.png", - "x_offset": -19, - "y_offset": -26, + "x": -19, + "y": -26, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_1_3.png", - "x_offset": -17, - "y_offset": -31, + "x": -17, + "y": -31, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_1_4.png", - "x_offset": -26, - "y_offset": -129, + "x": -26, + "y": -129, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_1_5.png", - "x_offset": -22, - "y_offset": -40, + "x": -22, + "y": -40, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_2_1.png", - "x_offset": -22, - "y_offset": -7, + "x": -22, + "y": -7, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_2_2.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_2_3.png", - "x_offset": -32, - "y_offset": -59, + "x": -32, + "y": -59, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_2_4.png", - "x_offset": -25, - "y_offset": -154, + "x": -25, + "y": -154, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_2_5.png", - "x_offset": -21, - "y_offset": -47, + "x": -21, + "y": -47, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_3_1.png", - "x_offset": -32, - "y_offset": -12, + "x": -32, + "y": -12, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_3_2.png", - "x_offset": -32, - "y_offset": -34, + "x": -32, + "y": -34, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_3_3.png", - "x_offset": -32, - "y_offset": -87, + "x": -32, + "y": -87, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_3_4.png", - "x_offset": -10, - "y_offset": -148, + "x": -10, + "y": -148, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_3_5.png", - "x_offset": -12, - "y_offset": -47, + "x": -12, + "y": -47, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_4_1.png", - "x_offset": -23, - "y_offset": -34, + "x": -23, + "y": -34, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_4_2.png", - "x_offset": -16, - "y_offset": -51, + "x": -16, + "y": -51, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_4_3.png", - "x_offset": -3, - "y_offset": -100, + "x": -3, + "y": -100, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_4_4.png", - "x_offset": -32, - "y_offset": -128, + "x": -32, + "y": -128, "palette": "keep" }, { "path": "track/intamin/medium_half_loop_right_4_5.png", - "x_offset": -32, - "y_offset": -37, + "x": -32, + "y": -37, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_1_1.png", - "x_offset": -22, - "y_offset": -29, + "x": -22, + "y": -29, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_1_2.png", - "x_offset": -18, - "y_offset": -42, + "x": -18, + "y": -42, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_1_3.png", - "x_offset": -19, - "y_offset": -70, + "x": -19, + "y": -70, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_1_4.png", - "x_offset": -24, - "y_offset": -85, + "x": -24, + "y": -85, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_1_5.png", - "x_offset": -16, - "y_offset": -70, + "x": -16, + "y": -70, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_1_6.png", - "x_offset": -9, - "y_offset": -183, + "x": -9, + "y": -183, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_1_7.png", - "x_offset": -21, - "y_offset": -20, + "x": -21, + "y": -20, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_2_1.png", - "x_offset": -22, - "y_offset": -5, + "x": -22, + "y": -5, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_2_2.png", - "x_offset": -6, - "y_offset": -9, + "x": -6, + "y": -9, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_2_3.png", - "x_offset": -9, - "y_offset": -27, + "x": -9, + "y": -27, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_2_4.png", - "x_offset": -8, - "y_offset": -94, + "x": -8, + "y": -94, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_2_5.png", - "x_offset": -32, - "y_offset": -130, + "x": -32, + "y": -130, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_2_6.png", - "x_offset": -25, - "y_offset": -197, + "x": -25, + "y": -197, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_2_7.png", - "x_offset": -22, - "y_offset": -31, + "x": -22, + "y": -31, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_3_1.png", - "x_offset": -24, - "y_offset": -3, + "x": -24, + "y": -3, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_3_2.png", - "x_offset": -32, - "y_offset": -9, + "x": -32, + "y": -9, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_3_3.png", - "x_offset": -29, - "y_offset": -38, + "x": -29, + "y": -38, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_3_4.png", - "x_offset": -7, - "y_offset": -61, + "x": -7, + "y": -61, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_3_5.png", - "x_offset": -7, - "y_offset": -117, + "x": -7, + "y": -117, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_3_6.png", - "x_offset": -22, - "y_offset": -197, + "x": -22, + "y": -197, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_3_7.png", - "x_offset": -28, - "y_offset": -32, + "x": -28, + "y": -32, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_4_1.png", - "x_offset": -24, - "y_offset": -18, + "x": -24, + "y": -18, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_4_2.png", - "x_offset": -30, - "y_offset": -21, + "x": -30, + "y": -21, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_4_3.png", - "x_offset": -32, - "y_offset": -52, + "x": -32, + "y": -52, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_4_4.png", - "x_offset": -32, - "y_offset": -84, + "x": -32, + "y": -84, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_4_5.png", - "x_offset": 16, - "y_offset": -62, + "x": 16, + "y": -62, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_4_6.png", - "x_offset": -16, - "y_offset": -186, + "x": -16, + "y": -186, "palette": "keep" }, { "path": "track/intamin/large_half_loop_left_4_7.png", - "x_offset": -24, - "y_offset": -22, + "x": -24, + "y": -22, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_1_1.png", - "x_offset": -22, - "y_offset": -18, + "x": -22, + "y": -18, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_1_2.png", - "x_offset": -18, - "y_offset": -21, + "x": -18, + "y": -21, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_1_3.png", - "x_offset": -13, - "y_offset": -52, + "x": -13, + "y": -52, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_1_4.png", - "x_offset": 0, - "y_offset": -84, + "x": 0, + "y": -84, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_1_5.png", - "x_offset": -32, - "y_offset": -62, + "x": -32, + "y": -62, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_1_6.png", - "x_offset": -19, - "y_offset": -186, + "x": -19, + "y": -186, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_1_7.png", - "x_offset": -22, - "y_offset": -22, + "x": -22, + "y": -22, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_2_1.png", - "x_offset": -22, - "y_offset": -3, + "x": -22, + "y": -3, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_2_2.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_2_3.png", - "x_offset": -6, - "y_offset": -38, + "x": -6, + "y": -38, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_2_4.png", - "x_offset": -16, - "y_offset": -61, + "x": -16, + "y": -61, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_2_5.png", - "x_offset": -23, - "y_offset": -117, + "x": -23, + "y": -117, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_2_6.png", - "x_offset": -17, - "y_offset": -197, + "x": -17, + "y": -197, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_2_7.png", - "x_offset": -21, - "y_offset": -32, + "x": -21, + "y": -32, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_3_1.png", - "x_offset": -26, - "y_offset": -5, + "x": -26, + "y": -5, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_3_2.png", - "x_offset": -30, - "y_offset": -9, + "x": -30, + "y": -9, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_3_3.png", - "x_offset": -29, - "y_offset": -27, + "x": -29, + "y": -27, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_3_4.png", - "x_offset": -32, - "y_offset": -94, + "x": -32, + "y": -94, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_3_5.png", - "x_offset": 16, - "y_offset": -130, + "x": 16, + "y": -130, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_3_6.png", - "x_offset": 0, - "y_offset": -197, + "x": 0, + "y": -197, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_3_7.png", - "x_offset": -17, - "y_offset": -31, + "x": -17, + "y": -31, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_4_1.png", - "x_offset": -24, - "y_offset": -29, + "x": -24, + "y": -29, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_4_2.png", - "x_offset": -25, - "y_offset": -42, + "x": -25, + "y": -42, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_4_3.png", - "x_offset": -21, - "y_offset": -70, + "x": -21, + "y": -70, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_4_4.png", - "x_offset": -5, - "y_offset": -85, + "x": -5, + "y": -85, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_4_5.png", - "x_offset": -7, - "y_offset": -70, + "x": -7, + "y": -70, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_4_6.png", - "x_offset": -32, - "y_offset": -183, + "x": -32, + "y": -183, "palette": "keep" }, { "path": "track/intamin/large_half_loop_right_4_7.png", - "x_offset": -31, - "y_offset": -20, + "x": -31, + "y": -20, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_1_1.png", - "x_offset": -22, - "y_offset": -15, + "x": -22, + "y": -15, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_1_2.png", - "x_offset": -10, - "y_offset": -16, + "x": -10, + "y": -16, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_1_3.png", - "x_offset": -11, - "y_offset": -26, + "x": -11, + "y": -26, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_1_4.png", - "x_offset": -19, - "y_offset": -31, + "x": -19, + "y": -31, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_2_1.png", - "x_offset": -22, - "y_offset": -3, + "x": -22, + "y": -3, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_2_2.png", - "x_offset": -22, - "y_offset": -4, + "x": -22, + "y": -4, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_2_3.png", - "x_offset": -23, - "y_offset": -18, + "x": -23, + "y": -18, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_2_4.png", - "x_offset": -21, - "y_offset": -18, + "x": -21, + "y": -18, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_3_1.png", - "x_offset": -20, - "y_offset": -11, + "x": -20, + "y": -11, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_3_2.png", - "x_offset": -22, - "y_offset": -25, + "x": -22, + "y": -25, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_3_3.png", - "x_offset": -11, - "y_offset": -18, + "x": -11, + "y": -18, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_3_4.png", - "x_offset": -23, - "y_offset": -27, + "x": -23, + "y": -27, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_4_1.png", - "x_offset": -15, - "y_offset": -27, + "x": -15, + "y": -27, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_4_2.png", - "x_offset": -11, - "y_offset": -45, + "x": -11, + "y": -45, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_4_3.png", - "x_offset": -3, - "y_offset": -12, + "x": -3, + "y": -12, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_left_4_4.png", - "x_offset": -21, - "y_offset": -31, + "x": -21, + "y": -31, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_1_1.png", - "x_offset": -22, - "y_offset": -27, + "x": -22, + "y": -27, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_1_2.png", - "x_offset": -27, - "y_offset": -45, + "x": -27, + "y": -45, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_1_3.png", - "x_offset": -22, - "y_offset": -16, + "x": -22, + "y": -16, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_1_4.png", - "x_offset": -27, - "y_offset": -31, + "x": -27, + "y": -31, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_2_1.png", - "x_offset": -22, - "y_offset": -11, + "x": -22, + "y": -11, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_2_2.png", - "x_offset": -17, - "y_offset": -25, + "x": -17, + "y": -25, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_2_3.png", - "x_offset": -13, - "y_offset": -18, + "x": -13, + "y": -18, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_2_4.png", - "x_offset": -11, - "y_offset": -27, + "x": -11, + "y": -27, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_3_1.png", - "x_offset": 3, - "y_offset": -3, + "x": 3, + "y": -3, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_3_2.png", - "x_offset": -9, - "y_offset": -4, + "x": -9, + "y": -4, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_3_3.png", - "x_offset": -11, - "y_offset": -18, + "x": -11, + "y": -18, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_3_4.png", - "x_offset": -21, - "y_offset": -18, + "x": -21, + "y": -18, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_4_1.png", - "x_offset": -20, - "y_offset": -15, + "x": -20, + "y": -15, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_4_2.png", - "x_offset": -35, - "y_offset": -16, + "x": -35, + "y": -16, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_4_3.png", - "x_offset": -24, - "y_offset": -26, + "x": -24, + "y": -26, "palette": "keep" }, { "path": "track/intamin/zero_g_roll_right_4_4.png", - "x_offset": -22, - "y_offset": -31, + "x": -22, + "y": -31, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_1_1.png", - "x_offset": -21, - "y_offset": -47, + "x": -21, + "y": -47, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_1_2.png", - "x_offset": -23, - "y_offset": -36, + "x": -23, + "y": -36, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_1_3.png", - "x_offset": -15, - "y_offset": -52, + "x": -15, + "y": -52, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_1_4.png", - "x_offset": -13, - "y_offset": -40, + "x": -13, + "y": -40, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_1_5.png", - "x_offset": -17, - "y_offset": -31, + "x": -17, + "y": -31, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_2_1.png", - "x_offset": -21, - "y_offset": -42, + "x": -21, + "y": -42, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_2_2.png", - "x_offset": -25, - "y_offset": -30, + "x": -25, + "y": -30, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_2_3.png", - "x_offset": -32, - "y_offset": -24, + "x": -32, + "y": -24, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_2_4.png", - "x_offset": -29, - "y_offset": -19, + "x": -29, + "y": -19, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_3_1.png", - "x_offset": -10, - "y_offset": -33, + "x": -10, + "y": -33, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_3_2.png", - "x_offset": -18, - "y_offset": -31, + "x": -18, + "y": -31, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_3_3.png", - "x_offset": -27, - "y_offset": -40, + "x": -27, + "y": -40, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_3_4.png", - "x_offset": -24, - "y_offset": -33, + "x": -24, + "y": -33, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_3_5.png", - "x_offset": 1, - "y_offset": -12, + "x": 1, + "y": -12, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_3_6.png", - "x_offset": -22, - "y_offset": -25, + "x": -22, + "y": -25, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_4_1.png", - "x_offset": -15, - "y_offset": -48, + "x": -15, + "y": -48, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_4_2.png", - "x_offset": -14, - "y_offset": -48, + "x": -14, + "y": -48, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_4_3.png", - "x_offset": -10, - "y_offset": -33, + "x": -10, + "y": -33, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_4_4.png", - "x_offset": -9, - "y_offset": -42, + "x": -9, + "y": -42, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_left_4_5.png", - "x_offset": -21, - "y_offset": -31, + "x": -21, + "y": -31, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_1_1.png", - "x_offset": -21, - "y_offset": -48, + "x": -21, + "y": -48, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_1_2.png", - "x_offset": -31, - "y_offset": -48, + "x": -31, + "y": -48, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_1_3.png", - "x_offset": -31, - "y_offset": -33, + "x": -31, + "y": -33, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_1_4.png", - "x_offset": -30, - "y_offset": -42, + "x": -30, + "y": -42, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_1_5.png", - "x_offset": -32, - "y_offset": -31, + "x": -32, + "y": -31, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_2_1.png", - "x_offset": -21, - "y_offset": -33, + "x": -21, + "y": -33, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_2_2.png", - "x_offset": -21, - "y_offset": -31, + "x": -21, + "y": -31, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_2_3.png", - "x_offset": -24, - "y_offset": -40, + "x": -24, + "y": -40, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_2_4.png", - "x_offset": -15, - "y_offset": -33, + "x": -15, + "y": -33, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_2_5.png", - "x_offset": -8, - "y_offset": -11, + "x": -8, + "y": -11, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_2_6.png", - "x_offset": -8, - "y_offset": -25, + "x": -8, + "y": -25, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_3_1.png", - "x_offset": -17, - "y_offset": -42, + "x": -17, + "y": -42, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_3_2.png", - "x_offset": -11, - "y_offset": -30, + "x": -11, + "y": -30, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_3_3.png", - "x_offset": -5, - "y_offset": -24, + "x": -5, + "y": -24, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_3_4.png", - "x_offset": -21, - "y_offset": -19, + "x": -21, + "y": -19, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_4_1.png", - "x_offset": -23, - "y_offset": -47, + "x": -23, + "y": -47, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_4_2.png", - "x_offset": -6, - "y_offset": -26, + "x": -6, + "y": -26, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_4_3.png", - "x_offset": -32, - "y_offset": -52, + "x": -32, + "y": -52, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_4_4.png", - "x_offset": -26, - "y_offset": -40, + "x": -26, + "y": -40, "palette": "keep" }, { "path": "track/intamin/large_zero_g_roll_right_4_5.png", - "x_offset": -22, - "y_offset": -31, + "x": -22, + "y": -31, "palette": "keep" }, { "path": "track/intamin/small_flat_to_steep_up_1.png", - "x_offset": -22, - "y_offset": -28, + "x": -22, + "y": -28, "palette": "keep" }, { "path": "track/intamin/small_flat_to_steep_up_2_1.png", - "x_offset": -22, - "y_offset": -10, + "x": -22, + "y": -10, "palette": "keep" }, { "path": "track/intamin/small_flat_to_steep_up_2_2.png", - "x_offset": -18, - "y_offset": -12, + "x": -18, + "y": -12, "palette": "keep" }, { "path": "track/intamin/small_flat_to_steep_up_3_1.png", - "x_offset": -6, - "y_offset": -4, + "x": -6, + "y": -4, "palette": "keep" }, { "path": "track/intamin/small_flat_to_steep_up_3_2.png", - "x_offset": -25, - "y_offset": -12, + "x": -25, + "y": -12, "palette": "keep" }, { "path": "track/intamin/small_flat_to_steep_up_4.png", - "x_offset": -25, - "y_offset": -29, + "x": -25, + "y": -29, "palette": "keep" }, { "path": "track/intamin/small_steep_to_flat_up_1.png", - "x_offset": -21, - "y_offset": -28, + "x": -21, + "y": -28, "palette": "keep" }, { "path": "track/intamin/small_steep_to_flat_up_2_1.png", - "x_offset": -12, - "y_offset": -15, + "x": -12, + "y": -15, "palette": "keep" }, { "path": "track/intamin/small_steep_to_flat_up_2_2.png", - "x_offset": -21, - "y_offset": -7, + "x": -21, + "y": -7, "palette": "keep" }, { "path": "track/intamin/small_steep_to_flat_up_3_1.png", - "x_offset": -22, - "y_offset": -15, + "x": -22, + "y": -15, "palette": "keep" }, { "path": "track/intamin/small_steep_to_flat_up_3_2.png", - "x_offset": -17, - "y_offset": -8, + "x": -17, + "y": -8, "palette": "keep" }, { "path": "track/intamin/small_steep_to_flat_up_4.png", - "x_offset": -22, - "y_offset": -28, + "x": -22, + "y": -28, "palette": "keep" }, { "path": "track/intamin/small_flat_to_steep_up_diag_1.png", - "x_offset": -32, - "y_offset": -22, + "x": -32, + "y": -22, "palette": "keep" }, { "path": "track/intamin/small_flat_to_steep_up_diag_2.png", - "x_offset": -8, - "y_offset": -10, + "x": -8, + "y": -10, "palette": "keep" }, { "path": "track/intamin/small_flat_to_steep_up_diag_3.png", - "x_offset": -32, - "y_offset": -22, + "x": -32, + "y": -22, "palette": "keep" }, { "path": "track/intamin/small_flat_to_steep_up_diag_4.png", - "x_offset": -8, - "y_offset": -34, + "x": -8, + "y": -34, "palette": "keep" }, { "path": "track/intamin/small_steep_to_flat_up_diag_1.png", - "x_offset": -32, - "y_offset": -21, + "x": -32, + "y": -21, "palette": "keep" }, { "path": "track/intamin/small_steep_to_flat_up_diag_2.png", - "x_offset": -8, - "y_offset": -15, + "x": -8, + "y": -15, "palette": "keep" }, { "path": "track/intamin/small_steep_to_flat_up_diag_3.png", - "x_offset": -32, - "y_offset": -21, + "x": -32, + "y": -21, "palette": "keep" }, { "path": "track/intamin/small_steep_to_flat_up_diag_4.png", - "x_offset": -8, - "y_offset": -34, + "x": -8, + "y": -34, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_1_1.png", - "x_offset": -22, - "y_offset": -16, + "x": -22, + "y": -16, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_1_2.png", - "x_offset": -31, - "y_offset": -24, + "x": -31, + "y": -24, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_1_3.png", - "x_offset": 13, - "y_offset": 8, + "x": 13, + "y": 8, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_1_4.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_2_1.png", - "x_offset": -22, - "y_offset": -5, + "x": -22, + "y": -5, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_2_2.png", - "x_offset": -32, - "y_offset": -11, + "x": -32, + "y": -11, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_2_3.png", - "x_offset": -24, - "y_offset": 14, + "x": -24, + "y": 14, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_2_4.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_3_1.png", - "x_offset": -5, - "y_offset": -3, + "x": -5, + "y": -3, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_3_2.png", - "x_offset": 8, - "y_offset": -3, + "x": 8, + "y": -3, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_3_3.png", - "x_offset": -31, - "y_offset": -1, + "x": -31, + "y": -1, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_3_4.png", - "x_offset": -8, - "y_offset": -15, + "x": -8, + "y": -15, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_4_1.png", - "x_offset": -25, - "y_offset": -17, + "x": -25, + "y": -17, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_4_2.png", - "x_offset": -26, - "y_offset": -9, + "x": -26, + "y": -9, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_4_3.png", - "x_offset": 0, - "y_offset": -15, + "x": 0, + "y": -15, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_diag_gentle_up_4_4.png", - "x_offset": 0, - "y_offset": -13, + "x": 0, + "y": -13, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_1_1.png", - "x_offset": -22, - "y_offset": -17, + "x": -22, + "y": -17, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_1_2.png", - "x_offset": -18, - "y_offset": -9, + "x": -18, + "y": -9, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_1_3.png", - "x_offset": -12, - "y_offset": -15, + "x": -12, + "y": -15, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_1_4.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_2_1.png", - "x_offset": -22, - "y_offset": -3, + "x": -22, + "y": -3, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_2_2.png", - "x_offset": -34, - "y_offset": -3, + "x": -34, + "y": -3, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_2_3.png", - "x_offset": -2, - "y_offset": -1, + "x": -2, + "y": -1, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_2_4.png", - "x_offset": -13, - "y_offset": -15, + "x": -13, + "y": -15, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_3_1.png", - "x_offset": -6, - "y_offset": -5, + "x": -6, + "y": -5, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_3_2.png", - "x_offset": -8, - "y_offset": -11, + "x": -8, + "y": -11, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_3_3.png", - "x_offset": 0, - "y_offset": 14, + "x": 0, + "y": 14, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_3_4.png", - "x_offset": 0, - "y_offset": -13, + "x": 0, + "y": -13, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_4_1.png", - "x_offset": -13, - "y_offset": -16, + "x": -13, + "y": -16, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_4_2.png", - "x_offset": -3, - "y_offset": -24, + "x": -3, + "y": -24, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_4_3.png", - "x_offset": -32, - "y_offset": 8, + "x": -32, + "y": 8, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_diag_gentle_up_4_4.png", - "x_offset": -8, - "y_offset": -9, + "x": -8, + "y": -9, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -12, + "x": 0, + "y": -12, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": -16, + "x": -32, + "y": -16, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_1_4.png", - "x_offset": -31, - "y_offset": -20, + "x": -31, + "y": -20, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_2_1.png", - "x_offset": -8, - "y_offset": 6, + "x": -8, + "y": 6, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_2_3.png", - "x_offset": -7, - "y_offset": -10, + "x": -7, + "y": -10, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_2_4.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_3_3.png", - "x_offset": -17, - "y_offset": -1, + "x": -17, + "y": -1, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_3_4.png", - "x_offset": -22, - "y_offset": -3, + "x": -22, + "y": -3, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_4_1.png", - "x_offset": -9, - "y_offset": -8, + "x": -9, + "y": -8, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_4_3.png", - "x_offset": -21, - "y_offset": -4, + "x": -21, + "y": -4, "palette": "keep" }, { "path": "track/intamin/large_turn_left_to_orthogonal_gentle_up_4_4.png", - "x_offset": -22, - "y_offset": -20, + "x": -22, + "y": -20, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -6, + "x": 0, + "y": -6, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": -1, + "x": -32, + "y": -1, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_1_4.png", - "x_offset": -32, - "y_offset": -3, + "x": -32, + "y": -3, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_2_1.png", - "x_offset": 0, - "y_offset": 6, + "x": 0, + "y": 6, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_2_3.png", - "x_offset": -16, - "y_offset": -10, + "x": -16, + "y": -10, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_2_4.png", - "x_offset": -22, - "y_offset": -5, + "x": -22, + "y": -5, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -12, + "x": -32, + "y": -12, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_3_3.png", - "x_offset": -11, - "y_offset": -16, + "x": -11, + "y": -16, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_3_4.png", - "x_offset": -22, - "y_offset": -20, + "x": -22, + "y": -20, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_4_1.png", - "x_offset": -8, - "y_offset": -8, + "x": -8, + "y": -8, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_4_3.png", - "x_offset": -6, - "y_offset": -4, + "x": -6, + "y": -4, "palette": "keep" }, { "path": "track/intamin/large_turn_right_to_orthogonal_gentle_up_4_4.png", - "x_offset": -24, - "y_offset": -20, + "x": -24, + "y": -20, "palette": "keep" }, { "path": "track/intamin/gentle_up_to_gentle_up_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/gentle_up_to_gentle_up_left_bank_diag_1_2.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/gentle_up_to_gentle_up_left_bank_diag_2.png", - "x_offset": -10, - "y_offset": -10, + "x": -10, + "y": -10, "palette": "keep" }, { "path": "track/intamin/gentle_up_to_gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -17, + "x": -32, + "y": -17, "palette": "keep" }, { "path": "track/intamin/gentle_up_to_gentle_up_left_bank_diag_4.png", - "x_offset": -8, - "y_offset": -30, + "x": -8, + "y": -30, "palette": "keep" }, { "path": "track/intamin/gentle_up_to_gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -17, + "x": -32, + "y": -17, "palette": "keep" }, { "path": "track/intamin/gentle_up_to_gentle_up_right_bank_diag_2.png", - "x_offset": -8, - "y_offset": -10, + "x": -8, + "y": -10, "palette": "keep" }, { "path": "track/intamin/gentle_up_to_gentle_up_right_bank_diag_3_1.png", - "x_offset": -31, - "y_offset": -13, + "x": -31, + "y": -13, "palette": "keep" }, { "path": "track/intamin/gentle_up_to_gentle_up_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/gentle_up_to_gentle_up_right_bank_diag_4.png", - "x_offset": -10, - "y_offset": -30, + "x": -10, + "y": -30, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_gentle_up_diag_1_1.png", - "x_offset": -21, - "y_offset": -13, + "x": -21, + "y": -13, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_gentle_up_diag_1_2.png", - "x_offset": -32, - "y_offset": -2, + "x": -32, + "y": -2, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_gentle_up_diag_2.png", - "x_offset": -10, - "y_offset": -15, + "x": -10, + "y": -15, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_gentle_up_diag_3.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_gentle_up_diag_4.png", - "x_offset": -8, - "y_offset": -25, + "x": -8, + "y": -25, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_gentle_up_diag_1.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_gentle_up_diag_2.png", - "x_offset": -8, - "y_offset": -15, + "x": -8, + "y": -15, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_gentle_up_diag_3_1.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_gentle_up_diag_3_2.png", - "x_offset": -32, - "y_offset": -2, + "x": -32, + "y": -2, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_gentle_up_diag_4.png", - "x_offset": -10, - "y_offset": -25, + "x": -10, + "y": -25, "palette": "keep" }, { "path": "track/intamin/left_bank_to_gentle_up_left_bank_diag_1.png", - "x_offset": -32, - "y_offset": -5, + "x": -32, + "y": -5, "palette": "keep" }, { "path": "track/intamin/left_bank_to_gentle_up_left_bank_diag_2.png", - "x_offset": -11, - "y_offset": -14, + "x": -11, + "y": -14, "palette": "keep" }, { "path": "track/intamin/left_bank_to_gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -9, + "x": -32, + "y": -9, "palette": "keep" }, { "path": "track/intamin/left_bank_to_gentle_up_left_bank_diag_4.png", - "x_offset": -6, - "y_offset": -22, + "x": -6, + "y": -22, "palette": "keep" }, { "path": "track/intamin/right_bank_to_gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -9, + "x": -32, + "y": -9, "palette": "keep" }, { "path": "track/intamin/right_bank_to_gentle_up_right_bank_diag_2.png", - "x_offset": -6, - "y_offset": -13, + "x": -6, + "y": -13, "palette": "keep" }, { "path": "track/intamin/right_bank_to_gentle_up_right_bank_diag_3.png", - "x_offset": -32, - "y_offset": -5, + "x": -32, + "y": -5, "palette": "keep" }, { "path": "track/intamin/right_bank_to_gentle_up_right_bank_diag_4.png", - "x_offset": -11, - "y_offset": -22, + "x": -11, + "y": -22, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_left_bank_diag_1.png", - "x_offset": -32, - "y_offset": -3, + "x": -32, + "y": -3, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_left_bank_diag_2.png", - "x_offset": -11, - "y_offset": -15, + "x": -11, + "y": -15, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -9, + "x": -32, + "y": -9, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_left_bank_diag_4.png", - "x_offset": -6, - "y_offset": -21, + "x": -6, + "y": -21, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -9, + "x": -32, + "y": -9, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_right_bank_diag_2.png", - "x_offset": -6, - "y_offset": -15, + "x": -6, + "y": -15, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_right_bank_diag_3.png", - "x_offset": -32, - "y_offset": -3, + "x": -32, + "y": -3, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_right_bank_diag_4.png", - "x_offset": -11, - "y_offset": -22, + "x": -11, + "y": -22, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_diag_1.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_diag_2.png", - "x_offset": -10, - "y_offset": -15, + "x": -10, + "y": -15, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -17, + "x": -32, + "y": -17, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_diag_4.png", - "x_offset": -6, - "y_offset": -30, + "x": -6, + "y": -30, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -17, + "x": -32, + "y": -17, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_diag_2.png", - "x_offset": -6, - "y_offset": -15, + "x": -6, + "y": -15, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_diag_3.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_diag_4.png", - "x_offset": -10, - "y_offset": -30, + "x": -10, + "y": -30, "palette": "keep" }, { "path": "track/intamin/flat_to_gentle_up_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": -5, + "x": -32, + "y": -5, "palette": "keep" }, { "path": "track/intamin/flat_to_gentle_up_left_bank_diag_1_2.png", - "x_offset": -32, - "y_offset": -5, + "x": -32, + "y": -5, "palette": "keep" }, { "path": "track/intamin/flat_to_gentle_up_left_bank_diag_2.png", - "x_offset": -10, - "y_offset": -10, + "x": -10, + "y": -10, "palette": "keep" }, { "path": "track/intamin/flat_to_gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -9, + "x": -32, + "y": -9, "palette": "keep" }, { "path": "track/intamin/flat_to_gentle_up_left_bank_diag_4.png", - "x_offset": -8, - "y_offset": -22, + "x": -8, + "y": -22, "palette": "keep" }, { "path": "track/intamin/flat_to_gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -9, + "x": -32, + "y": -9, "palette": "keep" }, { "path": "track/intamin/flat_to_gentle_up_right_bank_diag_2.png", - "x_offset": -8, - "y_offset": -10, + "x": -8, + "y": -10, "palette": "keep" }, { "path": "track/intamin/flat_to_gentle_up_right_bank_diag_3_1.png", - "x_offset": -31, - "y_offset": -5, + "x": -31, + "y": -5, "palette": "keep" }, { "path": "track/intamin/flat_to_gentle_up_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": -5, + "x": -32, + "y": -5, "palette": "keep" }, { "path": "track/intamin/flat_to_gentle_up_right_bank_diag_4.png", - "x_offset": -10, - "y_offset": -22, + "x": -10, + "y": -22, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_flat_diag_1_1.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_flat_diag_1_2.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_flat_diag_2.png", - "x_offset": -10, - "y_offset": -15, + "x": -10, + "y": -15, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_flat_diag_3.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/intamin/gentle_up_left_bank_to_flat_diag_4.png", - "x_offset": -8, - "y_offset": -18, + "x": -8, + "y": -18, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_flat_diag_1.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_flat_diag_2.png", - "x_offset": -8, - "y_offset": -15, + "x": -8, + "y": -15, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_flat_diag_3_1.png", - "x_offset": -32, - "y_offset": -5, + "x": -32, + "y": -5, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_flat_diag_3_2.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/intamin/gentle_up_right_bank_to_flat_diag_4.png", - "x_offset": -9, - "y_offset": -18, + "x": -9, + "y": -18, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_1_1.png", - "x_offset": -18, - "y_offset": -14, + "x": -18, + "y": -14, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_1_2.png", - "x_offset": -27, - "y_offset": -24, + "x": -27, + "y": -24, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_1_3.png", - "x_offset": 17, - "y_offset": 8, + "x": 17, + "y": 8, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_1_4.png", - "x_offset": -10, - "y_offset": -14, + "x": -10, + "y": -14, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_2_1.png", - "x_offset": -22, - "y_offset": -6, + "x": -22, + "y": -6, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_2_2.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_2_3.png", - "x_offset": -24, - "y_offset": 13, + "x": -24, + "y": 13, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_2_4.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_3_1.png", - "x_offset": -7, - "y_offset": -8, + "x": -7, + "y": -8, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_3_2.png", - "x_offset": 1, - "y_offset": -7, + "x": 1, + "y": -7, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_3_3.png", - "x_offset": -32, - "y_offset": -4, + "x": -32, + "y": -4, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_3_4.png", - "x_offset": -10, - "y_offset": -20, + "x": -10, + "y": -20, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_4_1.png", - "x_offset": -23, - "y_offset": -19, + "x": -23, + "y": -19, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_4_2.png", - "x_offset": -24, - "y_offset": -12, + "x": -24, + "y": -12, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_4_3.png", - "x_offset": 0, - "y_offset": -20, + "x": 0, + "y": -20, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_diag_gentle_up_4_4.png", - "x_offset": 0, - "y_offset": -17, + "x": 0, + "y": -17, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_1_1.png", - "x_offset": -23, - "y_offset": -19, + "x": -23, + "y": -19, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_1_2.png", - "x_offset": -20, - "y_offset": -12, + "x": -20, + "y": -12, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_1_3.png", - "x_offset": -14, - "y_offset": -20, + "x": -14, + "y": -20, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_1_4.png", - "x_offset": -32, - "y_offset": -17, + "x": -32, + "y": -17, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_2_1.png", - "x_offset": -19, - "y_offset": -8, + "x": -19, + "y": -8, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_2_2.png", - "x_offset": -31, - "y_offset": -8, + "x": -31, + "y": -8, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_2_3.png", - "x_offset": 10, - "y_offset": -4, + "x": 10, + "y": -4, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_2_4.png", - "x_offset": -8, - "y_offset": -20, + "x": -8, + "y": -20, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_3_1.png", - "x_offset": -7, - "y_offset": -6, + "x": -7, + "y": -6, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_3_2.png", - "x_offset": -8, - "y_offset": -13, + "x": -8, + "y": -13, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_3_3.png", - "x_offset": 0, - "y_offset": 13, + "x": 0, + "y": 13, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_3_4.png", - "x_offset": 0, - "y_offset": -13, + "x": 0, + "y": -13, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_4_1.png", - "x_offset": -18, - "y_offset": -14, + "x": -18, + "y": -14, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_4_2.png", - "x_offset": -6, - "y_offset": -24, + "x": -6, + "y": -24, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_4_3.png", - "x_offset": -32, - "y_offset": 8, + "x": -32, + "y": 8, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_diag_gentle_up_4_4.png", - "x_offset": -10, - "y_offset": -14, + "x": -10, + "y": -14, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -10, + "x": 0, + "y": -10, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": -14, + "x": -32, + "y": -14, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_1_4.png", - "x_offset": -29, - "y_offset": -18, + "x": -29, + "y": -18, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_2_1.png", - "x_offset": -8, - "y_offset": 1, + "x": -8, + "y": 1, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_2_3.png", - "x_offset": -10, - "y_offset": -10, + "x": -10, + "y": -10, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_2_4.png", - "x_offset": -17, - "y_offset": -6, + "x": -17, + "y": -6, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -11, + "x": -32, + "y": -11, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_3_3.png", - "x_offset": -22, - "y_offset": -6, + "x": -22, + "y": -6, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_3_4.png", - "x_offset": -26, - "y_offset": -8, + "x": -26, + "y": -8, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_4_1.png", - "x_offset": -8, - "y_offset": -8, + "x": -8, + "y": -8, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_4_3.png", - "x_offset": -21, - "y_offset": -4, + "x": -21, + "y": -4, "palette": "keep" }, { "path": "track/intamin/large_turn_left_bank_to_orthogonal_gentle_up_4_4.png", - "x_offset": -22, - "y_offset": -23, + "x": -22, + "y": -23, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -11, + "x": 0, + "y": -11, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_1_4.png", - "x_offset": -26, - "y_offset": -8, + "x": -26, + "y": -8, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_2_1.png", - "x_offset": 0, - "y_offset": 1, + "x": 0, + "y": 1, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_2_3.png", - "x_offset": -16, - "y_offset": -10, + "x": -16, + "y": -10, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_2_4.png", - "x_offset": -21, - "y_offset": -6, + "x": -21, + "y": -6, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -10, + "x": -32, + "y": -10, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_3_3.png", - "x_offset": -13, - "y_offset": -14, + "x": -13, + "y": -14, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_3_4.png", - "x_offset": -26, - "y_offset": -18, + "x": -26, + "y": -18, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_4_1.png", - "x_offset": -10, - "y_offset": -8, + "x": -10, + "y": -8, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_4_3.png", - "x_offset": -7, - "y_offset": -5, + "x": -7, + "y": -5, "palette": "keep" }, { "path": "track/intamin/large_turn_right_bank_to_orthogonal_gentle_up_4_4.png", - "x_offset": -24, - "y_offset": -22, + "x": -24, + "y": -22, "palette": "keep" }, { "path": "track/mini/booster_1.png", - "x_offset": -22, - "y_offset": -4 + "x": -22, + "y": -4 }, { "path": "track/mini/booster_2.png", - "x_offset": -22, - "y_offset": -4 + "x": -22, + "y": -4 }, { "path": "track/bm/brake_horizontal.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/bm/brake_vertical.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/bm/blockbrake_horizontal_closed.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/bm/blockbrake_horizontal_open.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/bm/blockbrake_vertical_closed.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/bm/blockbrake_vertical_open.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/bm/booster_1.png", - "x_offset": -25, - "y_offset": -5 + "x": -25, + "y": -5 }, { "path": "track/bm/booster_2.png", - "x_offset": -25, - "y_offset": -5 + "x": -25, + "y": -5 }, { "path": "track/railway/quarter_turn_3_tiles_sw_se_part_3.png", - "x_offset": -8, - "y_offset": 1 + "x": -8, + "y": 1 }, { "path": "track/railway/gravel_sw_ne.png", - "x_offset": -33, - "y_offset": -2 + "x": -33, + "y": -2 }, { "path": "track/railway/gravel_nw_se.png", - "x_offset": -21, - "y_offset": -2 + "x": -21, + "y": -2 }, { "path": "track/railway/grooved_sw_ne.png", - "x_offset": -28, - "y_offset": -1 + "x": -28, + "y": -1 }, { "path": "track/railway/grooved_nw_se.png", - "x_offset": -14, - "y_offset": -2 + "x": -14, + "y": -2 }, { "path": "track/railway/grooved_sw_ne_trans.png", - "x_offset": -28, - "y_offset": -1, + "x": -28, + "y": -1, "palette": "keep" }, { "path": "track/railway/grooved_nw_se_trans.png", - "x_offset": -14, - "y_offset": -2, + "x": -14, + "y": -2, "palette": "keep" }, { "path": "track/railway/grooved_end_ne_trans.png", - "x_offset": -28, - "y_offset": -1, + "x": -28, + "y": -1, "palette": "keep" }, { "path": "track/railway/grooved_end_se_trans.png", - "x_offset": -14, - "y_offset": -2, + "x": -14, + "y": -2, "palette": "keep" }, { "path": "track/railway/grooved_end_nw_trans.png", - "x_offset": -14, - "y_offset": -2, + "x": -14, + "y": -2, "palette": "keep" }, { "path": "track/railway/grooved_end_sw_trans.png", - "x_offset": -26, - "y_offset": -2, + "x": -26, + "y": -2, "palette": "keep" }, { "path": "track/railway/grooved_end_sw_ne_trans.png", - "x_offset": -28, - "y_offset": -1, + "x": -28, + "y": -1, "palette": "keep" }, { "path": "track/railway/grooved_end_nw_se_trans.png", - "x_offset": -14, - "y_offset": -2, + "x": -14, + "y": -2, "palette": "keep" }, { "path": "track/wooden/booster_1.png", - "x_offset": -34, - "y_offset": -15 + "x": -34, + "y": -15 }, { "path": "track/wooden/booster_2.png", - "x_offset": -30, - "y_offset": -15 + "x": -30, + "y": -15 }, { "path": "track/wooden/brake_horizontal.png", - "x_offset": -32, - "y_offset": -10, + "x": -32, + "y": -10, "palette": "keep" }, { "path": "track/wooden/brake_vertical.png", - "x_offset": -25, - "y_offset": -14, + "x": -25, + "y": -14, "palette": "keep" }, { "path": "track/wooden/blockbrake_horizontal_closed.png", - "x_offset": -32, - "y_offset": -10, + "x": -32, + "y": -10, "palette": "keep" }, { "path": "track/wooden/blockbrake_horizontal_open.png", - "x_offset": -32, - "y_offset": -10, + "x": -32, + "y": -10, "palette": "keep" }, { "path": "track/wooden/blockbrake_vertical_closed.png", - "x_offset": -25, - "y_offset": -14, + "x": -25, + "y": -14, "palette": "keep" }, { "path": "track/wooden/blockbrake_vertical_open.png", - "x_offset": -25, - "y_offset": -14, + "x": -25, + "y": -14, "palette": "keep" }, { "path": "track/wooden/station_block_brake_open_sw_ne.png", - "x_offset": -34, - "y_offset": -8 + "x": -34, + "y": -8 }, { "path": "track/wooden/station_block_brake_open_nw_se.png", - "x_offset": -30, - "y_offset": -8 + "x": -30, + "y": -8 }, { "path": "track/wooden/station_block_brake_closed_sw_ne.png", - "x_offset": -34, - "y_offset": -8 + "x": -34, + "y": -8 }, { "path": "track/wooden/station_block_brake_closed_nw_se.png", - "x_offset": -30, - "y_offset": -8 + "x": -30, + "y": -8 }, { "path": "track/wooden/classic_wooden_preview_track.png", - "x_offset": 1, - "y_offset": 1 + "x": 1, + "y": 1 }, { "path": "track/wooden/classic_wooden_preview_supports.png", - "x_offset": 2, - "y_offset": 1 + "x": 2, + "y": 1 }, { "path": "track/wooden/25_60_swne_chained.png", - "x_offset": -32, - "y_offset": -49, + "x": -32, + "y": -49, "palette": "keep" }, { "path": "track/wooden/25_60_senw_chained.png", - "x_offset": -32, - "y_offset": -49, + "x": -32, + "y": -49, "palette": "keep" }, { "path": "track/wooden/25_60_swne_chained_back.png", - "x_offset": -32, - "y_offset": -24, + "x": -32, + "y": -24, "palette": "keep" }, { "path": "track/wooden/25_60_senw_chained_back.png", - "x_offset": -32, - "y_offset": -24, + "x": -32, + "y": -24, "palette": "keep" }, { "path": "track/wooden/60_swne_chained.png", - "x_offset": -32, - "y_offset": -80, + "x": -32, + "y": -80, "palette": "keep" }, { "path": "track/wooden/60_senw_chained.png", - "x_offset": -32, - "y_offset": -80, + "x": -32, + "y": -80, "palette": "keep" }, { "path": "track/wooden/60_swne_chained_back.png", - "x_offset": -32, - "y_offset": -60, + "x": -32, + "y": -60, "palette": "keep" }, { "path": "track/wooden/60_senw_chained_back.png", - "x_offset": -32, - "y_offset": -59, + "x": -32, + "y": -59, "palette": "keep" }, { "path": "track/wooden/60_25_swne_chained.png", - "x_offset": -32, - "y_offset": -47, + "x": -32, + "y": -47, "palette": "keep" }, { "path": "track/wooden/60_25_senw_chained.png", - "x_offset": -32, - "y_offset": -47, + "x": -32, + "y": -47, "palette": "keep" }, { "path": "track/wooden/60_25_swne_chained_back.png", - "x_offset": 0, - "y_offset": -30, + "x": 0, + "y": -30, "palette": "keep" }, { "path": "track/wooden/60_25_senw_chained_back.png", - "x_offset": -32, - "y_offset": -30, + "x": -32, + "y": -30, "palette": "keep" }, { "path": "track/bm_invert/booster_1.png", - "x_offset": -25, - "y_offset": -5 + "x": -25, + "y": -5 }, { "path": "track/bm_invert/booster_2.png", - "x_offset": -25, - "y_offset": -5 + "x": -25, + "y": -5 }, { "path": "track/bm_invert/brake_horizontal.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/bm_invert/brake_vertical.png", - "x_offset": -13, - "y_offset": -13, + "x": -13, + "y": -13, "palette": "keep" }, { "path": "track/looping/brake_horizontal_1.png", - "x_offset": -32, - "y_offset": 0, + "x": -32, + "y": 0, "palette": "keep" }, { "path": "track/looping/brake_horizontal_2.png", - "x_offset": -32, - "y_offset": 0, + "x": -32, + "y": 0, "palette": "keep" }, { "path": "track/looping/brake_vertical_1.png", - "x_offset": -15, - "y_offset": -8, + "x": -15, + "y": -8, "palette": "keep" }, { "path": "track/looping/brake_vertical_2.png", - "x_offset": -15, - "y_offset": -8, + "x": -15, + "y": -8, "palette": "keep" }, { "path": "track/minetrain/brake_horizontal.png", - "x_offset": -32, - "y_offset": 6, + "x": -32, + "y": 6, "palette": "keep" }, { "path": "track/minetrain/brake_vertical.png", - "x_offset": -17, - "y_offset": -3, + "x": -17, + "y": -3, "palette": "keep" }, { "path": "track/minetrain/blockbrake_horizontal_closed.png", - "x_offset": -32, - "y_offset": 6, + "x": -32, + "y": 6, "palette": "keep" }, { "path": "track/minetrain/blockbrake_horizontal_open.png", - "x_offset": -32, - "y_offset": 6, + "x": -32, + "y": 6, "palette": "keep" }, { "path": "track/minetrain/blockbrake_vertical_closed.png", - "x_offset": -17, - "y_offset": -3, + "x": -17, + "y": -3, "palette": "keep" }, { "path": "track/minetrain/blockbrake_vertical_open.png", - "x_offset": -17, - "y_offset": -3, + "x": -17, + "y": -3, "palette": "keep" }, { "path": "track/standup/brake_horizontal.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/standup/brake_vertical.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/standup/blockbrake_horizontal_closed.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/standup/blockbrake_horizontal_open.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/standup/blockbrake_vertical_closed.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/standup/blockbrake_vertical_open.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/steeplechase/brake_horizontal.png", - "x_offset": -32, - "y_offset": 9, + "x": -32, + "y": 9, "palette": "keep" }, { "path": "track/steeplechase/brake_vertical.png", - "x_offset": -4, - "y_offset": -6, + "x": -4, + "y": -6, "palette": "keep" }, { "path": "track/multidim/upright_brake_horizontal.png", - "x_offset": -32, - "y_offset": 3, + "x": -32, + "y": 3, "palette": "keep" }, { "path": "track/multidim/upright_brake_vertical.png", - "x_offset": -11, - "y_offset": -8, + "x": -11, + "y": -8, "palette": "keep" }, { "path": "track/multidim/upright_blockbrake_horizontal_closed.png", - "x_offset": -32, - "y_offset": 3, + "x": -32, + "y": 3, "palette": "keep" }, { "path": "track/multidim/upright_blockbrake_horizontal_open.png", - "x_offset": -32, - "y_offset": 3, + "x": -32, + "y": 3, "palette": "keep" }, { "path": "track/multidim/upright_blockbrake_vertical_closed.png", - "x_offset": -11, - "y_offset": -8, + "x": -11, + "y": -8, "palette": "keep" }, { "path": "track/multidim/upright_blockbrake_vertical_open.png", - "x_offset": -11, - "y_offset": -8, + "x": -11, + "y": -8, "palette": "keep" }, { "path": "track/multidim/inverted_brake_horizontal.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/multidim/inverted_brake_vertical.png", - "x_offset": -11, - "y_offset": -12, + "x": -11, + "y": -12, "palette": "keep" }, { "path": "track/multidim/inverted_blockbrake_horizontal.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/multidim/inverted_blockbrake_vertical_open.png", - "x_offset": -11, - "y_offset": -12, + "x": -11, + "y": -12, "palette": "keep" }, { "path": "track/multidim/inverted_blockbrake_vertical_closed.png", - "x_offset": -11, - "y_offset": -12, + "x": -11, + "y": -12, "palette": "keep" }, { "path": "track/slc/brake_horizontal.png", - "x_offset": -32, - "y_offset": 4, + "x": -32, + "y": 4, "palette": "keep" }, { "path": "track/slc/brake_vertical.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/slc/blockbrake_vertical_open.png", - "x_offset": -13, - "y_offset": -9, + "x": -13, + "y": -9, "palette": "keep" }, { "path": "track/corkscrew/brake_horizontal.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/corkscrew/brake_vertical.png", - "x_offset": -13, - "y_offset": -8, + "x": -13, + "y": -8, "palette": "keep" }, { "path": "track/corkscrew/blockbrake_horizontal_closed.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/corkscrew/blockbrake_horizontal_open.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/corkscrew/blockbrake_vertical_closed.png", - "x_offset": -13, - "y_offset": -8, + "x": -13, + "y": -8, "palette": "keep" }, { "path": "track/corkscrew/blockbrake_vertical_open.png", - "x_offset": -13, - "y_offset": -8, + "x": -13, + "y": -8, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_1_1.png", - "x_offset": -22, - "y_offset": 9, + "x": -22, + "y": 9, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_1_2.png", - "x_offset": -11, - "y_offset": 7, + "x": -11, + "y": 7, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_1_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_1_4.png", - "x_offset": -22, - "y_offset": -16, + "x": -22, + "y": -16, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_1_5.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_1_6.png", - "x_offset": -12, - "y_offset": -20, + "x": -12, + "y": -20, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_2_1.png", - "x_offset": -19, - "y_offset": 1, + "x": -19, + "y": 1, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_2_2.png", - "x_offset": -22, - "y_offset": 6, + "x": -22, + "y": 6, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_2_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_2_4.png", - "x_offset": -28, - "y_offset": -4, + "x": -28, + "y": -4, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_2_5.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_2_6.png", - "x_offset": -32, - "y_offset": -18, + "x": -32, + "y": -18, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_3_1.png", - "x_offset": -29, - "y_offset": -1, + "x": -29, + "y": -1, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_3_2.png", - "x_offset": -2, - "y_offset": 6, + "x": -2, + "y": 6, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_3_3.png", - "x_offset": -25, - "y_offset": -13, + "x": -25, + "y": -13, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_3_4.png", - "x_offset": -27, - "y_offset": -12, + "x": -27, + "y": -12, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_3_5.png", - "x_offset": 2, - "y_offset": -11, + "x": 2, + "y": -11, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_3_6.png", - "x_offset": -22, - "y_offset": -17, + "x": -22, + "y": -17, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_4_1.png", - "x_offset": -15, - "y_offset": -12, + "x": -15, + "y": -12, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_4_2.png", - "x_offset": 1, - "y_offset": 18, + "x": 1, + "y": 18, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_4_3.png", - "x_offset": -12, - "y_offset": -17, + "x": -12, + "y": -17, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_4_4.png", - "x_offset": -10, - "y_offset": -20, + "x": -10, + "y": -20, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_4_5.png", - "x_offset": 11, - "y_offset": -4, + "x": 11, + "y": -4, "palette": "keep" }, { "path": "track/lim/barrel_roll_left_4_6.png", - "x_offset": -22, - "y_offset": -20, + "x": -22, + "y": -20, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_1_1.png", - "x_offset": -23, - "y_offset": -12, + "x": -23, + "y": -12, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_1_2.png", - "x_offset": -11, - "y_offset": 16, + "x": -11, + "y": 16, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_1_3.png", - "x_offset": -28, - "y_offset": -17, + "x": -28, + "y": -17, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_1_4.png", - "x_offset": -23, - "y_offset": -19, + "x": -23, + "y": -19, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_1_5.png", - "x_offset": -21, - "y_offset": -4, + "x": -21, + "y": -4, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_1_6.png", - "x_offset": -23, - "y_offset": -20, + "x": -23, + "y": -20, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_2_1.png", - "x_offset": -22, - "y_offset": 0, + "x": -22, + "y": 0, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_2_2.png", - "x_offset": -22, - "y_offset": 7, + "x": -22, + "y": 7, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_2_3.png", - "x_offset": -10, - "y_offset": -13, + "x": -10, + "y": -13, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_2_4.png", - "x_offset": 3, - "y_offset": -12, + "x": 3, + "y": -12, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_2_5.png", - "x_offset": -7, - "y_offset": -11, + "x": -7, + "y": -11, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_2_6.png", - "x_offset": -6, - "y_offset": -18, + "x": -6, + "y": -18, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_3_1.png", - "x_offset": -1, - "y_offset": 0, + "x": -1, + "y": 0, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_3_2.png", - "x_offset": -4, - "y_offset": 6, + "x": -4, + "y": 6, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_3_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_3_4.png", - "x_offset": 0, - "y_offset": -4, + "x": 0, + "y": -4, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_3_5.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_3_6.png", - "x_offset": -22, - "y_offset": -18, + "x": -22, + "y": -18, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_4_1.png", - "x_offset": -9, - "y_offset": 9, + "x": -9, + "y": 9, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_4_2.png", - "x_offset": -20, - "y_offset": 7, + "x": -20, + "y": 7, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_4_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_4_4.png", - "x_offset": -28, - "y_offset": -16, + "x": -28, + "y": -16, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_4_5.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/lim/barrel_roll_right_4_6.png", - "x_offset": -23, - "y_offset": -20, + "x": -23, + "y": -20, "palette": "keep" }, { "path": "track/lim/half_loop_1_1.png", - "x_offset": -28, - "y_offset": -21, + "x": -28, + "y": -21, "palette": "keep" }, { "path": "track/lim/half_loop_1_2.png", - "x_offset": -22, - "y_offset": -40, + "x": -22, + "y": -40, "palette": "keep" }, { "path": "track/lim/half_loop_1_3.png", - "x_offset": -15, - "y_offset": -82, + "x": -15, + "y": -82, "palette": "keep" }, { "path": "track/lim/half_loop_1_4.png", - "x_offset": -22, - "y_offset": 24, + "x": -22, + "y": 24, "palette": "keep" }, { "path": "track/lim/half_loop_2_1.png", - "x_offset": -16, - "y_offset": -4, + "x": -16, + "y": -4, "palette": "keep" }, { "path": "track/lim/half_loop_2_2.png", - "x_offset": 1, - "y_offset": -32, + "x": 1, + "y": -32, "palette": "keep" }, { "path": "track/lim/half_loop_2_3.png", - "x_offset": -38, - "y_offset": -114, + "x": -38, + "y": -114, "palette": "keep" }, { "path": "track/lim/half_loop_2_4.png", - "x_offset": -22, - "y_offset": 12, + "x": -22, + "y": 12, "palette": "keep" }, { "path": "track/lim/half_loop_3_1.png", - "x_offset": -25, - "y_offset": -4, + "x": -25, + "y": -4, "palette": "keep" }, { "path": "track/lim/half_loop_3_2.png", - "x_offset": -27, - "y_offset": -28, + "x": -27, + "y": -28, "palette": "keep" }, { "path": "track/lim/half_loop_3_3.png", - "x_offset": -1, - "y_offset": -121, + "x": -1, + "y": -121, "palette": "keep" }, { "path": "track/lim/half_loop_3_4.png", - "x_offset": -24, - "y_offset": 4, + "x": -24, + "y": 4, "palette": "keep" }, { "path": "track/lim/half_loop_4_1.png", - "x_offset": -14, - "y_offset": -20, + "x": -14, + "y": -20, "palette": "keep" }, { "path": "track/lim/half_loop_4_2.png", - "x_offset": -16, - "y_offset": -43, + "x": -16, + "y": -43, "palette": "keep" }, { "path": "track/lim/half_loop_4_3.png", - "x_offset": 5, - "y_offset": -91, + "x": 5, + "y": -91, "palette": "keep" }, { "path": "track/lim/half_loop_4_4.png", - "x_offset": 6, - "y_offset": 16, + "x": 6, + "y": 16, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_1_1.png", - "x_offset": -22, - "y_offset": -4, + "x": -22, + "y": -4, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_1_2.png", - "x_offset": -22, - "y_offset": -19, + "x": -22, + "y": -19, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_1_3.png", - "x_offset": -21, - "y_offset": -27, + "x": -21, + "y": -27, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_1_4.png", - "x_offset": -23, - "y_offset": -46, + "x": -23, + "y": -46, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_2_1.png", - "x_offset": -22, - "y_offset": 1, + "x": -22, + "y": 1, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_2_2.png", - "x_offset": -25, - "y_offset": -5, + "x": -25, + "y": -5, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_2_3.png", - "x_offset": -25, - "y_offset": -7, + "x": -25, + "y": -7, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_2_4.png", - "x_offset": -20, - "y_offset": -32, + "x": -20, + "y": -32, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_3_1.png", - "x_offset": -23, - "y_offset": 0, + "x": -23, + "y": 0, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_3_2.png", - "x_offset": -24, - "y_offset": -4, + "x": -24, + "y": -4, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_3_3.png", - "x_offset": -23, - "y_offset": -13, + "x": -23, + "y": -13, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_3_4.png", - "x_offset": -23, - "y_offset": -32, + "x": -23, + "y": -32, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_4_1.png", - "x_offset": -21, - "y_offset": -4, + "x": -21, + "y": -4, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_4_2.png", - "x_offset": -23, - "y_offset": -19, + "x": -23, + "y": -19, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_4_3.png", - "x_offset": -23, - "y_offset": -27, + "x": -23, + "y": -27, "palette": "keep" }, { "path": "track/lim/flat_to_steep_up_4_4.png", - "x_offset": -22, - "y_offset": -46, + "x": -22, + "y": -46, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_1_1.png", - "x_offset": -24, - "y_offset": -43, + "x": -24, + "y": -43, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_1_2.png", - "x_offset": -24, - "y_offset": -28, + "x": -24, + "y": -28, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_1_3.png", - "x_offset": -24, - "y_offset": -19, + "x": -24, + "y": -19, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_1_4.png", - "x_offset": -23, - "y_offset": -8, + "x": -23, + "y": -8, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_2_1.png", - "x_offset": -24, - "y_offset": -26, + "x": -24, + "y": -26, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_2_2.png", - "x_offset": -19, - "y_offset": -14, + "x": -19, + "y": -14, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_2_3.png", - "x_offset": -12, - "y_offset": -7, + "x": -12, + "y": -7, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_2_4.png", - "x_offset": -15, - "y_offset": -2, + "x": -15, + "y": -2, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_3_1.png", - "x_offset": -14, - "y_offset": -25, + "x": -14, + "y": -25, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_3_2.png", - "x_offset": -13, - "y_offset": -13, + "x": -13, + "y": -13, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_3_3.png", - "x_offset": -18, - "y_offset": -7, + "x": -18, + "y": -7, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_3_4.png", - "x_offset": -22, - "y_offset": -5, + "x": -22, + "y": -5, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_4_1.png", - "x_offset": -21, - "y_offset": -41, + "x": -21, + "y": -41, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_4_2.png", - "x_offset": -20, - "y_offset": -28, + "x": -20, + "y": -28, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_4_3.png", - "x_offset": -19, - "y_offset": -18, + "x": -19, + "y": -18, "palette": "keep" }, { "path": "track/lim/steep_to_flat_up_4_4.png", - "x_offset": -22, - "y_offset": -7, + "x": -22, + "y": -7, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_1_1.png", - "x_offset": -22, - "y_offset": -7, + "x": -22, + "y": -7, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_1_2.png", - "x_offset": -21, - "y_offset": -43, + "x": -21, + "y": -43, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_1_3.png", - "x_offset": -29, - "y_offset": -32, + "x": -29, + "y": -32, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_1_4.png", - "x_offset": -22, - "y_offset": -44, + "x": -22, + "y": -44, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_1_5.png", - "x_offset": -22, - "y_offset": -28, + "x": -22, + "y": -28, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_2_1.png", - "x_offset": -22, - "y_offset": 1, + "x": -22, + "y": 1, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_2_2.png", - "x_offset": -32, - "y_offset": -10, + "x": -32, + "y": -10, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_2_3.png", - "x_offset": -23, - "y_offset": -46, + "x": -23, + "y": -46, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_2_4.png", - "x_offset": -19, - "y_offset": -52, + "x": -19, + "y": -52, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_2_5.png", - "x_offset": -15, - "y_offset": -28, + "x": -15, + "y": -28, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_3_1.png", - "x_offset": -16, - "y_offset": 0, + "x": -16, + "y": 0, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_3_2.png", - "x_offset": -13, - "y_offset": -11, + "x": -13, + "y": -11, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_3_3.png", - "x_offset": 17, - "y_offset": -21, + "x": 17, + "y": -21, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_3_4.png", - "x_offset": -8, - "y_offset": -32, + "x": -8, + "y": -32, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_3_5.png", - "x_offset": -16, - "y_offset": -24, + "x": -16, + "y": -24, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_4_1.png", - "x_offset": -24, - "y_offset": -7, + "x": -24, + "y": -7, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_4_2.png", - "x_offset": -24, - "y_offset": -23, + "x": -24, + "y": -23, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_4_3.png", - "x_offset": -14, - "y_offset": -9, + "x": -14, + "y": -9, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_4_4.png", - "x_offset": -14, - "y_offset": -25, + "x": -14, + "y": -25, "palette": "keep" }, { "path": "track/lim/large_corkscrew_left_4_5.png", - "x_offset": -22, - "y_offset": -20, + "x": -22, + "y": -20, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_1_1.png", - "x_offset": -22, - "y_offset": -7, + "x": -22, + "y": -7, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_1_2.png", - "x_offset": -23, - "y_offset": -24, + "x": -23, + "y": -24, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_1_3.png", - "x_offset": -21, - "y_offset": -9, + "x": -21, + "y": -9, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_1_4.png", - "x_offset": -30, - "y_offset": -25, + "x": -30, + "y": -25, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_1_5.png", - "x_offset": -32, - "y_offset": -21, + "x": -32, + "y": -21, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_2_1.png", - "x_offset": -22, - "y_offset": 1, + "x": -22, + "y": 1, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_2_2.png", - "x_offset": -16, - "y_offset": -11, + "x": -16, + "y": -11, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_2_3.png", - "x_offset": -24, - "y_offset": -21, + "x": -24, + "y": -21, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_2_4.png", - "x_offset": -16, - "y_offset": -31, + "x": -16, + "y": -31, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_2_5.png", - "x_offset": -22, - "y_offset": -23, + "x": -22, + "y": -23, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_3_1.png", - "x_offset": -18, - "y_offset": 0, + "x": -18, + "y": 0, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_3_2.png", - "x_offset": -16, - "y_offset": -11, + "x": -16, + "y": -11, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_3_3.png", - "x_offset": -26, - "y_offset": -47, + "x": -26, + "y": -47, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_3_4.png", - "x_offset": -29, - "y_offset": -53, + "x": -29, + "y": -53, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_3_5.png", - "x_offset": -23, - "y_offset": -28, + "x": -23, + "y": -28, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_4_1.png", - "x_offset": -22, - "y_offset": -7, + "x": -22, + "y": -7, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_4_2.png", - "x_offset": -10, - "y_offset": -43, + "x": -10, + "y": -43, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_4_3.png", - "x_offset": 17, - "y_offset": -32, + "x": 17, + "y": -32, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_4_4.png", - "x_offset": -11, - "y_offset": -44, + "x": -11, + "y": -44, "palette": "keep" }, { "path": "track/lim/large_corkscrew_right_4_5.png", - "x_offset": -18, - "y_offset": -28, + "x": -18, + "y": -28, "palette": "keep" }, { "path": "track/lim/small_turn_left_bank_to_gentle_up_1_1.png", - "x_offset": -26, - "y_offset": -15, + "x": -26, + "y": -15, "palette": "keep" }, { "path": "track/lim/small_turn_left_bank_to_gentle_up_1_2.png", - "x_offset": -18, - "y_offset": -10, + "x": -18, + "y": -10, "palette": "keep" }, { "path": "track/lim/small_turn_left_bank_to_gentle_up_2_1.png", - "x_offset": 37, - "y_offset": 0, + "x": 37, + "y": 0, "palette": "keep" }, { "path": "track/lim/small_turn_left_bank_to_gentle_up_2_2.png", - "x_offset": -16, - "y_offset": -4, + "x": -16, + "y": -4, "palette": "keep" }, { "path": "track/lim/small_turn_left_bank_to_gentle_up_2_3.png", - "x_offset": -38, - "y_offset": -11, + "x": -38, + "y": -11, "palette": "keep" }, { "path": "track/lim/small_turn_left_bank_to_gentle_up_3_1.png", - "x_offset": -19, - "y_offset": -8, + "x": -19, + "y": -8, "palette": "keep" }, { "path": "track/lim/small_turn_left_bank_to_gentle_up_3_2.png", - "x_offset": -6, - "y_offset": 1, + "x": -6, + "y": 1, "palette": "keep" }, { "path": "track/lim/small_turn_left_bank_to_gentle_up_4_1.png", - "x_offset": -26, - "y_offset": -9, + "x": -26, + "y": -9, "palette": "keep" }, { "path": "track/lim/small_turn_left_bank_to_gentle_up_4_2.png", - "x_offset": -29, - "y_offset": 4, + "x": -29, + "y": 4, "palette": "keep" }, { "path": "track/lim/small_turn_right_bank_to_gentle_up_1_1.png", - "x_offset": -28, - "y_offset": -10, + "x": -28, + "y": -10, "palette": "keep" }, { "path": "track/lim/small_turn_right_bank_to_gentle_up_1_2.png", - "x_offset": -26, - "y_offset": 4, + "x": -26, + "y": 4, "palette": "keep" }, { "path": "track/lim/small_turn_right_bank_to_gentle_up_2_1.png", - "x_offset": -14, - "y_offset": -8, + "x": -14, + "y": -8, "palette": "keep" }, { "path": "track/lim/small_turn_right_bank_to_gentle_up_2_2.png", - "x_offset": -29, - "y_offset": 1, + "x": -29, + "y": 1, "palette": "keep" }, { "path": "track/lim/small_turn_right_bank_to_gentle_up_3_1.png", - "x_offset": -38, - "y_offset": 0, + "x": -38, + "y": 0, "palette": "keep" }, { "path": "track/lim/small_turn_right_bank_to_gentle_up_3_2.png", - "x_offset": -38, - "y_offset": -4, + "x": -38, + "y": -4, "palette": "keep" }, { "path": "track/lim/small_turn_right_bank_to_gentle_up_3_3.png", - "x_offset": -17, - "y_offset": -10, + "x": -17, + "y": -10, "palette": "keep" }, { "path": "track/lim/small_turn_right_bank_to_gentle_up_4_1.png", - "x_offset": -7, - "y_offset": -15, + "x": -7, + "y": -15, "palette": "keep" }, { "path": "track/lim/small_turn_right_bank_to_gentle_up_4_2.png", - "x_offset": -19, - "y_offset": -11, + "x": -19, + "y": -11, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_1_1.png", - "x_offset": -23, - "y_offset": -29, + "x": -23, + "y": -29, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_1_2.png", - "x_offset": -23, - "y_offset": -46, + "x": -23, + "y": -46, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_1_3.png", - "x_offset": -30, - "y_offset": -80, + "x": -30, + "y": -80, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_1_4.png", - "x_offset": 0, - "y_offset": -114, + "x": 0, + "y": -114, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_1_5.png", - "x_offset": -22, - "y_offset": -25, + "x": -22, + "y": -25, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_2_1.png", - "x_offset": -22, - "y_offset": -7, + "x": -22, + "y": -7, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_2_2.png", - "x_offset": 0, - "y_offset": -28, + "x": 0, + "y": -28, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_2_3.png", - "x_offset": 0, - "y_offset": -82, + "x": 0, + "y": -82, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_2_4.png", - "x_offset": -31, - "y_offset": -143, + "x": -31, + "y": -143, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_2_5.png", - "x_offset": -23, - "y_offset": -36, + "x": -23, + "y": -36, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_3_1.png", - "x_offset": -17, - "y_offset": -1, + "x": -17, + "y": -1, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_3_2.png", - "x_offset": 0, - "y_offset": -8, + "x": 0, + "y": -8, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_3_3.png", - "x_offset": -2, - "y_offset": -52, + "x": -2, + "y": -52, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_3_4.png", - "x_offset": -32, - "y_offset": -148, + "x": -32, + "y": -148, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_3_5.png", - "x_offset": -16, - "y_offset": -36, + "x": -16, + "y": -36, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_4_1.png", - "x_offset": -22, - "y_offset": -14, + "x": -22, + "y": -14, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_4_2.png", - "x_offset": -24, - "y_offset": -21, + "x": -24, + "y": -21, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_4_3.png", - "x_offset": -30, - "y_offset": -26, + "x": -30, + "y": -26, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_4_4.png", - "x_offset": -9, - "y_offset": -118, + "x": -9, + "y": -118, "palette": "keep" }, { "path": "track/lim/medium_half_loop_left_4_5.png", - "x_offset": -23, - "y_offset": -28, + "x": -23, + "y": -28, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_1_1.png", - "x_offset": -22, - "y_offset": -15, + "x": -22, + "y": -15, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_1_2.png", - "x_offset": -20, - "y_offset": -22, + "x": -20, + "y": -22, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_1_3.png", - "x_offset": -18, - "y_offset": -27, + "x": -18, + "y": -27, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_1_4.png", - "x_offset": -15, - "y_offset": -118, + "x": -15, + "y": -118, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_1_5.png", - "x_offset": -23, - "y_offset": -28, + "x": -23, + "y": -28, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_2_1.png", - "x_offset": -22, - "y_offset": -1, + "x": -22, + "y": -1, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_2_2.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_2_3.png", - "x_offset": -32, - "y_offset": -52, + "x": -32, + "y": -52, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_2_4.png", - "x_offset": -25, - "y_offset": -148, + "x": -25, + "y": -148, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_2_5.png", - "x_offset": -22, - "y_offset": -36, + "x": -22, + "y": -36, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_3_1.png", - "x_offset": -32, - "y_offset": -7, + "x": -32, + "y": -7, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_3_2.png", - "x_offset": -32, - "y_offset": -28, + "x": -32, + "y": -28, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_3_3.png", - "x_offset": -32, - "y_offset": -82, + "x": -32, + "y": -82, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_3_4.png", - "x_offset": -9, - "y_offset": -143, + "x": -9, + "y": -143, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_3_5.png", - "x_offset": -12, - "y_offset": -35, + "x": -12, + "y": -35, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_4_1.png", - "x_offset": -22, - "y_offset": -29, + "x": -22, + "y": -29, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_4_2.png", - "x_offset": -16, - "y_offset": -46, + "x": -16, + "y": -46, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_4_3.png", - "x_offset": -2, - "y_offset": -80, + "x": -2, + "y": -80, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_4_4.png", - "x_offset": -32, - "y_offset": -115, + "x": -32, + "y": -115, "palette": "keep" }, { "path": "track/lim/medium_half_loop_right_4_5.png", - "x_offset": -32, - "y_offset": -25, + "x": -32, + "y": -25, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_1_1.png", - "x_offset": -23, - "y_offset": -25, + "x": -23, + "y": -25, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_1_2.png", - "x_offset": -20, - "y_offset": -38, + "x": -20, + "y": -38, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_1_3.png", - "x_offset": -20, - "y_offset": -65, + "x": -20, + "y": -65, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_1_4.png", - "x_offset": -24, - "y_offset": -80, + "x": -24, + "y": -80, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_1_5.png", - "x_offset": -15, - "y_offset": -64, + "x": -15, + "y": -64, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_1_6.png", - "x_offset": -9, - "y_offset": -171, + "x": -9, + "y": -171, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_1_7.png", - "x_offset": -21, - "y_offset": -8, + "x": -21, + "y": -8, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_2_1.png", - "x_offset": -22, - "y_offset": -1, + "x": -22, + "y": -1, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_2_2.png", - "x_offset": -6, - "y_offset": -4, + "x": -6, + "y": -4, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_2_3.png", - "x_offset": -9, - "y_offset": -22, + "x": -9, + "y": -22, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_2_4.png", - "x_offset": -8, - "y_offset": -90, + "x": -8, + "y": -90, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_2_5.png", - "x_offset": -32, - "y_offset": -126, + "x": -32, + "y": -126, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_2_6.png", - "x_offset": -26, - "y_offset": -192, + "x": -26, + "y": -192, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_2_7.png", - "x_offset": -23, - "y_offset": -20, + "x": -23, + "y": -20, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_3_1.png", - "x_offset": -24, - "y_offset": 0, + "x": -24, + "y": 0, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_3_2.png", - "x_offset": -29, - "y_offset": -4, + "x": -29, + "y": -4, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_3_3.png", - "x_offset": -24, - "y_offset": -33, + "x": -24, + "y": -33, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_3_4.png", - "x_offset": -5, - "y_offset": -56, + "x": -5, + "y": -56, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_3_5.png", - "x_offset": -6, - "y_offset": -112, + "x": -6, + "y": -112, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_3_6.png", - "x_offset": -21, - "y_offset": -192, + "x": -21, + "y": -192, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_3_7.png", - "x_offset": -26, - "y_offset": -20, + "x": -26, + "y": -20, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_4_1.png", - "x_offset": -23, - "y_offset": -13, + "x": -23, + "y": -13, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_4_2.png", - "x_offset": -29, - "y_offset": -17, + "x": -29, + "y": -17, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_4_3.png", - "x_offset": -32, - "y_offset": -48, + "x": -32, + "y": -48, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_4_4.png", - "x_offset": -32, - "y_offset": -79, + "x": -32, + "y": -79, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_4_5.png", - "x_offset": 17, - "y_offset": -57, + "x": 17, + "y": -57, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_4_6.png", - "x_offset": -14, - "y_offset": -176, + "x": -14, + "y": -176, "palette": "keep" }, { "path": "track/lim/large_half_loop_left_4_7.png", - "x_offset": -19, - "y_offset": -10, + "x": -19, + "y": -10, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_1_1.png", - "x_offset": -22, - "y_offset": -14, + "x": -22, + "y": -14, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_1_2.png", - "x_offset": -19, - "y_offset": -17, + "x": -19, + "y": -17, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_1_3.png", - "x_offset": -14, - "y_offset": -49, + "x": -14, + "y": -49, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_1_4.png", - "x_offset": 0, - "y_offset": -79, + "x": 0, + "y": -79, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_1_5.png", - "x_offset": -32, - "y_offset": -57, + "x": -32, + "y": -57, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_1_6.png", - "x_offset": -19, - "y_offset": -175, + "x": -19, + "y": -175, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_1_7.png", - "x_offset": -23, - "y_offset": -10, + "x": -23, + "y": -10, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_2_1.png", - "x_offset": -22, - "y_offset": 0, + "x": -22, + "y": 0, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_2_2.png", - "x_offset": -10, - "y_offset": -4, + "x": -10, + "y": -4, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_2_3.png", - "x_offset": -6, - "y_offset": -33, + "x": -6, + "y": -33, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_2_4.png", - "x_offset": -16, - "y_offset": -56, + "x": -16, + "y": -56, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_2_5.png", - "x_offset": -24, - "y_offset": -112, + "x": -24, + "y": -112, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_2_6.png", - "x_offset": -17, - "y_offset": -192, + "x": -17, + "y": -192, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_2_7.png", - "x_offset": -22, - "y_offset": -20, + "x": -22, + "y": -20, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_3_1.png", - "x_offset": -26, - "y_offset": -1, + "x": -26, + "y": -1, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_3_2.png", - "x_offset": -26, - "y_offset": -4, + "x": -26, + "y": -4, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_3_3.png", - "x_offset": -28, - "y_offset": -22, + "x": -28, + "y": -22, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_3_4.png", - "x_offset": -32, - "y_offset": -89, + "x": -32, + "y": -89, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_3_5.png", - "x_offset": 17, - "y_offset": -125, + "x": 17, + "y": -125, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_3_6.png", - "x_offset": 0, - "y_offset": -192, + "x": 0, + "y": -192, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_3_7.png", - "x_offset": -17, - "y_offset": -19, + "x": -17, + "y": -19, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_4_1.png", - "x_offset": -23, - "y_offset": -25, + "x": -23, + "y": -25, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_4_2.png", - "x_offset": -24, - "y_offset": -38, + "x": -24, + "y": -38, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_4_3.png", - "x_offset": -21, - "y_offset": -65, + "x": -21, + "y": -65, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_4_4.png", - "x_offset": -4, - "y_offset": -80, + "x": -4, + "y": -80, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_4_5.png", - "x_offset": -6, - "y_offset": -64, + "x": -6, + "y": -64, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_4_6.png", - "x_offset": -28, - "y_offset": -172, + "x": -28, + "y": -172, "palette": "keep" }, { "path": "track/lim/large_half_loop_right_4_7.png", - "x_offset": -27, - "y_offset": -8, + "x": -27, + "y": -8, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_1_1.png", - "x_offset": -22, - "y_offset": -6, + "x": -22, + "y": -6, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_1_2.png", - "x_offset": -12, - "y_offset": -11, + "x": -12, + "y": -11, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_1_3.png", - "x_offset": -11, - "y_offset": -21, + "x": -11, + "y": -21, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_1_4.png", - "x_offset": -20, - "y_offset": -19, + "x": -20, + "y": -19, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_2_1.png", - "x_offset": -16, - "y_offset": 1, + "x": -16, + "y": 1, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_2_2.png", - "x_offset": -22, - "y_offset": -1, + "x": -22, + "y": -1, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_2_3.png", - "x_offset": -23, - "y_offset": -15, + "x": -23, + "y": -15, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_2_4.png", - "x_offset": -21, - "y_offset": -15, + "x": -21, + "y": -15, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_3_1.png", - "x_offset": -20, - "y_offset": -8, + "x": -20, + "y": -8, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_3_2.png", - "x_offset": -21, - "y_offset": -21, + "x": -21, + "y": -21, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_3_3.png", - "x_offset": -1, - "y_offset": -13, + "x": -1, + "y": -13, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_3_4.png", - "x_offset": -23, - "y_offset": -17, + "x": -23, + "y": -17, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_4_1.png", - "x_offset": -16, - "y_offset": -24, + "x": -16, + "y": -24, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_4_2.png", - "x_offset": -11, - "y_offset": -33, + "x": -11, + "y": -33, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_4_3.png", - "x_offset": 16, - "y_offset": 0, + "x": 16, + "y": 0, "palette": "keep" }, { "path": "track/lim/zero_g_roll_left_4_4.png", - "x_offset": -21, - "y_offset": -20, + "x": -21, + "y": -20, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_1_1.png", - "x_offset": -22, - "y_offset": -24, + "x": -22, + "y": -24, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_1_2.png", - "x_offset": -28, - "y_offset": -33, + "x": -28, + "y": -33, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_1_3.png", - "x_offset": -21, - "y_offset": 1, + "x": -21, + "y": 1, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_1_4.png", - "x_offset": -24, - "y_offset": -20, + "x": -24, + "y": -20, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_2_1.png", - "x_offset": -22, - "y_offset": -8, + "x": -22, + "y": -8, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_2_2.png", - "x_offset": -16, - "y_offset": -21, + "x": -16, + "y": -21, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_2_3.png", - "x_offset": -13, - "y_offset": -13, + "x": -13, + "y": -13, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_2_4.png", - "x_offset": -11, - "y_offset": -17, + "x": -11, + "y": -17, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_3_1.png", - "x_offset": 3, - "y_offset": 1, + "x": 3, + "y": 1, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_3_2.png", - "x_offset": -9, - "y_offset": -1, + "x": -9, + "y": -1, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_3_3.png", - "x_offset": -11, - "y_offset": -15, + "x": -11, + "y": -15, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_3_4.png", - "x_offset": -21, - "y_offset": -15, + "x": -21, + "y": -15, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_4_1.png", - "x_offset": -16, - "y_offset": -6, + "x": -16, + "y": -6, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_4_2.png", - "x_offset": -27, - "y_offset": -11, + "x": -27, + "y": -11, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_4_3.png", - "x_offset": -24, - "y_offset": -21, + "x": -24, + "y": -21, "palette": "keep" }, { "path": "track/lim/zero_g_roll_right_4_4.png", - "x_offset": -23, - "y_offset": -20, + "x": -23, + "y": -20, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_1_1.png", - "x_offset": -24, - "y_offset": -43, + "x": -24, + "y": -43, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_1_2.png", - "x_offset": -24, - "y_offset": 2, + "x": -24, + "y": 2, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_1_3.png", - "x_offset": -18, - "y_offset": -47, + "x": -18, + "y": -47, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_1_4.png", - "x_offset": -14, - "y_offset": -36, + "x": -14, + "y": -36, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_1_5.png", - "x_offset": -18, - "y_offset": -19, + "x": -18, + "y": -19, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_2_1.png", - "x_offset": -24, - "y_offset": -39, + "x": -24, + "y": -39, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_2_2.png", - "x_offset": -27, - "y_offset": -28, + "x": -27, + "y": -28, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_2_3.png", - "x_offset": -32, - "y_offset": -21, + "x": -32, + "y": -21, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_2_4.png", - "x_offset": -29, - "y_offset": -14, + "x": -29, + "y": -14, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_3_1.png", - "x_offset": -8, - "y_offset": -29, + "x": -8, + "y": -29, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_3_2.png", - "x_offset": -11, - "y_offset": -28, + "x": -11, + "y": -28, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_3_3.png", - "x_offset": -28, - "y_offset": -36, + "x": -28, + "y": -36, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_3_4.png", - "x_offset": -24, - "y_offset": -22, + "x": -24, + "y": -22, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_3_5.png", - "x_offset": 3, - "y_offset": -6, + "x": 3, + "y": -6, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_3_6.png", - "x_offset": -23, - "y_offset": -13, + "x": -23, + "y": -13, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_4_1.png", - "x_offset": -15, - "y_offset": -46, + "x": -15, + "y": -46, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_4_2.png", - "x_offset": -14, - "y_offset": -43, + "x": -14, + "y": -43, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_4_3.png", - "x_offset": -6, - "y_offset": -25, + "x": -6, + "y": -25, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_4_4.png", - "x_offset": -9, - "y_offset": -32, + "x": -9, + "y": -32, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_left_4_5.png", - "x_offset": -22, - "y_offset": -20, + "x": -22, + "y": -20, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_1_1.png", - "x_offset": -24, - "y_offset": -48, + "x": -24, + "y": -48, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_1_2.png", - "x_offset": -32, - "y_offset": -43, + "x": -32, + "y": -43, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_1_3.png", - "x_offset": -30, - "y_offset": -24, + "x": -30, + "y": -24, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_1_4.png", - "x_offset": -31, - "y_offset": -32, + "x": -31, + "y": -32, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_1_5.png", - "x_offset": -26, - "y_offset": -20, + "x": -26, + "y": -20, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_2_1.png", - "x_offset": 5, - "y_offset": -30, + "x": 5, + "y": -30, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_2_2.png", - "x_offset": -24, - "y_offset": -29, + "x": -24, + "y": -29, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_2_3.png", - "x_offset": -25, - "y_offset": -37, + "x": -25, + "y": -37, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_2_4.png", - "x_offset": -17, - "y_offset": -22, + "x": -17, + "y": -22, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_2_5.png", - "x_offset": -8, - "y_offset": -7, + "x": -8, + "y": -7, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_2_6.png", - "x_offset": -8, - "y_offset": -13, + "x": -8, + "y": -13, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_3_1.png", - "x_offset": -16, - "y_offset": -39, + "x": -16, + "y": -39, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_3_2.png", - "x_offset": -12, - "y_offset": -28, + "x": -12, + "y": -28, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_3_3.png", - "x_offset": -5, - "y_offset": -21, + "x": -5, + "y": -21, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_3_4.png", - "x_offset": -22, - "y_offset": -14, + "x": -22, + "y": -14, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_4_1.png", - "x_offset": -16, - "y_offset": -42, + "x": -16, + "y": -42, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_4_2.png", - "x_offset": 5, - "y_offset": 1, + "x": 5, + "y": 1, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_4_3.png", - "x_offset": -29, - "y_offset": -47, + "x": -29, + "y": -47, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_4_4.png", - "x_offset": -27, - "y_offset": -36, + "x": -27, + "y": -36, "palette": "keep" }, { "path": "track/lim/large_zero_g_roll_right_4_5.png", - "x_offset": -23, - "y_offset": -20, + "x": -23, + "y": -20, "palette": "keep" }, { "path": "track/lim/small_flat_to_steep_up_1.png", - "x_offset": -22, - "y_offset": -22, + "x": -22, + "y": -22, "palette": "keep" }, { "path": "track/lim/small_flat_to_steep_up_2_1.png", - "x_offset": -19, - "y_offset": 1, + "x": -19, + "y": 1, "palette": "keep" }, { "path": "track/lim/small_flat_to_steep_up_2_2.png", - "x_offset": -22, - "y_offset": -8, + "x": -22, + "y": -8, "palette": "keep" }, { "path": "track/lim/small_flat_to_steep_up_3_1.png", - "x_offset": -3, - "y_offset": 0, + "x": -3, + "y": 0, "palette": "keep" }, { "path": "track/lim/small_flat_to_steep_up_3_2.png", - "x_offset": -23, - "y_offset": -8, + "x": -23, + "y": -8, "palette": "keep" }, { "path": "track/lim/small_flat_to_steep_up_4.png", - "x_offset": -22, - "y_offset": -22, + "x": -22, + "y": -22, "palette": "keep" }, { "path": "track/lim/small_steep_to_flat_up_1.png", - "x_offset": -24, - "y_offset": -24, + "x": -24, + "y": -24, "palette": "keep" }, { "path": "track/lim/small_steep_to_flat_up_2_1.png", - "x_offset": -10, - "y_offset": -11, + "x": -10, + "y": -11, "palette": "keep" }, { "path": "track/lim/small_steep_to_flat_up_2_2.png", - "x_offset": -24, - "y_offset": -6, + "x": -24, + "y": -6, "palette": "keep" }, { "path": "track/lim/small_steep_to_flat_up_3_1.png", - "x_offset": -22, - "y_offset": -11, + "x": -22, + "y": -11, "palette": "keep" }, { "path": "track/lim/small_steep_to_flat_up_3_2.png", - "x_offset": -11, - "y_offset": -6, + "x": -11, + "y": -6, "palette": "keep" }, { "path": "track/lim/small_steep_to_flat_up_4.png", - "x_offset": -22, - "y_offset": -23, + "x": -22, + "y": -23, "palette": "keep" }, { "path": "track/lim/small_flat_to_steep_up_diag_1.png", - "x_offset": -32, - "y_offset": -18, + "x": -32, + "y": -18, "palette": "keep" }, { "path": "track/lim/small_flat_to_steep_up_diag_2.png", - "x_offset": -10, - "y_offset": -5, + "x": -10, + "y": -5, "palette": "keep" }, { "path": "track/lim/small_flat_to_steep_up_diag_3.png", - "x_offset": -32, - "y_offset": -17, + "x": -32, + "y": -17, "palette": "keep" }, { "path": "track/lim/small_flat_to_steep_up_diag_4.png", - "x_offset": -10, - "y_offset": -29, + "x": -10, + "y": -29, "palette": "keep" }, { "path": "track/lim/small_steep_to_flat_up_diag_1.png", - "x_offset": -32, - "y_offset": -17, + "x": -32, + "y": -17, "palette": "keep" }, { "path": "track/lim/small_steep_to_flat_up_diag_2.png", - "x_offset": -10, - "y_offset": -9, + "x": -10, + "y": -9, "palette": "keep" }, { "path": "track/lim/small_steep_to_flat_up_diag_3.png", - "x_offset": -32, - "y_offset": -17, + "x": -32, + "y": -17, "palette": "keep" }, { "path": "track/lim/small_steep_to_flat_up_diag_4.png", - "x_offset": -10, - "y_offset": -29, + "x": -10, + "y": -29, "palette": "keep" }, { "path": "track/flume/25-60-down-nesw.png", - "x_offset": -26, - "y_offset": -39, + "x": -26, + "y": -39, "palette": "keep" }, { "path": "track/flume/25-60-down-nwse.png", - "x_offset": -28, - "y_offset": -39, + "x": -28, + "y": -39, "palette": "keep" }, { "path": "track/flume/25-60-down-nesw-back-water.png", - "y_offset": -23, + "y": -23, "palette": "keep" }, { "path": "track/flume/25-60-down-nesw-back.png", - "x_offset": -26, - "y_offset": -12, + "x": -26, + "y": -12, "palette": "keep" }, { "path": "track/flume/25-60-down-nwse-back-water.png", - "x_offset": -25, - "y_offset": -22, + "x": -25, + "y": -22, "palette": "keep" }, { "path": "track/flume/25-60-down-nwse-back.png", - "x_offset": -10, - "y_offset": -12, + "x": -10, + "y": -12, "palette": "keep" }, { "path": "track/flume/60-down-nesw.png", - "x_offset": -27, - "y_offset": -71, + "x": -27, + "y": -71, "palette": "keep" }, { "path": "track/flume/60-down-nwse.png", - "x_offset": -28, - "y_offset": -70, + "x": -28, + "y": -70, "palette": "keep" }, { "path": "track/flume/60-down-nesw-back.png", - "x_offset": -26, - "y_offset": -53, + "x": -26, + "y": -53, "palette": "keep" }, { "path": "track/flume/60-down-nwse-back.png", - "x_offset": -27, - "y_offset": -55, + "x": -27, + "y": -55, "palette": "keep" }, { "path": "track/flume/60-25-down-nesw.png", - "x_offset": -27, - "y_offset": -39, + "x": -27, + "y": -39, "palette": "keep" }, { "path": "track/flume/60-25-down-nwse.png", - "x_offset": -28, - "y_offset": -39, + "x": -28, + "y": -39, "palette": "keep" }, { "path": "track/flume/60-25-down-nesw-back-water.png", - "x_offset": -20, - "y_offset": -6, + "x": -20, + "y": -6, "palette": "keep" }, { "path": "track/flume/60-25-down-nesw-back.png", - "x_offset": -27, - "y_offset": -22, + "x": -27, + "y": -22, "palette": "keep" }, { "path": "track/flume/60-25-down-nwse-back-water.png", - "x_offset": 2, - "y_offset": -6, + "x": 2, + "y": -6, "palette": "keep" }, { "path": "track/flume/60-25-down-nwse-back.png", - "x_offset": -26, - "y_offset": -22, + "x": -26, + "y": -22, "palette": "keep" }, { "path": "support/flat_to_steep_1_1.png", - "x_offset": -32, - "y_offset": -5 + "x": -32, + "y": -5 }, { "path": "support/flat_to_steep_1_2.png", - "x_offset": -32, - "y_offset": -1 + "x": -32, + "y": -1 }, { "path": "support/flat_to_steep_1_3.png", - "x_offset": -32, - "y_offset": -1 + "x": -32, + "y": -1 }, { "path": "support/flat_to_steep_1_4.png", - "x_offset": -32, - "y_offset": -5 + "x": -32, + "y": -5 }, { "path": "support/flat_to_steep_2_1.png", - "x_offset": -32, - "y_offset": -18 + "x": -32, + "y": -18 }, { "path": "support/flat_to_steep_2_2.png", - "x_offset": -32, - "y_offset": -5 + "x": -32, + "y": -5 }, { "path": "support/flat_to_steep_2_3.png", - "x_offset": -32, - "y_offset": -5 + "x": -32, + "y": -5 }, { "path": "support/flat_to_steep_2_4.png", - "x_offset": -32, - "y_offset": -18 + "x": -32, + "y": -18 }, { "path": "support/flat_to_steep_3_1.png", - "x_offset": -32, - "y_offset": -27 + "x": -32, + "y": -27 }, { "path": "support/flat_to_steep_3_2.png", - "x_offset": -32, - "y_offset": -11 + "x": -32, + "y": -11 }, { "path": "support/flat_to_steep_3_3.png", - "x_offset": -32, - "y_offset": -11 + "x": -32, + "y": -11 }, { "path": "support/flat_to_steep_3_4.png", - "x_offset": -32, - "y_offset": -27 + "x": -32, + "y": -27 }, { "path": "support/flat_to_steep_4_1.png", - "x_offset": -32, - "y_offset": -57 + "x": -32, + "y": -57 }, { "path": "support/flat_to_steep_4_2.png", - "x_offset": -32, - "y_offset": -41 + "x": -32, + "y": -41 }, { "path": "support/flat_to_steep_4_3.png", - "x_offset": -32, - "y_offset": -41 + "x": -32, + "y": -41 }, { "path": "support/flat_to_steep_4_4.png", - "x_offset": -32, - "y_offset": -57 + "x": -32, + "y": -57 }, { "path": "support/steep_to_flat_1_1.png", - "x_offset": -32, - "y_offset": -54 + "x": -32, + "y": -54 }, { "path": "support/steep_to_flat_1_2.png", - "x_offset": -32, - "y_offset": -38 + "x": -32, + "y": -38 }, { "path": "support/steep_to_flat_1_3.png", - "x_offset": -32, - "y_offset": -38 + "x": -32, + "y": -38 }, { "path": "support/steep_to_flat_1_4.png", - "x_offset": -32, - "y_offset": -54 + "x": -32, + "y": -54 }, { "path": "support/steep_to_flat_2_1.png", - "x_offset": -32, - "y_offset": -31 + "x": -32, + "y": -31 }, { "path": "support/steep_to_flat_2_2.png", - "x_offset": -32, - "y_offset": -15 + "x": -32, + "y": -15 }, { "path": "support/steep_to_flat_2_3.png", - "x_offset": -32, - "y_offset": -15 + "x": -32, + "y": -15 }, { "path": "support/steep_to_flat_2_4.png", - "x_offset": -32, - "y_offset": -31 + "x": -32, + "y": -31 }, { "path": "support/steep_to_flat_3_1.png", - "x_offset": -32, - "y_offset": -28 + "x": -32, + "y": -28 }, { "path": "support/steep_to_flat_3_2.png", - "x_offset": -32, - "y_offset": -16 + "x": -32, + "y": -16 }, { "path": "support/steep_to_flat_3_3.png", - "x_offset": -32, - "y_offset": -16 + "x": -32, + "y": -16 }, { "path": "support/steep_to_flat_3_4.png", - "x_offset": -32, - "y_offset": -28 + "x": -32, + "y": -28 }, { "path": "support/steep_to_flat_4_1.png", - "x_offset": -32, - "y_offset": -17 + "x": -32, + "y": -17 }, { "path": "support/steep_to_flat_4_2.png", - "x_offset": -32, - "y_offset": -12 + "x": -32, + "y": -12 }, { "path": "support/steep_to_flat_4_3.png", - "x_offset": -32, - "y_offset": -12 + "x": -32, + "y": -12 }, { "path": "support/steep_to_flat_4_4.png", - "x_offset": -32, - "y_offset": -17 + "x": -32, + "y": -17 }, { "path": "track/rmc/preview_track.png", - "x_offset": 1, - "y_offset": 1, + "x": 1, + "y": 1, "palette": "keep" }, { "path": "track/rmc/preview_support.png", - "x_offset": 1, - "y_offset": 1, + "x": 1, + "y": 1, "palette": "keep" }, { "path": "track/rmc/flat_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/brake_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/brake_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/block_brake_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/block_brake_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/booster_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/booster_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_4.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_flat_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_flat_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_flat_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_flat_4.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_1.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_4.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_1.png", - "x_offset": -34, - "y_offset": -41, + "x": -34, + "y": -41, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_2_1.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_2_2.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_3_1.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_3_2.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_4.png", - "x_offset": -34, - "y_offset": -41, + "x": -34, + "y": -41, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_1.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_2_2.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_3_1.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_3_2.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_4.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/steep_1.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/steep_2.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/steep_3.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/steep_4.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/steep_to_vertical_up_1.png", - "x_offset": -34, - "y_offset": -70, + "x": -34, + "y": -70, "palette": "keep" }, { "path": "track/rmc/steep_to_vertical_up_2.png", - "x_offset": -34, - "y_offset": -59, + "x": -34, + "y": -59, "palette": "keep" }, { "path": "track/rmc/steep_to_vertical_up_3.png", - "x_offset": -32, - "y_offset": -59, + "x": -32, + "y": -59, "palette": "keep" }, { "path": "track/rmc/steep_to_vertical_up_4.png", - "x_offset": -32, - "y_offset": -70, + "x": -32, + "y": -70, "palette": "keep" }, { "path": "track/rmc/vertical_to_steep_up_1.png", - "x_offset": -15, - "y_offset": -65, + "x": -15, + "y": -65, "palette": "keep" }, { "path": "track/rmc/vertical_to_steep_up_2.png", - "x_offset": -14, - "y_offset": -49, + "x": -14, + "y": -49, "palette": "keep" }, { "path": "track/rmc/vertical_to_steep_up_3.png", - "x_offset": -34, - "y_offset": -49, + "x": -34, + "y": -49, "palette": "keep" }, { "path": "track/rmc/vertical_to_steep_up_4.png", - "x_offset": -34, - "y_offset": -65, + "x": -34, + "y": -65, "palette": "keep" }, { "path": "track/rmc/vertical_1.png", - "x_offset": -15, - "y_offset": -46, + "x": -15, + "y": -46, "palette": "keep" }, { "path": "track/rmc/vertical_2.png", - "x_offset": -15, - "y_offset": -35, + "x": -15, + "y": -35, "palette": "keep" }, { "path": "track/rmc/vertical_3.png", - "x_offset": -32, - "y_offset": -35, + "x": -32, + "y": -35, "palette": "keep" }, { "path": "track/rmc/vertical_4.png", - "x_offset": -32, - "y_offset": -46, + "x": -32, + "y": -46, "palette": "keep" }, { "path": "track/rmc/small_turn_left_1_1.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/small_turn_left_1_2.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/small_turn_left_1_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/small_turn_left_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/small_turn_left_2_2.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/small_turn_left_2_3.png", - "x_offset": -98, - "y_offset": -12, + "x": -98, + "y": -12, "palette": "keep" }, { "path": "track/rmc/small_turn_left_3_1.png", - "x_offset": -27, - "y_offset": -12, + "x": -27, + "y": -12, "palette": "keep" }, { "path": "track/rmc/small_turn_left_3_2.png", - "x_offset": 5, - "y_offset": -28, + "x": 5, + "y": -28, "palette": "keep" }, { "path": "track/rmc/small_turn_left_3_3.png", - "x_offset": -27, - "y_offset": -44, + "x": -27, + "y": -44, "palette": "keep" }, { "path": "track/rmc/small_turn_left_4_1.png", - "x_offset": -98, - "y_offset": -8, + "x": -98, + "y": -8, "palette": "keep" }, { "path": "track/rmc/small_turn_left_4_2.png", - "x_offset": -66, - "y_offset": 8, + "x": -66, + "y": 8, "palette": "keep" }, { "path": "track/rmc/small_turn_left_4_3.png", - "x_offset": -34, - "y_offset": -8, + "x": -34, + "y": -8, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_1_1.png", - "x_offset": -34, - "y_offset": -76, + "x": -34, + "y": -76, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_1_2.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_1_3.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_1_4.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_1_5.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_2_2.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_2_3.png", - "x_offset": -98, - "y_offset": -12, + "x": -98, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_2_4.png", - "x_offset": -130, - "y_offset": -28, + "x": -130, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_2_5.png", - "x_offset": -162, - "y_offset": -12, + "x": -162, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_3_1.png", - "x_offset": -40, - "y_offset": -12, + "x": -40, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_3_2.png", - "x_offset": -8, - "y_offset": -28, + "x": -8, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_3_3.png", - "x_offset": -40, - "y_offset": -44, + "x": -40, + "y": -44, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_3_4.png", - "x_offset": -8, - "y_offset": -60, + "x": -8, + "y": -60, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_3_5.png", - "x_offset": -40, - "y_offset": -76, + "x": -40, + "y": -76, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_4_1.png", - "x_offset": -162, - "y_offset": -15, + "x": -162, + "y": -15, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_4_2.png", - "x_offset": -130, - "y_offset": 1, + "x": -130, + "y": 1, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_4_3.png", - "x_offset": -98, - "y_offset": -15, + "x": -98, + "y": -15, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_4_4.png", - "x_offset": -66, - "y_offset": 1, + "x": -66, + "y": 1, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_4_5.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_1_1.png", - "x_offset": -34, - "y_offset": -46, + "x": -34, + "y": -46, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_1_2.png", - "x_offset": -66, - "y_offset": -30, + "x": -66, + "y": -30, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_1_3.png", - "x_offset": -34, - "y_offset": -14, + "x": -34, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_1_4.png", - "x_offset": -66, - "y_offset": 2, + "x": -66, + "y": 2, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_2_2.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_2_3.png", - "x_offset": -98, - "y_offset": -12, + "x": -98, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_2_4.png", - "x_offset": -130, - "y_offset": -28, + "x": -130, + "y": -28, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_3_1.png", - "x_offset": -56, - "y_offset": -12, + "x": -56, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_3_2.png", - "x_offset": -24, - "y_offset": -28, + "x": -24, + "y": -28, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_3_3.png", - "x_offset": -56, - "y_offset": -44, + "x": -56, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_3_4.png", - "x_offset": -24, - "y_offset": -60, + "x": -24, + "y": -60, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_4_1.png", - "x_offset": -98, - "y_offset": -24, + "x": -98, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_4_2.png", - "x_offset": -66, - "y_offset": -8, + "x": -66, + "y": -8, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_4_3.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_4_4.png", - "x_offset": -2, - "y_offset": -8, + "x": -2, + "y": -8, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_1_1.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_1_2.png", - "x_offset": -66, - "y_offset": -8, + "x": -66, + "y": -8, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_1_3.png", - "x_offset": -98, - "y_offset": -24, + "x": -98, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_1_4.png", - "x_offset": -130, - "y_offset": -8, + "x": -130, + "y": -8, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_2_2.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_2_3.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_2_4.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_3_1.png", - "x_offset": -98, - "y_offset": -12, + "x": -98, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_3_2.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_3_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_3_4.png", - "x_offset": -2, - "y_offset": -28, + "x": -2, + "y": -28, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_4_1.png", - "x_offset": -56, - "y_offset": -46, + "x": -56, + "y": -46, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_4_2.png", - "x_offset": -24, - "y_offset": -30, + "x": -24, + "y": -30, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_4_3.png", - "x_offset": -56, - "y_offset": -14, + "x": -56, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_4_4.png", - "x_offset": -24, - "y_offset": 2, + "x": -24, + "y": 2, "palette": "keep" }, { "path": "track/rmc/flat_diag_1.png", - "x_offset": -34, - "y_offset": -8, + "x": -34, + "y": -8, "palette": "keep" }, { "path": "track/rmc/flat_diag_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/brake_diag_1.png", - "x_offset": -34, - "y_offset": -8, + "x": -34, + "y": -8, "palette": "keep" }, { "path": "track/rmc/brake_diag_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/block_brake_diag_1.png", - "x_offset": -34, - "y_offset": -8, + "x": -34, + "y": -8, "palette": "keep" }, { "path": "track/rmc/block_brake_diag_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_diag_1.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_diag_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_diag_3.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_diag_4.png", - "x_offset": -24, - "y_offset": -22, + "x": -24, + "y": -22, "palette": "keep" }, { "path": "track/rmc/gentle_to_flat_up_diag_1.png", - "x_offset": -53, - "y_offset": -16, + "x": -53, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_to_flat_up_diag_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/gentle_to_flat_up_diag_3.png", - "x_offset": -34, - "y_offset": -16, + "x": -34, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_to_flat_up_diag_4.png", - "x_offset": -24, - "y_offset": -22, + "x": -24, + "y": -22, "palette": "keep" }, { "path": "track/rmc/gentle_diag_1.png", - "x_offset": -54, - "y_offset": -23, + "x": -54, + "y": -23, "palette": "keep" }, { "path": "track/rmc/gentle_diag_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/gentle_diag_3.png", - "x_offset": -34, - "y_offset": -23, + "x": -34, + "y": -23, "palette": "keep" }, { "path": "track/rmc/gentle_diag_4.png", - "x_offset": -24, - "y_offset": -30, + "x": -24, + "y": -30, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_diag_1.png", - "x_offset": -56, - "y_offset": -37, + "x": -56, + "y": -37, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_diag_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_diag_3.png", - "x_offset": -35, - "y_offset": -37, + "x": -35, + "y": -37, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_diag_4.png", - "x_offset": -24, - "y_offset": -46, + "x": -24, + "y": -46, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_diag_1.png", - "x_offset": -49, - "y_offset": -39, + "x": -49, + "y": -39, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_diag_2.png", - "x_offset": -24, - "y_offset": -19, + "x": -24, + "y": -19, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_diag_3.png", - "x_offset": -34, - "y_offset": -39, + "x": -34, + "y": -39, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_diag_4.png", - "x_offset": -24, - "y_offset": -46, + "x": -24, + "y": -46, "palette": "keep" }, { "path": "track/rmc/steep_diag_1.png", - "x_offset": -48, - "y_offset": -69, + "x": -48, + "y": -69, "palette": "keep" }, { "path": "track/rmc/steep_diag_2.png", - "x_offset": -24, - "y_offset": -46, + "x": -24, + "y": -46, "palette": "keep" }, { "path": "track/rmc/steep_diag_3.png", - "x_offset": -35, - "y_offset": -69, + "x": -35, + "y": -69, "palette": "keep" }, { "path": "track/rmc/steep_diag_4.png", - "x_offset": -24, - "y_offset": -78, + "x": -24, + "y": -78, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_1_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_1_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_2_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_4.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_1.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_3_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_3_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_4_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_4_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_1_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_1_2.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_2_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_3.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_4.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_2.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_3_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_3_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_4_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_4_2.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_1_1.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_1_2.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_2_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_3.png", - "x_offset": -34, - "y_offset": -16, + "x": -34, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_4.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_1.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_2.png", - "x_offset": -34, - "y_offset": -16, + "x": -34, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_3_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_3_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_4_1.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_4_2.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/left_bank_1_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/left_bank_1_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/left_bank_2_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/left_bank_2_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/left_bank_3.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/left_bank_4.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_diag_1_1.png", - "x_offset": -34, - "y_offset": -8, + "x": -34, + "y": -8, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_diag_1_2.png", - "x_offset": -34, - "y_offset": -8, + "x": -34, + "y": -8, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_diag_2.png", - "x_offset": -26, - "y_offset": -14, + "x": -26, + "y": -14, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_diag_3.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/flat_to_left_bank_diag_4.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_diag_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_diag_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_diag_3_1.png", - "x_offset": -34, - "y_offset": -8, + "x": -34, + "y": -8, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_diag_3_2.png", - "x_offset": -34, - "y_offset": -8, + "x": -34, + "y": -8, "palette": "keep" }, { "path": "track/rmc/flat_to_right_bank_diag_4.png", - "x_offset": -26, - "y_offset": -25, + "x": -26, + "y": -25, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_diag_1_1.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_diag_1_2.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_diag_2.png", - "x_offset": -26, - "y_offset": -25, + "x": -26, + "y": -25, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_diag_3.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_diag_4.png", - "x_offset": -24, - "y_offset": -22, + "x": -24, + "y": -22, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_diag_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_diag_2.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_diag_3_1.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_diag_3_2.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_diag_4.png", - "x_offset": -26, - "y_offset": -22, + "x": -26, + "y": -22, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_diag_1_1.png", - "x_offset": -53, - "y_offset": -12, + "x": -53, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_diag_1_2.png", - "x_offset": -53, - "y_offset": -12, + "x": -53, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_diag_2.png", - "x_offset": -26, - "y_offset": -14, + "x": -26, + "y": -14, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_diag_3.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_left_bank_diag_4.png", - "x_offset": -24, - "y_offset": -33, + "x": -24, + "y": -33, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_diag_1.png", - "x_offset": -53, - "y_offset": -28, + "x": -53, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_diag_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_diag_3_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_diag_3_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_right_bank_diag_4.png", - "x_offset": -25, - "y_offset": -33, + "x": -25, + "y": -33, "palette": "keep" }, { "path": "track/rmc/left_bank_diag_1_1.png", - "x_offset": -34, - "y_offset": -4, + "x": -34, + "y": -4, "palette": "keep" }, { "path": "track/rmc/left_bank_diag_1_2.png", - "x_offset": -34, - "y_offset": -4, + "x": -34, + "y": -4, "palette": "keep" }, { "path": "track/rmc/left_bank_diag_2.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/left_bank_diag_3.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/left_bank_diag_4.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_1_1.png", - "x_offset": -34, - "y_offset": -56, + "x": -34, + "y": -56, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_1_2.png", - "x_offset": -34, - "y_offset": -56, + "x": -34, + "y": -56, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_1_3.png", - "x_offset": -66, - "y_offset": -40, + "x": -66, + "y": -40, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_1_4.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_2_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_2_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_2_3.png", - "x_offset": -66, - "y_offset": -25, + "x": -66, + "y": -25, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_2_4.png", - "x_offset": -98, - "y_offset": -9, + "x": -98, + "y": -9, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_2_5.png", - "x_offset": -98, - "y_offset": -9, + "x": -98, + "y": -9, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_3_1.png", - "x_offset": -27, - "y_offset": -24, + "x": -27, + "y": -24, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_3_2.png", - "x_offset": 5, - "y_offset": -40, + "x": 5, + "y": -40, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_3_3.png", - "x_offset": -27, - "y_offset": -56, + "x": -27, + "y": -56, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_3_4.png", - "x_offset": -27, - "y_offset": -56, + "x": -27, + "y": -56, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_4_1.png", - "x_offset": -98, - "y_offset": -20, + "x": -98, + "y": -20, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_4_2.png", - "x_offset": -66, - "y_offset": -4, + "x": -66, + "y": -4, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_4_3.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_1_1.png", - "x_offset": -34, - "y_offset": -88, + "x": -34, + "y": -88, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_1_2.png", - "x_offset": -34, - "y_offset": -88, + "x": -34, + "y": -88, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_1_3.png", - "x_offset": -66, - "y_offset": -72, + "x": -66, + "y": -72, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_1_4.png", - "x_offset": -34, - "y_offset": -56, + "x": -34, + "y": -56, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_1_5.png", - "x_offset": -66, - "y_offset": -40, + "x": -66, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_1_6.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_2_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_2_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_2_3.png", - "x_offset": -66, - "y_offset": -25, + "x": -66, + "y": -25, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_2_4.png", - "x_offset": -98, - "y_offset": -9, + "x": -98, + "y": -9, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_2_5.png", - "x_offset": -98, - "y_offset": -9, + "x": -98, + "y": -9, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_2_6.png", - "x_offset": -130, - "y_offset": -25, + "x": -130, + "y": -25, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_2_7.png", - "x_offset": -162, - "y_offset": -9, + "x": -162, + "y": -9, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_2_8.png", - "x_offset": -162, - "y_offset": -9, + "x": -162, + "y": -9, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_3_1.png", - "x_offset": -40, - "y_offset": -24, + "x": -40, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_3_2.png", - "x_offset": -8, - "y_offset": -40, + "x": -8, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_3_3.png", - "x_offset": -40, - "y_offset": -56, + "x": -40, + "y": -56, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_3_4.png", - "x_offset": -8, - "y_offset": -72, + "x": -8, + "y": -72, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_3_5.png", - "x_offset": -40, - "y_offset": -88, + "x": -40, + "y": -88, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_3_6.png", - "x_offset": -40, - "y_offset": -88, + "x": -40, + "y": -88, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_4_1.png", - "x_offset": -162, - "y_offset": -27, + "x": -162, + "y": -27, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_4_2.png", - "x_offset": -130, - "y_offset": -11, + "x": -130, + "y": -11, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_4_3.png", - "x_offset": -98, - "y_offset": -27, + "x": -98, + "y": -27, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_4_4.png", - "x_offset": -66, - "y_offset": -11, + "x": -66, + "y": -11, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_4_5.png", - "x_offset": -34, - "y_offset": -27, + "x": -34, + "y": -27, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_1_1.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_1_2.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_1_3.png", - "x_offset": -66, - "y_offset": -41, + "x": -66, + "y": -41, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_1_4.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_1_5.png", - "x_offset": -66, - "y_offset": -9, + "x": -66, + "y": -9, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_2_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_2_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_2_3.png", - "x_offset": -66, - "y_offset": -25, + "x": -66, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_2_4.png", - "x_offset": -66, - "y_offset": -25, + "x": -66, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_2_5.png", - "x_offset": -98, - "y_offset": -9, + "x": -98, + "y": -9, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_2_6.png", - "x_offset": -130, - "y_offset": -25, + "x": -130, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_2_7.png", - "x_offset": -130, - "y_offset": -25, + "x": -130, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_3_1.png", - "x_offset": -56, - "y_offset": -24, + "x": -56, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_3_2.png", - "x_offset": -24, - "y_offset": -40, + "x": -24, + "y": -40, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_3_3.png", - "x_offset": -56, - "y_offset": -56, + "x": -56, + "y": -56, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_3_4.png", - "x_offset": -24, - "y_offset": -72, + "x": -24, + "y": -72, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_4_1.png", - "x_offset": -98, - "y_offset": -36, + "x": -98, + "y": -36, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_4_2.png", - "x_offset": -66, - "y_offset": -20, + "x": -66, + "y": -20, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_4_3.png", - "x_offset": -34, - "y_offset": -36, + "x": -34, + "y": -36, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_bank_4_4.png", - "x_offset": -2, - "y_offset": -20, + "x": -2, + "y": -20, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_1_1.png", - "x_offset": -34, - "y_offset": -36, + "x": -34, + "y": -36, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_1_2.png", - "x_offset": -66, - "y_offset": -20, + "x": -66, + "y": -20, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_1_3.png", - "x_offset": -98, - "y_offset": -36, + "x": -98, + "y": -36, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_1_4.png", - "x_offset": -130, - "y_offset": -20, + "x": -130, + "y": -20, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_2_1.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_2_2.png", - "x_offset": -66, - "y_offset": -40, + "x": -66, + "y": -40, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_2_3.png", - "x_offset": -34, - "y_offset": -56, + "x": -34, + "y": -56, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_2_4.png", - "x_offset": -66, - "y_offset": -72, + "x": -66, + "y": -72, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_3_1.png", - "x_offset": -97, - "y_offset": -9, + "x": -97, + "y": -9, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_3_2.png", - "x_offset": -97, - "y_offset": -9, + "x": -97, + "y": -9, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_3_3.png", - "x_offset": -65, - "y_offset": -25, + "x": -65, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_3_4.png", - "x_offset": -65, - "y_offset": -25, + "x": -65, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_3_5.png", - "x_offset": -33, - "y_offset": -9, + "x": -33, + "y": -9, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_3_6.png", - "x_offset": -1, - "y_offset": -25, + "x": -1, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_3_7.png", - "x_offset": -1, - "y_offset": -25, + "x": -1, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_4_1.png", - "x_offset": -56, - "y_offset": -57, + "x": -56, + "y": -57, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_4_2.png", - "x_offset": -56, - "y_offset": -57, + "x": -56, + "y": -57, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_4_3.png", - "x_offset": -24, - "y_offset": -41, + "x": -24, + "y": -41, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_4_4.png", - "x_offset": -56, - "y_offset": -25, + "x": -56, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_bank_4_5.png", - "x_offset": -24, - "y_offset": -9, + "x": -24, + "y": -9, "palette": "keep" }, { "path": "track/rmc/small_turn_left_gentle_up_1_1.png", - "x_offset": -40, - "y_offset": -79, + "x": -40, + "y": -79, "palette": "keep" }, { "path": "track/rmc/small_turn_left_gentle_up_1_2.png", - "x_offset": -28, - "y_offset": -31, + "x": -28, + "y": -31, "palette": "keep" }, { "path": "track/rmc/small_turn_left_gentle_up_2_1.png", - "x_offset": -28, - "y_offset": -47, + "x": -28, + "y": -47, "palette": "keep" }, { "path": "track/rmc/small_turn_left_gentle_up_2_2.png", - "x_offset": -104, - "y_offset": -31, + "x": -104, + "y": -31, "palette": "keep" }, { "path": "track/rmc/small_turn_left_gentle_up_3_1.png", - "x_offset": -33, - "y_offset": -15, + "x": -33, + "y": -15, "palette": "keep" }, { "path": "track/rmc/small_turn_left_gentle_up_3_2.png", - "x_offset": -21, - "y_offset": -31, + "x": -21, + "y": -31, "palette": "keep" }, { "path": "track/rmc/small_turn_left_gentle_up_4_1.png", - "x_offset": -92, - "y_offset": -32, + "x": -92, + "y": -32, "palette": "keep" }, { "path": "track/rmc/small_turn_left_gentle_up_4_2.png", - "x_offset": -40, - "y_offset": -16, + "x": -40, + "y": -16, "palette": "keep" }, { "path": "track/rmc/small_turn_right_gentle_up_1_1.png", - "x_offset": -40, - "y_offset": -32, + "x": -40, + "y": -32, "palette": "keep" }, { "path": "track/rmc/small_turn_right_gentle_up_1_2.png", - "x_offset": -92, - "y_offset": -16, + "x": -92, + "y": -16, "palette": "keep" }, { "path": "track/rmc/small_turn_right_gentle_up_2_1.png", - "x_offset": -28, - "y_offset": -15, + "x": -28, + "y": -15, "palette": "keep" }, { "path": "track/rmc/small_turn_right_gentle_up_2_2.png", - "x_offset": -40, - "y_offset": -31, + "x": -40, + "y": -31, "palette": "keep" }, { "path": "track/rmc/small_turn_right_gentle_up_3_1.png", - "x_offset": -104, - "y_offset": -47, + "x": -104, + "y": -47, "palette": "keep" }, { "path": "track/rmc/small_turn_right_gentle_up_3_2.png", - "x_offset": -28, - "y_offset": -31, + "x": -28, + "y": -31, "palette": "keep" }, { "path": "track/rmc/small_turn_right_gentle_up_4_1.png", - "x_offset": -21, - "y_offset": -79, + "x": -21, + "y": -79, "palette": "keep" }, { "path": "track/rmc/small_turn_right_gentle_up_4_2.png", - "x_offset": -33, - "y_offset": -31, + "x": -33, + "y": -31, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_1_1.png", - "x_offset": -34, - "y_offset": -140, + "x": -34, + "y": -140, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_1_2.png", - "x_offset": -66, - "y_offset": -108, + "x": -66, + "y": -108, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_1_3.png", - "x_offset": -34, - "y_offset": -140, + "x": -34, + "y": -140, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_1_4.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_1_5.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -76, + "x": -34, + "y": -76, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_2_2.png", - "x_offset": -66, - "y_offset": -76, + "x": -66, + "y": -76, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_2_3.png", - "x_offset": -98, - "y_offset": -52, + "x": -98, + "y": -52, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_2_4.png", - "x_offset": -130, - "y_offset": -60, + "x": -130, + "y": -60, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_2_5.png", - "x_offset": -162, - "y_offset": -28, + "x": -162, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_3_1.png", - "x_offset": -40, - "y_offset": -12, + "x": -40, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_3_2.png", - "x_offset": -40, - "y_offset": -12, + "x": -40, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_3_3.png", - "x_offset": -40, - "y_offset": -20, + "x": -40, + "y": -20, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_3_4.png", - "x_offset": -40, - "y_offset": -12, + "x": -40, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_3_5.png", - "x_offset": -40, - "y_offset": -28, + "x": -40, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_4_1.png", - "x_offset": -162, - "y_offset": -60, + "x": -162, + "y": -60, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_4_2.png", - "x_offset": -130, - "y_offset": -28, + "x": -130, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_4_3.png", - "x_offset": -98, - "y_offset": -36, + "x": -98, + "y": -36, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_4_4.png", - "x_offset": -66, - "y_offset": -12, + "x": -66, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_gentle_up_4_5.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_1_1.png", - "x_offset": -34, - "y_offset": -60, + "x": -34, + "y": -60, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_1_2.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_1_3.png", - "x_offset": -98, - "y_offset": -36, + "x": -98, + "y": -36, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_1_4.png", - "x_offset": -130, - "y_offset": -12, + "x": -130, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_1_5.png", - "x_offset": -162, - "y_offset": -12, + "x": -162, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_2_2.png", - "x_offset": -66, - "y_offset": -12, + "x": -66, + "y": -12, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_2_3.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_2_4.png", - "x_offset": -66, - "y_offset": -20, + "x": -66, + "y": -20, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_2_5.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_3_1.png", - "x_offset": -162, - "y_offset": -76, + "x": -162, + "y": -76, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_3_2.png", - "x_offset": -130, - "y_offset": -76, + "x": -130, + "y": -76, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_3_3.png", - "x_offset": -98, - "y_offset": -52, + "x": -98, + "y": -52, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_3_4.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_3_5.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_4_1.png", - "x_offset": -40, - "y_offset": -140, + "x": -40, + "y": -140, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_4_2.png", - "x_offset": -8, - "y_offset": -108, + "x": -8, + "y": -108, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_4_3.png", - "x_offset": -40, - "y_offset": -84, + "x": -40, + "y": -84, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_4_4.png", - "x_offset": -8, - "y_offset": -60, + "x": -8, + "y": -60, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_gentle_up_4_5.png", - "x_offset": -40, - "y_offset": -28, + "x": -40, + "y": -28, "palette": "keep" }, { "path": "track/rmc/very_small_turn_left_steep_up_1_1.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/very_small_turn_left_steep_up_1_2.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/very_small_turn_left_steep_up_2_1.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/very_small_turn_left_steep_up_2_2.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/very_small_turn_left_steep_up_3_1.png", - "x_offset": -15, - "y_offset": -57, + "x": -15, + "y": -57, "palette": "keep" }, { "path": "track/rmc/very_small_turn_left_steep_up_3_2.png", - "x_offset": -15, - "y_offset": -57, + "x": -15, + "y": -57, "palette": "keep" }, { "path": "track/rmc/very_small_turn_left_steep_up_4_1.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/very_small_turn_left_steep_up_4_2.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/very_small_turn_right_steep_up_1_1.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/very_small_turn_right_steep_up_1_2.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/very_small_turn_right_steep_up_2_1.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/very_small_turn_right_steep_up_2_2.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/very_small_turn_right_steep_up_3_1.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/very_small_turn_right_steep_up_3_2.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/very_small_turn_right_steep_up_4_1.png", - "x_offset": -15, - "y_offset": -73, + "x": -15, + "y": -73, "palette": "keep" }, { "path": "track/rmc/very_small_turn_right_steep_up_4_2.png", - "x_offset": -15, - "y_offset": -73, + "x": -15, + "y": -73, "palette": "keep" }, { "path": "track/rmc/vertical_twist_left_up_1.png", - "x_offset": -32, - "y_offset": -110, + "x": -32, + "y": -110, "palette": "keep" }, { "path": "track/rmc/vertical_twist_left_up_2_1.png", - "x_offset": -15, - "y_offset": -110, + "x": -15, + "y": -110, "palette": "keep" }, { "path": "track/rmc/vertical_twist_left_up_2_2.png", - "x_offset": -15, - "y_offset": -110, + "x": -15, + "y": -110, "palette": "keep" }, { "path": "track/rmc/vertical_twist_left_up_3.png", - "x_offset": -32, - "y_offset": -99, + "x": -32, + "y": -99, "palette": "keep" }, { "path": "track/rmc/vertical_twist_left_up_4_1.png", - "x_offset": -32, - "y_offset": -99, + "x": -32, + "y": -99, "palette": "keep" }, { "path": "track/rmc/vertical_twist_left_up_4_2.png", - "x_offset": -32, - "y_offset": -99, + "x": -32, + "y": -99, "palette": "keep" }, { "path": "track/rmc/vertical_twist_right_up_1_1.png", - "x_offset": -15, - "y_offset": -99, + "x": -15, + "y": -99, "palette": "keep" }, { "path": "track/rmc/vertical_twist_right_up_1_2.png", - "x_offset": -15, - "y_offset": -99, + "x": -15, + "y": -99, "palette": "keep" }, { "path": "track/rmc/vertical_twist_right_up_2.png", - "x_offset": -32, - "y_offset": -99, + "x": -32, + "y": -99, "palette": "keep" }, { "path": "track/rmc/vertical_twist_right_up_3_1.png", - "x_offset": -32, - "y_offset": -110, + "x": -32, + "y": -110, "palette": "keep" }, { "path": "track/rmc/vertical_twist_right_up_3_2.png", - "x_offset": -32, - "y_offset": -110, + "x": -32, + "y": -110, "palette": "keep" }, { "path": "track/rmc/vertical_twist_right_up_4.png", - "x_offset": -32, - "y_offset": -110, + "x": -32, + "y": -110, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_left_bank_1.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_left_bank_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_left_bank_2_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_left_bank_3.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_left_bank_4.png", - "x_offset": -34, - "y_offset": -40, + "x": -34, + "y": -40, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_right_bank_1.png", - "x_offset": -34, - "y_offset": -40, + "x": -34, + "y": -40, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_right_bank_2.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_right_bank_3_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_right_bank_3_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_right_bank_4.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_gentle_up_1.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_gentle_up_2_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_gentle_up_3.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_gentle_up_4.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_gentle_up_1.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_gentle_up_2.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_gentle_up_3_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_gentle_up_3_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_gentle_up_4.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_1_1.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_1_2.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_2_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_2_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_3.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_4.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_1.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_2.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_3_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_3_2.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_4_1.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_4_2.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_1_1.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_1_2.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_2_1.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_2_2.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_3.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_4.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_1.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_2.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_3_1.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_3_2.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_4_1.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_4_2.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_1.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_2.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_3.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_4.png", - "x_offset": -34, - "y_offset": -40, + "x": -34, + "y": -40, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_1.png", - "x_offset": -34, - "y_offset": -40, + "x": -34, + "y": -40, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_2.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_3.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_4.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_left_bank_1.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_left_bank_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_left_bank_2_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_left_bank_3.png", - "x_offset": -34, - "y_offset": -16, + "x": -34, + "y": -16, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_left_bank_4.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_right_bank_1.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_right_bank_2.png", - "x_offset": -34, - "y_offset": -16, + "x": -34, + "y": -16, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_right_bank_3_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_right_bank_3_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_right_bank_4.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_flat_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_flat_2_1.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_flat_2_2.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_flat_3.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_flat_4.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_flat_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_flat_2.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_flat_3_1.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_flat_3_2.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_flat_4.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_1_1.png", - "x_offset": -40, - "y_offset": -91, + "x": -40, + "y": -91, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_1_2.png", - "x_offset": -28, - "y_offset": -43, + "x": -28, + "y": -43, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_2_1.png", - "x_offset": -28, - "y_offset": -44, + "x": -28, + "y": -44, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_2_2.png", - "x_offset": -28, - "y_offset": -44, + "x": -28, + "y": -44, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_2_3.png", - "x_offset": -104, - "y_offset": -28, + "x": -104, + "y": -28, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_2_4.png", - "x_offset": -104, - "y_offset": -28, + "x": -104, + "y": -28, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_3_1.png", - "x_offset": -33, - "y_offset": -27, + "x": -33, + "y": -27, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_3_2.png", - "x_offset": -21, - "y_offset": -43, + "x": -21, + "y": -43, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_3_3.png", - "x_offset": -21, - "y_offset": -43, + "x": -21, + "y": -43, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_4_1.png", - "x_offset": -92, - "y_offset": -44, + "x": -92, + "y": -44, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_gentle_up_4_2.png", - "x_offset": -40, - "y_offset": -28, + "x": -40, + "y": -28, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_1_1.png", - "x_offset": -40, - "y_offset": -44, + "x": -40, + "y": -44, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_1_2.png", - "x_offset": -92, - "y_offset": -28, + "x": -92, + "y": -28, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_2_1.png", - "x_offset": -28, - "y_offset": -27, + "x": -28, + "y": -27, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_2_2.png", - "x_offset": -40, - "y_offset": -43, + "x": -40, + "y": -43, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_2_3.png", - "x_offset": -40, - "y_offset": -43, + "x": -40, + "y": -43, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_3_1.png", - "x_offset": -104, - "y_offset": -44, + "x": -104, + "y": -44, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_3_2.png", - "x_offset": -104, - "y_offset": -44, + "x": -104, + "y": -44, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_3_3.png", - "x_offset": -28, - "y_offset": -28, + "x": -28, + "y": -28, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_3_4.png", - "x_offset": -28, - "y_offset": -28, + "x": -28, + "y": -28, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_4_1.png", - "x_offset": -21, - "y_offset": -91, + "x": -21, + "y": -91, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_gentle_up_4_2.png", - "x_offset": -33, - "y_offset": -43, + "x": -33, + "y": -43, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_1_1.png", - "x_offset": -34, - "y_offset": -152, + "x": -34, + "y": -152, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_1_2.png", - "x_offset": -66, - "y_offset": -120, + "x": -66, + "y": -120, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_1_3.png", - "x_offset": -34, - "y_offset": -152, + "x": -34, + "y": -152, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_1_4.png", - "x_offset": -66, - "y_offset": -72, + "x": -66, + "y": -72, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_1_5.png", - "x_offset": -34, - "y_offset": -40, + "x": -34, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_2_2.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_2_3.png", - "x_offset": -66, - "y_offset": -73, + "x": -66, + "y": -73, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_2_4.png", - "x_offset": -66, - "y_offset": -73, + "x": -66, + "y": -73, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_2_5.png", - "x_offset": -98, - "y_offset": -49, + "x": -98, + "y": -49, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_2_6.png", - "x_offset": -98, - "y_offset": -49, + "x": -98, + "y": -49, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_2_7.png", - "x_offset": -130, - "y_offset": -57, + "x": -130, + "y": -57, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_2_8.png", - "x_offset": -130, - "y_offset": -57, + "x": -130, + "y": -57, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_2_9.png", - "x_offset": -162, - "y_offset": -25, + "x": -162, + "y": -25, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_2_10.png", - "x_offset": -162, - "y_offset": -25, + "x": -162, + "y": -25, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_3_1.png", - "x_offset": -40, - "y_offset": -24, + "x": -40, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_3_2.png", - "x_offset": -40, - "y_offset": -24, + "x": -40, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_3_3.png", - "x_offset": -40, - "y_offset": -32, + "x": -40, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_3_4.png", - "x_offset": -40, - "y_offset": -24, + "x": -40, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_3_5.png", - "x_offset": -40, - "y_offset": -40, + "x": -40, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_3_6.png", - "x_offset": -40, - "y_offset": -40, + "x": -40, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_4_1.png", - "x_offset": -162, - "y_offset": -72, + "x": -162, + "y": -72, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_4_2.png", - "x_offset": -130, - "y_offset": -40, + "x": -130, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_4_3.png", - "x_offset": -98, - "y_offset": -48, + "x": -98, + "y": -48, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_4_4.png", - "x_offset": -66, - "y_offset": -24, + "x": -66, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_left_bank_gentle_up_4_5.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_1_1.png", - "x_offset": -34, - "y_offset": -72, + "x": -34, + "y": -72, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_1_2.png", - "x_offset": -66, - "y_offset": -40, + "x": -66, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_1_3.png", - "x_offset": -98, - "y_offset": -48, + "x": -98, + "y": -48, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_1_4.png", - "x_offset": -130, - "y_offset": -24, + "x": -130, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_1_5.png", - "x_offset": -162, - "y_offset": -24, + "x": -162, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_2_2.png", - "x_offset": -66, - "y_offset": -24, + "x": -66, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_2_3.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_2_4.png", - "x_offset": -66, - "y_offset": -32, + "x": -66, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_2_5.png", - "x_offset": -34, - "y_offset": -40, + "x": -34, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_2_6.png", - "x_offset": -34, - "y_offset": -40, + "x": -34, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_3_1.png", - "x_offset": -162, - "y_offset": -73, + "x": -162, + "y": -73, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_3_2.png", - "x_offset": -162, - "y_offset": -73, + "x": -162, + "y": -73, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_3_3.png", - "x_offset": -130, - "y_offset": -73, + "x": -130, + "y": -73, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_3_4.png", - "x_offset": -130, - "y_offset": -73, + "x": -130, + "y": -73, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_3_5.png", - "x_offset": -98, - "y_offset": -49, + "x": -98, + "y": -49, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_3_6.png", - "x_offset": -98, - "y_offset": -49, + "x": -98, + "y": -49, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_3_7.png", - "x_offset": -66, - "y_offset": -57, + "x": -66, + "y": -57, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_3_8.png", - "x_offset": -66, - "y_offset": -57, + "x": -66, + "y": -57, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_3_9.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_3_10.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_4_1.png", - "x_offset": -40, - "y_offset": -152, + "x": -40, + "y": -152, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_4_2.png", - "x_offset": -8, - "y_offset": -120, + "x": -8, + "y": -120, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_4_3.png", - "x_offset": -40, - "y_offset": -96, + "x": -40, + "y": -96, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_4_4.png", - "x_offset": -8, - "y_offset": -72, + "x": -8, + "y": -72, "palette": "keep" }, { "path": "track/rmc/medium_turn_right_bank_gentle_up_4_5.png", - "x_offset": -40, - "y_offset": -40, + "x": -40, + "y": -40, "palette": "keep" }, { "path": "track/rmc/s_bend_left_1_1.png", - "x_offset": -34, - "y_offset": -60, + "x": -34, + "y": -60, "palette": "keep" }, { "path": "track/rmc/s_bend_left_1_2.png", - "x_offset": -66, - "y_offset": -44, + "x": -66, + "y": -44, "palette": "keep" }, { "path": "track/rmc/s_bend_left_1_3.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/s_bend_left_1_4.png", - "x_offset": -66, - "y_offset": -12, + "x": -66, + "y": -12, "palette": "keep" }, { "path": "track/rmc/s_bend_left_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/s_bend_left_2_2.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/s_bend_left_2_3.png", - "x_offset": -98, - "y_offset": -12, + "x": -98, + "y": -12, "palette": "keep" }, { "path": "track/rmc/s_bend_left_2_4.png", - "x_offset": -130, - "y_offset": -28, + "x": -130, + "y": -28, "palette": "keep" }, { "path": "track/rmc/s_bend_right_1_1.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/s_bend_right_1_2.png", - "x_offset": -66, - "y_offset": -12, + "x": -66, + "y": -12, "palette": "keep" }, { "path": "track/rmc/s_bend_right_1_3.png", - "x_offset": -98, - "y_offset": -28, + "x": -98, + "y": -28, "palette": "keep" }, { "path": "track/rmc/s_bend_right_1_4.png", - "x_offset": -130, - "y_offset": -12, + "x": -130, + "y": -12, "palette": "keep" }, { "path": "track/rmc/s_bend_right_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/s_bend_right_2_2.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/s_bend_right_2_3.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/s_bend_right_2_4.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_1_1.png", - "x_offset": -34, - "y_offset": -64, + "x": -34, + "y": -64, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_1_2.png", - "x_offset": -34, - "y_offset": -64, + "x": -34, + "y": -64, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_1_3.png", - "x_offset": -66, - "y_offset": -48, + "x": -66, + "y": -48, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_1_4.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_2_1.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_2_2.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_2_3.png", - "x_offset": -66, - "y_offset": -33, + "x": -66, + "y": -33, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_2_4.png", - "x_offset": -98, - "y_offset": -17, + "x": -98, + "y": -17, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_2_5.png", - "x_offset": -98, - "y_offset": -17, + "x": -98, + "y": -17, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_3_1.png", - "x_offset": -27, - "y_offset": -24, + "x": -27, + "y": -24, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_3_2.png", - "x_offset": 5, - "y_offset": -40, + "x": 5, + "y": -40, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_3_3.png", - "x_offset": -27, - "y_offset": -56, + "x": -27, + "y": -56, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_3_4.png", - "x_offset": -27, - "y_offset": -56, + "x": -27, + "y": -56, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_4_1.png", - "x_offset": -98, - "y_offset": -25, + "x": -98, + "y": -25, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_4_2.png", - "x_offset": -66, - "y_offset": -9, + "x": -66, + "y": -9, "palette": "keep" }, { "path": "track/rmc/small_helix_left_up_4_3.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_1_1.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_1_2.png", - "x_offset": -66, - "y_offset": -9, + "x": -66, + "y": -9, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_1_3.png", - "x_offset": -98, - "y_offset": -25, + "x": -98, + "y": -25, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_2_1.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_2_2.png", - "x_offset": -66, - "y_offset": -40, + "x": -66, + "y": -40, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_2_3.png", - "x_offset": -34, - "y_offset": -56, + "x": -34, + "y": -56, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_2_4.png", - "x_offset": -34, - "y_offset": -56, + "x": -34, + "y": -56, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_3_1.png", - "x_offset": -98, - "y_offset": -17, + "x": -98, + "y": -17, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_3_2.png", - "x_offset": -98, - "y_offset": -17, + "x": -98, + "y": -17, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_3_3.png", - "x_offset": -66, - "y_offset": -33, + "x": -66, + "y": -33, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_3_4.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_3_5.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_4_1.png", - "x_offset": -27, - "y_offset": -64, + "x": -27, + "y": -64, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_4_2.png", - "x_offset": -27, - "y_offset": -64, + "x": -27, + "y": -64, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_4_3.png", - "x_offset": 5, - "y_offset": -48, + "x": 5, + "y": -48, "palette": "keep" }, { "path": "track/rmc/small_helix_right_up_4_4.png", - "x_offset": -27, - "y_offset": -32, + "x": -27, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_1_1.png", - "x_offset": -34, - "y_offset": -96, + "x": -34, + "y": -96, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_1_2.png", - "x_offset": -34, - "y_offset": -96, + "x": -34, + "y": -96, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_1_3.png", - "x_offset": -66, - "y_offset": -80, + "x": -66, + "y": -80, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_1_4.png", - "x_offset": -34, - "y_offset": -64, + "x": -34, + "y": -64, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_1_5.png", - "x_offset": -66, - "y_offset": -48, + "x": -66, + "y": -48, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_1_6.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_2_1.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_2_2.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_2_3.png", - "x_offset": -66, - "y_offset": -33, + "x": -66, + "y": -33, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_2_4.png", - "x_offset": -98, - "y_offset": -17, + "x": -98, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_2_5.png", - "x_offset": -98, - "y_offset": -17, + "x": -98, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_2_6.png", - "x_offset": -130, - "y_offset": -33, + "x": -130, + "y": -33, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_2_7.png", - "x_offset": -162, - "y_offset": -17, + "x": -162, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_2_8.png", - "x_offset": -162, - "y_offset": -17, + "x": -162, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_3_1.png", - "x_offset": -40, - "y_offset": -24, + "x": -40, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_3_2.png", - "x_offset": -8, - "y_offset": -40, + "x": -8, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_3_3.png", - "x_offset": -40, - "y_offset": -56, + "x": -40, + "y": -56, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_3_4.png", - "x_offset": -8, - "y_offset": -72, + "x": -8, + "y": -72, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_3_5.png", - "x_offset": -40, - "y_offset": -88, + "x": -40, + "y": -88, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_3_6.png", - "x_offset": -40, - "y_offset": -88, + "x": -40, + "y": -88, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_4_1.png", - "x_offset": -162, - "y_offset": -32, + "x": -162, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_4_2.png", - "x_offset": -130, - "y_offset": -16, + "x": -130, + "y": -16, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_4_3.png", - "x_offset": -98, - "y_offset": -32, + "x": -98, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_4_4.png", - "x_offset": -66, - "y_offset": -16, + "x": -66, + "y": -16, "palette": "keep" }, { "path": "track/rmc/medium_helix_left_up_4_5.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_1_1.png", - "x_offset": -34, - "y_offset": -32, + "x": -34, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_1_2.png", - "x_offset": -66, - "y_offset": -16, + "x": -66, + "y": -16, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_1_3.png", - "x_offset": -98, - "y_offset": -32, + "x": -98, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_1_4.png", - "x_offset": -130, - "y_offset": -16, + "x": -130, + "y": -16, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_1_5.png", - "x_offset": -162, - "y_offset": -32, + "x": -162, + "y": -32, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_2_1.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_2_2.png", - "x_offset": -66, - "y_offset": -40, + "x": -66, + "y": -40, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_2_3.png", - "x_offset": -34, - "y_offset": -56, + "x": -34, + "y": -56, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_2_4.png", - "x_offset": -66, - "y_offset": -72, + "x": -66, + "y": -72, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_2_5.png", - "x_offset": -34, - "y_offset": -88, + "x": -34, + "y": -88, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_2_6.png", - "x_offset": -34, - "y_offset": -88, + "x": -34, + "y": -88, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_3_1.png", - "x_offset": -162, - "y_offset": -17, + "x": -162, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_3_2.png", - "x_offset": -162, - "y_offset": -17, + "x": -162, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_3_3.png", - "x_offset": -130, - "y_offset": -33, + "x": -130, + "y": -33, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_3_4.png", - "x_offset": -98, - "y_offset": -17, + "x": -98, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_3_5.png", - "x_offset": -98, - "y_offset": -17, + "x": -98, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_3_6.png", - "x_offset": -66, - "y_offset": -33, + "x": -66, + "y": -33, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_3_7.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_3_8.png", - "x_offset": -34, - "y_offset": -17, + "x": -34, + "y": -17, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_4_1.png", - "x_offset": -40, - "y_offset": -96, + "x": -40, + "y": -96, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_4_2.png", - "x_offset": -40, - "y_offset": -96, + "x": -40, + "y": -96, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_4_3.png", - "x_offset": -8, - "y_offset": -80, + "x": -8, + "y": -80, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_4_4.png", - "x_offset": -40, - "y_offset": -64, + "x": -40, + "y": -64, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_4_5.png", - "x_offset": -8, - "y_offset": -48, + "x": -8, + "y": -48, "palette": "keep" }, { "path": "track/rmc/medium_helix_right_up_4_6.png", - "x_offset": -40, - "y_offset": -32, + "x": -40, + "y": -32, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_1_1.png", - "x_offset": -34, - "y_offset": -76, + "x": -34, + "y": -76, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_1_2.png", - "x_offset": -34, - "y_offset": -76, + "x": -34, + "y": -76, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_1_3.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_1_4.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_1_5.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_1_6.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_2_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_2_3.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_2_4.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_2_5.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_2_6.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_3_1.png", - "x_offset": -98, - "y_offset": -15, + "x": -98, + "y": -15, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_3_2.png", - "x_offset": -98, - "y_offset": -15, + "x": -98, + "y": -15, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_3_3.png", - "x_offset": -66, - "y_offset": -31, + "x": -66, + "y": -31, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_3_4.png", - "x_offset": -66, - "y_offset": -31, + "x": -66, + "y": -31, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_3_5.png", - "x_offset": -34, - "y_offset": -47, + "x": -34, + "y": -47, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_3_6.png", - "x_offset": -34, - "y_offset": -47, + "x": -34, + "y": -47, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_4_1.png", - "x_offset": -98, - "y_offset": -76, + "x": -98, + "y": -76, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_4_2.png", - "x_offset": -98, - "y_offset": -76, + "x": -98, + "y": -76, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_4_3.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_4_4.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_4_5.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_left_4_6.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_1_1.png", - "x_offset": -34, - "y_offset": -76, + "x": -34, + "y": -76, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_1_2.png", - "x_offset": -34, - "y_offset": -76, + "x": -34, + "y": -76, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_1_3.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_1_4.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_1_5.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_1_6.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_2_1.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_2_2.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_2_3.png", - "x_offset": -66, - "y_offset": -31, + "x": -66, + "y": -31, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_2_4.png", - "x_offset": -66, - "y_offset": -31, + "x": -66, + "y": -31, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_2_5.png", - "x_offset": -98, - "y_offset": -47, + "x": -98, + "y": -47, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_2_6.png", - "x_offset": -98, - "y_offset": -47, + "x": -98, + "y": -47, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_3_1.png", - "x_offset": -98, - "y_offset": -12, + "x": -98, + "y": -12, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_3_2.png", - "x_offset": -98, - "y_offset": -12, + "x": -98, + "y": -12, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_3_3.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_3_4.png", - "x_offset": -66, - "y_offset": -28, + "x": -66, + "y": -28, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_3_5.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_3_6.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_4_1.png", - "x_offset": -98, - "y_offset": -76, + "x": -98, + "y": -76, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_4_2.png", - "x_offset": -98, - "y_offset": -76, + "x": -98, + "y": -76, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_4_3.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_4_4.png", - "x_offset": -66, - "y_offset": -60, + "x": -66, + "y": -60, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_4_5.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/barrel_roll_right_4_6.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_1_1.png", - "x_offset": -34, - "y_offset": -145, + "x": -34, + "y": -145, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_1_2.png", - "x_offset": -66, - "y_offset": -129, + "x": -66, + "y": -129, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_1_3.png", - "x_offset": -98, - "y_offset": -97, + "x": -98, + "y": -97, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_1_4.png", - "x_offset": -130, - "y_offset": -57, + "x": -130, + "y": -57, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_2_1.png", - "x_offset": -34, - "y_offset": -33, + "x": -34, + "y": -33, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_2_2.png", - "x_offset": -66, - "y_offset": -49, + "x": -66, + "y": -49, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_2_3.png", - "x_offset": -98, - "y_offset": -49, + "x": -98, + "y": -49, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_2_4.png", - "x_offset": -130, - "y_offset": -41, + "x": -130, + "y": -41, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_3_1.png", - "x_offset": -130, - "y_offset": -33, + "x": -130, + "y": -33, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_3_2.png", - "x_offset": -98, - "y_offset": -49, + "x": -98, + "y": -49, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_3_3.png", - "x_offset": -66, - "y_offset": -49, + "x": -66, + "y": -49, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_3_4.png", - "x_offset": -34, - "y_offset": -41, + "x": -34, + "y": -41, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_4_1.png", - "x_offset": -130, - "y_offset": -145, + "x": -130, + "y": -145, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_4_2.png", - "x_offset": -98, - "y_offset": -129, + "x": -98, + "y": -129, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_4_3.png", - "x_offset": -66, - "y_offset": -97, + "x": -66, + "y": -97, "palette": "keep" }, { "path": "track/rmc/flat_to_steep_up_4_4.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_1_1.png", - "x_offset": -34, - "y_offset": -148, + "x": -34, + "y": -148, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_1_2.png", - "x_offset": -66, - "y_offset": -92, + "x": -66, + "y": -92, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_1_3.png", - "x_offset": -98, - "y_offset": -52, + "x": -98, + "y": -52, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_1_4.png", - "x_offset": -130, - "y_offset": -20, + "x": -130, + "y": -20, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_2_1.png", - "x_offset": -34, - "y_offset": -51, + "x": -34, + "y": -51, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_2_2.png", - "x_offset": -66, - "y_offset": -27, + "x": -66, + "y": -27, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_2_3.png", - "x_offset": -98, - "y_offset": -19, + "x": -98, + "y": -19, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_2_4.png", - "x_offset": -130, - "y_offset": -19, + "x": -130, + "y": -19, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_3_1.png", - "x_offset": -130, - "y_offset": -51, + "x": -130, + "y": -51, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_3_2.png", - "x_offset": -98, - "y_offset": -27, + "x": -98, + "y": -27, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_3_3.png", - "x_offset": -66, - "y_offset": -19, + "x": -66, + "y": -19, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_3_4.png", - "x_offset": -34, - "y_offset": -19, + "x": -34, + "y": -19, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_4_1.png", - "x_offset": -130, - "y_offset": -148, + "x": -130, + "y": -148, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_4_2.png", - "x_offset": -98, - "y_offset": -92, + "x": -98, + "y": -92, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_4_3.png", - "x_offset": -66, - "y_offset": -52, + "x": -66, + "y": -52, "palette": "keep" }, { "path": "track/rmc/steep_to_flat_up_4_4.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_1_1.png", - "x_offset": -98, - "y_offset": -99, + "x": -98, + "y": -99, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_1_2.png", - "x_offset": -98, - "y_offset": -99, + "x": -98, + "y": -99, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_1_3.png", - "x_offset": -66, - "y_offset": -59, + "x": -66, + "y": -59, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_1_4.png", - "x_offset": -66, - "y_offset": -59, + "x": -66, + "y": -59, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_1_5.png", - "x_offset": -34, - "y_offset": -35, + "x": -34, + "y": -35, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_1_6.png", - "x_offset": -34, - "y_offset": -35, + "x": -34, + "y": -35, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_2_1.png", - "x_offset": -98, - "y_offset": -172, + "x": -98, + "y": -172, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_2_2.png", - "x_offset": -98, - "y_offset": -172, + "x": -98, + "y": -172, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_2_3.png", - "x_offset": -66, - "y_offset": -100, + "x": -66, + "y": -100, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_2_4.png", - "x_offset": -66, - "y_offset": -100, + "x": -66, + "y": -100, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_2_5.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_2_6.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_3_1.png", - "x_offset": -32, - "y_offset": -172, + "x": -32, + "y": -172, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_3_2.png", - "x_offset": -32, - "y_offset": -172, + "x": -32, + "y": -172, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_3_3.png", - "x_offset": -64, - "y_offset": -100, + "x": -64, + "y": -100, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_3_4.png", - "x_offset": -64, - "y_offset": -100, + "x": -64, + "y": -100, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_3_5.png", - "x_offset": -96, - "y_offset": -44, + "x": -96, + "y": -44, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_3_6.png", - "x_offset": -96, - "y_offset": -44, + "x": -96, + "y": -44, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_4_1.png", - "x_offset": -32, - "y_offset": -99, + "x": -32, + "y": -99, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_4_2.png", - "x_offset": -32, - "y_offset": -99, + "x": -32, + "y": -99, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_4_3.png", - "x_offset": -64, - "y_offset": -59, + "x": -64, + "y": -59, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_4_4.png", - "x_offset": -64, - "y_offset": -59, + "x": -64, + "y": -59, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_4_5.png", - "x_offset": -96, - "y_offset": -35, + "x": -96, + "y": -35, "palette": "keep" }, { "path": "track/rmc/quarter_loop_up_4_6.png", - "x_offset": -96, - "y_offset": -35, + "x": -96, + "y": -35, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_to_gentle_up_1_1.png", - "x_offset": -40, - "y_offset": -71, + "x": -40, + "y": -71, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_to_gentle_up_1_2.png", - "x_offset": -28, - "y_offset": -23, + "x": -28, + "y": -23, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_to_gentle_up_2_1.png", - "x_offset": -28, - "y_offset": -39, + "x": -28, + "y": -39, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_to_gentle_up_2_2.png", - "x_offset": -28, - "y_offset": -39, + "x": -28, + "y": -39, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_to_gentle_up_2_3.png", - "x_offset": -104, - "y_offset": -23, + "x": -104, + "y": -23, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_to_gentle_up_3_1.png", - "x_offset": -33, - "y_offset": -27, + "x": -33, + "y": -27, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_to_gentle_up_3_2.png", - "x_offset": -21, - "y_offset": -43, + "x": -21, + "y": -43, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_to_gentle_up_4_1.png", - "x_offset": -92, - "y_offset": -29, + "x": -92, + "y": -29, "palette": "keep" }, { "path": "track/rmc/small_turn_left_bank_to_gentle_up_4_2.png", - "x_offset": -40, - "y_offset": -13, + "x": -40, + "y": -13, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_to_gentle_up_1_1.png", - "x_offset": -40, - "y_offset": -29, + "x": -40, + "y": -29, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_to_gentle_up_1_2.png", - "x_offset": -92, - "y_offset": -13, + "x": -92, + "y": -13, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_to_gentle_up_2_1.png", - "x_offset": -28, - "y_offset": -27, + "x": -28, + "y": -27, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_to_gentle_up_2_2.png", - "x_offset": -40, - "y_offset": -43, + "x": -40, + "y": -43, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_to_gentle_up_3_1.png", - "x_offset": -104, - "y_offset": -39, + "x": -104, + "y": -39, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_to_gentle_up_3_2.png", - "x_offset": -104, - "y_offset": -39, + "x": -104, + "y": -39, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_to_gentle_up_3_3.png", - "x_offset": -28, - "y_offset": -23, + "x": -28, + "y": -23, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_to_gentle_up_4_1.png", - "x_offset": -21, - "y_offset": -71, + "x": -21, + "y": -71, "palette": "keep" }, { "path": "track/rmc/small_turn_right_bank_to_gentle_up_4_2.png", - "x_offset": -33, - "y_offset": -23, + "x": -33, + "y": -23, "palette": "keep" }, { "path": "track/rmc/powered_lift_1.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/powered_lift_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/powered_lift_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/powered_lift_4.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_1_1.png", - "x_offset": -34, - "y_offset": -100, + "x": -34, + "y": -100, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_1_2.png", - "x_offset": -34, - "y_offset": -100, + "x": -34, + "y": -100, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_1_3.png", - "x_offset": -66, - "y_offset": -76, + "x": -66, + "y": -76, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_1_4.png", - "x_offset": -66, - "y_offset": -76, + "x": -66, + "y": -76, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_1_5.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_1_6.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_2_1.png", - "x_offset": -34, - "y_offset": -36, + "x": -34, + "y": -36, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_2_2.png", - "x_offset": -34, - "y_offset": -36, + "x": -34, + "y": -36, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_2_3.png", - "x_offset": -66, - "y_offset": -44, + "x": -66, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_2_4.png", - "x_offset": -66, - "y_offset": -44, + "x": -66, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_2_5.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_2_6.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_3_1.png", - "x_offset": -98, - "y_offset": -36, + "x": -98, + "y": -36, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_3_2.png", - "x_offset": -66, - "y_offset": -44, + "x": -66, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_3_3.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_3_4.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_4_1.png", - "x_offset": -98, - "y_offset": -100, + "x": -98, + "y": -100, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_4_2.png", - "x_offset": -66, - "y_offset": -76, + "x": -66, + "y": -76, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_4_3.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_left_4_4.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_1_1.png", - "x_offset": -34, - "y_offset": -100, + "x": -34, + "y": -100, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_1_2.png", - "x_offset": -66, - "y_offset": -76, + "x": -66, + "y": -76, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_1_3.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_1_4.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_2_1.png", - "x_offset": -34, - "y_offset": -36, + "x": -34, + "y": -36, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_2_2.png", - "x_offset": -66, - "y_offset": -44, + "x": -66, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_2_3.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_2_4.png", - "x_offset": -98, - "y_offset": -44, + "x": -98, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_3_1.png", - "x_offset": -98, - "y_offset": -36, + "x": -98, + "y": -36, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_3_2.png", - "x_offset": -98, - "y_offset": -36, + "x": -98, + "y": -36, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_3_3.png", - "x_offset": -66, - "y_offset": -44, + "x": -66, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_3_4.png", - "x_offset": -66, - "y_offset": -44, + "x": -66, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_3_5.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_3_6.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_4_1.png", - "x_offset": -98, - "y_offset": -100, + "x": -98, + "y": -100, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_4_2.png", - "x_offset": -98, - "y_offset": -100, + "x": -98, + "y": -100, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_4_3.png", - "x_offset": -66, - "y_offset": -76, + "x": -66, + "y": -76, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_4_4.png", - "x_offset": -66, - "y_offset": -76, + "x": -66, + "y": -76, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_4_5.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/zero_g_roll_right_4_6.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_1_1.png", - "x_offset": -34, - "y_offset": -212, + "x": -34, + "y": -212, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_1_2.png", - "x_offset": -66, - "y_offset": -140, + "x": -66, + "y": -140, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_1_3.png", - "x_offset": -66, - "y_offset": -140, + "x": -66, + "y": -140, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_1_4.png", - "x_offset": -98, - "y_offset": -84, + "x": -98, + "y": -84, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_1_5.png", - "x_offset": -98, - "y_offset": -84, + "x": -98, + "y": -84, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_1_6.png", - "x_offset": -130, - "y_offset": -44, + "x": -130, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_1_7.png", - "x_offset": -130, - "y_offset": -44, + "x": -130, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_2_1.png", - "x_offset": -34, - "y_offset": -117, + "x": -34, + "y": -117, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_2_2.png", - "x_offset": -34, - "y_offset": -117, + "x": -34, + "y": -117, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_2_3.png", - "x_offset": -66, - "y_offset": -77, + "x": -66, + "y": -77, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_2_4.png", - "x_offset": -66, - "y_offset": -77, + "x": -66, + "y": -77, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_2_5.png", - "x_offset": -98, - "y_offset": -53, + "x": -98, + "y": -53, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_2_6.png", - "x_offset": -98, - "y_offset": -53, + "x": -98, + "y": -53, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_2_7.png", - "x_offset": -130, - "y_offset": -45, + "x": -130, + "y": -45, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_2_8.png", - "x_offset": -130, - "y_offset": -45, + "x": -130, + "y": -45, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_3_1.png", - "x_offset": -130, - "y_offset": -117, + "x": -130, + "y": -117, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_3_2.png", - "x_offset": -130, - "y_offset": -117, + "x": -130, + "y": -117, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_3_3.png", - "x_offset": -98, - "y_offset": -77, + "x": -98, + "y": -77, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_3_4.png", - "x_offset": -98, - "y_offset": -77, + "x": -98, + "y": -77, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_3_5.png", - "x_offset": -66, - "y_offset": -53, + "x": -66, + "y": -53, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_3_6.png", - "x_offset": -66, - "y_offset": -53, + "x": -66, + "y": -53, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_3_7.png", - "x_offset": -34, - "y_offset": -45, + "x": -34, + "y": -45, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_3_8.png", - "x_offset": -34, - "y_offset": -45, + "x": -34, + "y": -45, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_4_1.png", - "x_offset": -130, - "y_offset": -212, + "x": -130, + "y": -212, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_4_2.png", - "x_offset": -98, - "y_offset": -140, + "x": -98, + "y": -140, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_4_3.png", - "x_offset": -66, - "y_offset": -84, + "x": -66, + "y": -84, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_4_4.png", - "x_offset": -66, - "y_offset": -84, + "x": -66, + "y": -84, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_4_5.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_left_4_6.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_1_1.png", - "x_offset": -34, - "y_offset": -212, + "x": -34, + "y": -212, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_1_2.png", - "x_offset": -66, - "y_offset": -140, + "x": -66, + "y": -140, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_1_3.png", - "x_offset": -98, - "y_offset": -84, + "x": -98, + "y": -84, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_1_4.png", - "x_offset": -98, - "y_offset": -84, + "x": -98, + "y": -84, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_1_5.png", - "x_offset": -130, - "y_offset": -44, + "x": -130, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_1_6.png", - "x_offset": -130, - "y_offset": -44, + "x": -130, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_2_1.png", - "x_offset": -34, - "y_offset": -117, + "x": -34, + "y": -117, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_2_2.png", - "x_offset": -34, - "y_offset": -117, + "x": -34, + "y": -117, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_2_3.png", - "x_offset": -66, - "y_offset": -77, + "x": -66, + "y": -77, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_2_4.png", - "x_offset": -66, - "y_offset": -77, + "x": -66, + "y": -77, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_2_5.png", - "x_offset": -98, - "y_offset": -53, + "x": -98, + "y": -53, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_2_6.png", - "x_offset": -98, - "y_offset": -53, + "x": -98, + "y": -53, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_2_7.png", - "x_offset": -130, - "y_offset": -45, + "x": -130, + "y": -45, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_2_8.png", - "x_offset": -130, - "y_offset": -45, + "x": -130, + "y": -45, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_3_1.png", - "x_offset": -130, - "y_offset": -117, + "x": -130, + "y": -117, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_3_2.png", - "x_offset": -130, - "y_offset": -117, + "x": -130, + "y": -117, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_3_3.png", - "x_offset": -98, - "y_offset": -77, + "x": -98, + "y": -77, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_3_4.png", - "x_offset": -98, - "y_offset": -77, + "x": -98, + "y": -77, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_3_5.png", - "x_offset": -66, - "y_offset": -53, + "x": -66, + "y": -53, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_3_6.png", - "x_offset": -66, - "y_offset": -53, + "x": -66, + "y": -53, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_3_7.png", - "x_offset": -34, - "y_offset": -45, + "x": -34, + "y": -45, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_3_8.png", - "x_offset": -34, - "y_offset": -45, + "x": -34, + "y": -45, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_4_1.png", - "x_offset": -130, - "y_offset": -212, + "x": -130, + "y": -212, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_4_2.png", - "x_offset": -98, - "y_offset": -140, + "x": -98, + "y": -140, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_4_3.png", - "x_offset": -98, - "y_offset": -140, + "x": -98, + "y": -140, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_4_4.png", - "x_offset": -66, - "y_offset": -84, + "x": -66, + "y": -84, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_4_5.png", - "x_offset": -66, - "y_offset": -84, + "x": -66, + "y": -84, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_4_6.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_zero_g_roll_right_4_7.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_1_1.png", - "x_offset": -34, - "y_offset": -40, + "x": -34, + "y": -40, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_1_2.png", - "x_offset": -32, - "y_offset": -24, + "x": -32, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_1_3.png", - "x_offset": -3, - "y_offset": 8, + "x": -3, + "y": 8, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_1_4.png", - "x_offset": -28, - "y_offset": -14, + "x": -28, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_2_2.png", - "x_offset": -32, - "y_offset": -17, + "x": -32, + "y": -17, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_2_3.png", - "x_offset": -24, - "y_offset": 8, + "x": -24, + "y": 8, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_2_4.png", - "x_offset": -32, - "y_offset": -23, + "x": -32, + "y": -23, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_3_1.png", - "x_offset": -8, - "y_offset": -12, + "x": -8, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": -10, + "x": 0, + "y": -10, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_3_3.png", - "x_offset": -32, - "y_offset": -4, + "x": -32, + "y": -4, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_3_4.png", - "x_offset": -24, - "y_offset": -23, + "x": -24, + "y": -23, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_4_1.png", - "x_offset": -32, - "y_offset": -21, + "x": -32, + "y": -21, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_4_2.png", - "x_offset": -31, - "y_offset": -14, + "x": -31, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_4_3.png", - "x_offset": 0, - "y_offset": -25, + "x": 0, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_diag_gentle_up_4_4.png", - "x_offset": 0, - "y_offset": -23, + "x": 0, + "y": -23, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_1_1.png", - "x_offset": -34, - "y_offset": -21, + "x": -34, + "y": -21, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_1_2.png", - "x_offset": -21, - "y_offset": -14, + "x": -21, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_1_3.png", - "x_offset": -15, - "y_offset": -25, + "x": -15, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_1_4.png", - "x_offset": -32, - "y_offset": -23, + "x": -32, + "y": -23, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_2_2.png", - "x_offset": -34, - "y_offset": -10, + "x": -34, + "y": -10, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_2_3.png", - "x_offset": -2, - "y_offset": -4, + "x": -2, + "y": -4, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_2_4.png", - "x_offset": -11, - "y_offset": -23, + "x": -11, + "y": -23, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_3_1.png", - "x_offset": -13, - "y_offset": -12, + "x": -13, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_3_2.png", - "x_offset": -8, - "y_offset": -17, + "x": -8, + "y": -17, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_3_3.png", - "x_offset": 0, - "y_offset": 8, + "x": 0, + "y": 8, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_3_4.png", - "x_offset": 0, - "y_offset": -23, + "x": 0, + "y": -23, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_4_1.png", - "x_offset": -30, - "y_offset": -40, + "x": -30, + "y": -40, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_4_2.png", - "x_offset": -20, - "y_offset": -24, + "x": -20, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_4_3.png", - "x_offset": -32, - "y_offset": 8, + "x": -32, + "y": 8, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_diag_gentle_up_4_4.png", - "x_offset": -24, - "y_offset": -13, + "x": -24, + "y": -13, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -18, + "x": 0, + "y": -18, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": -22, + "x": -32, + "y": -22, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_1_4.png", - "x_offset": -32, - "y_offset": -28, + "x": -32, + "y": -28, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_2_1.png", - "x_offset": -24, - "y_offset": -2, + "x": -24, + "y": -2, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_2_3.png", - "x_offset": -23, - "y_offset": -18, + "x": -23, + "y": -18, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_2_4.png", - "x_offset": -27, - "y_offset": -13, + "x": -27, + "y": -13, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -15, + "x": -32, + "y": -15, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_3_3.png", - "x_offset": -23, - "y_offset": -7, + "x": -23, + "y": -7, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_3_4.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_4_1.png", - "x_offset": -26, - "y_offset": -8, + "x": -26, + "y": -8, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_4_3.png", - "x_offset": -31, - "y_offset": -8, + "x": -31, + "y": -8, "palette": "keep" }, { "path": "track/rmc/large_turn_left_to_orthogonal_gentle_up_4_4.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -15, + "x": 0, + "y": -15, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": -7, + "x": -32, + "y": -7, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_1_4.png", - "x_offset": -32, - "y_offset": -12, + "x": -32, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_2_1.png", - "x_offset": 0, - "y_offset": -2, + "x": 0, + "y": -2, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_2_3.png", - "x_offset": -16, - "y_offset": -18, + "x": -16, + "y": -18, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_2_4.png", - "x_offset": -34, - "y_offset": -13, + "x": -34, + "y": -13, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -18, + "x": -32, + "y": -18, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_3_3.png", - "x_offset": -16, - "y_offset": -22, + "x": -16, + "y": -22, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_3_4.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_4_1.png", - "x_offset": -24, - "y_offset": -8, + "x": -24, + "y": -8, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_4_3.png", - "x_offset": -22, - "y_offset": -8, + "x": -22, + "y": -8, "palette": "keep" }, { "path": "track/rmc/large_turn_right_to_orthogonal_gentle_up_4_4.png", - "x_offset": -32, - "y_offset": -28, + "x": -32, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": -20, + "x": -32, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_left_bank_diag_1_2.png", - "x_offset": -32, - "y_offset": -16, + "x": -32, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_left_bank_diag_2.png", - "x_offset": -26, - "y_offset": -19, + "x": -26, + "y": -19, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -35, + "x": -32, + "y": -35, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_left_bank_diag_4.png", - "x_offset": -24, - "y_offset": -41, + "x": -24, + "y": -41, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -35, + "x": -32, + "y": -35, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_right_bank_diag_2.png", - "x_offset": -24, - "y_offset": -19, + "x": -24, + "y": -19, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_right_bank_diag_3_1.png", - "x_offset": -32, - "y_offset": -20, + "x": -32, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": -16, + "x": -32, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_gentle_up_right_bank_diag_4.png", - "x_offset": -26, - "y_offset": -41, + "x": -26, + "y": -41, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_gentle_up_diag_1_1.png", - "x_offset": -32, - "y_offset": -23, + "x": -32, + "y": -23, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_gentle_up_diag_1_2.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_gentle_up_diag_2.png", - "x_offset": -26, - "y_offset": -25, + "x": -26, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_gentle_up_diag_3.png", - "x_offset": -32, - "y_offset": -23, + "x": -32, + "y": -23, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_gentle_up_diag_4.png", - "x_offset": -24, - "y_offset": -30, + "x": -24, + "y": -30, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_gentle_up_diag_1.png", - "x_offset": -32, - "y_offset": -23, + "x": -32, + "y": -23, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_gentle_up_diag_2.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_gentle_up_diag_3_1.png", - "x_offset": -32, - "y_offset": -23, + "x": -32, + "y": -23, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_gentle_up_diag_3_2.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_gentle_up_diag_4.png", - "x_offset": -26, - "y_offset": -30, + "x": -26, + "y": -30, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": -12, + "x": -32, + "y": -12, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_diag_1_2.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_diag_2.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -27, + "x": -32, + "y": -27, "palette": "keep" }, { "path": "track/rmc/left_bank_to_gentle_up_left_bank_diag_4.png", - "x_offset": -24, - "y_offset": -33, + "x": -24, + "y": -33, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -27, + "x": -32, + "y": -27, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_diag_2.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_diag_3_1.png", - "x_offset": -32, - "y_offset": -12, + "x": -32, + "y": -12, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/rmc/right_bank_to_gentle_up_right_bank_diag_4.png", - "x_offset": -24, - "y_offset": -33, + "x": -24, + "y": -33, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": -12, + "x": -32, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_diag_1_2.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_diag_2.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -28, + "x": -32, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_left_bank_diag_4.png", - "x_offset": -24, - "y_offset": -33, + "x": -24, + "y": -33, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -28, + "x": -32, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_diag_2.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_diag_3_1.png", - "x_offset": -32, - "y_offset": -12, + "x": -32, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_right_bank_diag_4.png", - "x_offset": -24, - "y_offset": -33, + "x": -24, + "y": -33, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": -20, + "x": -32, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_diag_1_2.png", - "x_offset": -32, - "y_offset": -16, + "x": -32, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_diag_2.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -35, + "x": -32, + "y": -35, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_diag_4.png", - "x_offset": -24, - "y_offset": -41, + "x": -24, + "y": -41, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -35, + "x": -32, + "y": -35, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_diag_2.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_diag_3_1.png", - "x_offset": -32, - "y_offset": -20, + "x": -32, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": -16, + "x": -32, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_diag_4.png", - "x_offset": -24, - "y_offset": -41, + "x": -24, + "y": -41, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": -12, + "x": -32, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_left_bank_diag_1_2.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_left_bank_diag_2.png", - "x_offset": -26, - "y_offset": -14, + "x": -26, + "y": -14, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -27, + "x": -32, + "y": -27, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_left_bank_diag_4.png", - "x_offset": -24, - "y_offset": -33, + "x": -24, + "y": -33, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -27, + "x": -32, + "y": -27, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_right_bank_diag_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_right_bank_diag_3_1.png", - "x_offset": -32, - "y_offset": -12, + "x": -32, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_right_bank_diag_4.png", - "x_offset": -26, - "y_offset": -33, + "x": -26, + "y": -33, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_flat_diag_1_1.png", - "x_offset": -32, - "y_offset": -16, + "x": -32, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_flat_diag_1_2.png", - "x_offset": -32, - "y_offset": -3, + "x": -32, + "y": -3, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_flat_diag_2.png", - "x_offset": -26, - "y_offset": -25, + "x": -26, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_flat_diag_3.png", - "x_offset": -32, - "y_offset": -21, + "x": -32, + "y": -21, "palette": "keep" }, { "path": "track/rmc/gentle_up_left_bank_to_flat_diag_4.png", - "x_offset": -24, - "y_offset": -21, + "x": -24, + "y": -21, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_flat_diag_1.png", - "x_offset": -32, - "y_offset": -21, + "x": -32, + "y": -21, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_flat_diag_2.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_flat_diag_3_1.png", - "x_offset": -32, - "y_offset": -16, + "x": -32, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_flat_diag_3_2.png", - "x_offset": -32, - "y_offset": -3, + "x": -32, + "y": -3, "palette": "keep" }, { "path": "track/rmc/gentle_up_right_bank_to_flat_diag_4.png", - "x_offset": -25, - "y_offset": -21, + "x": -25, + "y": -21, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_1_1.png", - "x_offset": -34, - "y_offset": -39, + "x": -34, + "y": -39, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_1_2.png", - "x_offset": -32, - "y_offset": -24, + "x": -32, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_1_3.png", - "x_offset": 1, - "y_offset": 8, + "x": 1, + "y": 8, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_1_4.png", - "x_offset": -28, - "y_offset": -25, + "x": -28, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_2_2.png", - "x_offset": -32, - "y_offset": -17, + "x": -32, + "y": -17, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_2_3.png", - "x_offset": -24, - "y_offset": 9, + "x": -24, + "y": 9, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_2_4.png", - "x_offset": -32, - "y_offset": -20, + "x": -32, + "y": -20, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_3_1.png", - "x_offset": -11, - "y_offset": -24, + "x": -11, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": -22, + "x": 0, + "y": -22, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_3_3.png", - "x_offset": -31, - "y_offset": -4, + "x": -31, + "y": -4, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_3_4.png", - "x_offset": -24, - "y_offset": -35, + "x": -24, + "y": -35, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_4_1.png", - "x_offset": -32, - "y_offset": -31, + "x": -32, + "y": -31, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_4_2.png", - "x_offset": -31, - "y_offset": -20, + "x": -31, + "y": -20, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_4_3.png", - "x_offset": 0, - "y_offset": -37, + "x": 0, + "y": -37, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_diag_gentle_up_4_4.png", - "x_offset": 0, - "y_offset": -35, + "x": 0, + "y": -35, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_1_1.png", - "x_offset": -34, - "y_offset": -31, + "x": -34, + "y": -31, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_1_2.png", - "x_offset": -24, - "y_offset": -20, + "x": -24, + "y": -20, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_1_3.png", - "x_offset": -16, - "y_offset": -37, + "x": -16, + "y": -37, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_1_4.png", - "x_offset": -32, - "y_offset": -35, + "x": -32, + "y": -35, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_2_1.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_2_2.png", - "x_offset": -34, - "y_offset": -22, + "x": -34, + "y": -22, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_2_3.png", - "x_offset": -2, - "y_offset": -4, + "x": -2, + "y": -4, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_2_4.png", - "x_offset": -15, - "y_offset": -35, + "x": -15, + "y": -35, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_3_1.png", - "x_offset": -13, - "y_offset": -12, + "x": -13, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_3_2.png", - "x_offset": -8, - "y_offset": -17, + "x": -8, + "y": -17, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_3_3.png", - "x_offset": 0, - "y_offset": 9, + "x": 0, + "y": 9, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_3_4.png", - "x_offset": 0, - "y_offset": -20, + "x": 0, + "y": -20, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_4_1.png", - "x_offset": -30, - "y_offset": -39, + "x": -30, + "y": -39, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_4_2.png", - "x_offset": -20, - "y_offset": -24, + "x": -20, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_4_3.png", - "x_offset": -32, - "y_offset": 8, + "x": -32, + "y": 8, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_diag_gentle_up_4_4.png", - "x_offset": -24, - "y_offset": -25, + "x": -24, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -14, + "x": 0, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": -14, + "x": 0, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_1_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_1_4.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_1_5.png", - "x_offset": -20, - "y_offset": -19, + "x": -20, + "y": -19, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_1_6.png", - "x_offset": -32, - "y_offset": -16, + "x": -32, + "y": -16, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_1_7.png", - "x_offset": -32, - "y_offset": -24, + "x": -32, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_1_8.png", - "x_offset": -32, - "y_offset": -25, + "x": -32, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_2_1.png", - "x_offset": -24, - "y_offset": -9, + "x": -24, + "y": -9, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_2_3.png", - "x_offset": -23, - "y_offset": -14, + "x": -23, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_2_4.png", - "x_offset": -27, - "y_offset": -11, + "x": -27, + "y": -11, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -27, + "x": -32, + "y": -27, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_3_3.png", - "x_offset": -32, - "y_offset": -23, + "x": -32, + "y": -23, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_3_4.png", - "x_offset": -34, - "y_offset": -24, + "x": -34, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_4_1.png", - "x_offset": -27, - "y_offset": -8, + "x": -27, + "y": -8, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_4_3.png", - "x_offset": -31, - "y_offset": -12, + "x": -31, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_left_bank_to_orthogonal_gentle_up_4_4.png", - "x_offset": -34, - "y_offset": -40, + "x": -34, + "y": -40, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -27, + "x": 0, + "y": -27, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": -23, + "x": -32, + "y": -23, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_1_4.png", - "x_offset": -32, - "y_offset": -24, + "x": -32, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_2_1.png", - "x_offset": 0, - "y_offset": -9, + "x": 0, + "y": -9, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_2_3.png", - "x_offset": -16, - "y_offset": -14, + "x": -16, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_2_4.png", - "x_offset": -34, - "y_offset": -11, + "x": -34, + "y": -11, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_3_1.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_3_2.png", - "x_offset": -32, - "y_offset": -14, + "x": -32, + "y": -14, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_3_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_3_4.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_3_5.png", - "x_offset": 0, - "y_offset": -19, + "x": 0, + "y": -19, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_3_6.png", - "x_offset": -16, - "y_offset": -16, + "x": -16, + "y": -16, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_3_7.png", - "x_offset": -9, - "y_offset": -24, + "x": -9, + "y": -24, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_3_8.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_4_1.png", - "x_offset": -24, - "y_offset": -8, + "x": -24, + "y": -8, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_4_3.png", - "x_offset": -22, - "y_offset": -12, + "x": -22, + "y": -12, "palette": "keep" }, { "path": "track/rmc/large_turn_right_bank_to_orthogonal_gentle_up_4_4.png", - "x_offset": -32, - "y_offset": -40, + "x": -32, + "y": -40, "palette": "keep" }, { "path": "track/rmc/flat_lift_1.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_lift_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_lift_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_lift_4.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_lift_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_lift_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_lift_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_lift_4.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_flat_lift_1.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_flat_lift_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_flat_lift_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_up_to_flat_lift_4.png", - "x_offset": -34, - "y_offset": -20, + "x": -34, + "y": -20, "palette": "keep" }, { "path": "track/rmc/gentle_lift_1.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_lift_2.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_lift_3.png", - "x_offset": -34, - "y_offset": -12, + "x": -34, + "y": -12, "palette": "keep" }, { "path": "track/rmc/gentle_lift_4.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_lift_1.png", - "x_offset": -34, - "y_offset": -41, + "x": -34, + "y": -41, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_lift_2_1.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_lift_2_2.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_lift_3_1.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_lift_3_2.png", - "x_offset": -34, - "y_offset": -25, + "x": -34, + "y": -25, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_lift_4.png", - "x_offset": -34, - "y_offset": -41, + "x": -34, + "y": -41, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_lift_1.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_lift_2_1.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_lift_2_2.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_lift_3_1.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_lift_3_2.png", - "x_offset": -34, - "y_offset": -28, + "x": -34, + "y": -28, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_lift_4.png", - "x_offset": -34, - "y_offset": -44, + "x": -34, + "y": -44, "palette": "keep" }, { "path": "track/rmc/steep_lift_1.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/steep_lift_2.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/steep_lift_3.png", - "x_offset": -34, - "y_offset": -57, + "x": -34, + "y": -57, "palette": "keep" }, { "path": "track/rmc/steep_lift_4.png", - "x_offset": -34, - "y_offset": -73, + "x": -34, + "y": -73, "palette": "keep" }, { "path": "track/rmc/flat_diag_lift_1.png", - "x_offset": -34, - "y_offset": -8, + "x": -34, + "y": -8, "palette": "keep" }, { "path": "track/rmc/flat_diag_lift_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/flat_diag_lift_3.png", - "x_offset": -34, - "y_offset": -8, + "x": -34, + "y": -8, "palette": "keep" }, { "path": "track/rmc/flat_diag_lift_4.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_diag_lift_1.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_diag_lift_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_diag_lift_3.png", - "x_offset": -34, - "y_offset": -15, + "x": -34, + "y": -15, "palette": "keep" }, { "path": "track/rmc/flat_to_gentle_up_diag_lift_4.png", - "x_offset": -24, - "y_offset": -22, + "x": -24, + "y": -22, "palette": "keep" }, { "path": "track/rmc/gentle_to_flat_up_diag_lift_1.png", - "x_offset": -53, - "y_offset": -16, + "x": -53, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_to_flat_up_diag_lift_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/gentle_to_flat_up_diag_lift_3.png", - "x_offset": -34, - "y_offset": -16, + "x": -34, + "y": -16, "palette": "keep" }, { "path": "track/rmc/gentle_to_flat_up_diag_lift_4.png", - "x_offset": -24, - "y_offset": -22, + "x": -24, + "y": -22, "palette": "keep" }, { "path": "track/rmc/gentle_diag_lift_1.png", - "x_offset": -54, - "y_offset": -23, + "x": -54, + "y": -23, "palette": "keep" }, { "path": "track/rmc/gentle_diag_lift_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/gentle_diag_lift_3.png", - "x_offset": -34, - "y_offset": -23, + "x": -34, + "y": -23, "palette": "keep" }, { "path": "track/rmc/gentle_diag_lift_4.png", - "x_offset": -24, - "y_offset": -30, + "x": -24, + "y": -30, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_diag_lift_1.png", - "x_offset": -56, - "y_offset": -37, + "x": -56, + "y": -37, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_diag_lift_2.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_diag_lift_3.png", - "x_offset": -35, - "y_offset": -37, + "x": -35, + "y": -37, "palette": "keep" }, { "path": "track/rmc/gentle_to_steep_up_diag_lift_4.png", - "x_offset": -24, - "y_offset": -46, + "x": -24, + "y": -46, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_diag_lift_1.png", - "x_offset": -49, - "y_offset": -39, + "x": -49, + "y": -39, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_diag_lift_2.png", - "x_offset": -24, - "y_offset": -19, + "x": -24, + "y": -19, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_diag_lift_3.png", - "x_offset": -34, - "y_offset": -39, + "x": -34, + "y": -39, "palette": "keep" }, { "path": "track/rmc/steep_to_gentle_up_diag_lift_4.png", - "x_offset": -24, - "y_offset": -46, + "x": -24, + "y": -46, "palette": "keep" }, { "path": "track/rmc/steep_diag_lift_1.png", - "x_offset": -48, - "y_offset": -69, + "x": -48, + "y": -69, "palette": "keep" }, { "path": "track/rmc/steep_diag_lift_2.png", - "x_offset": -24, - "y_offset": -46, + "x": -24, + "y": -46, "palette": "keep" }, { "path": "track/rmc/steep_diag_lift_3.png", - "x_offset": -35, - "y_offset": -69, + "x": -35, + "y": -69, "palette": "keep" }, { "path": "track/rmc/steep_diag_lift_4.png", - "x_offset": -24, - "y_offset": -78, + "x": -24, + "y": -78, "palette": "keep" }, { "path": "track/raptor/preview_track.png", - "x_offset": 9, - "y_offset": 3 + "x": 9, + "y": 3 }, { "path": "track/raptor/preview_support.png", - "x_offset": 24, - "y_offset": 13 + "x": 24, + "y": 13 }, { "path": "track/raptor/flat_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_2.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/brake_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/brake_2.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/block_brake_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/block_brake_2.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_to_gentle_up_1.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/flat_to_gentle_up_2.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_to_gentle_up_3.png", - "x_offset": -19, - "y_offset": 2 + "x": -19, + "y": 2 }, { "path": "track/raptor/flat_to_gentle_up_4.png", - "x_offset": -19, - "y_offset": -6 + "x": -19, + "y": -6 }, { "path": "track/raptor/gentle_up_to_flat_1.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/gentle_up_to_flat_2.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_up_to_flat_3.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_up_to_flat_4.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/gentle_1.png", - "x_offset": -18, - "y_offset": -14 + "x": -18, + "y": -14 }, { "path": "track/raptor/gentle_2.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_3.png", - "x_offset": -19, - "y_offset": 1 + "x": -19, + "y": 1 }, { "path": "track/raptor/gentle_4.png", - "x_offset": -19, - "y_offset": -14 + "x": -19, + "y": -14 }, { "path": "track/raptor/gentle_to_steep_up_1.png", - "x_offset": -18, - "y_offset": -30 + "x": -18, + "y": -30 }, { "path": "track/raptor/gentle_to_steep_up_2_1.png", - "x_offset": -18, - "y_offset": 0 + "x": -18, + "y": 0 }, { "path": "track/raptor/gentle_to_steep_up_2_2.png", - "x_offset": -17, - "y_offset": -14 + "x": -17, + "y": -14 }, { "path": "track/raptor/gentle_to_steep_up_3_1.png", - "x_offset": 2, - "y_offset": 0 + "x": 2, + "y": 0 }, { "path": "track/raptor/gentle_to_steep_up_3_2.png", - "x_offset": -21, - "y_offset": -14 + "x": -21, + "y": -14 }, { "path": "track/raptor/gentle_to_steep_up_4.png", - "x_offset": -21, - "y_offset": -30 + "x": -21, + "y": -30 }, { "path": "track/raptor/steep_to_gentle_up_1.png", - "x_offset": -18, - "y_offset": -30 + "x": -18, + "y": -30 }, { "path": "track/raptor/steep_to_gentle_up_2_1.png", - "x_offset": -5, - "y_offset": -15 + "x": -5, + "y": -15 }, { "path": "track/raptor/steep_to_gentle_up_2_2.png", - "x_offset": -18, - "y_offset": -10 + "x": -18, + "y": -10 }, { "path": "track/raptor/steep_to_gentle_up_3_1.png", - "x_offset": -19, - "y_offset": -15 + "x": -19, + "y": -15 }, { "path": "track/raptor/steep_to_gentle_up_3_2.png", - "x_offset": -12, - "y_offset": -10 + "x": -12, + "y": -10 }, { "path": "track/raptor/steep_to_gentle_up_4.png", - "x_offset": -19, - "y_offset": -30 + "x": -19, + "y": -30 }, { "path": "track/raptor/steep_1.png", - "x_offset": -18, - "y_offset": -62 + "x": -18, + "y": -62 }, { "path": "track/raptor/steep_2.png", - "x_offset": -18, - "y_offset": -46 + "x": -18, + "y": -46 }, { "path": "track/raptor/steep_3.png", - "x_offset": -21, - "y_offset": -46 + "x": -21, + "y": -46 }, { "path": "track/raptor/steep_4.png", - "x_offset": -21, - "y_offset": -62 + "x": -21, + "y": -62 }, { "path": "track/raptor/steep_to_vertical_up_1.png", - "x_offset": -18, - "y_offset": -48 + "x": -18, + "y": -48 }, { "path": "track/raptor/steep_to_vertical_up_2.png", - "x_offset": -18, - "y_offset": -46 + "x": -18, + "y": -46 }, { "path": "track/raptor/steep_to_vertical_up_3.png", - "x_offset": -6, - "y_offset": -46 + "x": -6, + "y": -46 }, { "path": "track/raptor/steep_to_vertical_up_4.png", - "x_offset": -6, - "y_offset": -48 + "x": -6, + "y": -48 }, { "path": "track/raptor/vertical_to_steep_up_1.png", - "x_offset": -2, - "y_offset": -54 + "x": -2, + "y": -54 }, { "path": "track/raptor/vertical_to_steep_up_2.png", - "x_offset": -2, - "y_offset": -38 + "x": -2, + "y": -38 }, { "path": "track/raptor/vertical_to_steep_up_3.png", - "x_offset": -21, - "y_offset": -38 + "x": -21, + "y": -38 }, { "path": "track/raptor/vertical_to_steep_up_4.png", - "x_offset": -21, - "y_offset": -54 + "x": -21, + "y": -54 }, { "path": "track/raptor/vertical_1.png", - "x_offset": -2, - "y_offset": -24 + "x": -2, + "y": -24 }, { "path": "track/raptor/vertical_2.png", - "x_offset": -2, - "y_offset": -22 + "x": -2, + "y": -22 }, { "path": "track/raptor/vertical_3.png", - "x_offset": -6, - "y_offset": -22 + "x": -6, + "y": -22 }, { "path": "track/raptor/vertical_4.png", - "x_offset": -6, - "y_offset": -24 + "x": -6, + "y": -24 }, { "path": "track/raptor/small_turn_left_1_1.png", - "x_offset": -18, - "y_offset": -1 + "x": -18, + "y": -1 }, { "path": "track/raptor/small_turn_left_1_2.png", - "x_offset": -32, - "y_offset": 2 + "x": -32, + "y": 2 }, { "path": "track/raptor/small_turn_left_1_3.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/small_turn_left_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/small_turn_left_2_2.png", - "x_offset": -4, - "y_offset": 0 + "x": -4, + "y": 0 }, { "path": "track/raptor/small_turn_left_2_3.png", - "x_offset": -32, - "y_offset": 2 + "x": -32, + "y": 2 }, { "path": "track/raptor/small_turn_left_3_1.png", - "x_offset": -4, - "y_offset": 2 + "x": -4, + "y": 2 }, { "path": "track/raptor/small_turn_left_3_2.png", - "x_offset": 25, - "y_offset": 1 + "x": 25, + "y": 1 }, { "path": "track/raptor/small_turn_left_3_3.png", - "x_offset": -7, - "y_offset": -1 + "x": -7, + "y": -1 }, { "path": "track/raptor/small_turn_left_4_1.png", - "x_offset": -28, - "y_offset": 7 + "x": -28, + "y": 7 }, { "path": "track/raptor/small_turn_left_4_2.png", - "x_offset": -8, - "y_offset": 23 + "x": -8, + "y": 23 }, { "path": "track/raptor/small_turn_left_4_3.png", - "x_offset": -18, - "y_offset": 7 + "x": -18, + "y": 7 }, { "path": "track/raptor/medium_turn_left_1_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/medium_turn_left_1_2.png", - "x_offset": -28, - "y_offset": 6 + "x": -28, + "y": 6 }, { "path": "track/raptor/medium_turn_left_1_3.png", - "x_offset": 9, - "y_offset": 6 + "x": 9, + "y": 6 }, { "path": "track/raptor/medium_turn_left_1_4.png", - "x_offset": -24, - "y_offset": 9 + "x": -24, + "y": 9 }, { "path": "track/raptor/medium_turn_left_1_5.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/medium_turn_left_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/medium_turn_left_2_2.png", - "x_offset": -10, - "y_offset": 0 + "x": -10, + "y": 0 }, { "path": "track/raptor/medium_turn_left_2_3.png", - "x_offset": -32, - "y_offset": 15 + "x": -32, + "y": 15 }, { "path": "track/raptor/medium_turn_left_2_4.png", - "x_offset": -16, - "y_offset": 0 + "x": -16, + "y": 0 }, { "path": "track/raptor/medium_turn_left_2_5.png", - "x_offset": -32, - "y_offset": 2 + "x": -32, + "y": 2 }, { "path": "track/raptor/medium_turn_left_3_1.png", - "x_offset": -14, - "y_offset": 2 + "x": -14, + "y": 2 }, { "path": "track/raptor/medium_turn_left_3_2.png", - "x_offset": 12, - "y_offset": 9 + "x": 12, + "y": 9 }, { "path": "track/raptor/medium_turn_left_3_3.png", - "x_offset": -20, - "y_offset": 6 + "x": -20, + "y": 6 }, { "path": "track/raptor/medium_turn_left_3_4.png", - "x_offset": 13, - "y_offset": 6 + "x": 13, + "y": 6 }, { "path": "track/raptor/medium_turn_left_3_5.png", - "x_offset": -11, - "y_offset": 2 + "x": -11, + "y": 2 }, { "path": "track/raptor/medium_turn_left_4_1.png", - "x_offset": -23, - "y_offset": 6 + "x": -23, + "y": 6 }, { "path": "track/raptor/medium_turn_left_4_2.png", - "x_offset": -30, - "y_offset": 16 + "x": -30, + "y": 16 }, { "path": "track/raptor/medium_turn_left_4_3.png", - "x_offset": -16, - "y_offset": 0 + "x": -16, + "y": 0 }, { "path": "track/raptor/medium_turn_left_4_4.png", - "x_offset": -18, - "y_offset": 16 + "x": -18, + "y": 16 }, { "path": "track/raptor/medium_turn_left_4_5.png", - "x_offset": -18, - "y_offset": 6 + "x": -18, + "y": 6 }, { "path": "track/raptor/large_turn_left_to_diag_1_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/large_turn_left_to_diag_1_2.png", - "x_offset": -26, - "y_offset": 1 + "x": -26, + "y": 1 }, { "path": "track/raptor/large_turn_left_to_diag_1_3.png", - "x_offset": 17, - "y_offset": 12 + "x": 17, + "y": 12 }, { "path": "track/raptor/large_turn_left_to_diag_1_4.png", - "x_offset": -8, - "y_offset": 10 + "x": -8, + "y": 10 }, { "path": "track/raptor/large_turn_left_to_diag_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/large_turn_left_to_diag_2_2.png", - "x_offset": -12, - "y_offset": 1 + "x": -12, + "y": 1 }, { "path": "track/raptor/large_turn_left_to_diag_2_3.png", - "x_offset": -24, - "y_offset": 19 + "x": -24, + "y": 19 }, { "path": "track/raptor/large_turn_left_to_diag_2_4.png", - "x_offset": -30, - "y_offset": 8 + "x": -30, + "y": 8 }, { "path": "track/raptor/large_turn_left_to_diag_3_1.png", - "x_offset": -16, - "y_offset": 2 + "x": -16, + "y": 2 }, { "path": "track/raptor/large_turn_left_to_diag_3_2.png", - "x_offset": -1, - "y_offset": 7 + "x": -1, + "y": 7 }, { "path": "track/raptor/large_turn_left_to_diag_3_3.png", - "x_offset": -32, - "y_offset": 11 + "x": -32, + "y": 11 }, { "path": "track/raptor/large_turn_left_to_diag_3_4.png", - "x_offset": -3, - "y_offset": -1 + "x": -3, + "y": -1 }, { "path": "track/raptor/large_turn_left_to_diag_4_1.png", - "x_offset": -21, - "y_offset": 6 + "x": -21, + "y": 6 }, { "path": "track/raptor/large_turn_left_to_diag_4_2.png", - "x_offset": -32, - "y_offset": 11 + "x": -32, + "y": 11 }, { "path": "track/raptor/large_turn_left_to_diag_4_3.png", - "x_offset": -4, - "y_offset": 0 + "x": -4, + "y": 0 }, { "path": "track/raptor/large_turn_left_to_diag_4_4.png", - "x_offset": 0, - "y_offset": 9 + "x": 0, + "y": 9 }, { "path": "track/raptor/large_turn_right_to_diag_1_1.png", - "x_offset": -18, - "y_offset": 6 + "x": -18, + "y": 6 }, { "path": "track/raptor/large_turn_right_to_diag_1_2.png", - "x_offset": -20, - "y_offset": 11 + "x": -20, + "y": 11 }, { "path": "track/raptor/large_turn_right_to_diag_1_3.png", - "x_offset": -6, - "y_offset": 0 + "x": -6, + "y": 0 }, { "path": "track/raptor/large_turn_right_to_diag_1_4.png", - "x_offset": -32, - "y_offset": 9 + "x": -32, + "y": 9 }, { "path": "track/raptor/large_turn_right_to_diag_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/large_turn_right_to_diag_2_2.png", - "x_offset": -22, - "y_offset": 7 + "x": -22, + "y": 7 }, { "path": "track/raptor/large_turn_right_to_diag_2_3.png", - "x_offset": 23, - "y_offset": 11 + "x": 23, + "y": 11 }, { "path": "track/raptor/large_turn_right_to_diag_2_4.png", - "x_offset": -5, - "y_offset": -1 + "x": -5, + "y": -1 }, { "path": "track/raptor/large_turn_right_to_diag_3_1.png", - "x_offset": -29, - "y_offset": 2 + "x": -29, + "y": 2 }, { "path": "track/raptor/large_turn_right_to_diag_3_2.png", - "x_offset": -28, - "y_offset": 1 + "x": -28, + "y": 1 }, { "path": "track/raptor/large_turn_right_to_diag_3_3.png", - "x_offset": -14, - "y_offset": 19 + "x": -14, + "y": 19 }, { "path": "track/raptor/large_turn_right_to_diag_3_4.png", - "x_offset": 0, - "y_offset": 8 + "x": 0, + "y": 8 }, { "path": "track/raptor/large_turn_right_to_diag_4_1.png", - "x_offset": -12, - "y_offset": 2 + "x": -12, + "y": 2 }, { "path": "track/raptor/large_turn_right_to_diag_4_2.png", - "x_offset": 2, - "y_offset": 1 + "x": 2, + "y": 1 }, { "path": "track/raptor/large_turn_right_to_diag_4_3.png", - "x_offset": -31, - "y_offset": 12 + "x": -31, + "y": 12 }, { "path": "track/raptor/large_turn_right_to_diag_4_4.png", - "x_offset": -3, - "y_offset": 10 + "x": -3, + "y": 10 }, { "path": "track/raptor/flat_diag_1.png", - "x_offset": -32, - "y_offset": 9 + "x": -32, + "y": 9 }, { "path": "track/raptor/flat_diag_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/brake_diag_1.png", - "x_offset": -32, - "y_offset": 9, + "x": -32, + "y": 9, "palette": "keep" }, { "path": "track/raptor/brake_diag_2.png", - "x_offset": -3, - "y_offset": -6, + "x": -3, + "y": -6, "palette": "keep" }, { "path": "track/raptor/block_brake_diag_1.png", - "x_offset": -32, - "y_offset": 9, + "x": -32, + "y": 9, "palette": "keep" }, { "path": "track/raptor/block_brake_diag_2.png", - "x_offset": -3, - "y_offset": -6, + "x": -3, + "y": -6, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_diag_1.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/flat_to_gentle_up_diag_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/flat_to_gentle_up_diag_3.png", - "x_offset": -33, - "y_offset": 1 + "x": -33, + "y": 1 }, { "path": "track/raptor/flat_to_gentle_up_diag_4.png", - "x_offset": -3, - "y_offset": -14 + "x": -3, + "y": -14 }, { "path": "track/raptor/gentle_to_flat_up_diag_1.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/gentle_to_flat_up_diag_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/gentle_to_flat_up_diag_3.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/gentle_to_flat_up_diag_4.png", - "x_offset": -3, - "y_offset": -14 + "x": -3, + "y": -14 }, { "path": "track/raptor/gentle_diag_1.png", - "x_offset": -32, - "y_offset": -7 + "x": -32, + "y": -7 }, { "path": "track/raptor/gentle_diag_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/gentle_diag_3.png", - "x_offset": -32, - "y_offset": -7 + "x": -32, + "y": -7 }, { "path": "track/raptor/gentle_diag_4.png", - "x_offset": -3, - "y_offset": -22 + "x": -3, + "y": -22 }, { "path": "track/raptor/gentle_to_steep_up_diag_1.png", - "x_offset": -32, - "y_offset": -23 + "x": -32, + "y": -23 }, { "path": "track/raptor/gentle_to_steep_up_diag_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/gentle_to_steep_up_diag_3.png", - "x_offset": -32, - "y_offset": -23 + "x": -32, + "y": -23 }, { "path": "track/raptor/gentle_to_steep_up_diag_4.png", - "x_offset": -3, - "y_offset": -38 + "x": -3, + "y": -38 }, { "path": "track/raptor/steep_to_gentle_up_diag_1.png", - "x_offset": -32, - "y_offset": -23 + "x": -32, + "y": -23 }, { "path": "track/raptor/steep_to_gentle_up_diag_2.png", - "x_offset": -3, - "y_offset": -11 + "x": -3, + "y": -11 }, { "path": "track/raptor/steep_to_gentle_up_diag_3.png", - "x_offset": -32, - "y_offset": -23 + "x": -32, + "y": -23 }, { "path": "track/raptor/steep_to_gentle_up_diag_4.png", - "x_offset": -3, - "y_offset": -38 + "x": -3, + "y": -38 }, { "path": "track/raptor/steep_diag_1.png", - "x_offset": -32, - "y_offset": -55 + "x": -32, + "y": -55 }, { "path": "track/raptor/steep_diag_2.png", - "x_offset": -3, - "y_offset": -38 + "x": -3, + "y": -38 }, { "path": "track/raptor/steep_diag_3.png", - "x_offset": -32, - "y_offset": -55 + "x": -32, + "y": -55 }, { "path": "track/raptor/steep_diag_4.png", - "x_offset": -3, - "y_offset": -70 + "x": -3, + "y": -70 }, { "path": "track/raptor/flat_to_left_bank_1_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_to_left_bank_1_2.png", - "x_offset": 1, - "y_offset": 2 + "x": 1, + "y": 2 }, { "path": "track/raptor/flat_to_left_bank_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_to_left_bank_2_2.png", - "x_offset": -17, - "y_offset": 8 + "x": -17, + "y": 8 }, { "path": "track/raptor/flat_to_left_bank_3.png", - "x_offset": -19, - "y_offset": 2 + "x": -19, + "y": 2 }, { "path": "track/raptor/flat_to_left_bank_4.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/flat_to_right_bank_1.png", - "x_offset": -18, - "y_offset": 0 + "x": -18, + "y": 0 }, { "path": "track/raptor/flat_to_right_bank_2.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_to_right_bank_3_1.png", - "x_offset": -13, - "y_offset": 2 + "x": -13, + "y": 2 }, { "path": "track/raptor/flat_to_right_bank_3_2.png", - "x_offset": -17, - "y_offset": 8 + "x": -17, + "y": 8 }, { "path": "track/raptor/flat_to_right_bank_4_1.png", - "x_offset": -16, - "y_offset": 2 + "x": -16, + "y": 2 }, { "path": "track/raptor/flat_to_right_bank_4_2.png", - "x_offset": -20, - "y_offset": 2 + "x": -20, + "y": 2 }, { "path": "track/raptor/left_bank_to_gentle_up_1_1.png", - "x_offset": -13, - "y_offset": -6 + "x": -13, + "y": -6 }, { "path": "track/raptor/left_bank_to_gentle_up_1_2.png", - "x_offset": -17, - "y_offset": 7 + "x": -17, + "y": 7 }, { "path": "track/raptor/left_bank_to_gentle_up_2_1.png", - "x_offset": -16, - "y_offset": 2 + "x": -16, + "y": 2 }, { "path": "track/raptor/left_bank_to_gentle_up_2_2.png", - "x_offset": -20, - "y_offset": 2 + "x": -20, + "y": 2 }, { "path": "track/raptor/left_bank_to_gentle_up_3.png", - "x_offset": -19, - "y_offset": 0 + "x": -19, + "y": 0 }, { "path": "track/raptor/left_bank_to_gentle_up_4.png", - "x_offset": -19, - "y_offset": -6 + "x": -19, + "y": -6 }, { "path": "track/raptor/right_bank_to_gentle_up_1.png", - "x_offset": -19, - "y_offset": -6 + "x": -19, + "y": -6 }, { "path": "track/raptor/right_bank_to_gentle_up_2.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/right_bank_to_gentle_up_3_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/right_bank_to_gentle_up_3_2.png", - "x_offset": -5, - "y_offset": 2 + "x": -5, + "y": 2 }, { "path": "track/raptor/right_bank_to_gentle_up_4_1.png", - "x_offset": -19, - "y_offset": -6 + "x": -19, + "y": -6 }, { "path": "track/raptor/right_bank_to_gentle_up_4_2.png", - "x_offset": -10, - "y_offset": 7 + "x": -10, + "y": 7 }, { "path": "track/raptor/gentle_up_to_left_bank_1_1.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/gentle_up_to_left_bank_1_2.png", - "x_offset": 3, - "y_offset": -6 + "x": 3, + "y": -6 }, { "path": "track/raptor/gentle_up_to_left_bank_2_1.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_up_to_left_bank_2_2.png", - "x_offset": -16, - "y_offset": 4 + "x": -16, + "y": 4 }, { "path": "track/raptor/gentle_up_to_left_bank_3.png", - "x_offset": -19, - "y_offset": 1 + "x": -19, + "y": 1 }, { "path": "track/raptor/gentle_up_to_left_bank_4.png", - "x_offset": -17, - "y_offset": -8 + "x": -17, + "y": -8 }, { "path": "track/raptor/gentle_up_to_right_bank_1.png", - "x_offset": -18, - "y_offset": -8 + "x": -18, + "y": -8 }, { "path": "track/raptor/gentle_up_to_right_bank_2.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_up_to_right_bank_3_1.png", - "x_offset": -13, - "y_offset": 1 + "x": -13, + "y": 1 }, { "path": "track/raptor/gentle_up_to_right_bank_3_2.png", - "x_offset": -17, - "y_offset": 4 + "x": -17, + "y": 4 }, { "path": "track/raptor/gentle_up_to_right_bank_4_1.png", - "x_offset": -17, - "y_offset": -6 + "x": -17, + "y": -6 }, { "path": "track/raptor/gentle_up_to_right_bank_4_2.png", - "x_offset": -20, - "y_offset": -6 + "x": -20, + "y": -6 }, { "path": "track/raptor/left_bank_1.png", - "x_offset": -17, - "y_offset": 2 + "x": -17, + "y": 2 }, { "path": "track/raptor/left_bank_2.png", - "x_offset": -20, - "y_offset": 2 + "x": -20, + "y": 2 }, { "path": "track/raptor/left_bank_3.png", - "x_offset": -19, - "y_offset": 0 + "x": -19, + "y": 0 }, { "path": "track/raptor/left_bank_4.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/flat_to_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": 9 + "x": -32, + "y": 9 }, { "path": "track/raptor/flat_to_left_bank_diag_1_2.png", - "x_offset": -30, - "y_offset": 9 + "x": -30, + "y": 9 }, { "path": "track/raptor/flat_to_left_bank_diag_2.png", - "x_offset": -5, - "y_offset": -6 + "x": -5, + "y": -6 }, { "path": "track/raptor/flat_to_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": 8 + "x": -32, + "y": 8 }, { "path": "track/raptor/flat_to_left_bank_diag_4.png", - "x_offset": -3, - "y_offset": -7 + "x": -3, + "y": -7 }, { "path": "track/raptor/flat_to_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": 8 + "x": -32, + "y": 8 }, { "path": "track/raptor/flat_to_right_bank_diag_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/flat_to_right_bank_diag_3_1.png", - "x_offset": -31, - "y_offset": 9 + "x": -31, + "y": 9 }, { "path": "track/raptor/flat_to_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": 9 + "x": -32, + "y": 9 }, { "path": "track/raptor/flat_to_right_bank_diag_4.png", - "x_offset": -6, - "y_offset": -7 + "x": -6, + "y": -7 }, { "path": "track/raptor/left_bank_to_gentle_up_diag_1_1.png", - "x_offset": -31, - "y_offset": 1 + "x": -31, + "y": 1 }, { "path": "track/raptor/left_bank_to_gentle_up_diag_1_2.png", - "x_offset": -32, - "y_offset": 8 + "x": -32, + "y": 8 }, { "path": "track/raptor/left_bank_to_gentle_up_diag_2.png", - "x_offset": -6, - "y_offset": -7 + "x": -6, + "y": -7 }, { "path": "track/raptor/left_bank_to_gentle_up_diag_3.png", - "x_offset": -33, - "y_offset": 1 + "x": -33, + "y": 1 }, { "path": "track/raptor/left_bank_to_gentle_up_diag_4.png", - "x_offset": -3, - "y_offset": -14 + "x": -3, + "y": -14 }, { "path": "track/raptor/right_bank_to_gentle_up_diag_1.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/right_bank_to_gentle_up_diag_2.png", - "x_offset": -3, - "y_offset": -7 + "x": -3, + "y": -7 }, { "path": "track/raptor/right_bank_to_gentle_up_diag_3_1.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/right_bank_to_gentle_up_diag_3_2.png", - "x_offset": -31, - "y_offset": 8 + "x": -31, + "y": 8 }, { "path": "track/raptor/right_bank_to_gentle_up_diag_4.png", - "x_offset": -5, - "y_offset": -14 + "x": -5, + "y": -14 }, { "path": "track/raptor/gentle_up_to_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": 3 + "x": -32, + "y": 3 }, { "path": "track/raptor/gentle_up_to_left_bank_diag_1_2.png", - "x_offset": -31, - "y_offset": 1 + "x": -31, + "y": 1 }, { "path": "track/raptor/gentle_up_to_left_bank_diag_2.png", - "x_offset": -5, - "y_offset": -6 + "x": -5, + "y": -6 }, { "path": "track/raptor/gentle_up_to_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": 0 + "x": -32, + "y": 0 }, { "path": "track/raptor/gentle_up_to_left_bank_diag_4.png", - "x_offset": -3, - "y_offset": -15 + "x": -3, + "y": -15 }, { "path": "track/raptor/gentle_up_to_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": 0 + "x": -32, + "y": 0 }, { "path": "track/raptor/gentle_up_to_right_bank_diag_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/gentle_up_to_right_bank_diag_3_1.png", - "x_offset": -31, - "y_offset": 1 + "x": -31, + "y": 1 }, { "path": "track/raptor/gentle_up_to_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/gentle_up_to_right_bank_diag_4.png", - "x_offset": -6, - "y_offset": -15 + "x": -6, + "y": -15 }, { "path": "track/raptor/left_bank_diag_1.png", - "x_offset": -32, - "y_offset": 9 + "x": -32, + "y": 9 }, { "path": "track/raptor/left_bank_diag_2.png", - "x_offset": -6, - "y_offset": -7 + "x": -6, + "y": -7 }, { "path": "track/raptor/left_bank_diag_3.png", - "x_offset": -32, - "y_offset": 8 + "x": -32, + "y": 8 }, { "path": "track/raptor/left_bank_diag_4.png", - "x_offset": -2, - "y_offset": -7 + "x": -2, + "y": -7 }, { "path": "track/raptor/small_turn_left_bank_1_1.png", - "x_offset": -5, - "y_offset": -1 + "x": -5, + "y": -1 }, { "path": "track/raptor/small_turn_left_bank_1_2.png", - "x_offset": -17, - "y_offset": -1 + "x": -17, + "y": -1 }, { "path": "track/raptor/small_turn_left_bank_1_3.png", - "x_offset": -32, - "y_offset": 2 + "x": -32, + "y": 2 }, { "path": "track/raptor/small_turn_left_bank_1_4.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/small_turn_left_bank_2_1.png", - "x_offset": -20, - "y_offset": 2 + "x": -20, + "y": 2 }, { "path": "track/raptor/small_turn_left_bank_2_2.png", - "x_offset": -4, - "y_offset": 0 + "x": -4, + "y": 0 }, { "path": "track/raptor/small_turn_left_bank_2_3.png", - "x_offset": -32, - "y_offset": 2 + "x": -32, + "y": 2 }, { "path": "track/raptor/small_turn_left_bank_3_1.png", - "x_offset": -6, - "y_offset": 0 + "x": -6, + "y": 0 }, { "path": "track/raptor/small_turn_left_bank_3_2.png", - "x_offset": 23, - "y_offset": 1 + "x": 23, + "y": 1 }, { "path": "track/raptor/small_turn_left_bank_3_3.png", - "x_offset": -8, - "y_offset": -1 + "x": -8, + "y": -1 }, { "path": "track/raptor/small_turn_left_bank_3_4.png", - "x_offset": -9, - "y_offset": -1 + "x": -9, + "y": -1 }, { "path": "track/raptor/small_turn_left_bank_4_1.png", - "x_offset": -26, - "y_offset": 6 + "x": -26, + "y": 6 }, { "path": "track/raptor/small_turn_left_bank_4_2.png", - "x_offset": -8, - "y_offset": 22 + "x": -8, + "y": 22 }, { "path": "track/raptor/small_turn_left_bank_4_3.png", - "x_offset": -19, - "y_offset": 6 + "x": -19, + "y": 6 }, { "path": "track/raptor/medium_turn_left_bank_1_1.png", - "x_offset": 3, - "y_offset": 3 + "x": 3, + "y": 3 }, { "path": "track/raptor/medium_turn_left_bank_1_2.png", - "x_offset": -17, - "y_offset": 3 + "x": -17, + "y": 3 }, { "path": "track/raptor/medium_turn_left_bank_1_3.png", - "x_offset": -26, - "y_offset": 5 + "x": -26, + "y": 5 }, { "path": "track/raptor/medium_turn_left_bank_1_4.png", - "x_offset": 12, - "y_offset": 7 + "x": 12, + "y": 7 }, { "path": "track/raptor/medium_turn_left_bank_1_5.png", - "x_offset": -22, - "y_offset": 8 + "x": -22, + "y": 8 }, { "path": "track/raptor/medium_turn_left_bank_1_6.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/medium_turn_left_bank_2_1.png", - "x_offset": -20, - "y_offset": 2 + "x": -20, + "y": 2 }, { "path": "track/raptor/medium_turn_left_bank_2_2.png", - "x_offset": -10, - "y_offset": 0 + "x": -10, + "y": 0 }, { "path": "track/raptor/medium_turn_left_bank_2_3.png", - "x_offset": -30, - "y_offset": 16 + "x": -30, + "y": 16 }, { "path": "track/raptor/medium_turn_left_bank_2_4.png", - "x_offset": -16, - "y_offset": 0 + "x": -16, + "y": 0 }, { "path": "track/raptor/medium_turn_left_bank_2_5.png", - "x_offset": -30, - "y_offset": 2 + "x": -30, + "y": 2 }, { "path": "track/raptor/medium_turn_left_bank_3_1.png", - "x_offset": -15, - "y_offset": 0 + "x": -15, + "y": 0 }, { "path": "track/raptor/medium_turn_left_bank_3_2.png", - "x_offset": 9, - "y_offset": 8 + "x": 9, + "y": 8 }, { "path": "track/raptor/medium_turn_left_bank_3_3.png", - "x_offset": -23, - "y_offset": 7 + "x": -23, + "y": 7 }, { "path": "track/raptor/medium_turn_left_bank_3_4.png", - "x_offset": 11, - "y_offset": 5 + "x": 11, + "y": 5 }, { "path": "track/raptor/medium_turn_left_bank_3_5.png", - "x_offset": -6, - "y_offset": 3 + "x": -6, + "y": 3 }, { "path": "track/raptor/medium_turn_left_bank_3_6.png", - "x_offset": -11, - "y_offset": 3 + "x": -11, + "y": 3 }, { "path": "track/raptor/medium_turn_left_bank_4_1.png", - "x_offset": -20, - "y_offset": 5 + "x": -20, + "y": 5 }, { "path": "track/raptor/medium_turn_left_bank_4_2.png", - "x_offset": -32, - "y_offset": 15 + "x": -32, + "y": 15 }, { "path": "track/raptor/medium_turn_left_bank_4_3.png", - "x_offset": -12, - "y_offset": 0 + "x": -12, + "y": 0 }, { "path": "track/raptor/medium_turn_left_bank_4_4.png", - "x_offset": -20, - "y_offset": 15 + "x": -20, + "y": 15 }, { "path": "track/raptor/medium_turn_left_bank_4_5.png", - "x_offset": -19, - "y_offset": 5 + "x": -19, + "y": 5 }, { "path": "track/raptor/large_turn_left_to_diag_bank_1_1.png", - "x_offset": -17, - "y_offset": 3 + "x": -17, + "y": 3 }, { "path": "track/raptor/large_turn_left_to_diag_bank_1_2.png", - "x_offset": -24, - "y_offset": 0 + "x": -24, + "y": 0 }, { "path": "track/raptor/large_turn_left_to_diag_bank_1_3.png", - "x_offset": 21, - "y_offset": 13 + "x": 21, + "y": 13 }, { "path": "track/raptor/large_turn_left_to_diag_bank_1_4.png", - "x_offset": -11, - "y_offset": 9 + "x": -11, + "y": 9 }, { "path": "track/raptor/large_turn_left_to_diag_bank_2_1.png", - "x_offset": -20, - "y_offset": 2 + "x": -20, + "y": 2 }, { "path": "track/raptor/large_turn_left_to_diag_bank_2_2.png", - "x_offset": -32, - "y_offset": -7 + "x": -32, + "y": -7 }, { "path": "track/raptor/large_turn_left_to_diag_bank_2_3.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/large_turn_left_to_diag_bank_2_4.png", - "x_offset": -32, - "y_offset": 8 + "x": -32, + "y": 8 }, { "path": "track/raptor/large_turn_left_to_diag_bank_3_1.png", - "x_offset": -18, - "y_offset": 0 + "x": -18, + "y": 0 }, { "path": "track/raptor/large_turn_left_to_diag_bank_3_2.png", - "x_offset": -2, - "y_offset": 7 + "x": -2, + "y": 7 }, { "path": "track/raptor/large_turn_left_to_diag_bank_3_3.png", - "x_offset": -32, - "y_offset": 13 + "x": -32, + "y": 13 }, { "path": "track/raptor/large_turn_left_to_diag_bank_3_4.png", - "x_offset": -5, - "y_offset": -2 + "x": -5, + "y": -2 }, { "path": "track/raptor/large_turn_left_to_diag_bank_4_1.png", - "x_offset": -18, - "y_offset": 5 + "x": -18, + "y": 5 }, { "path": "track/raptor/large_turn_left_to_diag_bank_4_2.png", - "x_offset": -32, - "y_offset": 10 + "x": -32, + "y": 10 }, { "path": "track/raptor/large_turn_left_to_diag_bank_4_3.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/large_turn_left_to_diag_bank_4_4.png", - "x_offset": 0, - "y_offset": 8 + "x": 0, + "y": 8 }, { "path": "track/raptor/large_turn_right_to_diag_bank_1_1.png", - "x_offset": -19, - "y_offset": 5 + "x": -19, + "y": 5 }, { "path": "track/raptor/large_turn_right_to_diag_bank_1_2.png", - "x_offset": -20, - "y_offset": 10 + "x": -20, + "y": 10 }, { "path": "track/raptor/large_turn_right_to_diag_bank_1_3.png", - "x_offset": -2, - "y_offset": 0 + "x": -2, + "y": 0 }, { "path": "track/raptor/large_turn_right_to_diag_bank_1_4.png", - "x_offset": -32, - "y_offset": 8 + "x": -32, + "y": 8 }, { "path": "track/raptor/large_turn_right_to_diag_bank_2_1.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/large_turn_right_to_diag_bank_2_2.png", - "x_offset": -20, - "y_offset": 7 + "x": -20, + "y": 7 }, { "path": "track/raptor/large_turn_right_to_diag_bank_2_3.png", - "x_offset": 26, - "y_offset": 13 + "x": 26, + "y": 13 }, { "path": "track/raptor/large_turn_right_to_diag_bank_2_4.png", - "x_offset": -4, - "y_offset": -2 + "x": -4, + "y": -2 }, { "path": "track/raptor/large_turn_right_to_diag_bank_3_1.png", - "x_offset": -28, - "y_offset": 2 + "x": -28, + "y": 2 }, { "path": "track/raptor/large_turn_right_to_diag_bank_3_2.png", - "x_offset": -32, - "y_offset": -7 + "x": -32, + "y": -7 }, { "path": "track/raptor/large_turn_right_to_diag_bank_3_3.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/large_turn_right_to_diag_bank_3_4.png", - "x_offset": 0, - "y_offset": 8 + "x": 0, + "y": 8 }, { "path": "track/raptor/large_turn_right_to_diag_bank_4_1.png", - "x_offset": -27, - "y_offset": -10 + "x": -27, + "y": -10 }, { "path": "track/raptor/large_turn_right_to_diag_bank_4_2.png", - "x_offset": 1, - "y_offset": 0 + "x": 1, + "y": 0 }, { "path": "track/raptor/large_turn_right_to_diag_bank_4_3.png", - "x_offset": -32, - "y_offset": 13 + "x": -32, + "y": 13 }, { "path": "track/raptor/large_turn_right_to_diag_bank_4_4.png", - "x_offset": -6, - "y_offset": 9 + "x": -6, + "y": 9 }, { "path": "track/raptor/small_turn_left_gentle_up_1_1.png", - "x_offset": -24, - "y_offset": -32 + "x": -24, + "y": -32 }, { "path": "track/raptor/small_turn_left_gentle_up_1_2.png", - "x_offset": -13, - "y_offset": -17 + "x": -13, + "y": -17 }, { "path": "track/raptor/small_turn_left_gentle_up_2_1.png", - "x_offset": -12, - "y_offset": -8 + "x": -12, + "y": -8 }, { "path": "track/raptor/small_turn_left_gentle_up_2_2.png", - "x_offset": -38, - "y_offset": -17 + "x": -38, + "y": -17 }, { "path": "track/raptor/small_turn_left_gentle_up_3_1.png", - "x_offset": -13, - "y_offset": -2 + "x": -13, + "y": -2 }, { "path": "track/raptor/small_turn_left_gentle_up_3_2.png", - "x_offset": -1, - "y_offset": -7 + "x": -1, + "y": -7 }, { "path": "track/raptor/small_turn_left_gentle_up_4_1.png", - "x_offset": -26, - "y_offset": -12 + "x": -26, + "y": -12 }, { "path": "track/raptor/small_turn_left_gentle_up_4_2.png", - "x_offset": -25, - "y_offset": -2 + "x": -25, + "y": -2 }, { "path": "track/raptor/small_turn_right_gentle_up_1_1.png", - "x_offset": -24, - "y_offset": -12 + "x": -24, + "y": -12 }, { "path": "track/raptor/small_turn_right_gentle_up_1_2.png", - "x_offset": -26, - "y_offset": -2 + "x": -26, + "y": -2 }, { "path": "track/raptor/small_turn_right_gentle_up_2_1.png", - "x_offset": -12, - "y_offset": -2 + "x": -12, + "y": -2 }, { "path": "track/raptor/small_turn_right_gentle_up_2_2.png", - "x_offset": -25, - "y_offset": -7 + "x": -25, + "y": -7 }, { "path": "track/raptor/small_turn_right_gentle_up_3_1.png", - "x_offset": -38, - "y_offset": -8 + "x": -38, + "y": -8 }, { "path": "track/raptor/small_turn_right_gentle_up_3_2.png", - "x_offset": -13, - "y_offset": -17 + "x": -13, + "y": -17 }, { "path": "track/raptor/small_turn_right_gentle_up_4_1.png", - "x_offset": -1, - "y_offset": -25 + "x": -1, + "y": -25 }, { "path": "track/raptor/small_turn_right_gentle_up_4_2.png", - "x_offset": -13, - "y_offset": -17 + "x": -13, + "y": -17 }, { "path": "track/raptor/medium_turn_left_gentle_up_1_1.png", - "x_offset": -18, - "y_offset": -15 + "x": -18, + "y": -15 }, { "path": "track/raptor/medium_turn_left_gentle_up_1_2.png", - "x_offset": -27, - "y_offset": -11 + "x": -27, + "y": -11 }, { "path": "track/raptor/medium_turn_left_gentle_up_1_3.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_left_gentle_up_1_4.png", - "x_offset": -27, - "y_offset": -8 + "x": -27, + "y": -8 }, { "path": "track/raptor/medium_turn_left_gentle_up_1_5.png", - "x_offset": -19, - "y_offset": -14 + "x": -19, + "y": -14 }, { "path": "track/raptor/medium_turn_left_gentle_up_2_1.png", - "x_offset": -18, - "y_offset": -5 + "x": -18, + "y": -5 }, { "path": "track/raptor/medium_turn_left_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": -14 + "x": 0, + "y": -14 }, { "path": "track/raptor/medium_turn_left_gentle_up_2_3.png", - "x_offset": 0, - "y_offset": 1 + "x": 0, + "y": 1 }, { "path": "track/raptor/medium_turn_left_gentle_up_2_4.png", - "x_offset": -12, - "y_offset": -21 + "x": -12, + "y": -21 }, { "path": "track/raptor/medium_turn_left_gentle_up_2_5.png", - "x_offset": -17, - "y_offset": -14 + "x": -17, + "y": -14 }, { "path": "track/raptor/medium_turn_left_gentle_up_3_1.png", - "x_offset": -20, - "y_offset": 1 + "x": -20, + "y": 1 }, { "path": "track/raptor/medium_turn_left_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_left_gentle_up_3_3.png", - "x_offset": -20, - "y_offset": 6 + "x": -20, + "y": 6 }, { "path": "track/raptor/medium_turn_left_gentle_up_3_4.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_left_gentle_up_3_5.png", - "x_offset": -16, - "y_offset": 0 + "x": -16, + "y": 0 }, { "path": "track/raptor/medium_turn_left_gentle_up_4_1.png", - "x_offset": -26, - "y_offset": -12 + "x": -26, + "y": -12 }, { "path": "track/raptor/medium_turn_left_gentle_up_4_2.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/medium_turn_left_gentle_up_4_3.png", - "x_offset": -18, - "y_offset": -13 + "x": -18, + "y": -13 }, { "path": "track/raptor/medium_turn_left_gentle_up_4_4.png", - "x_offset": -16, - "y_offset": 4 + "x": -16, + "y": 4 }, { "path": "track/raptor/medium_turn_left_gentle_up_4_5.png", - "x_offset": -19, - "y_offset": 1 + "x": -19, + "y": 1 }, { "path": "track/raptor/medium_turn_right_gentle_up_1_1.png", - "x_offset": -18, - "y_offset": -12 + "x": -18, + "y": -12 }, { "path": "track/raptor/medium_turn_right_gentle_up_1_2.png", - "x_offset": -10, - "y_offset": 1 + "x": -10, + "y": 1 }, { "path": "track/raptor/medium_turn_right_gentle_up_1_3.png", - "x_offset": 0, - "y_offset": -13 + "x": 0, + "y": -13 }, { "path": "track/raptor/medium_turn_right_gentle_up_1_4.png", - "x_offset": -16, - "y_offset": 4 + "x": -16, + "y": 4 }, { "path": "track/raptor/medium_turn_right_gentle_up_1_5.png", - "x_offset": -21, - "y_offset": 1 + "x": -21, + "y": 1 }, { "path": "track/raptor/medium_turn_right_gentle_up_2_1.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/medium_turn_right_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_right_gentle_up_2_3.png", - "x_offset": 0, - "y_offset": 6 + "x": 0, + "y": 6 }, { "path": "track/raptor/medium_turn_right_gentle_up_2_4.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_right_gentle_up_2_5.png", - "x_offset": -19, - "y_offset": 0 + "x": -19, + "y": 0 }, { "path": "track/raptor/medium_turn_right_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -5 + "x": -32, + "y": -5 }, { "path": "track/raptor/medium_turn_right_gentle_up_3_2.png", - "x_offset": -32, - "y_offset": -14 + "x": -32, + "y": -14 }, { "path": "track/raptor/medium_turn_right_gentle_up_3_3.png", - "x_offset": -26, - "y_offset": -1 + "x": -26, + "y": -1 }, { "path": "track/raptor/medium_turn_right_gentle_up_3_4.png", - "x_offset": -22, - "y_offset": -24 + "x": -22, + "y": -24 }, { "path": "track/raptor/medium_turn_right_gentle_up_3_5.png", - "x_offset": -19, - "y_offset": -14 + "x": -19, + "y": -14 }, { "path": "track/raptor/medium_turn_right_gentle_up_4_1.png", - "x_offset": -12, - "y_offset": -13 + "x": -12, + "y": -13 }, { "path": "track/raptor/medium_turn_right_gentle_up_4_2.png", - "x_offset": 12, - "y_offset": -11 + "x": 12, + "y": -11 }, { "path": "track/raptor/medium_turn_right_gentle_up_4_3.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_right_gentle_up_4_4.png", - "x_offset": 12, - "y_offset": -7 + "x": 12, + "y": -7 }, { "path": "track/raptor/medium_turn_right_gentle_up_4_5.png", - "x_offset": -13, - "y_offset": -14 + "x": -13, + "y": -14 }, { "path": "track/raptor/very_small_turn_left_steep_up_1_1.png", - "x_offset": -21, - "y_offset": -62 + "x": -21, + "y": -62 }, { "path": "track/raptor/very_small_turn_left_steep_up_1_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/very_small_turn_left_steep_up_2_1.png", - "x_offset": -10, - "y_offset": -62 + "x": -10, + "y": -62 }, { "path": "track/raptor/very_small_turn_left_steep_up_2_2.png", - "x_offset": -18, - "y_offset": -31 + "x": -18, + "y": -31 }, { "path": "track/raptor/very_small_turn_left_steep_up_3_1.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/very_small_turn_left_steep_up_3_2.png", - "x_offset": 6, - "y_offset": -46 + "x": 6, + "y": -46 }, { "path": "track/raptor/very_small_turn_left_steep_up_4_1.png", - "x_offset": -9, - "y_offset": -33 + "x": -9, + "y": -33 }, { "path": "track/raptor/very_small_turn_left_steep_up_4_2.png", - "x_offset": -21, - "y_offset": -46 + "x": -21, + "y": -46 }, { "path": "track/raptor/very_small_turn_right_steep_up_1_1.png", - "x_offset": -18, - "y_offset": -24 + "x": -18, + "y": -24 }, { "path": "track/raptor/very_small_turn_right_steep_up_1_2.png", - "x_offset": 0, - "y_offset": -46 + "x": 0, + "y": -46 }, { "path": "track/raptor/very_small_turn_right_steep_up_2_1.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/very_small_turn_right_steep_up_2_2.png", - "x_offset": -21, - "y_offset": -46 + "x": -21, + "y": -46 }, { "path": "track/raptor/very_small_turn_right_steep_up_3_1.png", - "x_offset": -21, - "y_offset": -62 + "x": -21, + "y": -62 }, { "path": "track/raptor/very_small_turn_right_steep_up_3_2.png", - "x_offset": -10, - "y_offset": -33 + "x": -10, + "y": -33 }, { "path": "track/raptor/very_small_turn_right_steep_up_4_1.png", - "x_offset": 6, - "y_offset": -62 + "x": 6, + "y": -62 }, { "path": "track/raptor/very_small_turn_right_steep_up_4_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/vertical_twist_left_up_1.png", - "x_offset": -6, - "y_offset": -88 + "x": -6, + "y": -88 }, { "path": "track/raptor/vertical_twist_left_up_2_1.png", - "x_offset": -2, - "y_offset": -88 + "x": -2, + "y": -88 }, { "path": "track/raptor/vertical_twist_left_up_2_2.png", - "x_offset": -2, - "y_offset": -41 + "x": -2, + "y": -41 }, { "path": "track/raptor/vertical_twist_left_up_3.png", - "x_offset": -6, - "y_offset": -86 + "x": -6, + "y": -86 }, { "path": "track/raptor/vertical_twist_left_up_4_1.png", - "x_offset": -6, - "y_offset": -40 + "x": -6, + "y": -40 }, { "path": "track/raptor/vertical_twist_left_up_4_2.png", - "x_offset": -6, - "y_offset": -86 + "x": -6, + "y": -86 }, { "path": "track/raptor/vertical_twist_right_up_1_1.png", - "x_offset": -2, - "y_offset": -41 + "x": -2, + "y": -41 }, { "path": "track/raptor/vertical_twist_right_up_1_2.png", - "x_offset": -2, - "y_offset": -86 + "x": -2, + "y": -86 }, { "path": "track/raptor/vertical_twist_right_up_2.png", - "x_offset": -6, - "y_offset": -86 + "x": -6, + "y": -86 }, { "path": "track/raptor/vertical_twist_right_up_3_1.png", - "x_offset": -6, - "y_offset": -88 + "x": -6, + "y": -88 }, { "path": "track/raptor/vertical_twist_right_up_3_2.png", - "x_offset": -6, - "y_offset": -41 + "x": -6, + "y": -41 }, { "path": "track/raptor/vertical_twist_right_up_4.png", - "x_offset": -6, - "y_offset": -88 + "x": -6, + "y": -88 }, { "path": "track/raptor/gentle_up_to_gentle_up_left_bank_1.png", - "x_offset": -18, - "y_offset": -14 + "x": -18, + "y": -14 }, { "path": "track/raptor/gentle_up_to_gentle_up_left_bank_2_1.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_up_to_gentle_up_left_bank_2_2.png", - "x_offset": -17, - "y_offset": 1 + "x": -17, + "y": 1 }, { "path": "track/raptor/gentle_up_to_gentle_up_left_bank_3.png", - "x_offset": -20, - "y_offset": 0 + "x": -20, + "y": 0 }, { "path": "track/raptor/gentle_up_to_gentle_up_left_bank_4.png", - "x_offset": -18, - "y_offset": -15 + "x": -18, + "y": -15 }, { "path": "track/raptor/gentle_up_to_gentle_up_right_bank_1.png", - "x_offset": -18, - "y_offset": -15 + "x": -18, + "y": -15 }, { "path": "track/raptor/gentle_up_to_gentle_up_right_bank_2.png", - "x_offset": -18, - "y_offset": 0 + "x": -18, + "y": 0 }, { "path": "track/raptor/gentle_up_to_gentle_up_right_bank_3_1.png", - "x_offset": -9, - "y_offset": 1 + "x": -9, + "y": 1 }, { "path": "track/raptor/gentle_up_to_gentle_up_right_bank_3_2.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_up_to_gentle_up_right_bank_4.png", - "x_offset": -20, - "y_offset": -14 + "x": -20, + "y": -14 }, { "path": "track/raptor/gentle_up_left_bank_to_gentle_up_1.png", - "x_offset": -17, - "y_offset": -14 + "x": -17, + "y": -14 }, { "path": "track/raptor/gentle_up_left_bank_to_gentle_up_2_1.png", - "x_offset": -16, - "y_offset": 1 + "x": -16, + "y": 1 }, { "path": "track/raptor/gentle_up_left_bank_to_gentle_up_2_2.png", - "x_offset": -19, - "y_offset": 1 + "x": -19, + "y": 1 }, { "path": "track/raptor/gentle_up_left_bank_to_gentle_up_3.png", - "x_offset": -19, - "y_offset": 0 + "x": -19, + "y": 0 }, { "path": "track/raptor/gentle_up_left_bank_to_gentle_up_4.png", - "x_offset": -19, - "y_offset": -14 + "x": -19, + "y": -14 }, { "path": "track/raptor/gentle_up_right_bank_to_gentle_up_1.png", - "x_offset": -19, - "y_offset": -14 + "x": -19, + "y": -14 }, { "path": "track/raptor/gentle_up_right_bank_to_gentle_up_2.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/gentle_up_right_bank_to_gentle_up_3_1.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_up_right_bank_to_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 1 + "x": 0, + "y": 1 }, { "path": "track/raptor/gentle_up_right_bank_to_gentle_up_4.png", - "x_offset": -19, - "y_offset": -14 + "x": -19, + "y": -14 }, { "path": "track/raptor/left_bank_to_gentle_up_left_bank_1.png", - "x_offset": -17, - "y_offset": -6 + "x": -17, + "y": -6 }, { "path": "track/raptor/left_bank_to_gentle_up_left_bank_2.png", - "x_offset": -20, - "y_offset": 2 + "x": -20, + "y": 2 }, { "path": "track/raptor/left_bank_to_gentle_up_left_bank_3.png", - "x_offset": -20, - "y_offset": 0 + "x": -20, + "y": 0 }, { "path": "track/raptor/left_bank_to_gentle_up_left_bank_4.png", - "x_offset": -18, - "y_offset": -7 + "x": -18, + "y": -7 }, { "path": "track/raptor/right_bank_to_gentle_up_right_bank_1.png", - "x_offset": -19, - "y_offset": -7 + "x": -19, + "y": -7 }, { "path": "track/raptor/right_bank_to_gentle_up_right_bank_2.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/right_bank_to_gentle_up_right_bank_3.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/right_bank_to_gentle_up_right_bank_4.png", - "x_offset": -20, - "y_offset": -6 + "x": -20, + "y": -6 }, { "path": "track/raptor/gentle_up_left_bank_to_left_bank_1.png", - "x_offset": -16, - "y_offset": -6 + "x": -16, + "y": -6 }, { "path": "track/raptor/gentle_up_left_bank_to_left_bank_2.png", - "x_offset": -19, - "y_offset": 1 + "x": -19, + "y": 1 }, { "path": "track/raptor/gentle_up_left_bank_to_left_bank_3.png", - "x_offset": -19, - "y_offset": 0 + "x": -19, + "y": 0 }, { "path": "track/raptor/gentle_up_left_bank_to_left_bank_4.png", - "x_offset": -17, - "y_offset": -8 + "x": -17, + "y": -8 }, { "path": "track/raptor/gentle_up_right_bank_to_right_bank_1.png", - "x_offset": -19, - "y_offset": -8 + "x": -19, + "y": -8 }, { "path": "track/raptor/gentle_up_right_bank_to_right_bank_2.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/gentle_up_right_bank_to_right_bank_3.png", - "x_offset": -17, - "y_offset": 1 + "x": -17, + "y": 1 }, { "path": "track/raptor/gentle_up_right_bank_to_right_bank_4.png", - "x_offset": -20, - "y_offset": -6 + "x": -20, + "y": -6 }, { "path": "track/raptor/gentle_up_left_bank_1.png", - "x_offset": -16, - "y_offset": -14 + "x": -16, + "y": -14 }, { "path": "track/raptor/gentle_up_left_bank_2.png", - "x_offset": -19, - "y_offset": 1 + "x": -19, + "y": 1 }, { "path": "track/raptor/gentle_up_left_bank_3.png", - "x_offset": -20, - "y_offset": 0 + "x": -20, + "y": 0 }, { "path": "track/raptor/gentle_up_left_bank_4.png", - "x_offset": -18, - "y_offset": -15 + "x": -18, + "y": -15 }, { "path": "track/raptor/gentle_up_right_bank_1.png", - "x_offset": -19, - "y_offset": -15 + "x": -19, + "y": -15 }, { "path": "track/raptor/gentle_up_right_bank_2.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/gentle_up_right_bank_3.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_up_right_bank_4.png", - "x_offset": -20, - "y_offset": -14 + "x": -20, + "y": -14 }, { "path": "track/raptor/flat_to_gentle_up_left_bank_1.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/flat_to_gentle_up_left_bank_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_to_gentle_up_left_bank_2_2.png", - "x_offset": -17, - "y_offset": 7 + "x": -17, + "y": 7 }, { "path": "track/raptor/flat_to_gentle_up_left_bank_3.png", - "x_offset": -20, - "y_offset": 2 + "x": -20, + "y": 2 }, { "path": "track/raptor/flat_to_gentle_up_left_bank_4.png", - "x_offset": -18, - "y_offset": -7 + "x": -18, + "y": -7 }, { "path": "track/raptor/flat_to_gentle_up_right_bank_1.png", - "x_offset": -18, - "y_offset": -7 + "x": -18, + "y": -7 }, { "path": "track/raptor/flat_to_gentle_up_right_bank_2.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_to_gentle_up_right_bank_3_1.png", - "x_offset": -3, - "y_offset": 2 + "x": -3, + "y": 2 }, { "path": "track/raptor/flat_to_gentle_up_right_bank_3_2.png", - "x_offset": -18, - "y_offset": 7 + "x": -18, + "y": 7 }, { "path": "track/raptor/flat_to_gentle_up_right_bank_4.png", - "x_offset": -20, - "y_offset": -6 + "x": -20, + "y": -6 }, { "path": "track/raptor/gentle_up_left_bank_to_flat_1.png", - "x_offset": -17, - "y_offset": -6 + "x": -17, + "y": -6 }, { "path": "track/raptor/gentle_up_left_bank_to_flat_2_1.png", - "x_offset": -16, - "y_offset": 1 + "x": -16, + "y": 1 }, { "path": "track/raptor/gentle_up_left_bank_to_flat_2_2.png", - "x_offset": -19, - "y_offset": 1 + "x": -19, + "y": 1 }, { "path": "track/raptor/gentle_up_left_bank_to_flat_3.png", - "x_offset": -18, - "y_offset": 0 + "x": -18, + "y": 0 }, { "path": "track/raptor/gentle_up_left_bank_to_flat_4.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/gentle_up_right_bank_to_flat_1.png", - "x_offset": -19, - "y_offset": -6 + "x": -19, + "y": -6 }, { "path": "track/raptor/gentle_up_right_bank_to_flat_2.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/gentle_up_right_bank_to_flat_3_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/gentle_up_right_bank_to_flat_3_2.png", - "x_offset": -3, - "y_offset": 1 + "x": -3, + "y": 1 }, { "path": "track/raptor/gentle_up_right_bank_to_flat_4.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/small_turn_left_bank_gentle_up_1_1.png", - "x_offset": -23, - "y_offset": -32 + "x": -23, + "y": -32 }, { "path": "track/raptor/small_turn_left_bank_gentle_up_1_2.png", - "x_offset": -12, - "y_offset": -18 + "x": -12, + "y": -18 }, { "path": "track/raptor/small_turn_left_bank_gentle_up_2_1.png", - "x_offset": -13, - "y_offset": -7 + "x": -13, + "y": -7 }, { "path": "track/raptor/small_turn_left_bank_gentle_up_2_2.png", - "x_offset": -38, - "y_offset": -17 + "x": -38, + "y": -17 }, { "path": "track/raptor/small_turn_left_bank_gentle_up_3_1.png", - "x_offset": -15, - "y_offset": -3 + "x": -15, + "y": -3 }, { "path": "track/raptor/small_turn_left_bank_gentle_up_3_2.png", - "x_offset": -3, - "y_offset": -7 + "x": -3, + "y": -7 }, { "path": "track/raptor/small_turn_left_bank_gentle_up_4_1.png", - "x_offset": -26, - "y_offset": -13 + "x": -26, + "y": -13 }, { "path": "track/raptor/small_turn_left_bank_gentle_up_4_2.png", - "x_offset": -26, - "y_offset": -4 + "x": -26, + "y": -4 }, { "path": "track/raptor/small_turn_right_bank_gentle_up_1_1.png", - "x_offset": -25, - "y_offset": -13 + "x": -25, + "y": -13 }, { "path": "track/raptor/small_turn_right_bank_gentle_up_1_2.png", - "x_offset": -26, - "y_offset": -4 + "x": -26, + "y": -4 }, { "path": "track/raptor/small_turn_right_bank_gentle_up_2_1.png", - "x_offset": -11, - "y_offset": -3 + "x": -11, + "y": -3 }, { "path": "track/raptor/small_turn_right_bank_gentle_up_2_2.png", - "x_offset": -24, - "y_offset": -7 + "x": -24, + "y": -7 }, { "path": "track/raptor/small_turn_right_bank_gentle_up_3_1.png", - "x_offset": -38, - "y_offset": -7 + "x": -38, + "y": -7 }, { "path": "track/raptor/small_turn_right_bank_gentle_up_3_2.png", - "x_offset": -14, - "y_offset": -17 + "x": -14, + "y": -17 }, { "path": "track/raptor/small_turn_right_bank_gentle_up_4_1.png", - "x_offset": -3, - "y_offset": -25 + "x": -3, + "y": -25 }, { "path": "track/raptor/small_turn_right_bank_gentle_up_4_2.png", - "x_offset": -15, - "y_offset": -18 + "x": -15, + "y": -18 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_1_1.png", - "x_offset": -17, - "y_offset": -15 + "x": -17, + "y": -15 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_1_2.png", - "x_offset": -25, - "y_offset": -11 + "x": -25, + "y": -11 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_1_3.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_1_4.png", - "x_offset": -25, - "y_offset": -8 + "x": -25, + "y": -8 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_1_5.png", - "x_offset": -18, - "y_offset": -15 + "x": -18, + "y": -15 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_2_1.png", - "x_offset": -19, - "y_offset": -5 + "x": -19, + "y": -5 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": -14 + "x": 0, + "y": -14 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_2_3.png", - "x_offset": 0, - "y_offset": 2 + "x": 0, + "y": 2 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_2_4.png", - "x_offset": -11, - "y_offset": -21 + "x": -11, + "y": -21 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_2_5.png", - "x_offset": -16, - "y_offset": -14 + "x": -16, + "y": -14 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_3_1.png", - "x_offset": -22, - "y_offset": 0 + "x": -22, + "y": 0 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_3_3.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_3_4.png", - "x_offset": 11, - "y_offset": -2 + "x": 11, + "y": -2 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_3_5.png", - "x_offset": -15, - "y_offset": 0 + "x": -15, + "y": 0 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_4_1.png", - "x_offset": -24, - "y_offset": -13 + "x": -24, + "y": -13 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_4_2.png", - "x_offset": -32, - "y_offset": -1 + "x": -32, + "y": -1 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_4_3.png", - "x_offset": -18, - "y_offset": -14 + "x": -18, + "y": -14 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_4_4.png", - "x_offset": -16, - "y_offset": 3 + "x": -16, + "y": 3 }, { "path": "track/raptor/medium_turn_left_bank_gentle_up_4_5.png", - "x_offset": -20, - "y_offset": 0 + "x": -20, + "y": 0 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_1_1.png", - "x_offset": -19, - "y_offset": -13 + "x": -19, + "y": -13 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_1_2.png", - "x_offset": -11, - "y_offset": -1 + "x": -11, + "y": -1 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_1_3.png", - "x_offset": 0, - "y_offset": -14 + "x": 0, + "y": -14 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_1_4.png", - "x_offset": -16, - "y_offset": 3 + "x": -16, + "y": 3 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_1_5.png", - "x_offset": -20, - "y_offset": 0 + "x": -20, + "y": 0 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_2_1.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_2_3.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_2_4.png", - "x_offset": -32, - "y_offset": -2 + "x": -32, + "y": -2 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_2_5.png", - "x_offset": -18, - "y_offset": 0 + "x": -18, + "y": 0 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -5 + "x": -32, + "y": -5 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_3_2.png", - "x_offset": -32, - "y_offset": -14 + "x": -32, + "y": -14 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_3_3.png", - "x_offset": -26, - "y_offset": 0 + "x": -26, + "y": 0 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_3_4.png", - "x_offset": -22, - "y_offset": -22 + "x": -22, + "y": -22 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_3_5.png", - "x_offset": -20, - "y_offset": -14 + "x": -20, + "y": -14 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_4_1.png", - "x_offset": -13, - "y_offset": -13 + "x": -13, + "y": -13 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_4_2.png", - "x_offset": 10, - "y_offset": -11 + "x": 10, + "y": -11 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_4_3.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_4_4.png", - "x_offset": 9, - "y_offset": -7 + "x": 9, + "y": -7 }, { "path": "track/raptor/medium_turn_right_bank_gentle_up_4_5.png", - "x_offset": -15, - "y_offset": -15 + "x": -15, + "y": -15 }, { "path": "track/raptor/s_bend_left_1_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/s_bend_left_1_2.png", - "x_offset": -26, - "y_offset": 6 + "x": -26, + "y": 6 }, { "path": "track/raptor/s_bend_left_1_3.png", - "x_offset": 11, - "y_offset": 8 + "x": 11, + "y": 8 }, { "path": "track/raptor/s_bend_left_1_4.png", - "x_offset": -15, - "y_offset": 2 + "x": -15, + "y": 2 }, { "path": "track/raptor/s_bend_left_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/s_bend_left_2_2.png", - "x_offset": -10, - "y_offset": 0 + "x": -10, + "y": 0 }, { "path": "track/raptor/s_bend_left_2_3.png", - "x_offset": -30, - "y_offset": 16 + "x": -30, + "y": 16 }, { "path": "track/raptor/s_bend_left_2_4.png", - "x_offset": -22, - "y_offset": 6 + "x": -22, + "y": 6 }, { "path": "track/raptor/s_bend_right_1_1.png", - "x_offset": -18, - "y_offset": 6 + "x": -18, + "y": 6 }, { "path": "track/raptor/s_bend_right_1_2.png", - "x_offset": -19, - "y_offset": 16 + "x": -19, + "y": 16 }, { "path": "track/raptor/s_bend_right_1_3.png", - "x_offset": -16, - "y_offset": 0 + "x": -16, + "y": 0 }, { "path": "track/raptor/s_bend_right_1_4.png", - "x_offset": -32, - "y_offset": 2 + "x": -32, + "y": 2 }, { "path": "track/raptor/s_bend_right_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/s_bend_right_2_2.png", - "x_offset": -23, - "y_offset": 8 + "x": -23, + "y": 8 }, { "path": "track/raptor/s_bend_right_2_3.png", - "x_offset": 13, - "y_offset": 6 + "x": 13, + "y": 6 }, { "path": "track/raptor/s_bend_right_2_4.png", - "x_offset": -12, - "y_offset": 2 + "x": -12, + "y": 2 }, { "path": "track/raptor/small_helix_left_up_1_1.png", - "x_offset": -6, - "y_offset": -1 + "x": -6, + "y": -1 }, { "path": "track/raptor/small_helix_left_up_1_2.png", - "x_offset": -17, - "y_offset": -1 + "x": -17, + "y": -1 }, { "path": "track/raptor/small_helix_left_up_1_3.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/small_helix_left_up_1_4.png", - "x_offset": -17, - "y_offset": -8 + "x": -17, + "y": -8 }, { "path": "track/raptor/small_helix_left_up_2_1.png", - "x_offset": -19, - "y_offset": 2 + "x": -19, + "y": 2 }, { "path": "track/raptor/small_helix_left_up_2_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/small_helix_left_up_2_3.png", - "x_offset": -32, - "y_offset": -6 + "x": -32, + "y": -6 }, { "path": "track/raptor/small_helix_left_up_3_1.png", - "x_offset": -7, - "y_offset": 0 + "x": -7, + "y": 0 }, { "path": "track/raptor/small_helix_left_up_3_2.png", - "x_offset": 23, - "y_offset": 0 + "x": 23, + "y": 0 }, { "path": "track/raptor/small_helix_left_up_3_3.png", - "x_offset": -2, - "y_offset": -1 + "x": -2, + "y": -1 }, { "path": "track/raptor/small_helix_left_up_3_4.png", - "x_offset": -7, - "y_offset": -1 + "x": -7, + "y": -1 }, { "path": "track/raptor/small_helix_left_up_4_1.png", - "x_offset": -26, - "y_offset": 2 + "x": -26, + "y": 2 }, { "path": "track/raptor/small_helix_left_up_4_2.png", - "x_offset": -8, - "y_offset": 17 + "x": -8, + "y": 17 }, { "path": "track/raptor/small_helix_left_up_4_3.png", - "x_offset": -19, - "y_offset": 1 + "x": -19, + "y": 1 }, { "path": "track/raptor/small_helix_right_up_1_1.png", - "x_offset": -19, - "y_offset": 2 + "x": -19, + "y": 2 }, { "path": "track/raptor/small_helix_right_up_1_2.png", - "x_offset": -6, - "y_offset": 17 + "x": -6, + "y": 17 }, { "path": "track/raptor/small_helix_right_up_1_3.png", - "x_offset": -26, - "y_offset": 1 + "x": -26, + "y": 1 }, { "path": "track/raptor/small_helix_right_up_2_1.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/small_helix_right_up_2_2.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/small_helix_right_up_2_3.png", - "x_offset": -2, - "y_offset": -1 + "x": -2, + "y": -1 }, { "path": "track/raptor/small_helix_right_up_2_4.png", - "x_offset": -17, - "y_offset": -1 + "x": -17, + "y": -1 }, { "path": "track/raptor/small_helix_right_up_3_1.png", - "x_offset": -32, - "y_offset": 2 + "x": -32, + "y": 2 }, { "path": "track/raptor/small_helix_right_up_3_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/small_helix_right_up_3_3.png", - "x_offset": -20, - "y_offset": -6 + "x": -20, + "y": -6 }, { "path": "track/raptor/small_helix_right_up_4_1.png", - "x_offset": -6, - "y_offset": -1 + "x": -6, + "y": -1 }, { "path": "track/raptor/small_helix_right_up_4_2.png", - "x_offset": -8, - "y_offset": -1 + "x": -8, + "y": -1 }, { "path": "track/raptor/small_helix_right_up_4_3.png", - "x_offset": 23, - "y_offset": 0 + "x": 23, + "y": 0 }, { "path": "track/raptor/small_helix_right_up_4_4.png", - "x_offset": -8, - "y_offset": -8 + "x": -8, + "y": -8 }, { "path": "track/raptor/medium_helix_left_up_1_1.png", - "x_offset": -1, - "y_offset": 2 + "x": -1, + "y": 2 }, { "path": "track/raptor/medium_helix_left_up_1_2.png", - "x_offset": -17, - "y_offset": 3 + "x": -17, + "y": 3 }, { "path": "track/raptor/medium_helix_left_up_1_3.png", - "x_offset": -27, - "y_offset": 6 + "x": -27, + "y": 6 }, { "path": "track/raptor/medium_helix_left_up_1_4.png", - "x_offset": 10, - "y_offset": 7 + "x": 10, + "y": 7 }, { "path": "track/raptor/medium_helix_left_up_1_5.png", - "x_offset": -20, - "y_offset": 7 + "x": -20, + "y": 7 }, { "path": "track/raptor/medium_helix_left_up_1_6.png", - "x_offset": -17, - "y_offset": -8 + "x": -17, + "y": -8 }, { "path": "track/raptor/medium_helix_left_up_2_1.png", - "x_offset": -20, - "y_offset": 2 + "x": -20, + "y": 2 }, { "path": "track/raptor/medium_helix_left_up_2_2.png", - "x_offset": -6, - "y_offset": 0 + "x": -6, + "y": 0 }, { "path": "track/raptor/medium_helix_left_up_2_3.png", - "x_offset": -32, - "y_offset": 10 + "x": -32, + "y": 10 }, { "path": "track/raptor/medium_helix_left_up_2_4.png", - "x_offset": -4, - "y_offset": 0 + "x": -4, + "y": 0 }, { "path": "track/raptor/medium_helix_left_up_2_5.png", - "x_offset": -32, - "y_offset": -6 + "x": -32, + "y": -6 }, { "path": "track/raptor/medium_helix_left_up_3_1.png", - "x_offset": -16, - "y_offset": 0 + "x": -16, + "y": 0 }, { "path": "track/raptor/medium_helix_left_up_3_2.png", - "x_offset": 9, - "y_offset": 7 + "x": 9, + "y": 7 }, { "path": "track/raptor/medium_helix_left_up_3_3.png", - "x_offset": -22, - "y_offset": 7 + "x": -22, + "y": 7 }, { "path": "track/raptor/medium_helix_left_up_3_4.png", - "x_offset": 15, - "y_offset": 7 + "x": 15, + "y": 7 }, { "path": "track/raptor/medium_helix_left_up_3_5.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_helix_left_up_3_6.png", - "x_offset": -6, - "y_offset": 0 + "x": -6, + "y": 0 }, { "path": "track/raptor/medium_helix_left_up_4_1.png", - "x_offset": -18, - "y_offset": 4 + "x": -18, + "y": 4 }, { "path": "track/raptor/medium_helix_left_up_4_2.png", - "x_offset": -32, - "y_offset": 12 + "x": -32, + "y": 12 }, { "path": "track/raptor/medium_helix_left_up_4_3.png", - "x_offset": -8, - "y_offset": -5 + "x": -8, + "y": -5 }, { "path": "track/raptor/medium_helix_left_up_4_4.png", - "x_offset": -28, - "y_offset": 11 + "x": -28, + "y": 11 }, { "path": "track/raptor/medium_helix_left_up_4_5.png", - "x_offset": -19, - "y_offset": 1 + "x": -19, + "y": 1 }, { "path": "track/raptor/medium_helix_right_up_1_1.png", - "x_offset": -19, - "y_offset": 4 + "x": -19, + "y": 4 }, { "path": "track/raptor/medium_helix_right_up_1_2.png", - "x_offset": -22, - "y_offset": 12 + "x": -22, + "y": 12 }, { "path": "track/raptor/medium_helix_right_up_1_3.png", - "x_offset": -8, - "y_offset": -5 + "x": -8, + "y": -5 }, { "path": "track/raptor/medium_helix_right_up_1_4.png", - "x_offset": -32, - "y_offset": 11 + "x": -32, + "y": 11 }, { "path": "track/raptor/medium_helix_right_up_1_5.png", - "x_offset": -12, - "y_offset": 1 + "x": -12, + "y": 1 }, { "path": "track/raptor/medium_helix_right_up_2_1.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/medium_helix_right_up_2_2.png", - "x_offset": -21, - "y_offset": 7 + "x": -21, + "y": 7 }, { "path": "track/raptor/medium_helix_right_up_2_3.png", - "x_offset": 7, - "y_offset": 7 + "x": 7, + "y": 7 }, { "path": "track/raptor/medium_helix_right_up_2_4.png", - "x_offset": -30, - "y_offset": 7 + "x": -30, + "y": 7 }, { "path": "track/raptor/medium_helix_right_up_2_5.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/medium_helix_right_up_2_6.png", - "x_offset": -17, - "y_offset": 0 + "x": -17, + "y": 0 }, { "path": "track/raptor/medium_helix_right_up_3_1.png", - "x_offset": -32, - "y_offset": 2 + "x": -32, + "y": 2 }, { "path": "track/raptor/medium_helix_right_up_3_2.png", - "x_offset": -10, - "y_offset": 0 + "x": -10, + "y": 0 }, { "path": "track/raptor/medium_helix_right_up_3_3.png", - "x_offset": -32, - "y_offset": 10 + "x": -32, + "y": 10 }, { "path": "track/raptor/medium_helix_right_up_3_4.png", - "x_offset": -2, - "y_offset": 0 + "x": -2, + "y": 0 }, { "path": "track/raptor/medium_helix_right_up_3_5.png", - "x_offset": -20, - "y_offset": -6 + "x": -20, + "y": -6 }, { "path": "track/raptor/medium_helix_right_up_4_1.png", - "x_offset": -6, - "y_offset": 2 + "x": -6, + "y": 2 }, { "path": "track/raptor/medium_helix_right_up_4_2.png", - "x_offset": -10, - "y_offset": 3 + "x": -10, + "y": 3 }, { "path": "track/raptor/medium_helix_right_up_4_3.png", - "x_offset": 13, - "y_offset": 6 + "x": 13, + "y": 6 }, { "path": "track/raptor/medium_helix_right_up_4_4.png", - "x_offset": -22, - "y_offset": 7 + "x": -22, + "y": 7 }, { "path": "track/raptor/medium_helix_right_up_4_5.png", - "x_offset": 9, - "y_offset": 7 + "x": 9, + "y": 7 }, { "path": "track/raptor/medium_helix_right_up_4_6.png", - "x_offset": -18, - "y_offset": -8 + "x": -18, + "y": -8 }, { "path": "track/raptor/barrel_roll_left_1_1.png", - "x_offset": -18, - "y_offset": 8 + "x": -18, + "y": 8 }, { "path": "track/raptor/barrel_roll_left_1_2.png", - "x_offset": -5, - "y_offset": 6 + "x": -5, + "y": 6 }, { "path": "track/raptor/barrel_roll_left_1_3.png", - "x_offset": -21, - "y_offset": 22 + "x": -21, + "y": 22 }, { "path": "track/raptor/barrel_roll_left_1_4.png", - "x_offset": -20, - "y_offset": -12 + "x": -20, + "y": -12 }, { "path": "track/raptor/barrel_roll_left_1_5.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/barrel_roll_left_1_6.png", - "x_offset": -9, - "y_offset": -21 + "x": -9, + "y": -21 }, { "path": "track/raptor/barrel_roll_left_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/barrel_roll_left_2_2.png", - "x_offset": -17, - "y_offset": 8 + "x": -17, + "y": 8 }, { "path": "track/raptor/barrel_roll_left_2_3.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/barrel_roll_left_2_4.png", - "x_offset": -28, - "y_offset": -2 + "x": -28, + "y": -2 }, { "path": "track/raptor/barrel_roll_left_2_5.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/barrel_roll_left_2_6.png", - "x_offset": -32, - "y_offset": -13 + "x": -32, + "y": -13 }, { "path": "track/raptor/barrel_roll_left_3_1.png", - "x_offset": -28, - "y_offset": 1 + "x": -28, + "y": 1 }, { "path": "track/raptor/barrel_roll_left_3_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/barrel_roll_left_3_3.png", - "x_offset": -26, - "y_offset": -8 + "x": -26, + "y": -8 }, { "path": "track/raptor/barrel_roll_left_3_4.png", - "x_offset": -27, - "y_offset": -6 + "x": -27, + "y": -6 }, { "path": "track/raptor/barrel_roll_left_3_5.png", - "x_offset": 2, - "y_offset": -14 + "x": 2, + "y": -14 }, { "path": "track/raptor/barrel_roll_left_3_6.png", - "x_offset": -18, - "y_offset": -19 + "x": -18, + "y": -19 }, { "path": "track/raptor/barrel_roll_left_4_1.png", - "x_offset": -11, - "y_offset": -9 + "x": -11, + "y": -9 }, { "path": "track/raptor/barrel_roll_left_4_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/barrel_roll_left_4_3.png", - "x_offset": -11, - "y_offset": -19 + "x": -11, + "y": -19 }, { "path": "track/raptor/barrel_roll_left_4_4.png", - "x_offset": -10, - "y_offset": -21 + "x": -10, + "y": -21 }, { "path": "track/raptor/barrel_roll_left_4_5.png", - "x_offset": 8, - "y_offset": -7 + "x": 8, + "y": -7 }, { "path": "track/raptor/barrel_roll_left_4_6.png", - "x_offset": -18, - "y_offset": -21 + "x": -18, + "y": -21 }, { "path": "track/raptor/barrel_roll_right_1_1.png", - "x_offset": -18, - "y_offset": -9 + "x": -18, + "y": -9 }, { "path": "track/raptor/barrel_roll_right_1_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/barrel_roll_right_1_3.png", - "x_offset": -25, - "y_offset": -19 + "x": -25, + "y": -19 }, { "path": "track/raptor/barrel_roll_right_1_4.png", - "x_offset": 3, - "y_offset": -21 + "x": 3, + "y": -21 }, { "path": "track/raptor/barrel_roll_right_1_5.png", - "x_offset": -22, - "y_offset": -14 + "x": -22, + "y": -14 }, { "path": "track/raptor/barrel_roll_right_1_6.png", - "x_offset": -23, - "y_offset": -21 + "x": -23, + "y": -21 }, { "path": "track/raptor/barrel_roll_right_2_1.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/barrel_roll_right_2_2.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/barrel_roll_right_2_3.png", - "x_offset": -6, - "y_offset": -8 + "x": -6, + "y": -8 }, { "path": "track/raptor/barrel_roll_right_2_4.png", - "x_offset": 17, - "y_offset": -6 + "x": 17, + "y": -6 }, { "path": "track/raptor/barrel_roll_right_2_5.png", - "x_offset": -6, - "y_offset": -14 + "x": -6, + "y": -14 }, { "path": "track/raptor/barrel_roll_right_2_6.png", - "x_offset": -6, - "y_offset": -19 + "x": -6, + "y": -19 }, { "path": "track/raptor/barrel_roll_right_3_1.png", - "x_offset": -2, - "y_offset": 2 + "x": -2, + "y": 2 }, { "path": "track/raptor/barrel_roll_right_3_2.png", - "x_offset": -4, - "y_offset": 8 + "x": -4, + "y": 8 }, { "path": "track/raptor/barrel_roll_right_3_3.png", - "x_offset": 6, - "y_offset": -2 + "x": 6, + "y": -2 }, { "path": "track/raptor/barrel_roll_right_3_4.png", - "x_offset": 0, - "y_offset": -2 + "x": 0, + "y": -2 }, { "path": "track/raptor/barrel_roll_right_3_5.png", - "x_offset": -12, - "y_offset": -2 + "x": -12, + "y": -2 }, { "path": "track/raptor/barrel_roll_right_3_6.png", - "x_offset": -18, - "y_offset": -13 + "x": -18, + "y": -13 }, { "path": "track/raptor/barrel_roll_right_4_1.png", - "x_offset": -11, - "y_offset": 8 + "x": -11, + "y": 8 }, { "path": "track/raptor/barrel_roll_right_4_2.png", - "x_offset": -19, - "y_offset": 6 + "x": -19, + "y": 6 }, { "path": "track/raptor/barrel_roll_right_4_3.png", - "x_offset": -9, - "y_offset": 1 + "x": -9, + "y": 1 }, { "path": "track/raptor/barrel_roll_right_4_4.png", - "x_offset": -26, - "y_offset": -12 + "x": -26, + "y": -12 }, { "path": "track/raptor/barrel_roll_right_4_5.png", - "x_offset": 0, - "y_offset": 0 + "x": 0, + "y": 0 }, { "path": "track/raptor/barrel_roll_right_4_6.png", - "x_offset": -18, - "y_offset": -21 + "x": -18, + "y": -21 }, { "path": "track/raptor/half_loop_1_1.png", - "x_offset": -24, - "y_offset": -18 + "x": -24, + "y": -18 }, { "path": "track/raptor/half_loop_1_2.png", - "x_offset": -19, - "y_offset": -38 + "x": -19, + "y": -38 }, { "path": "track/raptor/half_loop_1_3.png", - "x_offset": -12, - "y_offset": -82 + "x": -12, + "y": -82 }, { "path": "track/raptor/half_loop_1_4.png", - "x_offset": -18, - "y_offset": 23 + "x": -18, + "y": 23 }, { "path": "track/raptor/half_loop_2_1.png", - "x_offset": -12, - "y_offset": -4 + "x": -12, + "y": -4 }, { "path": "track/raptor/half_loop_2_2.png", - "x_offset": 1, - "y_offset": -31 + "x": 1, + "y": -31 }, { "path": "track/raptor/half_loop_2_3.png", - "x_offset": -38, - "y_offset": -113 + "x": -38, + "y": -113 }, { "path": "track/raptor/half_loop_2_4.png", - "x_offset": -18, - "y_offset": 11 + "x": -18, + "y": 11 }, { "path": "track/raptor/half_loop_3_1.png", - "x_offset": -26, - "y_offset": -4 + "x": -26, + "y": -4 }, { "path": "track/raptor/half_loop_3_2.png", - "x_offset": -25, - "y_offset": -27 + "x": -25, + "y": -27 }, { "path": "track/raptor/half_loop_3_3.png", - "x_offset": 2, - "y_offset": -120 + "x": 2, + "y": -120 }, { "path": "track/raptor/half_loop_3_4.png", - "x_offset": -22, - "y_offset": 3 + "x": -22, + "y": 3 }, { "path": "track/raptor/half_loop_4_1.png", - "x_offset": -12, - "y_offset": -18 + "x": -12, + "y": -18 }, { "path": "track/raptor/half_loop_4_2.png", - "x_offset": -12, - "y_offset": -42 + "x": -12, + "y": -42 }, { "path": "track/raptor/half_loop_4_3.png", - "x_offset": 8, - "y_offset": -91 + "x": 8, + "y": -91 }, { "path": "track/raptor/half_loop_4_4.png", - "x_offset": 5, - "y_offset": 15 + "x": 5, + "y": 15 }, { "path": "track/raptor/flat_to_steep_up_1_1.png", - "x_offset": -18, - "y_offset": -2 + "x": -18, + "y": -2 }, { "path": "track/raptor/flat_to_steep_up_1_2.png", - "x_offset": -19, - "y_offset": -17 + "x": -19, + "y": -17 }, { "path": "track/raptor/flat_to_steep_up_1_3.png", - "x_offset": -17, - "y_offset": -25 + "x": -17, + "y": -25 }, { "path": "track/raptor/flat_to_steep_up_1_4.png", - "x_offset": -18, - "y_offset": -46 + "x": -18, + "y": -46 }, { "path": "track/raptor/flat_to_steep_up_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_to_steep_up_2_2.png", - "x_offset": -24, - "y_offset": -4 + "x": -24, + "y": -4 }, { "path": "track/raptor/flat_to_steep_up_2_3.png", - "x_offset": -25, - "y_offset": -6 + "x": -25, + "y": -6 }, { "path": "track/raptor/flat_to_steep_up_2_4.png", - "x_offset": -20, - "y_offset": -30 + "x": -20, + "y": -30 }, { "path": "track/raptor/flat_to_steep_up_3_1.png", - "x_offset": -20, - "y_offset": 2 + "x": -20, + "y": 2 }, { "path": "track/raptor/flat_to_steep_up_3_2.png", - "x_offset": -22, - "y_offset": -2 + "x": -22, + "y": -2 }, { "path": "track/raptor/flat_to_steep_up_3_3.png", - "x_offset": -23, - "y_offset": -13 + "x": -23, + "y": -13 }, { "path": "track/raptor/flat_to_steep_up_3_4.png", - "x_offset": -21, - "y_offset": -30 + "x": -21, + "y": -30 }, { "path": "track/raptor/flat_to_steep_up_4_1.png", - "x_offset": -19, - "y_offset": -2 + "x": -19, + "y": -2 }, { "path": "track/raptor/flat_to_steep_up_4_2.png", - "x_offset": -21, - "y_offset": -17 + "x": -21, + "y": -17 }, { "path": "track/raptor/flat_to_steep_up_4_3.png", - "x_offset": -20, - "y_offset": -25 + "x": -20, + "y": -25 }, { "path": "track/raptor/flat_to_steep_up_4_4.png", - "x_offset": -21, - "y_offset": -46 + "x": -21, + "y": -46 }, { "path": "track/raptor/steep_to_flat_up_1_1.png", - "x_offset": -18, - "y_offset": -41 + "x": -18, + "y": -41 }, { "path": "track/raptor/steep_to_flat_up_1_2.png", - "x_offset": -20, - "y_offset": -26 + "x": -20, + "y": -26 }, { "path": "track/raptor/steep_to_flat_up_1_3.png", - "x_offset": -20, - "y_offset": -18 + "x": -20, + "y": -18 }, { "path": "track/raptor/steep_to_flat_up_1_4.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/steep_to_flat_up_2_1.png", - "x_offset": -18, - "y_offset": -26 + "x": -18, + "y": -26 }, { "path": "track/raptor/steep_to_flat_up_2_2.png", - "x_offset": -18, - "y_offset": -13 + "x": -18, + "y": -13 }, { "path": "track/raptor/steep_to_flat_up_2_3.png", - "x_offset": -13, - "y_offset": -5 + "x": -13, + "y": -5 }, { "path": "track/raptor/steep_to_flat_up_2_4.png", - "x_offset": -14, - "y_offset": -1 + "x": -14, + "y": -1 }, { "path": "track/raptor/steep_to_flat_up_3_1.png", - "x_offset": -14, - "y_offset": -25 + "x": -14, + "y": -25 }, { "path": "track/raptor/steep_to_flat_up_3_2.png", - "x_offset": -13, - "y_offset": -13 + "x": -13, + "y": -13 }, { "path": "track/raptor/steep_to_flat_up_3_3.png", - "x_offset": -16, - "y_offset": -5 + "x": -16, + "y": -5 }, { "path": "track/raptor/steep_to_flat_up_3_4.png", - "x_offset": -18, - "y_offset": -3 + "x": -18, + "y": -3 }, { "path": "track/raptor/steep_to_flat_up_4_1.png", - "x_offset": -18, - "y_offset": -40 + "x": -18, + "y": -40 }, { "path": "track/raptor/steep_to_flat_up_4_2.png", - "x_offset": -18, - "y_offset": -26 + "x": -18, + "y": -26 }, { "path": "track/raptor/steep_to_flat_up_4_3.png", - "x_offset": -17, - "y_offset": -16 + "x": -17, + "y": -16 }, { "path": "track/raptor/steep_to_flat_up_4_4.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/quarter_loop_up_1_1.png", - "x_offset": -17, - "y_offset": -52 + "x": -17, + "y": -52 }, { "path": "track/raptor/quarter_loop_up_1_2.png", - "x_offset": 0, - "y_offset": -30 + "x": 0, + "y": -30 }, { "path": "track/raptor/quarter_loop_up_1_3.png", - "x_offset": -18, - "y_offset": -12 + "x": -18, + "y": -12 }, { "path": "track/raptor/quarter_loop_up_2_1.png", - "x_offset": -22, - "y_offset": -77 + "x": -22, + "y": -77 }, { "path": "track/raptor/quarter_loop_up_2_2.png", - "x_offset": -32, - "y_offset": -66 + "x": -32, + "y": -66 }, { "path": "track/raptor/quarter_loop_up_2_3.png", - "x_offset": -18, - "y_offset": -21 + "x": -18, + "y": -21 }, { "path": "track/raptor/quarter_loop_up_3_1.png", - "x_offset": -6, - "y_offset": -76 + "x": -6, + "y": -76 }, { "path": "track/raptor/quarter_loop_up_3_2.png", - "x_offset": -17, - "y_offset": -68 + "x": -17, + "y": -68 }, { "path": "track/raptor/quarter_loop_up_3_3.png", - "x_offset": 0, - "y_offset": -21 + "x": 0, + "y": -21 }, { "path": "track/raptor/quarter_loop_up_4_1.png", - "x_offset": -6, - "y_offset": -52 + "x": -6, + "y": -52 }, { "path": "track/raptor/quarter_loop_up_4_2.png", - "x_offset": -20, - "y_offset": -30 + "x": -20, + "y": -30 }, { "path": "track/raptor/quarter_loop_up_4_3.png", - "x_offset": -32, - "y_offset": -12 + "x": -32, + "y": -12 }, { "path": "track/raptor/corkscrew_left_1_1.png", - "x_offset": -18, - "y_offset": -32 + "x": -18, + "y": -32 }, { "path": "track/raptor/corkscrew_left_1_2.png", - "x_offset": -17, - "y_offset": -29 + "x": -17, + "y": -29 }, { "path": "track/raptor/corkscrew_left_1_3.png", - "x_offset": -18, - "y_offset": -21 + "x": -18, + "y": -21 }, { "path": "track/raptor/corkscrew_left_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/corkscrew_left_2_2.png", - "x_offset": -32, - "y_offset": -28 + "x": -32, + "y": -28 }, { "path": "track/raptor/corkscrew_left_2_3.png", - "x_offset": -18, - "y_offset": -21 + "x": -18, + "y": -21 }, { "path": "track/raptor/corkscrew_left_3_1.png", - "x_offset": -26, - "y_offset": -4 + "x": -26, + "y": -4 }, { "path": "track/raptor/corkscrew_left_3_2.png", - "x_offset": 5, - "y_offset": -14 + "x": 5, + "y": -14 }, { "path": "track/raptor/corkscrew_left_3_3.png", - "x_offset": -19, - "y_offset": -11 + "x": -19, + "y": -11 }, { "path": "track/raptor/corkscrew_left_4_1.png", - "x_offset": -29, - "y_offset": -32 + "x": -29, + "y": -32 }, { "path": "track/raptor/corkscrew_left_4_2.png", - "x_offset": -27, - "y_offset": -14 + "x": -27, + "y": -14 }, { "path": "track/raptor/corkscrew_left_4_3.png", - "x_offset": -18, - "y_offset": -11 + "x": -18, + "y": -11 }, { "path": "track/raptor/corkscrew_right_1_1.png", - "x_offset": -18, - "y_offset": -32 + "x": -18, + "y": -32 }, { "path": "track/raptor/corkscrew_right_1_2.png", - "x_offset": -6, - "y_offset": -14 + "x": -6, + "y": -14 }, { "path": "track/raptor/corkscrew_right_1_3.png", - "x_offset": -19, - "y_offset": -11 + "x": -19, + "y": -11 }, { "path": "track/raptor/corkscrew_right_2_1.png", - "x_offset": -18, - "y_offset": -4 + "x": -18, + "y": -4 }, { "path": "track/raptor/corkscrew_right_2_2.png", - "x_offset": -13, - "y_offset": -14 + "x": -13, + "y": -14 }, { "path": "track/raptor/corkscrew_right_2_3.png", - "x_offset": -18, - "y_offset": -11 + "x": -18, + "y": -11 }, { "path": "track/raptor/corkscrew_right_3_1.png", - "x_offset": -20, - "y_offset": -2 + "x": -20, + "y": -2 }, { "path": "track/raptor/corkscrew_right_3_2.png", - "x_offset": -18, - "y_offset": -28 + "x": -18, + "y": -28 }, { "path": "track/raptor/corkscrew_right_3_3.png", - "x_offset": -18, - "y_offset": -21 + "x": -18, + "y": -21 }, { "path": "track/raptor/corkscrew_right_4_1.png", - "x_offset": -22, - "y_offset": -32 + "x": -22, + "y": -32 }, { "path": "track/raptor/corkscrew_right_4_2.png", - "x_offset": 5, - "y_offset": -29 + "x": 5, + "y": -29 }, { "path": "track/raptor/corkscrew_right_4_3.png", - "x_offset": -20, - "y_offset": -21 + "x": -20, + "y": -21 }, { "path": "track/raptor/large_corkscrew_left_1_1.png", - "x_offset": -18, - "y_offset": -6, + "x": -18, + "y": -6, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_1_2.png", - "x_offset": -18, - "y_offset": -52, + "x": -18, + "y": -52, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_1_3.png", - "x_offset": -26, - "y_offset": -33, + "x": -26, + "y": -33, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_1_4.png", - "x_offset": -20, - "y_offset": -45, + "x": -20, + "y": -45, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_1_5.png", - "x_offset": -18, - "y_offset": -29, + "x": -18, + "y": -29, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_2_1.png", - "x_offset": -18, - "y_offset": 2, + "x": -18, + "y": 2, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_2_2.png", - "x_offset": -32, - "y_offset": -9, + "x": -32, + "y": -9, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_2_3.png", - "x_offset": -20, - "y_offset": -43, + "x": -20, + "y": -43, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_2_4.png", - "x_offset": -15, - "y_offset": -50, + "x": -15, + "y": -50, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_2_5.png", - "x_offset": -12, - "y_offset": -29, + "x": -12, + "y": -29, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_3_1.png", - "x_offset": -16, - "y_offset": 2, + "x": -16, + "y": 2, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_3_2.png", - "x_offset": -13, - "y_offset": -12, + "x": -13, + "y": -12, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_3_3.png", - "x_offset": 17, - "y_offset": -21, + "x": 17, + "y": -21, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_3_4.png", - "x_offset": -8, - "y_offset": -30, + "x": -8, + "y": -30, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_3_5.png", - "x_offset": -16, - "y_offset": -22, + "x": -16, + "y": -22, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_4_1.png", - "x_offset": -20, - "y_offset": -5, + "x": -20, + "y": -5, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_4_2.png", - "x_offset": -19, - "y_offset": -20, + "x": -19, + "y": -20, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_4_3.png", - "x_offset": -10, - "y_offset": -7, + "x": -10, + "y": -7, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_4_4.png", - "x_offset": -16, - "y_offset": -27, + "x": -16, + "y": -27, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_left_4_5.png", - "x_offset": -18, - "y_offset": -21, + "x": -18, + "y": -21, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_1_1.png", - "x_offset": -18, - "y_offset": -5, + "x": -18, + "y": -5, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_1_2.png", - "x_offset": -18, - "y_offset": -20, + "x": -18, + "y": -20, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_1_3.png", - "x_offset": -16, - "y_offset": -7, + "x": -16, + "y": -7, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_1_4.png", - "x_offset": -27, - "y_offset": -27, + "x": -27, + "y": -27, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_1_5.png", - "x_offset": -32, - "y_offset": -21, + "x": -32, + "y": -21, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_2_1.png", - "x_offset": -18, - "y_offset": 2, + "x": -18, + "y": 2, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_2_2.png", - "x_offset": -16, - "y_offset": -18, + "x": -16, + "y": -18, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_2_3.png", - "x_offset": -24, - "y_offset": -21, + "x": -24, + "y": -21, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_2_4.png", - "x_offset": -16, - "y_offset": -30, + "x": -16, + "y": -30, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_2_5.png", - "x_offset": -18, - "y_offset": -22, + "x": -18, + "y": -22, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_3_1.png", - "x_offset": -40, - "y_offset": 1, + "x": -40, + "y": 1, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_3_2.png", - "x_offset": -16, - "y_offset": -9, + "x": -16, + "y": -9, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_3_3.png", - "x_offset": -21, - "y_offset": -43, + "x": -21, + "y": -43, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_3_4.png", - "x_offset": -25, - "y_offset": -50, + "x": -25, + "y": -50, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_3_5.png", - "x_offset": -18, - "y_offset": -29, + "x": -18, + "y": -29, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_4_1.png", - "x_offset": -20, - "y_offset": -6, + "x": -20, + "y": -6, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_4_2.png", - "x_offset": -11, - "y_offset": -52, + "x": -11, + "y": -52, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_4_3.png", - "x_offset": 17, - "y_offset": -33, + "x": 17, + "y": -33, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_4_4.png", - "x_offset": -11, - "y_offset": -45, + "x": -11, + "y": -45, "palette": "keep" }, { "path": "track/raptor/large_corkscrew_right_4_5.png", - "x_offset": -18, - "y_offset": -29, + "x": -18, + "y": -29, "palette": "keep" }, { "path": "track/raptor/small_turn_left_bank_to_gentle_up_1_1.png", - "x_offset": -23, - "y_offset": -16 + "x": -23, + "y": -16 }, { "path": "track/raptor/small_turn_left_bank_to_gentle_up_1_2.png", - "x_offset": -13, - "y_offset": -9 + "x": -13, + "y": -9 }, { "path": "track/raptor/small_turn_left_bank_to_gentle_up_2_1.png", - "x_offset": 26, - "y_offset": 0 + "x": 26, + "y": 0 }, { "path": "track/raptor/small_turn_left_bank_to_gentle_up_2_2.png", - "x_offset": -13, - "y_offset": -2 + "x": -13, + "y": -2 }, { "path": "track/raptor/small_turn_left_bank_to_gentle_up_2_3.png", - "x_offset": -38, - "y_offset": -9 + "x": -38, + "y": -9 }, { "path": "track/raptor/small_turn_left_bank_to_gentle_up_3_1.png", - "x_offset": -14, - "y_offset": -3 + "x": -14, + "y": -3 }, { "path": "track/raptor/small_turn_left_bank_to_gentle_up_3_2.png", - "x_offset": -2, - "y_offset": 0 + "x": -2, + "y": 0 }, { "path": "track/raptor/small_turn_left_bank_to_gentle_up_4_1.png", - "x_offset": -26, - "y_offset": -5 + "x": -26, + "y": -5 }, { "path": "track/raptor/small_turn_left_bank_to_gentle_up_4_2.png", - "x_offset": -25, - "y_offset": 6 + "x": -25, + "y": 6 }, { "path": "track/raptor/small_turn_right_bank_to_gentle_up_1_1.png", - "x_offset": -25, - "y_offset": -5 + "x": -25, + "y": -5 }, { "path": "track/raptor/small_turn_right_bank_to_gentle_up_1_2.png", - "x_offset": -26, - "y_offset": 6 + "x": -26, + "y": 6 }, { "path": "track/raptor/small_turn_right_bank_to_gentle_up_2_1.png", - "x_offset": -11, - "y_offset": -3 + "x": -11, + "y": -3 }, { "path": "track/raptor/small_turn_right_bank_to_gentle_up_2_2.png", - "x_offset": -24, - "y_offset": 0 + "x": -24, + "y": 0 }, { "path": "track/raptor/small_turn_right_bank_to_gentle_up_3_1.png", - "x_offset": -38, - "y_offset": 0 + "x": -38, + "y": 0 }, { "path": "track/raptor/small_turn_right_bank_to_gentle_up_3_2.png", - "x_offset": -38, - "y_offset": -2 + "x": -38, + "y": -2 }, { "path": "track/raptor/small_turn_right_bank_to_gentle_up_3_3.png", - "x_offset": -13, - "y_offset": -9 + "x": -13, + "y": -9 }, { "path": "track/raptor/small_turn_right_bank_to_gentle_up_4_1.png", - "x_offset": -2, - "y_offset": -16 + "x": -2, + "y": -16 }, { "path": "track/raptor/small_turn_right_bank_to_gentle_up_4_2.png", - "x_offset": -14, - "y_offset": -9 + "x": -14, + "y": -9 }, { "path": "track/raptor/medium_half_loop_left_1_1.png", - "x_offset": -18, - "y_offset": -28, + "x": -18, + "y": -28, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_1_2.png", - "x_offset": -18, - "y_offset": -45, + "x": -18, + "y": -45, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_1_3.png", - "x_offset": -26, - "y_offset": -70, + "x": -26, + "y": -70, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_1_4.png", - "x_offset": -1, - "y_offset": -115, + "x": -1, + "y": -115, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_1_5.png", - "x_offset": -18, - "y_offset": -26, + "x": -18, + "y": -26, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_2_1.png", - "x_offset": -18, - "y_offset": -9, + "x": -18, + "y": -9, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_2_2.png", - "x_offset": -32, - "y_offset": -28, + "x": -32, + "y": -28, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_2_3.png", - "x_offset": 0, - "y_offset": -83, + "x": 0, + "y": -83, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_2_4.png", - "x_offset": -27, - "y_offset": -142, + "x": -27, + "y": -142, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_2_5.png", - "x_offset": -18, - "y_offset": -37, + "x": -18, + "y": -37, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_3_1.png", - "x_offset": -20, - "y_offset": -2, + "x": -20, + "y": -2, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_3_2.png", - "x_offset": 0, - "y_offset": -8, + "x": 0, + "y": -8, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_3_3.png", - "x_offset": 1, - "y_offset": -52, + "x": 1, + "y": -52, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_3_4.png", - "x_offset": -30, - "y_offset": -147, + "x": -30, + "y": -147, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_3_5.png", - "x_offset": -15, - "y_offset": -37, + "x": -15, + "y": -37, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_4_1.png", - "x_offset": -20, - "y_offset": -12, + "x": -20, + "y": -12, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_4_2.png", - "x_offset": -22, - "y_offset": -19, + "x": -22, + "y": -19, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_4_3.png", - "x_offset": -28, - "y_offset": -25, + "x": -28, + "y": -25, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_4_4.png", - "x_offset": -6, - "y_offset": -119, + "x": -6, + "y": -119, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_left_4_5.png", - "x_offset": -23, - "y_offset": -29, + "x": -23, + "y": -29, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_1_1.png", - "x_offset": -18, - "y_offset": -12, + "x": -18, + "y": -12, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_1_2.png", - "x_offset": -17, - "y_offset": -19, + "x": -17, + "y": -19, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_1_3.png", - "x_offset": -15, - "y_offset": -25, + "x": -15, + "y": -25, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_1_4.png", - "x_offset": -13, - "y_offset": -119, + "x": -13, + "y": -119, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_1_5.png", - "x_offset": -18, - "y_offset": -29, + "x": -18, + "y": -29, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_2_1.png", - "x_offset": -18, - "y_offset": -2, + "x": -18, + "y": -2, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_2_2.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_2_3.png", - "x_offset": -32, - "y_offset": -52, + "x": -32, + "y": -52, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_2_4.png", - "x_offset": -22, - "y_offset": -147, + "x": -22, + "y": -147, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_2_5.png", - "x_offset": -18, - "y_offset": -37, + "x": -18, + "y": -37, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_3_1.png", - "x_offset": -34, - "y_offset": -9, + "x": -34, + "y": -9, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_3_2.png", - "x_offset": -32, - "y_offset": -28, + "x": -32, + "y": -28, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_3_3.png", - "x_offset": -32, - "y_offset": -83, + "x": -32, + "y": -83, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_3_4.png", - "x_offset": -6, - "y_offset": -142, + "x": -6, + "y": -142, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_3_5.png", - "x_offset": -10, - "y_offset": -37, + "x": -10, + "y": -37, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_4_1.png", - "x_offset": -20, - "y_offset": -28, + "x": -20, + "y": -28, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_4_2.png", - "x_offset": -13, - "y_offset": -45, + "x": -13, + "y": -45, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_4_3.png", - "x_offset": 1, - "y_offset": -70, + "x": 1, + "y": -70, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_4_4.png", - "x_offset": -31, - "y_offset": -115, + "x": -31, + "y": -115, "palette": "keep" }, { "path": "track/raptor/medium_half_loop_right_4_5.png", - "x_offset": -32, - "y_offset": -26, + "x": -32, + "y": -26, "palette": "keep" }, { "path": "track/raptor/large_half_loop_left_1_1.png", - "x_offset": -18, - "y_offset": -22 + "x": -18, + "y": -22 }, { "path": "track/raptor/large_half_loop_left_1_2.png", - "x_offset": -16, - "y_offset": -36 + "x": -16, + "y": -36 }, { "path": "track/raptor/large_half_loop_left_1_3.png", - "x_offset": -16, - "y_offset": -64 + "x": -16, + "y": -64 }, { "path": "track/raptor/large_half_loop_left_1_4.png", - "x_offset": -20, - "y_offset": -80 + "x": -20, + "y": -80 }, { "path": "track/raptor/large_half_loop_left_1_5.png", - "x_offset": -12, - "y_offset": -65 + "x": -12, + "y": -65 }, { "path": "track/raptor/large_half_loop_left_1_6.png", - "x_offset": -8, - "y_offset": -172 + "x": -8, + "y": -172 }, { "path": "track/raptor/large_half_loop_left_1_7.png", - "x_offset": -18, - "y_offset": -9 + "x": -18, + "y": -9 }, { "path": "track/raptor/large_half_loop_left_2_1.png", - "x_offset": -18, - "y_offset": -1 + "x": -18, + "y": -1 }, { "path": "track/raptor/large_half_loop_left_2_2.png", - "x_offset": -6, - "y_offset": -4 + "x": -6, + "y": -4 }, { "path": "track/raptor/large_half_loop_left_2_3.png", - "x_offset": -9, - "y_offset": -22 + "x": -9, + "y": -22 }, { "path": "track/raptor/large_half_loop_left_2_4.png", - "x_offset": -8, - "y_offset": -69 + "x": -8, + "y": -69 }, { "path": "track/raptor/large_half_loop_left_2_5.png", - "x_offset": -32, - "y_offset": -118 + "x": -32, + "y": -118 }, { "path": "track/raptor/large_half_loop_left_2_6.png", - "x_offset": -22, - "y_offset": -191 + "x": -22, + "y": -191 }, { "path": "track/raptor/large_half_loop_left_2_7.png", - "x_offset": -18, - "y_offset": -21 + "x": -18, + "y": -21 }, { "path": "track/raptor/large_half_loop_left_3_1.png", - "x_offset": -24, - "y_offset": 1 + "x": -24, + "y": 1 }, { "path": "track/raptor/large_half_loop_left_3_2.png", - "x_offset": -29, - "y_offset": -5 + "x": -29, + "y": -5 }, { "path": "track/raptor/large_half_loop_left_3_3.png", - "x_offset": -24, - "y_offset": -32 + "x": -24, + "y": -32 }, { "path": "track/raptor/large_half_loop_left_3_4.png", - "x_offset": -3, - "y_offset": -56 + "x": -3, + "y": -56 }, { "path": "track/raptor/large_half_loop_left_3_5.png", - "x_offset": -3, - "y_offset": -111 + "x": -3, + "y": -111 }, { "path": "track/raptor/large_half_loop_left_3_6.png", - "x_offset": -19, - "y_offset": -191 + "x": -19, + "y": -191 }, { "path": "track/raptor/large_half_loop_left_3_7.png", - "x_offset": -25, - "y_offset": -21 + "x": -25, + "y": -21 }, { "path": "track/raptor/large_half_loop_left_4_1.png", - "x_offset": -21, - "y_offset": -11 + "x": -21, + "y": -11 }, { "path": "track/raptor/large_half_loop_left_4_2.png", - "x_offset": -27, - "y_offset": -15 + "x": -27, + "y": -15 }, { "path": "track/raptor/large_half_loop_left_4_3.png", - "x_offset": -32, - "y_offset": -40 + "x": -32, + "y": -40 }, { "path": "track/raptor/large_half_loop_left_4_4.png", - "x_offset": -32, - "y_offset": -69 + "x": -32, + "y": -69 }, { "path": "track/raptor/large_half_loop_left_4_5.png", - "x_offset": 20, - "y_offset": -58 + "x": 20, + "y": -58 }, { "path": "track/raptor/large_half_loop_left_4_6.png", - "x_offset": -12, - "y_offset": -176 + "x": -12, + "y": -176 }, { "path": "track/raptor/large_half_loop_left_4_7.png", - "x_offset": -18, - "y_offset": -12 + "x": -18, + "y": -12 }, { "path": "track/raptor/large_half_loop_right_1_1.png", - "x_offset": -18, - "y_offset": -11 + "x": -18, + "y": -11 }, { "path": "track/raptor/large_half_loop_right_1_2.png", - "x_offset": -16, - "y_offset": -15 + "x": -16, + "y": -15 }, { "path": "track/raptor/large_half_loop_right_1_3.png", - "x_offset": -10, - "y_offset": -40 + "x": -10, + "y": -40 }, { "path": "track/raptor/large_half_loop_right_1_4.png", - "x_offset": 0, - "y_offset": -69 + "x": 0, + "y": -69 }, { "path": "track/raptor/large_half_loop_right_1_5.png", - "x_offset": -32, - "y_offset": -58 + "x": -32, + "y": -58 }, { "path": "track/raptor/large_half_loop_right_1_6.png", - "x_offset": -17, - "y_offset": -176 + "x": -17, + "y": -176 }, { "path": "track/raptor/large_half_loop_right_1_7.png", - "x_offset": -18, - "y_offset": -12 + "x": -18, + "y": -12 }, { "path": "track/raptor/large_half_loop_right_2_1.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/large_half_loop_right_2_2.png", - "x_offset": -10, - "y_offset": -5 + "x": -10, + "y": -5 }, { "path": "track/raptor/large_half_loop_right_2_3.png", - "x_offset": -5, - "y_offset": -32 + "x": -5, + "y": -32 }, { "path": "track/raptor/large_half_loop_right_2_4.png", - "x_offset": -14, - "y_offset": -56 + "x": -14, + "y": -56 }, { "path": "track/raptor/large_half_loop_right_2_5.png", - "x_offset": -19, - "y_offset": -111 + "x": -19, + "y": -111 }, { "path": "track/raptor/large_half_loop_right_2_6.png", - "x_offset": -13, - "y_offset": -191 + "x": -13, + "y": -191 }, { "path": "track/raptor/large_half_loop_right_2_7.png", - "x_offset": -18, - "y_offset": -21 + "x": -18, + "y": -21 }, { "path": "track/raptor/large_half_loop_right_3_1.png", - "x_offset": -26, - "y_offset": -1 + "x": -26, + "y": -1 }, { "path": "track/raptor/large_half_loop_right_3_2.png", - "x_offset": -26, - "y_offset": -4 + "x": -26, + "y": -4 }, { "path": "track/raptor/large_half_loop_right_3_3.png", - "x_offset": -28, - "y_offset": -22 + "x": -28, + "y": -22 }, { "path": "track/raptor/large_half_loop_right_3_4.png", - "x_offset": -32, - "y_offset": -69 + "x": -32, + "y": -69 }, { "path": "track/raptor/large_half_loop_right_3_5.png", - "x_offset": 20, - "y_offset": -118 + "x": 20, + "y": -118 }, { "path": "track/raptor/large_half_loop_right_3_6.png", - "x_offset": 0, - "y_offset": -191 + "x": 0, + "y": -191 }, { "path": "track/raptor/large_half_loop_right_3_7.png", - "x_offset": -15, - "y_offset": -21 + "x": -15, + "y": -21 }, { "path": "track/raptor/large_half_loop_right_4_1.png", - "x_offset": -21, - "y_offset": -22 + "x": -21, + "y": -22 }, { "path": "track/raptor/large_half_loop_right_4_2.png", - "x_offset": -22, - "y_offset": -36 + "x": -22, + "y": -36 }, { "path": "track/raptor/large_half_loop_right_4_3.png", - "x_offset": -18, - "y_offset": -64 + "x": -18, + "y": -64 }, { "path": "track/raptor/large_half_loop_right_4_4.png", - "x_offset": -2, - "y_offset": -80 + "x": -2, + "y": -80 }, { "path": "track/raptor/large_half_loop_right_4_5.png", - "x_offset": -3, - "y_offset": -65 + "x": -3, + "y": -65 }, { "path": "track/raptor/large_half_loop_right_4_6.png", - "x_offset": -27, - "y_offset": -172 + "x": -27, + "y": -172 }, { "path": "track/raptor/large_half_loop_right_4_7.png", - "x_offset": -27, - "y_offset": -9 + "x": -27, + "y": -9 }, { "path": "track/raptor/zero_g_roll_left_1_1.png", - "x_offset": -18, - "y_offset": -9, + "x": -18, + "y": -9, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_1_2.png", - "x_offset": 4, - "y_offset": -12, + "x": 4, + "y": -12, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_1_3.png", - "x_offset": -10, - "y_offset": -19, + "x": -10, + "y": -19, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_1_4.png", - "x_offset": -16, - "y_offset": -21, + "x": -16, + "y": -21, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_2_1.png", - "x_offset": -18, - "y_offset": 1, + "x": -18, + "y": 1, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_2_2.png", - "x_offset": -17, - "y_offset": 2, + "x": -17, + "y": 2, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_2_3.png", - "x_offset": -23, - "y_offset": -11, + "x": -23, + "y": -11, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_2_4.png", - "x_offset": -21, - "y_offset": -11, + "x": -21, + "y": -11, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_3_1.png", - "x_offset": -19, - "y_offset": -4, + "x": -19, + "y": -4, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_3_2.png", - "x_offset": -21, - "y_offset": -19, + "x": -21, + "y": -19, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_3_3.png", - "x_offset": 4, - "y_offset": -15, + "x": 4, + "y": -15, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_3_4.png", - "x_offset": -18, - "y_offset": -19, + "x": -18, + "y": -19, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_4_1.png", - "x_offset": -12, - "y_offset": -21, + "x": -12, + "y": -21, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_4_2.png", - "x_offset": -11, - "y_offset": -34, + "x": -11, + "y": -34, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_4_3.png", - "x_offset": 12, - "y_offset": -4, + "x": 12, + "y": -4, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_left_4_4.png", - "x_offset": -18, - "y_offset": -21, + "x": -18, + "y": -21, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_1_1.png", - "x_offset": -18, - "y_offset": -21, + "x": -18, + "y": -21, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_1_2.png", - "x_offset": -25, - "y_offset": -34, + "x": -25, + "y": -34, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_1_3.png", - "x_offset": -22, - "y_offset": -13, + "x": -22, + "y": -13, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_1_4.png", - "x_offset": -24, - "y_offset": -21, + "x": -24, + "y": -21, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_2_1.png", - "x_offset": -18, - "y_offset": -4, + "x": -18, + "y": -4, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_2_2.png", - "x_offset": -15, - "y_offset": -19, + "x": -15, + "y": -19, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_2_3.png", - "x_offset": -12, - "y_offset": -15, + "x": -12, + "y": -15, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_2_4.png", - "x_offset": -11, - "y_offset": -19, + "x": -11, + "y": -19, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_3_1.png", - "x_offset": -9, - "y_offset": 1, + "x": -9, + "y": 1, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_3_2.png", - "x_offset": -9, - "y_offset": 3, + "x": -9, + "y": 3, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_3_3.png", - "x_offset": -11, - "y_offset": -11, + "x": -11, + "y": -11, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_3_4.png", - "x_offset": -18, - "y_offset": -11, + "x": -18, + "y": -11, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_4_1.png", - "x_offset": -20, - "y_offset": -10, + "x": -20, + "y": -10, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_4_2.png", - "x_offset": -27, - "y_offset": -12, + "x": -27, + "y": -12, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_4_3.png", - "x_offset": -22, - "y_offset": -19, + "x": -22, + "y": -19, "palette": "keep" }, { "path": "track/raptor/zero_g_roll_right_4_4.png", - "x_offset": -18, - "y_offset": -21, + "x": -18, + "y": -21, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_1_1.png", - "x_offset": -18, - "y_offset": -42, + "x": -18, + "y": -42, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_1_2.png", - "x_offset": -21, - "y_offset": 0, + "x": -21, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_1_3.png", - "x_offset": -16, - "y_offset": -47, + "x": -16, + "y": -47, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_1_4.png", - "x_offset": -11, - "y_offset": -33, + "x": -11, + "y": -33, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_1_5.png", - "x_offset": -14, - "y_offset": -21, + "x": -14, + "y": -21, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_2_1.png", - "x_offset": -18, - "y_offset": -36, + "x": -18, + "y": -36, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_2_2.png", - "x_offset": -23, - "y_offset": -24, + "x": -23, + "y": -24, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_2_3.png", - "x_offset": -29, - "y_offset": -18, + "x": -29, + "y": -18, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_2_4.png", - "x_offset": -28, - "y_offset": -12, + "x": -28, + "y": -12, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_3_1.png", - "x_offset": -9, - "y_offset": -29, + "x": -9, + "y": -29, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_3_2.png", - "x_offset": -12, - "y_offset": -28, + "x": -12, + "y": -28, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_3_3.png", - "x_offset": -23, - "y_offset": -33, + "x": -23, + "y": -33, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_3_4.png", - "x_offset": -24, - "y_offset": -23, + "x": -24, + "y": -23, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_3_5.png", - "x_offset": 7, - "y_offset": -9, + "x": 7, + "y": -9, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_3_6.png", - "x_offset": -18, - "y_offset": -14, + "x": -18, + "y": -14, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_4_1.png", - "x_offset": -10, - "y_offset": -42, + "x": -10, + "y": -42, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_4_2.png", - "x_offset": -10, - "y_offset": -43, + "x": -10, + "y": -43, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_4_3.png", - "x_offset": -8, - "y_offset": -28, + "x": -8, + "y": -28, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_4_4.png", - "x_offset": -9, - "y_offset": -33, + "x": -9, + "y": -33, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_left_4_5.png", - "x_offset": -18, - "y_offset": -21, + "x": -18, + "y": -21, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_1_1.png", - "x_offset": -18, - "y_offset": -42, + "x": -18, + "y": -42, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_1_2.png", - "x_offset": -28, - "y_offset": -43, + "x": -28, + "y": -43, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_1_3.png", - "x_offset": -29, - "y_offset": -28, + "x": -29, + "y": -28, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_1_4.png", - "x_offset": -18, - "y_offset": -33, + "x": -18, + "y": -33, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_1_5.png", - "x_offset": -26, - "y_offset": -21, + "x": -26, + "y": -21, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_2_1.png", - "x_offset": 2, - "y_offset": -29, + "x": 2, + "y": -29, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_2_2.png", - "x_offset": -18, - "y_offset": -28, + "x": -18, + "y": -28, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_2_3.png", - "x_offset": -24, - "y_offset": -33, + "x": -24, + "y": -33, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_2_4.png", - "x_offset": -13, - "y_offset": -23, + "x": -13, + "y": -23, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_2_5.png", - "x_offset": -8, - "y_offset": -9, + "x": -8, + "y": -9, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_2_6.png", - "x_offset": -8, - "y_offset": -14, + "x": -8, + "y": -14, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_3_1.png", - "x_offset": -14, - "y_offset": -36, + "x": -14, + "y": -36, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_3_2.png", - "x_offset": -6, - "y_offset": -24, + "x": -6, + "y": -24, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_3_3.png", - "x_offset": -4, - "y_offset": -18, + "x": -4, + "y": -18, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_3_4.png", - "x_offset": -18, - "y_offset": -12, + "x": -18, + "y": -12, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_4_1.png", - "x_offset": -17, - "y_offset": -42, + "x": -17, + "y": -42, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_4_2.png", - "x_offset": -21, - "y_offset": -47, + "x": -21, + "y": -47, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_4_3.png", - "x_offset": -27, - "y_offset": -47, + "x": -27, + "y": -47, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_4_4.png", - "x_offset": -22, - "y_offset": -33, + "x": -22, + "y": -33, "palette": "keep" }, { "path": "track/raptor/large_zero_g_roll_right_4_5.png", - "x_offset": -18, - "y_offset": -21, + "x": -18, + "y": -21, "palette": "keep" }, { "path": "track/raptor/small_flat_to_steep_up_1.png", - "x_offset": -18, - "y_offset": -22 + "x": -18, + "y": -22 }, { "path": "track/raptor/small_flat_to_steep_up_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/small_flat_to_steep_up_2_2.png", - "x_offset": -13, - "y_offset": -6 + "x": -13, + "y": -6 }, { "path": "track/raptor/small_flat_to_steep_up_3_1.png", - "x_offset": -3, - "y_offset": 2 + "x": -3, + "y": 2 }, { "path": "track/raptor/small_flat_to_steep_up_3_2.png", - "x_offset": -21, - "y_offset": -6 + "x": -21, + "y": -6 }, { "path": "track/raptor/small_flat_to_steep_up_4.png", - "x_offset": -21, - "y_offset": -22 + "x": -21, + "y": -22 }, { "path": "track/raptor/small_steep_to_flat_up_1.png", - "x_offset": -18, - "y_offset": -22 + "x": -18, + "y": -22 }, { "path": "track/raptor/small_steep_to_flat_up_2_1.png", - "x_offset": -10, - "y_offset": -10 + "x": -10, + "y": -10 }, { "path": "track/raptor/small_steep_to_flat_up_2_2.png", - "x_offset": -18, - "y_offset": -5 + "x": -18, + "y": -5 }, { "path": "track/raptor/small_steep_to_flat_up_3_1.png", - "x_offset": -18, - "y_offset": -10 + "x": -18, + "y": -10 }, { "path": "track/raptor/small_steep_to_flat_up_3_2.png", - "x_offset": -4, - "y_offset": -5 + "x": -4, + "y": -5 }, { "path": "track/raptor/small_steep_to_flat_up_4.png", - "x_offset": -18, - "y_offset": -22 + "x": -18, + "y": -22 }, { "path": "track/raptor/small_flat_to_steep_up_diag_1.png", - "x_offset": -32, - "y_offset": -15 + "x": -32, + "y": -15 }, { "path": "track/raptor/small_flat_to_steep_up_diag_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/small_flat_to_steep_up_diag_3.png", - "x_offset": -32, - "y_offset": -15 + "x": -32, + "y": -15 }, { "path": "track/raptor/small_flat_to_steep_up_diag_4.png", - "x_offset": -3, - "y_offset": -30 + "x": -3, + "y": -30 }, { "path": "track/raptor/small_steep_to_flat_up_diag_1.png", - "x_offset": -32, - "y_offset": -15 + "x": -32, + "y": -15 }, { "path": "track/raptor/small_steep_to_flat_up_diag_2.png", - "x_offset": -3, - "y_offset": -10 + "x": -3, + "y": -10 }, { "path": "track/raptor/small_steep_to_flat_up_diag_3.png", - "x_offset": -32, - "y_offset": -15 + "x": -32, + "y": -15 }, { "path": "track/raptor/small_steep_to_flat_up_diag_4.png", - "x_offset": -3, - "y_offset": -30 + "x": -3, + "y": -30 }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_1_1.png", - "x_offset": -18, - "y_offset": -13, + "x": -18, + "y": -13, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_1_2.png", - "x_offset": -26, - "y_offset": -8, + "x": -26, + "y": -8, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_1_3.png", - "x_offset": 19, - "y_offset": 8, + "x": 19, + "y": 8, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_1_4.png", - "x_offset": -7, - "y_offset": -6, + "x": -7, + "y": -6, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_2_1.png", - "x_offset": -18, - "y_offset": -2, + "x": -18, + "y": -2, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_2_2.png", - "x_offset": -16, - "y_offset": -6, + "x": -16, + "y": -6, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_2_3.png", - "x_offset": -24, - "y_offset": 19, + "x": -24, + "y": 19, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_2_4.png", - "x_offset": -32, - "y_offset": -7, + "x": -32, + "y": -7, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_3_1.png", - "x_offset": -6, - "y_offset": 1, + "x": -6, + "y": 1, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_3_2.png", - "x_offset": 10, - "y_offset": 2, + "x": 10, + "y": 2, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_3_3.png", - "x_offset": -27, - "y_offset": 4, + "x": -27, + "y": 4, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_3_4.png", - "x_offset": -3, - "y_offset": -11, + "x": -3, + "y": -11, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_4_1.png", - "x_offset": -23, - "y_offset": -13, + "x": -23, + "y": -13, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_4_2.png", - "x_offset": -25, - "y_offset": -4, + "x": -25, + "y": -4, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_4_3.png", - "x_offset": 0, - "y_offset": -9, + "x": 0, + "y": -9, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_diag_gentle_up_4_4.png", - "x_offset": 0, - "y_offset": -7, + "x": 0, + "y": -7, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_1_1.png", - "x_offset": -18, - "y_offset": -13, + "x": -18, + "y": -13, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_1_2.png", - "x_offset": -13, - "y_offset": -4, + "x": -13, + "y": -4, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_1_3.png", - "x_offset": -10, - "y_offset": -9, + "x": -10, + "y": -9, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_1_4.png", - "x_offset": -32, - "y_offset": -7, + "x": -32, + "y": -7, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_2_1.png", - "x_offset": -18, - "y_offset": 1, + "x": -18, + "y": 1, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_2_2.png", - "x_offset": -29, - "y_offset": 2, + "x": -29, + "y": 2, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_2_3.png", - "x_offset": 19, - "y_offset": 4, + "x": 19, + "y": 4, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_2_4.png", - "x_offset": -10, - "y_offset": -11, + "x": -10, + "y": -11, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_3_1.png", - "x_offset": -16, - "y_offset": -2, + "x": -16, + "y": -2, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_3_2.png", - "x_offset": -8, - "y_offset": -6, + "x": -8, + "y": -6, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_3_3.png", - "x_offset": 0, - "y_offset": 19, + "x": 0, + "y": 19, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_3_4.png", - "x_offset": 0, - "y_offset": -7, + "x": 0, + "y": -7, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_4_1.png", - "x_offset": -12, - "y_offset": -13, + "x": -12, + "y": -13, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_4_2.png", - "x_offset": 5, - "y_offset": -8, + "x": 5, + "y": -8, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_4_3.png", - "x_offset": -32, - "y_offset": 8, + "x": -32, + "y": 8, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_diag_gentle_up_4_4.png", - "x_offset": -3, - "y_offset": -6, + "x": -3, + "y": -6, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -5, + "x": 0, + "y": -5, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": -12, + "x": -32, + "y": -12, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_1_4.png", - "x_offset": -27, - "y_offset": -14, + "x": -27, + "y": -14, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_2_1.png", - "x_offset": -3, - "y_offset": 10, + "x": -3, + "y": 10, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_2_3.png", - "x_offset": 0, - "y_offset": -4, + "x": 0, + "y": -4, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_2_4.png", - "x_offset": -16, - "y_offset": 0, + "x": -16, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -1, + "x": -32, + "y": -1, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_3_3.png", - "x_offset": -22, - "y_offset": 3, + "x": -22, + "y": 3, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_3_4.png", - "x_offset": -19, - "y_offset": 1, + "x": -19, + "y": 1, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_4_1.png", - "x_offset": -6, - "y_offset": -8, + "x": -6, + "y": -8, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_4_3.png", - "x_offset": -19, - "y_offset": -1, + "x": -19, + "y": -1, "palette": "keep" }, { "path": "track/raptor/large_turn_left_to_orthogonal_gentle_up_4_4.png", - "x_offset": -19, - "y_offset": -14, + "x": -19, + "y": -14, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -1, + "x": 0, + "y": -1, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": 3, + "x": -32, + "y": 3, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_1_4.png", - "x_offset": -14, - "y_offset": 1, + "x": -14, + "y": 1, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_2_1.png", - "x_offset": -3, - "y_offset": 10, + "x": -3, + "y": 10, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_2_3.png", - "x_offset": -16, - "y_offset": -4, + "x": -16, + "y": -4, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_2_4.png", - "x_offset": -19, - "y_offset": 0, + "x": -19, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -5, + "x": -32, + "y": -5, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_3_3.png", - "x_offset": -10, - "y_offset": -12, + "x": -10, + "y": -12, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_3_4.png", - "x_offset": -19, - "y_offset": -14, + "x": -19, + "y": -14, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_4_1.png", - "x_offset": -3, - "y_offset": -8, + "x": -3, + "y": -8, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_4_3.png", - "x_offset": -1, - "y_offset": -1, + "x": -1, + "y": -1, "palette": "keep" }, { "path": "track/raptor/large_turn_right_to_orthogonal_gentle_up_4_4.png", - "x_offset": -19, - "y_offset": -14, + "x": -19, + "y": -14, "palette": "keep" }, { "path": "track/raptor/gentle_up_to_gentle_up_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/raptor/gentle_up_to_gentle_up_left_bank_diag_1_2.png", - "x_offset": -31, - "y_offset": -6, + "x": -31, + "y": -6, "palette": "keep" }, { "path": "track/raptor/gentle_up_to_gentle_up_left_bank_diag_2.png", - "x_offset": -5, - "y_offset": -6, + "x": -5, + "y": -6, "palette": "keep" }, { "path": "track/raptor/gentle_up_to_gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/raptor/gentle_up_to_gentle_up_left_bank_diag_4.png", - "x_offset": -3, - "y_offset": -23, + "x": -3, + "y": -23, "palette": "keep" }, { "path": "track/raptor/gentle_up_to_gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/raptor/gentle_up_to_gentle_up_right_bank_diag_2.png", - "x_offset": -3, - "y_offset": -6, + "x": -3, + "y": -6, "palette": "keep" }, { "path": "track/raptor/gentle_up_to_gentle_up_right_bank_diag_3_1.png", - "x_offset": -29, - "y_offset": -6, + "x": -29, + "y": -6, "palette": "keep" }, { "path": "track/raptor/gentle_up_to_gentle_up_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/raptor/gentle_up_to_gentle_up_right_bank_diag_4.png", - "x_offset": -6, - "y_offset": -23, + "x": -6, + "y": -23, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_gentle_up_diag_1_1.png", - "x_offset": -14, - "y_offset": -7, + "x": -14, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_gentle_up_diag_1_2.png", - "x_offset": -32, - "y_offset": 0, + "x": -32, + "y": 0, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_gentle_up_diag_2.png", - "x_offset": -5, - "y_offset": -7, + "x": -5, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_gentle_up_diag_3.png", - "x_offset": -32, - "y_offset": -7, + "x": -32, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_gentle_up_diag_4.png", - "x_offset": -3, - "y_offset": -22, + "x": -3, + "y": -22, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_gentle_up_diag_1.png", - "x_offset": -32, - "y_offset": -7, + "x": -32, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_gentle_up_diag_2.png", - "x_offset": -3, - "y_offset": -7, + "x": -3, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_gentle_up_diag_3_1.png", - "x_offset": -32, - "y_offset": -7, + "x": -32, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_gentle_up_diag_3_2.png", - "x_offset": -31, - "y_offset": 0, + "x": -31, + "y": 0, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_gentle_up_diag_4.png", - "x_offset": -6, - "y_offset": -22, + "x": -6, + "y": -22, "palette": "keep" }, { "path": "track/raptor/left_bank_to_gentle_up_left_bank_diag_1.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/raptor/left_bank_to_gentle_up_left_bank_diag_2.png", - "x_offset": -6, - "y_offset": -7, + "x": -6, + "y": -7, "palette": "keep" }, { "path": "track/raptor/left_bank_to_gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": 0, + "x": -32, + "y": 0, "palette": "keep" }, { "path": "track/raptor/left_bank_to_gentle_up_left_bank_diag_4.png", - "x_offset": -2, - "y_offset": -15, + "x": -2, + "y": -15, "palette": "keep" }, { "path": "track/raptor/right_bank_to_gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": 0, + "x": -32, + "y": 0, "palette": "keep" }, { "path": "track/raptor/right_bank_to_gentle_up_right_bank_diag_2.png", - "x_offset": -2, - "y_offset": -7, + "x": -2, + "y": -7, "palette": "keep" }, { "path": "track/raptor/right_bank_to_gentle_up_right_bank_diag_3.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/raptor/right_bank_to_gentle_up_right_bank_diag_4.png", - "x_offset": -6, - "y_offset": -15, + "x": -6, + "y": -15, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_left_bank_diag_1.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_left_bank_diag_2.png", - "x_offset": -6, - "y_offset": -7, + "x": -6, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": 0, + "x": -32, + "y": 0, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_left_bank_diag_4.png", - "x_offset": -2, - "y_offset": -15, + "x": -2, + "y": -15, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": 0, + "x": -32, + "y": 0, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_right_bank_diag_2.png", - "x_offset": -2, - "y_offset": -7, + "x": -2, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_right_bank_diag_3.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_right_bank_diag_4.png", - "x_offset": -6, - "y_offset": -15, + "x": -6, + "y": -15, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_diag_1.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_diag_2.png", - "x_offset": -6, - "y_offset": -7, + "x": -6, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_diag_4.png", - "x_offset": -2, - "y_offset": -23, + "x": -2, + "y": -23, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_diag_2.png", - "x_offset": -2, - "y_offset": -7, + "x": -2, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_diag_3.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_diag_4.png", - "x_offset": -6, - "y_offset": -23, + "x": -6, + "y": -23, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": 7, + "x": -32, + "y": 7, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_left_bank_diag_1_2.png", - "x_offset": -29, - "y_offset": 2, + "x": -29, + "y": 2, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_left_bank_diag_2.png", - "x_offset": -5, - "y_offset": -6, + "x": -5, + "y": -6, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": 0, + "x": -32, + "y": 0, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_left_bank_diag_4.png", - "x_offset": -3, - "y_offset": -15, + "x": -3, + "y": -15, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": 0, + "x": -32, + "y": 0, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_right_bank_diag_2.png", - "x_offset": -3, - "y_offset": -6, + "x": -3, + "y": -6, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_right_bank_diag_3_1.png", - "x_offset": -29, - "y_offset": 2, + "x": -29, + "y": 2, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/raptor/flat_to_gentle_up_right_bank_diag_4.png", - "x_offset": -6, - "y_offset": -15, + "x": -6, + "y": -15, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_flat_diag_1_1.png", - "x_offset": -9, - "y_offset": 1, + "x": -9, + "y": 1, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_flat_diag_1_2.png", - "x_offset": -32, - "y_offset": 6, + "x": -32, + "y": 6, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_flat_diag_2.png", - "x_offset": -5, - "y_offset": -7, + "x": -5, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_flat_diag_3.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/raptor/gentle_up_left_bank_to_flat_diag_4.png", - "x_offset": -3, - "y_offset": -14, + "x": -3, + "y": -14, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_flat_diag_1.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_flat_diag_2.png", - "x_offset": -3, - "y_offset": -7, + "x": -3, + "y": -7, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_flat_diag_3_1.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_flat_diag_3_2.png", - "x_offset": -30, - "y_offset": 6, + "x": -30, + "y": 6, "palette": "keep" }, { "path": "track/raptor/gentle_up_right_bank_to_flat_diag_4.png", - "x_offset": -6, - "y_offset": -13, + "x": -6, + "y": -13, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_1_1.png", - "x_offset": -17, - "y_offset": -13, + "x": -17, + "y": -13, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_1_2.png", - "x_offset": -24, - "y_offset": -24, + "x": -24, + "y": -24, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_1_3.png", - "x_offset": 21, - "y_offset": 8, + "x": 21, + "y": 8, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_1_4.png", - "x_offset": -6, - "y_offset": -6, + "x": -6, + "y": -6, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_2_1.png", - "x_offset": -19, - "y_offset": -2, + "x": -19, + "y": -2, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_2_2.png", - "x_offset": -16, - "y_offset": -7, + "x": -16, + "y": -7, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_2_3.png", - "x_offset": -24, - "y_offset": 19, + "x": -24, + "y": 19, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_2_4.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_3_1.png", - "x_offset": -7, - "y_offset": 0, + "x": -7, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_3_2.png", - "x_offset": 10, - "y_offset": 0, + "x": 10, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_3_3.png", - "x_offset": -28, - "y_offset": 2, + "x": -28, + "y": 2, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_3_4.png", - "x_offset": -5, - "y_offset": -12, + "x": -5, + "y": -12, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_4_1.png", - "x_offset": -22, - "y_offset": -14, + "x": -22, + "y": -14, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_4_2.png", - "x_offset": -24, - "y_offset": -5, + "x": -24, + "y": -5, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_4_3.png", - "x_offset": 0, - "y_offset": -11, + "x": 0, + "y": -11, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_diag_gentle_up_4_4.png", - "x_offset": 0, - "y_offset": -8, + "x": 0, + "y": -8, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_1_1.png", - "x_offset": -19, - "y_offset": -14, + "x": -19, + "y": -14, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_1_2.png", - "x_offset": -14, - "y_offset": -5, + "x": -14, + "y": -5, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_1_3.png", - "x_offset": -10, - "y_offset": -11, + "x": -10, + "y": -11, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_1_4.png", - "x_offset": -32, - "y_offset": -8, + "x": -32, + "y": -8, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_2_1.png", - "x_offset": -17, - "y_offset": 0, + "x": -17, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_2_2.png", - "x_offset": -28, - "y_offset": 0, + "x": -28, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_2_3.png", - "x_offset": 19, - "y_offset": 2, + "x": 19, + "y": 2, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_2_4.png", - "x_offset": -9, - "y_offset": -12, + "x": -9, + "y": -12, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_3_1.png", - "x_offset": -16, - "y_offset": -2, + "x": -16, + "y": -2, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_3_2.png", - "x_offset": -8, - "y_offset": -7, + "x": -8, + "y": -7, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_3_3.png", - "x_offset": 0, - "y_offset": 19, + "x": 0, + "y": 19, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_3_4.png", - "x_offset": 0, - "y_offset": -6, + "x": 0, + "y": -6, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_4_1.png", - "x_offset": -13, - "y_offset": -13, + "x": -13, + "y": -13, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_4_2.png", - "x_offset": -1, - "y_offset": -24, + "x": -1, + "y": -24, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_4_3.png", - "x_offset": -32, - "y_offset": 8, + "x": -32, + "y": 8, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_diag_gentle_up_4_4.png", - "x_offset": -6, - "y_offset": -6, + "x": -6, + "y": -6, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -4, + "x": 0, + "y": -4, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": -11, + "x": -32, + "y": -11, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_1_4.png", - "x_offset": -26, - "y_offset": -14, + "x": -26, + "y": -14, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_2_1.png", - "x_offset": -5, - "y_offset": 9, + "x": -5, + "y": 9, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_2_3.png", - "x_offset": 0, - "y_offset": -3, + "x": 0, + "y": -3, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_2_4.png", - "x_offset": -16, - "y_offset": 0, + "x": -16, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -2, + "x": -32, + "y": -2, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_3_3.png", - "x_offset": -22, - "y_offset": 2, + "x": -22, + "y": 2, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_3_4.png", - "x_offset": -20, - "y_offset": 0, + "x": -20, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_4_1.png", - "x_offset": -4, - "y_offset": -8, + "x": -4, + "y": -8, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_4_3.png", - "x_offset": -18, - "y_offset": -2, + "x": -18, + "y": -2, "palette": "keep" }, { "path": "track/raptor/large_turn_left_bank_to_orthogonal_gentle_up_4_4.png", - "x_offset": -18, - "y_offset": -15, + "x": -18, + "y": -15, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_1_1.png", - "x_offset": 0, - "y_offset": -2, + "x": 0, + "y": -2, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_1_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_1_3.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_1_4.png", - "x_offset": -13, - "y_offset": 0, + "x": -13, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_2_1.png", - "x_offset": -2, - "y_offset": 9, + "x": -2, + "y": 9, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_2_3.png", - "x_offset": -16, - "y_offset": -3, + "x": -16, + "y": -3, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_2_4.png", - "x_offset": -18, - "y_offset": 0, + "x": -18, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -4, + "x": -32, + "y": -4, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_3_3.png", - "x_offset": -9, - "y_offset": -11, + "x": -9, + "y": -11, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_3_4.png", - "x_offset": -20, - "y_offset": -14, + "x": -20, + "y": -14, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_4_1.png", - "x_offset": -6, - "y_offset": -8, + "x": -6, + "y": -8, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_4_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_4_3.png", - "x_offset": -3, - "y_offset": -2, + "x": -3, + "y": -2, "palette": "keep" }, { "path": "track/raptor/large_turn_right_bank_to_orthogonal_gentle_up_4_4.png", - "x_offset": -20, - "y_offset": -15, + "x": -20, + "y": -15, "palette": "keep" }, { "path": "track/raptor/flat_lift_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_lift_2.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_lift_3.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_lift_4.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_to_gentle_up_lift_1.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/flat_to_gentle_up_lift_2.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/flat_to_gentle_up_lift_3.png", - "x_offset": -19, - "y_offset": 2 + "x": -19, + "y": 2 }, { "path": "track/raptor/flat_to_gentle_up_lift_4.png", - "x_offset": -19, - "y_offset": -6 + "x": -19, + "y": -6 }, { "path": "track/raptor/gentle_up_to_flat_lift_1.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/gentle_up_to_flat_lift_2.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_up_to_flat_lift_3.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_up_to_flat_lift_4.png", - "x_offset": -18, - "y_offset": -6 + "x": -18, + "y": -6 }, { "path": "track/raptor/gentle_lift_1.png", - "x_offset": -18, - "y_offset": -14 + "x": -18, + "y": -14 }, { "path": "track/raptor/gentle_lift_2.png", - "x_offset": -18, - "y_offset": 1 + "x": -18, + "y": 1 }, { "path": "track/raptor/gentle_lift_3.png", - "x_offset": -19, - "y_offset": 1 + "x": -19, + "y": 1 }, { "path": "track/raptor/gentle_lift_4.png", - "x_offset": -19, - "y_offset": -14 + "x": -19, + "y": -14 }, { "path": "track/raptor/gentle_to_steep_up_lift_1.png", - "x_offset": -18, - "y_offset": -30 + "x": -18, + "y": -30 }, { "path": "track/raptor/gentle_to_steep_up_lift_2_1.png", - "x_offset": -18, - "y_offset": -1 + "x": -18, + "y": -1 }, { "path": "track/raptor/gentle_to_steep_up_lift_2_2.png", - "x_offset": -17, - "y_offset": -14 + "x": -17, + "y": -14 }, { "path": "track/raptor/gentle_to_steep_up_lift_3_1.png", - "x_offset": 0, - "y_offset": -1 + "x": 0, + "y": -1 }, { "path": "track/raptor/gentle_to_steep_up_lift_3_2.png", - "x_offset": -21, - "y_offset": -14 + "x": -21, + "y": -14 }, { "path": "track/raptor/gentle_to_steep_up_lift_4.png", - "x_offset": -21, - "y_offset": -30 + "x": -21, + "y": -30 }, { "path": "track/raptor/steep_to_gentle_up_lift_1.png", - "x_offset": -18, - "y_offset": -30 + "x": -18, + "y": -30 }, { "path": "track/raptor/steep_to_gentle_up_lift_2_1.png", - "x_offset": -5, - "y_offset": -15 + "x": -5, + "y": -15 }, { "path": "track/raptor/steep_to_gentle_up_lift_2_2.png", - "x_offset": -18, - "y_offset": -10 + "x": -18, + "y": -10 }, { "path": "track/raptor/steep_to_gentle_up_lift_3_1.png", - "x_offset": -19, - "y_offset": -15 + "x": -19, + "y": -15 }, { "path": "track/raptor/steep_to_gentle_up_lift_3_2.png", - "x_offset": -12, - "y_offset": -10 + "x": -12, + "y": -10 }, { "path": "track/raptor/steep_to_gentle_up_lift_4.png", - "x_offset": -19, - "y_offset": -30 + "x": -19, + "y": -30 }, { "path": "track/raptor/steep_lift_1.png", - "x_offset": -18, - "y_offset": -62 + "x": -18, + "y": -62 }, { "path": "track/raptor/steep_lift_2.png", - "x_offset": -18, - "y_offset": -46 + "x": -18, + "y": -46 }, { "path": "track/raptor/steep_lift_3.png", - "x_offset": -21, - "y_offset": -46 + "x": -21, + "y": -46 }, { "path": "track/raptor/steep_lift_4.png", - "x_offset": -21, - "y_offset": -62 + "x": -21, + "y": -62 }, { "path": "track/raptor/flat_diag_lift_1.png", - "x_offset": -32, - "y_offset": 9 + "x": -32, + "y": 9 }, { "path": "track/raptor/flat_diag_lift_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/flat_diag_lift_3.png", - "x_offset": -32, - "y_offset": 9 + "x": -32, + "y": 9 }, { "path": "track/raptor/flat_diag_lift_4.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/flat_to_gentle_up_diag_lift_1.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/flat_to_gentle_up_diag_lift_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/flat_to_gentle_up_diag_lift_3.png", - "x_offset": -33, - "y_offset": 1 + "x": -33, + "y": 1 }, { "path": "track/raptor/flat_to_gentle_up_diag_lift_4.png", - "x_offset": -3, - "y_offset": -14 + "x": -3, + "y": -14 }, { "path": "track/raptor/gentle_to_flat_up_diag_lift_1.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/gentle_to_flat_up_diag_lift_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/gentle_to_flat_up_diag_lift_3.png", - "x_offset": -32, - "y_offset": 1 + "x": -32, + "y": 1 }, { "path": "track/raptor/gentle_to_flat_up_diag_lift_4.png", - "x_offset": -3, - "y_offset": -14 + "x": -3, + "y": -14 }, { "path": "track/raptor/gentle_diag_lift_1.png", - "x_offset": -32, - "y_offset": -7 + "x": -32, + "y": -7 }, { "path": "track/raptor/gentle_diag_lift_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/gentle_diag_lift_3.png", - "x_offset": -32, - "y_offset": -7 + "x": -32, + "y": -7 }, { "path": "track/raptor/gentle_diag_lift_4.png", - "x_offset": -3, - "y_offset": -22 + "x": -3, + "y": -22 }, { "path": "track/raptor/gentle_to_steep_up_diag_lift_1.png", - "x_offset": -32, - "y_offset": -23 + "x": -32, + "y": -23 }, { "path": "track/raptor/gentle_to_steep_up_diag_lift_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/gentle_to_steep_up_diag_lift_3.png", - "x_offset": -32, - "y_offset": -23 + "x": -32, + "y": -23 }, { "path": "track/raptor/gentle_to_steep_up_diag_lift_4.png", - "x_offset": -3, - "y_offset": -38 + "x": -3, + "y": -38 }, { "path": "track/raptor/steep_to_gentle_up_diag_lift_1.png", - "x_offset": -32, - "y_offset": -23 + "x": -32, + "y": -23 }, { "path": "track/raptor/steep_to_gentle_up_diag_lift_2.png", - "x_offset": -3, - "y_offset": -11 + "x": -3, + "y": -11 }, { "path": "track/raptor/steep_to_gentle_up_diag_lift_3.png", - "x_offset": -32, - "y_offset": -23 + "x": -32, + "y": -23 }, { "path": "track/raptor/steep_to_gentle_up_diag_lift_4.png", - "x_offset": -3, - "y_offset": -38 + "x": -3, + "y": -38 }, { "path": "track/raptor/steep_diag_lift_1.png", - "x_offset": -32, - "y_offset": -55 + "x": -32, + "y": -55 }, { "path": "track/raptor/steep_diag_lift_2.png", - "x_offset": -3, - "y_offset": -38 + "x": -3, + "y": -38 }, { "path": "track/raptor/steep_diag_lift_3.png", - "x_offset": -32, - "y_offset": -55 + "x": -32, + "y": -55 }, { "path": "track/raptor/steep_diag_lift_4.png", - "x_offset": -3, - "y_offset": -70 + "x": -3, + "y": -70 }, { "path": "track/raptor/small_flat_to_steep_up_lift_1.png", - "x_offset": -18, - "y_offset": -22 + "x": -18, + "y": -22 }, { "path": "track/raptor/small_flat_to_steep_up_lift_2_1.png", - "x_offset": -18, - "y_offset": 2 + "x": -18, + "y": 2 }, { "path": "track/raptor/small_flat_to_steep_up_lift_2_2.png", - "x_offset": -13, - "y_offset": -6 + "x": -13, + "y": -6 }, { "path": "track/raptor/small_flat_to_steep_up_lift_3_1.png", - "x_offset": -5, - "y_offset": 2 + "x": -5, + "y": 2 }, { "path": "track/raptor/small_flat_to_steep_up_lift_3_2.png", - "x_offset": -21, - "y_offset": -6 + "x": -21, + "y": -6 }, { "path": "track/raptor/small_flat_to_steep_up_lift_4.png", - "x_offset": -21, - "y_offset": -22 + "x": -21, + "y": -22 }, { "path": "track/raptor/small_steep_to_flat_up_lift_1.png", - "x_offset": -18, - "y_offset": -22 + "x": -18, + "y": -22 }, { "path": "track/raptor/small_steep_to_flat_up_lift_2_1.png", - "x_offset": -10, - "y_offset": -10 + "x": -10, + "y": -10 }, { "path": "track/raptor/small_steep_to_flat_up_lift_2_2.png", - "x_offset": -18, - "y_offset": -5 + "x": -18, + "y": -5 }, { "path": "track/raptor/small_steep_to_flat_up_lift_3_1.png", - "x_offset": -18, - "y_offset": -10 + "x": -18, + "y": -10 }, { "path": "track/raptor/small_steep_to_flat_up_lift_3_2.png", - "x_offset": -4, - "y_offset": -5 + "x": -4, + "y": -5 }, { "path": "track/raptor/small_steep_to_flat_up_lift_4.png", - "x_offset": -18, - "y_offset": -22 + "x": -18, + "y": -22 }, { "path": "track/raptor/small_flat_to_steep_up_diag_lift_1.png", - "x_offset": -32, - "y_offset": -15 + "x": -32, + "y": -15 }, { "path": "track/raptor/small_flat_to_steep_up_diag_lift_2.png", - "x_offset": -3, - "y_offset": -6 + "x": -3, + "y": -6 }, { "path": "track/raptor/small_flat_to_steep_up_diag_lift_3.png", - "x_offset": -32, - "y_offset": -15 + "x": -32, + "y": -15 }, { "path": "track/raptor/small_flat_to_steep_up_diag_lift_4.png", - "x_offset": -3, - "y_offset": -30 + "x": -3, + "y": -30 }, { "path": "track/raptor/small_steep_to_flat_up_diag_lift_1.png", - "x_offset": -32, - "y_offset": -15 + "x": -32, + "y": -15 }, { "path": "track/raptor/small_steep_to_flat_up_diag_lift_2.png", - "x_offset": -3, - "y_offset": -10 + "x": -3, + "y": -10 }, { "path": "track/raptor/small_steep_to_flat_up_diag_lift_3.png", - "x_offset": -32, - "y_offset": -15 + "x": -32, + "y": -15 }, { "path": "track/raptor/small_steep_to_flat_up_diag_lift_4.png", - "x_offset": -3, - "y_offset": -30 + "x": -3, + "y": -30 }, { "path": "track/alpine/preview_track.png", - "x_offset": 8, - "y_offset": 1 + "x": 8, + "y": 1 }, { "path": "track/alpine/preview_support.png", - "x_offset": 25, - "y_offset": 11 + "x": 25, + "y": 11 }, { "path": "track/alpine/flat_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_2.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_1.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_2.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_3.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_4.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_flat_1.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_flat_2.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_flat_3.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_flat_4.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/gentle_1.png", - "x_offset": -19, - "y_offset": -13, + "x": -19, + "y": -13, "palette": "keep" }, { "path": "track/alpine/gentle_2.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/gentle_3.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/gentle_4.png", - "x_offset": -19, - "y_offset": -13, + "x": -19, + "y": -13, "palette": "keep" }, { "path": "track/alpine/small_turn_left_1_1.png", - "x_offset": -19, - "y_offset": -1, + "x": -19, + "y": -1, "palette": "keep" }, { "path": "track/alpine/small_turn_left_1_2.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/small_turn_left_1_3.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/small_turn_left_2_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/small_turn_left_2_2.png", - "x_offset": -2, - "y_offset": 0, + "x": -2, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_turn_left_2_3.png", - "x_offset": -32, - "y_offset": 3, + "x": -32, + "y": 3, "palette": "keep" }, { "path": "track/alpine/small_turn_left_3_1.png", - "x_offset": -4, - "y_offset": 3, + "x": -4, + "y": 3, "palette": "keep" }, { "path": "track/alpine/small_turn_left_3_2.png", - "x_offset": 24, - "y_offset": 1, + "x": 24, + "y": 1, "palette": "keep" }, { "path": "track/alpine/small_turn_left_3_3.png", - "x_offset": -8, - "y_offset": -1, + "x": -8, + "y": -1, "palette": "keep" }, { "path": "track/alpine/small_turn_left_4_1.png", - "x_offset": -26, - "y_offset": 8, + "x": -26, + "y": 8, "palette": "keep" }, { "path": "track/alpine/small_turn_left_4_2.png", - "x_offset": -8, - "y_offset": 24, + "x": -8, + "y": 24, "palette": "keep" }, { "path": "track/alpine/small_turn_left_4_3.png", - "x_offset": -19, - "y_offset": 8, + "x": -19, + "y": 8, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_1_1.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_1_2.png", - "x_offset": -28, - "y_offset": 6, + "x": -28, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_1_3.png", - "x_offset": 9, - "y_offset": 6, + "x": 9, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_1_4.png", - "x_offset": -24, - "y_offset": 9, + "x": -24, + "y": 9, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_1_5.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_2_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_2_2.png", - "x_offset": -8, - "y_offset": 0, + "x": -8, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_2_3.png", - "x_offset": -28, - "y_offset": 17, + "x": -28, + "y": 17, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_2_4.png", - "x_offset": -14, - "y_offset": 0, + "x": -14, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_2_5.png", - "x_offset": -30, - "y_offset": 3, + "x": -30, + "y": 3, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_3_1.png", - "x_offset": -14, - "y_offset": 3, + "x": -14, + "y": 3, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_3_2.png", - "x_offset": 11, - "y_offset": 9, + "x": 11, + "y": 9, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_3_3.png", - "x_offset": -22, - "y_offset": 6, + "x": -22, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_3_4.png", - "x_offset": 12, - "y_offset": 6, + "x": 12, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_3_5.png", - "x_offset": -10, - "y_offset": 2, + "x": -10, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_4_1.png", - "x_offset": -22, - "y_offset": 7, + "x": -22, + "y": 7, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_4_2.png", - "x_offset": -28, - "y_offset": 17, + "x": -28, + "y": 17, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_4_3.png", - "x_offset": -14, - "y_offset": 1, + "x": -14, + "y": 1, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_4_4.png", - "x_offset": -16, - "y_offset": 17, + "x": -16, + "y": 17, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_4_5.png", - "x_offset": -19, - "y_offset": 7, + "x": -19, + "y": 7, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_1_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_1_2.png", - "x_offset": -26, - "y_offset": 0, + "x": -26, + "y": 0, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_1_3.png", - "x_offset": 17, - "y_offset": 12, + "x": 17, + "y": 12, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_1_4.png", - "x_offset": -8, - "y_offset": 12, + "x": -8, + "y": 12, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_2_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_2_2.png", - "x_offset": -10, - "y_offset": 2, + "x": -10, + "y": 2, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_2_3.png", - "x_offset": -20, - "y_offset": 21, + "x": -20, + "y": 21, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_2_4.png", - "x_offset": -28, - "y_offset": 9, + "x": -28, + "y": 9, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_3_1.png", - "x_offset": -16, - "y_offset": 3, + "x": -16, + "y": 3, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_3_2.png", - "x_offset": -1, - "y_offset": 7, + "x": -1, + "y": 7, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_3_3.png", - "x_offset": -32, - "y_offset": 11, + "x": -32, + "y": 11, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_3_4.png", - "x_offset": -4, - "y_offset": -1, + "x": -4, + "y": -1, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_4_1.png", - "x_offset": -20, - "y_offset": 6, + "x": -20, + "y": 6, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_4_2.png", - "x_offset": -32, - "y_offset": 12, + "x": -32, + "y": 12, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_4_3.png", - "x_offset": -3, - "y_offset": 0, + "x": -3, + "y": 0, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_4_4.png", - "x_offset": 0, - "y_offset": 10, + "x": 0, + "y": 10, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_1_1.png", - "x_offset": -19, - "y_offset": 6, + "x": -19, + "y": 6, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_1_2.png", - "x_offset": -18, - "y_offset": 12, + "x": -18, + "y": 12, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_1_3.png", - "x_offset": -4, - "y_offset": 0, + "x": -4, + "y": 0, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_1_4.png", - "x_offset": -32, - "y_offset": 10, + "x": -32, + "y": 10, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_2_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_2_2.png", - "x_offset": -22, - "y_offset": 7, + "x": -22, + "y": 7, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_2_3.png", - "x_offset": 23, - "y_offset": 11, + "x": 23, + "y": 11, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_2_4.png", - "x_offset": -6, - "y_offset": -1, + "x": -6, + "y": -1, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_3_1.png", - "x_offset": -28, - "y_offset": 3, + "x": -28, + "y": 3, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_3_2.png", - "x_offset": -24, - "y_offset": 2, + "x": -24, + "y": 2, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_3_3.png", - "x_offset": -12, - "y_offset": 21, + "x": -12, + "y": 21, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_3_4.png", - "x_offset": 0, - "y_offset": 9, + "x": 0, + "y": 9, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_4_1.png", - "x_offset": -12, - "y_offset": 3, + "x": -12, + "y": 3, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_4_2.png", - "x_offset": 1, - "y_offset": 0, + "x": 1, + "y": 0, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_4_3.png", - "x_offset": -31, - "y_offset": 12, + "x": -31, + "y": 12, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_4_4.png", - "x_offset": -4, - "y_offset": 12, + "x": -4, + "y": 12, "palette": "keep" }, { "path": "track/alpine/flat_diag_1.png", - "x_offset": -32, - "y_offset": 10, + "x": -32, + "y": 10, "palette": "keep" }, { "path": "track/alpine/flat_diag_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/flat_diag_3.png", - "x_offset": -32, - "y_offset": 10, + "x": -32, + "y": 10, "palette": "keep" }, { "path": "track/alpine/flat_diag_4.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_diag_1.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_diag_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_diag_3.png", - "x_offset": -33, - "y_offset": 2, + "x": -33, + "y": 2, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_diag_4.png", - "x_offset": -5, - "y_offset": -12, + "x": -5, + "y": -12, "palette": "keep" }, { "path": "track/alpine/gentle_to_flat_up_diag_1.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/gentle_to_flat_up_diag_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/gentle_to_flat_up_diag_3.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/gentle_to_flat_up_diag_4.png", - "x_offset": -5, - "y_offset": -12, + "x": -5, + "y": -12, "palette": "keep" }, { "path": "track/alpine/gentle_diag_1.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/alpine/gentle_diag_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/gentle_diag_3.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/alpine/gentle_diag_4.png", - "x_offset": -5, - "y_offset": -20, + "x": -5, + "y": -20, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_1_1.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_1_2.png", - "x_offset": -1, - "y_offset": 4, + "x": -1, + "y": 4, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_2_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_2_2.png", - "x_offset": -19, - "y_offset": 6, + "x": -19, + "y": 6, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_3.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_4.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_1.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_2.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_3_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_3_2.png", - "x_offset": -15, - "y_offset": 6, + "x": -15, + "y": 6, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_4_1.png", - "x_offset": -18, - "y_offset": 4, + "x": -18, + "y": 4, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_4_2.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_1_1.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_1_2.png", - "x_offset": -15, - "y_offset": -1, + "x": -15, + "y": -1, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_2_1.png", - "x_offset": -18, - "y_offset": 4, + "x": -18, + "y": 4, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_2_2.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_3.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_4.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_1.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_2.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_3_1.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_3_2.png", - "x_offset": -5, - "y_offset": 4, + "x": -5, + "y": 4, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_4_1.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_4_2.png", - "x_offset": -18, - "y_offset": -1, + "x": -18, + "y": -1, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_1_1.png", - "x_offset": -19, - "y_offset": -4, + "x": -19, + "y": -4, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_1_2.png", - "x_offset": -1, - "y_offset": -4, + "x": -1, + "y": -4, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_2_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_2_2.png", - "x_offset": -16, - "y_offset": 6, + "x": -16, + "y": 6, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_3.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_4.png", - "x_offset": -19, - "y_offset": -6, + "x": -19, + "y": -6, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_1.png", - "x_offset": -19, - "y_offset": -6, + "x": -19, + "y": -6, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_2.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_3_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_3_2.png", - "x_offset": -15, - "y_offset": 6, + "x": -15, + "y": 6, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_4_1.png", - "x_offset": -18, - "y_offset": -4, + "x": -18, + "y": -4, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_4_2.png", - "x_offset": -19, - "y_offset": -4, + "x": -19, + "y": -4, "palette": "keep" }, { "path": "track/alpine/left_bank_1.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/left_bank_2.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/left_bank_3.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/left_bank_4.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": 10, + "x": -32, + "y": 10, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_diag_1_2.png", - "x_offset": -32, - "y_offset": 12, + "x": -32, + "y": 12, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_diag_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": 9, + "x": -32, + "y": 9, "palette": "keep" }, { "path": "track/alpine/flat_to_left_bank_diag_4.png", - "x_offset": -4, - "y_offset": -5, + "x": -4, + "y": -5, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": 9, + "x": -32, + "y": 9, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_diag_2.png", - "x_offset": -4, - "y_offset": -4, + "x": -4, + "y": -4, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_diag_3_1.png", - "x_offset": -32, - "y_offset": 10, + "x": -32, + "y": 10, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": 12, + "x": -32, + "y": 12, "palette": "keep" }, { "path": "track/alpine/flat_to_right_bank_diag_4.png", - "x_offset": -5, - "y_offset": -5, + "x": -5, + "y": -5, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_diag_1_1.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_diag_1_2.png", - "x_offset": -32, - "y_offset": 7, + "x": -32, + "y": 7, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_diag_2.png", - "x_offset": -5, - "y_offset": -5, + "x": -5, + "y": -5, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_diag_3.png", - "x_offset": -33, - "y_offset": 2, + "x": -33, + "y": 2, "palette": "keep" }, { "path": "track/alpine/left_bank_to_gentle_up_diag_4.png", - "x_offset": -4, - "y_offset": -12, + "x": -4, + "y": -12, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_diag_1.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_diag_2.png", - "x_offset": -4, - "y_offset": -5, + "x": -4, + "y": -5, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_diag_3_1.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_diag_3_2.png", - "x_offset": -31, - "y_offset": 7, + "x": -31, + "y": 7, "palette": "keep" }, { "path": "track/alpine/right_bank_to_gentle_up_diag_4.png", - "x_offset": -5, - "y_offset": -12, + "x": -5, + "y": -12, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_diag_1_1.png", - "x_offset": -32, - "y_offset": 3, + "x": -32, + "y": 3, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_diag_1_2.png", - "x_offset": -32, - "y_offset": 4, + "x": -32, + "y": 4, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_diag_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_diag_3.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_left_bank_diag_4.png", - "x_offset": -4, - "y_offset": -13, + "x": -4, + "y": -13, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_diag_1.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_diag_2.png", - "x_offset": -4, - "y_offset": -4, + "x": -4, + "y": -4, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_diag_3_1.png", - "x_offset": -32, - "y_offset": 3, + "x": -32, + "y": 3, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_diag_3_2.png", - "x_offset": -32, - "y_offset": 4, + "x": -32, + "y": 4, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_right_bank_diag_4.png", - "x_offset": -5, - "y_offset": -13, + "x": -5, + "y": -13, "palette": "keep" }, { "path": "track/alpine/left_bank_diag_1.png", - "x_offset": -32, - "y_offset": 11, + "x": -32, + "y": 11, "palette": "keep" }, { "path": "track/alpine/left_bank_diag_2.png", - "x_offset": -5, - "y_offset": -5, + "x": -5, + "y": -5, "palette": "keep" }, { "path": "track/alpine/left_bank_diag_3.png", - "x_offset": -32, - "y_offset": 9, + "x": -32, + "y": 9, "palette": "keep" }, { "path": "track/alpine/left_bank_diag_4.png", - "x_offset": -4, - "y_offset": -5, + "x": -4, + "y": -5, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_1_1.png", - "x_offset": -19, - "y_offset": -1, + "x": -19, + "y": -1, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_1_2.png", - "x_offset": -15, - "y_offset": 4, + "x": -15, + "y": 4, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_1_3.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_1_4.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_2_1.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_2_2.png", - "x_offset": -2, - "y_offset": 0, + "x": -2, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_2_3.png", - "x_offset": -32, - "y_offset": 4, + "x": -32, + "y": 4, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_3_1.png", - "x_offset": -5, - "y_offset": 2, + "x": -5, + "y": 2, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_3_2.png", - "x_offset": 23, - "y_offset": 1, + "x": 23, + "y": 1, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_3_3.png", - "x_offset": -7, - "y_offset": -1, + "x": -7, + "y": -1, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_3_4.png", - "x_offset": -6, - "y_offset": 4, + "x": -6, + "y": 4, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_4_1.png", - "x_offset": -28, - "y_offset": 7, + "x": -28, + "y": 7, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_4_2.png", - "x_offset": -8, - "y_offset": 23, + "x": -8, + "y": 23, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_4_3.png", - "x_offset": -19, - "y_offset": 7, + "x": -19, + "y": 7, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_1_1.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_1_2.png", - "x_offset": -15, - "y_offset": 4, + "x": -15, + "y": 4, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_1_3.png", - "x_offset": -26, - "y_offset": 6, + "x": -26, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_1_4.png", - "x_offset": 11, - "y_offset": 6, + "x": 11, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_1_5.png", - "x_offset": -25, - "y_offset": 8, + "x": -25, + "y": 8, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_1_6.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_2_1.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_2_2.png", - "x_offset": -8, - "y_offset": 1, + "x": -8, + "y": 1, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_2_3.png", - "x_offset": -24, - "y_offset": 19, + "x": -24, + "y": 19, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_2_4.png", - "x_offset": -14, - "y_offset": 1, + "x": -14, + "y": 1, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_2_5.png", - "x_offset": -28, - "y_offset": 4, + "x": -28, + "y": 4, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_3_1.png", - "x_offset": -14, - "y_offset": 2, + "x": -14, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_3_2.png", - "x_offset": 11, - "y_offset": 8, + "x": 11, + "y": 8, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_3_3.png", - "x_offset": -22, - "y_offset": 6, + "x": -22, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_3_4.png", - "x_offset": 13, - "y_offset": 6, + "x": 13, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_3_5.png", - "x_offset": -9, - "y_offset": 2, + "x": -9, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_3_6.png", - "x_offset": -10, - "y_offset": 4, + "x": -10, + "y": 4, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_4_1.png", - "x_offset": -24, - "y_offset": 6, + "x": -24, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_4_2.png", - "x_offset": -30, - "y_offset": 16, + "x": -30, + "y": 16, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_4_3.png", - "x_offset": -16, - "y_offset": 0, + "x": -16, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_4_4.png", - "x_offset": -18, - "y_offset": 16, + "x": -18, + "y": 16, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_bank_4_5.png", - "x_offset": -19, - "y_offset": 6, + "x": -19, + "y": 6, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_1_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_1_2.png", - "x_offset": -24, - "y_offset": 0, + "x": -24, + "y": 0, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_1_3.png", - "x_offset": 19, - "y_offset": 12, + "x": 19, + "y": 12, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_1_4.png", - "x_offset": -13, - "y_offset": 11, + "x": -13, + "y": 11, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_2_1.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_2_2.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_2_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_2_4.png", - "x_offset": -32, - "y_offset": 10, + "x": -32, + "y": 10, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_3_1.png", - "x_offset": -17, - "y_offset": 2, + "x": -17, + "y": 2, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_3_2.png", - "x_offset": -2, - "y_offset": 7, + "x": -2, + "y": 7, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_3_3.png", - "x_offset": -32, - "y_offset": 11, + "x": -32, + "y": 11, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_3_4.png", - "x_offset": -4, - "y_offset": -1, + "x": -4, + "y": -1, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_4_1.png", - "x_offset": -22, - "y_offset": 6, + "x": -22, + "y": 6, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_4_2.png", - "x_offset": -32, - "y_offset": 11, + "x": -32, + "y": 11, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_4_3.png", - "x_offset": -4, - "y_offset": 0, + "x": -4, + "y": 0, "palette": "keep" }, { "path": "track/alpine/large_turn_left_to_diag_bank_4_4.png", - "x_offset": 0, - "y_offset": 9, + "x": 0, + "y": 9, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_1_1.png", - "x_offset": -19, - "y_offset": 6, + "x": -19, + "y": 6, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_1_2.png", - "x_offset": -20, - "y_offset": 11, + "x": -20, + "y": 11, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_1_3.png", - "x_offset": -6, - "y_offset": 0, + "x": -6, + "y": 0, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_1_4.png", - "x_offset": -32, - "y_offset": 9, + "x": -32, + "y": 9, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_2_1.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_2_2.png", - "x_offset": -22, - "y_offset": 7, + "x": -22, + "y": 7, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_2_3.png", - "x_offset": 23, - "y_offset": 11, + "x": 23, + "y": 11, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_2_4.png", - "x_offset": -6, - "y_offset": -1, + "x": -6, + "y": -1, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_3_1.png", - "x_offset": -26, - "y_offset": 4, + "x": -26, + "y": 4, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_3_2.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_3_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_3_4.png", - "x_offset": 0, - "y_offset": 10, + "x": 0, + "y": 10, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_4_1.png", - "x_offset": -25, - "y_offset": -10, + "x": -25, + "y": -10, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_4_2.png", - "x_offset": 1, - "y_offset": 0, + "x": 1, + "y": 0, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_4_3.png", - "x_offset": -31, - "y_offset": 12, + "x": -31, + "y": 12, "palette": "keep" }, { "path": "track/alpine/large_turn_right_to_diag_bank_4_4.png", - "x_offset": -4, - "y_offset": 11, + "x": -4, + "y": 11, "palette": "keep" }, { "path": "track/alpine/small_turn_left_gentle_up_1_1.png", - "x_offset": -25, - "y_offset": -30, + "x": -25, + "y": -30, "palette": "keep" }, { "path": "track/alpine/small_turn_left_gentle_up_1_2.png", - "x_offset": -13, - "y_offset": -16, + "x": -13, + "y": -16, "palette": "keep" }, { "path": "track/alpine/small_turn_left_gentle_up_2_1.png", - "x_offset": -13, - "y_offset": -7, + "x": -13, + "y": -7, "palette": "keep" }, { "path": "track/alpine/small_turn_left_gentle_up_2_2.png", - "x_offset": -38, - "y_offset": -16, + "x": -38, + "y": -16, "palette": "keep" }, { "path": "track/alpine/small_turn_left_gentle_up_3_1.png", - "x_offset": -14, - "y_offset": 0, + "x": -14, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_turn_left_gentle_up_3_2.png", - "x_offset": -2, - "y_offset": -5, + "x": -2, + "y": -5, "palette": "keep" }, { "path": "track/alpine/small_turn_left_gentle_up_4_1.png", - "x_offset": -26, - "y_offset": -11, + "x": -26, + "y": -11, "palette": "keep" }, { "path": "track/alpine/small_turn_left_gentle_up_4_2.png", - "x_offset": -25, - "y_offset": -1, + "x": -25, + "y": -1, "palette": "keep" }, { "path": "track/alpine/small_turn_right_gentle_up_1_1.png", - "x_offset": -25, - "y_offset": -11, + "x": -25, + "y": -11, "palette": "keep" }, { "path": "track/alpine/small_turn_right_gentle_up_1_2.png", - "x_offset": -26, - "y_offset": -1, + "x": -26, + "y": -1, "palette": "keep" }, { "path": "track/alpine/small_turn_right_gentle_up_2_1.png", - "x_offset": -13, - "y_offset": 0, + "x": -13, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_turn_right_gentle_up_2_2.png", - "x_offset": -25, - "y_offset": -5, + "x": -25, + "y": -5, "palette": "keep" }, { "path": "track/alpine/small_turn_right_gentle_up_3_1.png", - "x_offset": -38, - "y_offset": -7, + "x": -38, + "y": -7, "palette": "keep" }, { "path": "track/alpine/small_turn_right_gentle_up_3_2.png", - "x_offset": -13, - "y_offset": -16, + "x": -13, + "y": -16, "palette": "keep" }, { "path": "track/alpine/small_turn_right_gentle_up_4_1.png", - "x_offset": -2, - "y_offset": -23, + "x": -2, + "y": -23, "palette": "keep" }, { "path": "track/alpine/small_turn_right_gentle_up_4_2.png", - "x_offset": -14, - "y_offset": -16, + "x": -14, + "y": -16, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_1_1.png", - "x_offset": -19, - "y_offset": -13, + "x": -19, + "y": -13, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_1_2.png", - "x_offset": -28, - "y_offset": -9, + "x": -28, + "y": -9, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_1_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_1_4.png", - "x_offset": -26, - "y_offset": -6, + "x": -26, + "y": -6, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_1_5.png", - "x_offset": -19, - "y_offset": -13, + "x": -19, + "y": -13, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_2_1.png", - "x_offset": -19, - "y_offset": -4, + "x": -19, + "y": -4, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": -13, + "x": 0, + "y": -13, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_2_3.png", - "x_offset": 0, - "y_offset": 2, + "x": 0, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_2_4.png", - "x_offset": -12, - "y_offset": -20, + "x": -12, + "y": -20, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_2_5.png", - "x_offset": -17, - "y_offset": -13, + "x": -17, + "y": -13, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_3_1.png", - "x_offset": -22, - "y_offset": 3, + "x": -22, + "y": 3, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_3_3.png", - "x_offset": -20, - "y_offset": 8, + "x": -20, + "y": 8, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_3_4.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_3_5.png", - "x_offset": -13, - "y_offset": 2, + "x": -13, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_4_1.png", - "x_offset": -24, - "y_offset": -11, + "x": -24, + "y": -11, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_4_2.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_4_3.png", - "x_offset": -17, - "y_offset": -11, + "x": -17, + "y": -11, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_4_4.png", - "x_offset": -16, - "y_offset": 5, + "x": -16, + "y": 5, "palette": "keep" }, { "path": "track/alpine/medium_turn_left_gentle_up_4_5.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_1_1.png", - "x_offset": -19, - "y_offset": -11, + "x": -19, + "y": -11, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_1_2.png", - "x_offset": -11, - "y_offset": 2, + "x": -11, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_1_3.png", - "x_offset": 0, - "y_offset": -11, + "x": 0, + "y": -11, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_1_4.png", - "x_offset": -16, - "y_offset": 5, + "x": -16, + "y": 5, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_1_5.png", - "x_offset": -18, - "y_offset": 2, + "x": -18, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_2_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_2_3.png", - "x_offset": 0, - "y_offset": 8, + "x": 0, + "y": 8, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_2_4.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_2_5.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_3_1.png", - "x_offset": -32, - "y_offset": -4, + "x": -32, + "y": -4, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_3_2.png", - "x_offset": -32, - "y_offset": -13, + "x": -32, + "y": -13, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_3_3.png", - "x_offset": -25, - "y_offset": 1, + "x": -25, + "y": 1, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_3_4.png", - "x_offset": -21, - "y_offset": -22, + "x": -21, + "y": -22, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_3_5.png", - "x_offset": -19, - "y_offset": -13, + "x": -19, + "y": -13, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_4_1.png", - "x_offset": -11, - "y_offset": -11, + "x": -11, + "y": -11, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_4_2.png", - "x_offset": 11, - "y_offset": -9, + "x": 11, + "y": -9, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_4_3.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_4_4.png", - "x_offset": 10, - "y_offset": -5, + "x": 10, + "y": -5, "palette": "keep" }, { "path": "track/alpine/medium_turn_right_gentle_up_4_5.png", - "x_offset": -14, - "y_offset": -13, + "x": -14, + "y": -13, "palette": "keep" }, { "path": "track/alpine/s_bend_left_1_1.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/s_bend_left_1_2.png", - "x_offset": -26, - "y_offset": 6, + "x": -26, + "y": 6, "palette": "keep" }, { "path": "track/alpine/s_bend_left_1_3.png", - "x_offset": 10, - "y_offset": 8, + "x": 10, + "y": 8, "palette": "keep" }, { "path": "track/alpine/s_bend_left_1_4.png", - "x_offset": -15, - "y_offset": 3, + "x": -15, + "y": 3, "palette": "keep" }, { "path": "track/alpine/s_bend_left_2_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/s_bend_left_2_2.png", - "x_offset": -10, - "y_offset": 1, + "x": -10, + "y": 1, "palette": "keep" }, { "path": "track/alpine/s_bend_left_2_3.png", - "x_offset": -28, - "y_offset": 17, + "x": -28, + "y": 17, "palette": "keep" }, { "path": "track/alpine/s_bend_left_2_4.png", - "x_offset": -20, - "y_offset": 6, + "x": -20, + "y": 6, "palette": "keep" }, { "path": "track/alpine/s_bend_right_1_1.png", - "x_offset": -19, - "y_offset": 6, + "x": -19, + "y": 6, "palette": "keep" }, { "path": "track/alpine/s_bend_right_1_2.png", - "x_offset": -18, - "y_offset": 17, + "x": -18, + "y": 17, "palette": "keep" }, { "path": "track/alpine/s_bend_right_1_3.png", - "x_offset": -14, - "y_offset": 1, + "x": -14, + "y": 1, "palette": "keep" }, { "path": "track/alpine/s_bend_right_1_4.png", - "x_offset": -30, - "y_offset": 3, + "x": -30, + "y": 3, "palette": "keep" }, { "path": "track/alpine/s_bend_right_2_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/s_bend_right_2_2.png", - "x_offset": -24, - "y_offset": 8, + "x": -24, + "y": 8, "palette": "keep" }, { "path": "track/alpine/s_bend_right_2_3.png", - "x_offset": 12, - "y_offset": 6, + "x": 12, + "y": 6, "palette": "keep" }, { "path": "track/alpine/s_bend_right_2_4.png", - "x_offset": -12, - "y_offset": 2, + "x": -12, + "y": 2, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_1_1.png", - "x_offset": -18, - "y_offset": -1, + "x": -18, + "y": -1, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_1_2.png", - "x_offset": -15, - "y_offset": 1, + "x": -15, + "y": 1, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_1_3.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_1_4.png", - "x_offset": -19, - "y_offset": -6, + "x": -19, + "y": -6, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_2_1.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_2_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_2_3.png", - "x_offset": -32, - "y_offset": -4, + "x": -32, + "y": -4, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_3_1.png", - "x_offset": -6, - "y_offset": 1, + "x": -6, + "y": 1, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_3_2.png", - "x_offset": 23, - "y_offset": 1, + "x": 23, + "y": 1, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_3_3.png", - "x_offset": -5, - "y_offset": -1, + "x": -5, + "y": -1, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_3_4.png", - "x_offset": -5, - "y_offset": 0, + "x": -5, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_4_1.png", - "x_offset": -26, - "y_offset": 4, + "x": -26, + "y": 4, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_4_2.png", - "x_offset": -8, - "y_offset": 19, + "x": -8, + "y": 19, "palette": "keep" }, { "path": "track/alpine/small_helix_left_up_4_3.png", - "x_offset": -18, - "y_offset": 3, + "x": -18, + "y": 3, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_1_1.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_1_2.png", - "x_offset": -6, - "y_offset": 19, + "x": -6, + "y": 19, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_1_3.png", - "x_offset": -26, - "y_offset": 3, + "x": -26, + "y": 3, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_2_1.png", - "x_offset": -19, - "y_offset": 1, + "x": -19, + "y": 1, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_2_2.png", - "x_offset": -32, - "y_offset": 1, + "x": -32, + "y": 1, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_2_3.png", - "x_offset": -19, - "y_offset": -1, + "x": -19, + "y": -1, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_2_4.png", - "x_offset": -16, - "y_offset": 0, + "x": -16, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_3_1.png", - "x_offset": -32, - "y_offset": 4, + "x": -32, + "y": 4, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_3_2.png", - "x_offset": 0, - "y_offset": 0, + "x": 0, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_3_3.png", - "x_offset": -19, - "y_offset": -4, + "x": -19, + "y": -4, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_4_1.png", - "x_offset": -6, - "y_offset": -1, + "x": -6, + "y": -1, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_4_2.png", - "x_offset": -6, - "y_offset": 1, + "x": -6, + "y": 1, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_4_3.png", - "x_offset": 23, - "y_offset": 0, + "x": 23, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_helix_right_up_4_4.png", - "x_offset": -7, - "y_offset": -6, + "x": -7, + "y": -6, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_1_1.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_1_2.png", - "x_offset": -15, - "y_offset": 4, + "x": -15, + "y": 4, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_1_3.png", - "x_offset": -28, - "y_offset": 7, + "x": -28, + "y": 7, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_1_4.png", - "x_offset": 9, - "y_offset": 6, + "x": 9, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_1_5.png", - "x_offset": -22, - "y_offset": 7, + "x": -22, + "y": 7, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_1_6.png", - "x_offset": -19, - "y_offset": -6, + "x": -19, + "y": -6, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_2_1.png", - "x_offset": -19, - "y_offset": 4, + "x": -19, + "y": 4, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_2_2.png", - "x_offset": -4, - "y_offset": 0, + "x": -4, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_2_3.png", - "x_offset": -32, - "y_offset": 12, + "x": -32, + "y": 12, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_2_4.png", - "x_offset": 1, - "y_offset": 0, + "x": 1, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_2_5.png", - "x_offset": -32, - "y_offset": -4, + "x": -32, + "y": -4, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_3_1.png", - "x_offset": -16, - "y_offset": 1, + "x": -16, + "y": 1, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_3_2.png", - "x_offset": 10, - "y_offset": 8, + "x": 10, + "y": 8, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_3_3.png", - "x_offset": -21, - "y_offset": 6, + "x": -21, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_3_4.png", - "x_offset": 15, - "y_offset": 7, + "x": 15, + "y": 7, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_3_5.png", - "x_offset": -3, - "y_offset": 0, + "x": -3, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_3_6.png", - "x_offset": -7, - "y_offset": 2, + "x": -7, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_4_1.png", - "x_offset": -20, - "y_offset": 5, + "x": -20, + "y": 5, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_4_2.png", - "x_offset": -30, - "y_offset": 13, + "x": -30, + "y": 13, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_4_3.png", - "x_offset": -8, - "y_offset": -4, + "x": -8, + "y": -4, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_4_4.png", - "x_offset": -26, - "y_offset": 12, + "x": -26, + "y": 12, "palette": "keep" }, { "path": "track/alpine/medium_helix_left_up_4_5.png", - "x_offset": -18, - "y_offset": 2, + "x": -18, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_1_1.png", - "x_offset": -19, - "y_offset": 5, + "x": -19, + "y": 5, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_1_2.png", - "x_offset": -20, - "y_offset": 13, + "x": -20, + "y": 13, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_1_3.png", - "x_offset": -8, - "y_offset": -4, + "x": -8, + "y": -4, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_1_4.png", - "x_offset": -30, - "y_offset": 12, + "x": -30, + "y": 12, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_1_5.png", - "x_offset": -14, - "y_offset": 2, + "x": -14, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_2_1.png", - "x_offset": -19, - "y_offset": 1, + "x": -19, + "y": 1, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_2_2.png", - "x_offset": -24, - "y_offset": 8, + "x": -24, + "y": 8, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_2_3.png", - "x_offset": 5, - "y_offset": 6, + "x": 5, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_2_4.png", - "x_offset": -30, - "y_offset": 7, + "x": -30, + "y": 7, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_2_5.png", - "x_offset": -19, - "y_offset": 0, + "x": -19, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_2_6.png", - "x_offset": -15, - "y_offset": 2, + "x": -15, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_3_1.png", - "x_offset": -32, - "y_offset": 4, + "x": -32, + "y": 4, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_3_2.png", - "x_offset": -6, - "y_offset": 0, + "x": -6, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_3_3.png", - "x_offset": -32, - "y_offset": 12, + "x": -32, + "y": 12, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_3_4.png", - "x_offset": -2, - "y_offset": 0, + "x": -2, + "y": 0, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_3_5.png", - "x_offset": -19, - "y_offset": -4, + "x": -19, + "y": -4, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_4_1.png", - "x_offset": -8, - "y_offset": 2, + "x": -8, + "y": 2, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_4_2.png", - "x_offset": -8, - "y_offset": 4, + "x": -8, + "y": 4, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_4_3.png", - "x_offset": 15, - "y_offset": 7, + "x": 15, + "y": 7, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_4_4.png", - "x_offset": -21, - "y_offset": 6, + "x": -21, + "y": 6, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_4_5.png", - "x_offset": 10, - "y_offset": 7, + "x": 10, + "y": 7, "palette": "keep" }, { "path": "track/alpine/medium_helix_right_up_4_6.png", - "x_offset": -17, - "y_offset": -6, + "x": -17, + "y": -6, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_to_gentle_up_1_1.png", - "x_offset": -24, - "y_offset": -14, + "x": -24, + "y": -14, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_to_gentle_up_1_2.png", - "x_offset": -13, - "y_offset": -8, + "x": -13, + "y": -8, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_to_gentle_up_2_1.png", - "x_offset": -10, - "y_offset": 0, + "x": -10, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_to_gentle_up_2_2.png", - "x_offset": -12, - "y_offset": 0, + "x": -12, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_to_gentle_up_2_3.png", - "x_offset": -38, - "y_offset": -8, + "x": -38, + "y": -8, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_to_gentle_up_3_1.png", - "x_offset": -15, - "y_offset": -2, + "x": -15, + "y": -2, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_to_gentle_up_3_2.png", - "x_offset": -3, - "y_offset": 2, + "x": -3, + "y": 2, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_to_gentle_up_4_1.png", - "x_offset": -26, - "y_offset": -4, + "x": -26, + "y": -4, "palette": "keep" }, { "path": "track/alpine/small_turn_left_bank_to_gentle_up_4_2.png", - "x_offset": -25, - "y_offset": 7, + "x": -25, + "y": 7, "palette": "keep" }, { "path": "track/alpine/small_turn_right_bank_to_gentle_up_1_1.png", - "x_offset": -24, - "y_offset": -4, + "x": -24, + "y": -4, "palette": "keep" }, { "path": "track/alpine/small_turn_right_bank_to_gentle_up_1_2.png", - "x_offset": -26, - "y_offset": 7, + "x": -26, + "y": 7, "palette": "keep" }, { "path": "track/alpine/small_turn_right_bank_to_gentle_up_2_1.png", - "x_offset": -12, - "y_offset": -2, + "x": -12, + "y": -2, "palette": "keep" }, { "path": "track/alpine/small_turn_right_bank_to_gentle_up_2_2.png", - "x_offset": -25, - "y_offset": 2, + "x": -25, + "y": 2, "palette": "keep" }, { "path": "track/alpine/small_turn_right_bank_to_gentle_up_3_1.png", - "x_offset": -38, - "y_offset": 0, + "x": -38, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_turn_right_bank_to_gentle_up_3_2.png", - "x_offset": -38, - "y_offset": 0, + "x": -38, + "y": 0, "palette": "keep" }, { "path": "track/alpine/small_turn_right_bank_to_gentle_up_3_3.png", - "x_offset": -13, - "y_offset": -8, + "x": -13, + "y": -8, "palette": "keep" }, { "path": "track/alpine/small_turn_right_bank_to_gentle_up_4_1.png", - "x_offset": -2, - "y_offset": -14, + "x": -2, + "y": -14, "palette": "keep" }, { "path": "track/alpine/small_turn_right_bank_to_gentle_up_4_2.png", - "x_offset": -15, - "y_offset": -8, + "x": -15, + "y": -8, "palette": "keep" }, { "path": "track/alpine/flat_lift_1.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_lift_2.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_lift_3.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_lift_4.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_lift_1.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_lift_2.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_lift_3.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_lift_4.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_flat_lift_1.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_flat_lift_2.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_flat_lift_3.png", - "x_offset": -19, - "y_offset": 3, + "x": -19, + "y": 3, "palette": "keep" }, { "path": "track/alpine/gentle_up_to_flat_lift_4.png", - "x_offset": -19, - "y_offset": -5, + "x": -19, + "y": -5, "palette": "keep" }, { "path": "track/alpine/gentle_lift_1.png", - "x_offset": -19, - "y_offset": -13, + "x": -19, + "y": -13, "palette": "keep" }, { "path": "track/alpine/gentle_lift_2.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/gentle_lift_3.png", - "x_offset": -19, - "y_offset": 2, + "x": -19, + "y": 2, "palette": "keep" }, { "path": "track/alpine/gentle_lift_4.png", - "x_offset": -19, - "y_offset": -13, + "x": -19, + "y": -13, "palette": "keep" }, { "path": "track/alpine/flat_diag_lift_1.png", - "x_offset": -32, - "y_offset": 10, + "x": -32, + "y": 10, "palette": "keep" }, { "path": "track/alpine/flat_diag_lift_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/flat_diag_lift_3.png", - "x_offset": -32, - "y_offset": 10, + "x": -32, + "y": 10, "palette": "keep" }, { "path": "track/alpine/flat_diag_lift_4.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_diag_lift_1.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_diag_lift_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_diag_lift_3.png", - "x_offset": -33, - "y_offset": 2, + "x": -33, + "y": 2, "palette": "keep" }, { "path": "track/alpine/flat_to_gentle_up_diag_lift_4.png", - "x_offset": -5, - "y_offset": -12, + "x": -5, + "y": -12, "palette": "keep" }, { "path": "track/alpine/gentle_to_flat_up_diag_lift_1.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/gentle_to_flat_up_diag_lift_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/gentle_to_flat_up_diag_lift_3.png", - "x_offset": -32, - "y_offset": 2, + "x": -32, + "y": 2, "palette": "keep" }, { "path": "track/alpine/gentle_to_flat_up_diag_lift_4.png", - "x_offset": -5, - "y_offset": -12, + "x": -5, + "y": -12, "palette": "keep" }, { "path": "track/alpine/gentle_diag_lift_1.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/alpine/gentle_diag_lift_2.png", - "x_offset": -5, - "y_offset": -4, + "x": -5, + "y": -4, "palette": "keep" }, { "path": "track/alpine/gentle_diag_lift_3.png", - "x_offset": -32, - "y_offset": -6, + "x": -32, + "y": -6, "palette": "keep" }, { "path": "track/alpine/gentle_diag_lift_4.png", - "x_offset": -5, - "y_offset": -20, + "x": -5, + "y": -20, "palette": "keep" }, { "path": "icons/medium-curve-left.png", - "x_offset": 2, - "y_offset": 6 + "x": 2, + "y": 6 }, { "path": "icons/medium-curve-right.png", - "x_offset": 1, - "y_offset": 6 + "x": 1, + "y": 6 } ] diff --git a/src/openrct2-android/app/build.gradle b/src/openrct2-android/app/build.gradle index 5e8073f5e1..5041a40b6b 100644 --- a/src/openrct2-android/app/build.gradle +++ b/src/openrct2-android/app/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 31 + compileSdk 34 buildToolsVersion "34.0.0" ndkVersion "26.2.11394342" // Latest r26c (LTS), to be synced with CI container image namespace "io.openrct2" defaultConfig { applicationId 'io.openrct2' - minSdkVersion 19 + minSdkVersion 21 targetSdkVersion 28 versionCode 2 @@ -17,7 +17,7 @@ android { arguments '-DANDROID_STL=c++_shared' targets 'openrct2', 'openrct2-ui', 'openrct2-cli' // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' - abiFilters 'arm64-v8a' + abiFilters 'arm64-v8a', 'x86_64' } } } @@ -45,8 +45,8 @@ android { } dependencies { - implementation 'commons-io:commons-io:2.6' - implementation 'androidx.appcompat:appcompat:1.4.0' + implementation 'commons-io:commons-io:2.13.0' + implementation 'androidx.appcompat:appcompat:1.6.1' implementation fileTree(include: ['*.jar'], dir: 'libs') } diff --git a/src/openrct2-android/app/src/main/CMakeLists.txt b/src/openrct2-android/app/src/main/CMakeLists.txt index 53d5228a6f..4e3dfb59db 100644 --- a/src/openrct2-android/app/src/main/CMakeLists.txt +++ b/src/openrct2-android/app/src/main/CMakeLists.txt @@ -20,7 +20,7 @@ endif() include(ExternalProject) ExternalProject_Add(libs - URL https://github.com/OpenRCT2/openrct2-dependencies-android/releases/download/v10/${ANDROID_ABI}-android-dynamic.tar.zst + URL https://github.com/OpenRCT2/openrct2-dependencies-android/releases/download/v11/${ANDROID_ABI}-android-dynamic.tar.zst SOURCE_DIR "${CMAKE_BINARY_DIR}/libs" @@ -29,6 +29,14 @@ ExternalProject_Add(libs INSTALL_COMMAND "" BUILD_BYPRODUCTS + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}crypto${CMAKE_SHARED_LIBRARY_SUFFIX} + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}vorbis${CMAKE_SHARED_LIBRARY_SUFFIX} + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}vorbisfile${CMAKE_SHARED_LIBRARY_SUFFIX} + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}FLAC${CMAKE_SHARED_LIBRARY_SUFFIX} + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}brotlidec${CMAKE_SHARED_LIBRARY_SUFFIX} + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}brotlicommon${CMAKE_SHARED_LIBRARY_SUFFIX} + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}ogg${CMAKE_SHARED_LIBRARY_SUFFIX} + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}bz2${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}freetype${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}png16${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX} @@ -53,6 +61,14 @@ ExternalProject_Add(libs add_custom_command(TARGET libs POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} # COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/*.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libcrypto.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libvorbis.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libvorbisfile.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libFLAC.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libbrotlidec.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libbrotlicommon.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libogg.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libbz2.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libicudata.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libicuuc.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libicui18n.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} @@ -124,13 +140,64 @@ set_target_properties(ssl PROPERTIES IMPORTED_LOCATION ) add_dependencies(ssl libs) +add_library(crypto SHARED IMPORTED) +set_target_properties(crypto PROPERTIES IMPORTED_LOCATION + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}crypto${CMAKE_SHARED_LIBRARY_SUFFIX} +) +add_dependencies(crypto libs) + +add_library(vorbis SHARED IMPORTED) +set_target_properties(vorbis PROPERTIES IMPORTED_LOCATION + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}vorbis${CMAKE_SHARED_LIBRARY_SUFFIX} +) +add_dependencies(vorbis libs) + +add_library(vorbisfile SHARED IMPORTED) +set_target_properties(vorbisfile PROPERTIES IMPORTED_LOCATION + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}vorbisfile${CMAKE_SHARED_LIBRARY_SUFFIX} +) +add_dependencies(vorbisfile libs) + +add_library(FLAC SHARED IMPORTED) +set_target_properties(FLAC PROPERTIES IMPORTED_LOCATION + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}FLAC${CMAKE_SHARED_LIBRARY_SUFFIX} +) +add_dependencies(FLAC libs) + +add_library(brotlidec SHARED IMPORTED) +set_target_properties(brotlidec PROPERTIES IMPORTED_LOCATION + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}brotlidec${CMAKE_SHARED_LIBRARY_SUFFIX} +) +add_dependencies(brotlidec libs) + +add_library(brotlicommon SHARED IMPORTED) +set_target_properties(brotlicommon PROPERTIES IMPORTED_LOCATION + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}brotlicommon${CMAKE_SHARED_LIBRARY_SUFFIX} +) +add_dependencies(brotlicommon libs) + +add_library(ogg SHARED IMPORTED) +set_target_properties(ogg PROPERTIES IMPORTED_LOCATION + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}ogg${CMAKE_SHARED_LIBRARY_SUFFIX} +) +add_dependencies(ogg libs) + +add_library(bz2 SHARED IMPORTED) +set_target_properties(bz2 PROPERTIES IMPORTED_LOCATION + ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}bz2${CMAKE_SHARED_LIBRARY_SUFFIX} +) +add_dependencies(bz2 libs) + include_directories(SYSTEM "${CMAKE_BINARY_DIR}/libs/include") include_directories(SYSTEM "${CMAKE_BINARY_DIR}/libs/include/freetype2") include_directories(SYSTEM "${CMAKE_BINARY_DIR}/libs/include/SDL2") # now build app's shared lib -add_definitions(-DDISABLE_HTTP -DDISABLE_DISCORD_RPC -DDISABLE_HTTP -DDISABLE_NETWORK -DDISABLE_FLAC -DDISABLE_VORBIS -DDISABLE_OPENGL -DGL_GLEXT_PROTOTYPES -D__STDC_LIMIT_MACROS -DNO_TTF -DSDL_MAIN_HANDLED) +add_definitions(-DDISABLE_DISCORD_RPC -DDISABLE_OPENGL -DGL_GLEXT_PROTOTYPES -D__STDC_LIMIT_MACROS -DNO_TTF -DSDL_MAIN_HANDLED) + +# Enable scripting +add_definitions(-DENABLE_SCRIPTING) # Fix SpeexDSP compilation add_definitions(-DHAVE_STDINT_H) @@ -142,9 +209,12 @@ set(COMMON_COMPILE_OPTIONS "${COMMON_COMPILE_OPTIONS} -fPIC") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++1z ${COMMON_COMPILE_OPTIONS} -Wnon-virtual-dtor") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++20 ${COMMON_COMPILE_OPTIONS} -Wnon-virtual-dtor") get_filename_component(ORCT2_ROOT "${CMAKE_SOURCE_DIR}/../../../../../" REALPATH) +# Enable char8_t<->char conversion +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-char8_t -Wno-deprecated-declarations") + list(APPEND CMAKE_MODULE_PATH "${ORCT2_ROOT}/cmake") find_package(CCache) @@ -159,6 +229,7 @@ if (CCache_FOUND) endif (CCache_FOUND) file(GLOB_RECURSE LIBOPENRCT2_SOURCES + "${ORCT2_ROOT}/src/thirdparty/duktape/duktape.cpp" "${ORCT2_ROOT}/src/openrct2/*.cpp" "${ORCT2_ROOT}/src/openrct2/*.h" "${ORCT2_ROOT}/src/openrct2/*.hpp") @@ -179,20 +250,20 @@ file(GLOB_RECURSE OPENRCT2_CLI_SOURCES "${ORCT2_ROOT}/src/openrct2-cli/*.hpp") add_library(openrct2 SHARED ${LIBOPENRCT2_SOURCES}) -target_link_libraries(openrct2 android stdc++ log dl SDL2 png z icu icuuc icudata) +target_link_libraries(openrct2 android stdc++ log dl SDL2 png z icu icuuc icudata crypto ssl) add_library(openrct2-ui SHARED ${OPENRCT2_GUI_SOURCES}) -target_link_libraries(openrct2-ui openrct2 android stdc++ GLESv1_CM GLESv2 SDL2main speexdsp) +target_link_libraries(openrct2-ui openrct2 android stdc++ GLESv1_CM GLESv2 SDL2main speexdsp brotlicommon brotlidec bz2 freetype ogg vorbis vorbisfile FLAC) add_executable(openrct2-cli ${OPENRCT2_CLI_SOURCES}) target_link_libraries(openrct2-cli openrct2 android stdc++ GLESv1_CM GLESv2) +target_include_directories(openrct2 PRIVATE "${ORCT2_ROOT}/src/thirdparty/duktape/") target_include_directories(openrct2 SYSTEM PRIVATE "${ORCT2_ROOT}/src/thirdparty") +target_include_directories(openrct2-ui PRIVATE "${ORCT2_ROOT}/src/thirdparty/duktape/") 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") -# Header-only nlohmann library is installed in CI images at /nlohmann. -# To be tiny bit more specific, use '/nlohmann/../' instead of just '/' -target_include_directories(openrct2 PRIVATE "/nlohmann/../") -target_include_directories(openrct2-ui PRIVATE "/nlohmann/../") +target_include_directories(openrct2 PRIVATE "/opt/openrct2/include/nlohmann/../") +target_include_directories(openrct2-ui PRIVATE "/opt/openrct2/include/nlohmann/../") diff --git a/src/openrct2-android/app/src/main/java/io/openrct2/GameActivity.java b/src/openrct2-android/app/src/main/java/io/openrct2/GameActivity.java index 56e51c4595..8ddfeaea6f 100644 --- a/src/openrct2-android/app/src/main/java/io/openrct2/GameActivity.java +++ b/src/openrct2-android/app/src/main/java/io/openrct2/GameActivity.java @@ -80,6 +80,8 @@ public class GameActivity extends SDLActivity { return new String[]{ "c++_shared", "speexdsp", + "bz2", + "freetype", "z", "png16", "SDL2", diff --git a/src/openrct2-android/app/src/main/java/io/openrct2/HttpAndroid.java b/src/openrct2-android/app/src/main/java/io/openrct2/HttpAndroid.java new file mode 100644 index 0000000000..ffb58a1062 --- /dev/null +++ b/src/openrct2-android/app/src/main/java/io/openrct2/HttpAndroid.java @@ -0,0 +1,122 @@ +package io.openrct2; + +import android.util.Log; + +import org.apache.commons.io.IOUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; +import java.net.HttpURLConnection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class HttpAndroid { + private static final String TAG = "HttpAndroid"; + + // Corresponding Java enum for the C++ 'Status' enum + public enum Status { + Invalid(0), + Ok(200), + NotFound(404); + + private final int code; + Status(int code) { + this.code = code; + } + + public int getCode() { + return code; + } + } + + // Corresponding Java enum for the C++ 'Method' enum + public enum Method { + GET, + POST, + PUT + } + + // Java class equivalent to the C++ 'Response' struct + public static class Response { + Status status; + String contentType; + String body; + Map> headers; + String error; + + } + + // Java class equivalent to the C++ 'Request' struct + public static class Request { + String url; + Map headers; + Method method; + String body; + boolean forceIPv4; + + public Request() { + this.method = Method.GET; // Default method + } + } + + public static Response request(Request request) { + Response response = new Response(); + response.status = Status.Invalid; + response.error = "Request failed"; + try { + InputStream inputStream = null; + try { + URL url = new URL(request.url); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod(request.method.toString()); + connection.setConnectTimeout(10000); + connection.setReadTimeout(10000); + connection.setUseCaches(false); + connection.setDoInput(true); + connection.setInstanceFollowRedirects(true); + if (request.headers != null) { + for (Map.Entry entry : request.headers.entrySet()) { + connection.setRequestProperty(entry.getKey(), entry.getValue()); + } + } + connection.connect(); + if (request.body!= null) { + OutputStream os = connection.getOutputStream(); + os.write(request.body.getBytes()); + os.flush(); + os.close(); + } + int responseCode = connection.getResponseCode(); + if (responseCode == 200) { + inputStream = connection.getInputStream(); + } else { + inputStream = connection.getErrorStream(); + } + // Log + Log.d(TAG, "Request: " + request.url + ", response code: " + responseCode); + response.status = Status.Ok; + response.contentType = connection.getContentType(); + response.headers = connection.getHeaderFields(); + response.body = IOUtils.toString(inputStream, "UTF-8"); + response.error = null; + return response; + } catch (IOException e) { + Log.e(TAG, "Error while requesting " + request.url + ", error: " + e.getMessage(), e); + response.error = e.getMessage(); + return response; + } finally { + if (inputStream != null) { + inputStream.close(); + } + } + } catch (IOException e) { + Log.e(TAG, "Error while requesting " + request.url, e); + response.error = e.getMessage(); + return response; + } + } +} diff --git a/src/openrct2-android/build.gradle b/src/openrct2-android/build.gradle index d748ef16df..01f316eecb 100644 --- a/src/openrct2-android/build.gradle +++ b/src/openrct2-android/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:8.3.0-alpha10' + classpath 'com.android.tools.build:gradle:8.3.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/src/openrct2-android/gradle.properties b/src/openrct2-android/gradle.properties index fa2c20f971..e37f08064c 100644 --- a/src/openrct2-android/gradle.properties +++ b/src/openrct2-android/gradle.properties @@ -16,6 +16,7 @@ # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -android.enableJetifier=true +android.enableJetifier=false android.useAndroidX=true +org.gradle.configuration-cache=true org.gradle.jvmargs=-Xmx4096m diff --git a/src/openrct2-ui/SDLException.cpp b/src/openrct2-ui/SDLException.cpp index a358abcaa6..7623981ffc 100644 --- a/src/openrct2-ui/SDLException.cpp +++ b/src/openrct2-ui/SDLException.cpp @@ -11,6 +11,8 @@ #include +using namespace OpenRCT2::Ui; + SDLException::SDLException(const std::string& message) : runtime_error(message.c_str()) { diff --git a/src/openrct2-ui/SDLException.h b/src/openrct2-ui/SDLException.h index 6ba8aed36d..06f01d78cf 100644 --- a/src/openrct2-ui/SDLException.h +++ b/src/openrct2-ui/SDLException.h @@ -12,19 +12,22 @@ #include #include -/** - * An exception which wraps an SDL error. - */ -class SDLException : public std::runtime_error +namespace OpenRCT2::Ui { -public: - explicit SDLException(const std::string& message); - - explicit SDLException(const char* message); - /** - * Throws an SDL exception with a message containing the given call information - * and the message given by SDL_GetError. + * An exception which wraps an SDL error. */ - static void Throw(const char* call); -}; + class SDLException : public std::runtime_error + { + public: + explicit SDLException(const std::string& message); + + explicit SDLException(const char* message); + + /** + * Throws an SDL exception with a message containing the given call information + * and the message given by SDL_GetError. + */ + static void Throw(const char* call); + }; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index def05b4eee..16faf0a902 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -177,7 +177,7 @@ public: SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP, }; - uint32_t windowFlags = _sdlFullscreenFlags[static_cast(mode)]; + uint32_t windowFlags = _sdlFullscreenFlags[EnumValue(mode)]; // HACK Changing window size when in fullscreen usually has no effect if (mode == FULLSCREEN_MODE::FULLSCREEN) diff --git a/src/openrct2-ui/UiContext.h b/src/openrct2-ui/UiContext.h index 37d4922701..a98ab7a900 100644 --- a/src/openrct2-ui/UiContext.h +++ b/src/openrct2-ui/UiContext.h @@ -20,35 +20,35 @@ namespace OpenRCT2 { struct IContext; struct IPlatformEnvironment; - - namespace Ui - { - struct FileDialogDesc; - class InGameConsole; - struct IUiContext; - - struct IPlatformUiContext - { - virtual ~IPlatformUiContext() = default; - virtual void SetWindowIcon(SDL_Window* window) abstract; - virtual bool IsSteamOverlayAttached() abstract; - - virtual void ShowMessageBox(SDL_Window* window, const std::string& message) abstract; - virtual bool HasMenuSupport() abstract; - virtual int32_t ShowMenuDialog( - const std::vector& options, const std::string& title, const std::string& text) abstract; - virtual void OpenFolder(const std::string& path) abstract; - - virtual void OpenURL(const std::string& url) abstract; - virtual std::string ShowFileDialog(SDL_Window* window, const FileDialogDesc& desc) abstract; - virtual std::string ShowDirectoryDialog(SDL_Window* window, const std::string& title) abstract; - - virtual bool HasFilePicker() const abstract; - }; - - [[nodiscard]] std::unique_ptr CreateUiContext(const std::shared_ptr& env); - [[nodiscard]] std::unique_ptr CreatePlatformUiContext(); - - [[nodiscard]] InGameConsole& GetInGameConsole(); - } // namespace Ui } // namespace OpenRCT2 + +namespace OpenRCT2::Ui +{ + struct FileDialogDesc; + class InGameConsole; + struct IUiContext; + + struct IPlatformUiContext + { + virtual ~IPlatformUiContext() = default; + virtual void SetWindowIcon(SDL_Window* window) abstract; + virtual bool IsSteamOverlayAttached() abstract; + + virtual void ShowMessageBox(SDL_Window* window, const std::string& message) abstract; + virtual bool HasMenuSupport() abstract; + virtual int32_t ShowMenuDialog( + const std::vector& options, const std::string& title, const std::string& text) abstract; + virtual void OpenFolder(const std::string& path) abstract; + + virtual void OpenURL(const std::string& url) abstract; + virtual std::string ShowFileDialog(SDL_Window* window, const FileDialogDesc& desc) abstract; + virtual std::string ShowDirectoryDialog(SDL_Window* window, const std::string& title) abstract; + + virtual bool HasFilePicker() const abstract; + }; + + [[nodiscard]] std::unique_ptr CreateUiContext(const std::shared_ptr& env); + [[nodiscard]] std::unique_ptr CreatePlatformUiContext(); + + [[nodiscard]] InGameConsole& GetInGameConsole(); +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 7e9e73d519..f9f37aa088 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -10,6 +10,7 @@ #include "WindowManager.h" #include "interface/Theme.h" +#include "ride/VehicleSounds.h" #include "windows/Window.h" #include @@ -28,6 +29,7 @@ #include using namespace OpenRCT2::Ui; +using namespace OpenRCT2::Ui::Windows; class WindowManager final : public IWindowManager { @@ -43,101 +45,101 @@ public: switch (wc) { case WindowClass::About: - return WindowAboutOpen(); + return AboutOpen(); case WindowClass::BottomToolbar: - return WindowGameBottomToolbarOpen(); + return GameBottomToolbarOpen(); case WindowClass::Changelog: return OpenView(WV_CHANGELOG); case WindowClass::Cheats: - return WindowCheatsOpen(); + return CheatsOpen(); case WindowClass::ClearScenery: - return WindowClearSceneryOpen(); + return ClearSceneryOpen(); case WindowClass::CustomCurrencyConfig: - return CustomCurrencyWindowOpen(); + return CustomCurrencyOpen(); case WindowClass::DebugPaint: - return WindowDebugPaintOpen(); + return DebugPaintOpen(); case WindowClass::EditorInventionList: - return WindowEditorInventionsListOpen(); + return EditorInventionsListOpen(); case WindowClass::EditorObjectSelection: - return WindowEditorObjectSelectionOpen(); + return EditorObjectSelectionOpen(); case WindowClass::EditorObjectiveOptions: - return WindowEditorObjectiveOptionsOpen(); + return EditorObjectiveOptionsOpen(); case WindowClass::EditorScenarioOptions: - return WindowEditorScenarioOptionsOpen(); + return EditorScenarioOptionsOpen(); case WindowClass::Finances: - return WindowFinancesOpen(); + return FinancesOpen(); case WindowClass::Footpath: - return WindowFootpathOpen(); + return FootpathOpen(); case WindowClass::GuestList: - return WindowGuestListOpen(); + return GuestListOpen(); case WindowClass::Land: - return WindowLandOpen(); + return LandOpen(); case WindowClass::LandRights: - return WindowLandRightsOpen(); + return LandRightsOpen(); case WindowClass::MainWindow: - return WindowMainOpen(); + return MainOpen(); case WindowClass::Map: - return WindowMapOpen(); + return MapOpen(); case WindowClass::Mapgen: - return WindowMapgenOpen(); + return MapgenOpen(); case WindowClass::Multiplayer: - return WindowMultiplayerOpen(); + return MultiplayerOpen(); case WindowClass::ConstructRide: - return WindowNewRideOpen(); + return NewRideOpen(); case WindowClass::ParkInformation: - return WindowParkEntranceOpen(); + return ParkEntranceOpen(); case WindowClass::RecentNews: - return WindowNewsOpen(); + return NewsOpen(); case WindowClass::RideConstruction: - return WindowRideConstructionOpen(); + return RideConstructionOpen(); case WindowClass::Research: - return WindowResearchOpen(); + return ResearchOpen(); case WindowClass::RideList: - return WindowRideListOpen(); + return RideListOpen(); case WindowClass::NotificationOptions: - return WindowNewsOptionsOpen(); + return NewsOptionsOpen(); case WindowClass::Options: - return WindowOptionsOpen(); + return OptionsOpen(); case WindowClass::SavePrompt: - return WindowSavePromptOpen(); + return SavePromptOpen(); case WindowClass::Scenery: - return WindowSceneryOpen(); + return SceneryOpen(); case WindowClass::SceneryScatter: - return WindowSceneryScatterOpen(); + return SceneryScatterOpen(); #ifndef DISABLE_NETWORK case WindowClass::ServerList: - return WindowServerListOpen(); + return ServerListOpen(); case WindowClass::ServerStart: - return WindowServerStartOpen(); + return ServerStartOpen(); #endif case WindowClass::KeyboardShortcutList: - return WindowShortcutKeysOpen(); + return ShortcutKeysOpen(); case WindowClass::StaffList: - return WindowStaffListOpen(); + return StaffListOpen(); case WindowClass::Themes: - return WindowThemesOpen(); + return ThemesOpen(); case WindowClass::TileInspector: - return WindowTileInspectorOpen(); + return TileInspectorOpen(); case WindowClass::TitleExit: - return WindowTitleExitOpen(); + return TitleExitOpen(); case WindowClass::TitleLogo: - return WindowTitleLogoOpen(); + return TitleLogoOpen(); case WindowClass::TitleMenu: - return WindowTitleMenuOpen(); + return TitleMenuOpen(); case WindowClass::TitleOptions: - return WindowTitleOptionsOpen(); + return TitleOptionsOpen(); case WindowClass::TopToolbar: - return WindowTopToolbarOpen(); + return TopToolbarOpen(); case WindowClass::ViewClipping: - return WindowViewClippingOpen(); + return ViewClippingOpen(); case WindowClass::Viewport: - return WindowViewportOpen(); + return ViewportOpen(); case WindowClass::Water: - return WindowWaterOpen(); + return WaterOpen(); case WindowClass::Transparency: - return WindowTransparencyOpen(); + return TransparencyOpen(); case WindowClass::AssetPacks: - return WindowAssetPacksOpen(); + return AssetPacksOpen(); default: Console::Error::WriteLine("Unhandled window class (%d)", wc); return nullptr; @@ -149,35 +151,35 @@ public: switch (view) { case WV_PARK_AWARDS: - return WindowParkAwardsOpen(); + return ParkAwardsOpen(); case WV_PARK_RATING: - return WindowParkRatingOpen(); + return ParkRatingOpen(); case WV_PARK_OBJECTIVE: - return WindowParkObjectiveOpen(); + return ParkObjectiveOpen(); case WV_PARK_GUESTS: - return WindowParkGuestsOpen(); + return ParkGuestsOpen(); case WV_FINANCES_RESEARCH: - return WindowFinancesResearchOpen(); + return FinancesResearchOpen(); case WV_RIDE_RESEARCH: if (gConfigInterface.ToolbarShowResearch) { return this->OpenWindow(WindowClass::Research); } - return WindowNewRideOpenResearch(); + return NewRideOpenResearch(); case WV_MAZE_CONSTRUCTION: - return WindowMazeConstructionOpen(); + return MazeConstructionOpen(); case WV_NETWORK_PASSWORD: - return WindowNetworkStatusOpenPassword(); + return NetworkStatusOpenPassword(); case WV_EDITOR_BOTTOM_TOOLBAR: - return WindowEditorBottomToolbarOpen(); + return EditorBottomToolbarOpen(); case WV_CHANGELOG: - return WindowChangelogOpen(WV_CHANGELOG); + return ChangelogOpen(WV_CHANGELOG); case WV_NEW_VERSION_INFO: - return WindowChangelogOpen(WV_NEW_VERSION_INFO); + return ChangelogOpen(WV_NEW_VERSION_INFO); case WV_CONTRIBUTORS: - return WindowChangelogOpen(WV_CONTRIBUTORS); + return ChangelogOpen(WV_CONTRIBUTORS); case WV_FINANCE_MARKETING: - return WindowFinancesMarketingOpen(); + return FinancesMarketingOpen(); default: return nullptr; } @@ -188,19 +190,19 @@ public: switch (type) { case WD_BANNER: - return WindowBannerOpen(id); + return BannerOpen(id); case WD_NEW_CAMPAIGN: - return WindowNewCampaignOpen(id); + return NewCampaignOpen(id); case WD_DEMOLISH_RIDE: - return WindowRideDemolishPromptOpen(*GetRide(RideId::FromUnderlying(id))); + return RideDemolishPromptOpen(*GetRide(RideId::FromUnderlying(id))); case WD_REFURBISH_RIDE: - return WindowRideRefurbishPromptOpen(*GetRide(RideId::FromUnderlying(id))); + return RideRefurbishPromptOpen(*GetRide(RideId::FromUnderlying(id))); case WD_SIGN: - return WindowSignOpen(id); + return SignOpen(id); case WD_SIGN_SMALL: - return WindowSignSmallOpen(id); + return SignSmallOpen(id); case WD_PLAYER: - return WindowPlayerOpen(id); + return PlayerOpen(id); default: return nullptr; @@ -209,12 +211,12 @@ public: WindowBase* ShowError(StringId title, StringId message, const Formatter& args) override { - return WindowErrorOpen(title, message, args); + return ErrorOpen(title, message, args); } WindowBase* ShowError(std::string_view title, std::string_view message) override { - return WindowErrorOpen(title, message); + return ErrorOpen(title, message); } WindowBase* OpenIntent(Intent* intent) override @@ -222,13 +224,13 @@ public: switch (intent->GetWindowClass()) { case WindowClass::Peep: - return WindowGuestOpen(static_cast(intent->GetPointerExtra(INTENT_EXTRA_PEEP))); + return GuestOpen(static_cast(intent->GetPointerExtra(INTENT_EXTRA_PEEP))); case WindowClass::FirePrompt: - return WindowStaffFirePromptOpen(static_cast(intent->GetPointerExtra(INTENT_EXTRA_PEEP))); + return StaffFirePromptOpen(static_cast(intent->GetPointerExtra(INTENT_EXTRA_PEEP))); case WindowClass::InstallTrack: - return WindowInstallTrackOpen(intent->GetStringExtra(INTENT_EXTRA_PATH).c_str()); + return InstallTrackOpen(intent->GetStringExtra(INTENT_EXTRA_PATH).c_str()); case WindowClass::GuestList: - return WindowGuestListOpenWithFilter( + return GuestListOpenWithFilter( static_cast(intent->GetSIntExtra(INTENT_EXTRA_GUEST_LIST_FILTER)), intent->GetSIntExtra(INTENT_EXTRA_RIDE_ID)); case WindowClass::Loadsave: @@ -238,7 +240,7 @@ public: loadsave_callback callback = reinterpret_cast( intent->GetPointerExtra(INTENT_EXTRA_CALLBACK)); TrackDesign* trackDesign = static_cast(intent->GetPointerExtra(INTENT_EXTRA_TRACK_DESIGN)); - auto* w = WindowLoadsaveOpen( + auto* w = LoadsaveOpen( type, defaultName, [callback](int32_t result, std::string_view path) { if (callback != nullptr) @@ -250,20 +252,19 @@ public: return w; } case WindowClass::ManageTrackDesign: - return WindowTrackManageOpen( - static_cast(intent->GetPointerExtra(INTENT_EXTRA_TRACK_DESIGN))); + return TrackManageOpen(static_cast(intent->GetPointerExtra(INTENT_EXTRA_TRACK_DESIGN))); case WindowClass::NetworkStatus: { std::string message = intent->GetStringExtra(INTENT_EXTRA_MESSAGE); close_callback callback = intent->GetCloseCallbackExtra(INTENT_EXTRA_CALLBACK); - return WindowNetworkStatusOpen(message, callback); + return NetworkStatusOpen(message, callback); } case WindowClass::ObjectLoadError: { std::string path = intent->GetStringExtra(INTENT_EXTRA_PATH); auto objects = static_cast(intent->GetPointerExtra(INTENT_EXTRA_LIST)); size_t count = intent->GetUIntExtra(INTENT_EXTRA_LIST_COUNT); - WindowObjectLoadErrorOpen(const_cast(path.c_str()), count, objects); + ObjectLoadErrorOpen(const_cast(path.c_str()), count, objects); return nullptr; } @@ -271,20 +272,19 @@ public: { const auto rideId = RideId::FromUnderlying(intent->GetSIntExtra(INTENT_EXTRA_RIDE_ID)); auto ride = GetRide(rideId); - return ride == nullptr ? nullptr : WindowRideMainOpen(*ride); + return ride == nullptr ? nullptr : RideMainOpen(*ride); } case WindowClass::TrackDesignPlace: - return WindowTrackPlaceOpen( - static_cast(intent->GetPointerExtra(INTENT_EXTRA_TRACK_DESIGN))); + return TrackPlaceOpen(static_cast(intent->GetPointerExtra(INTENT_EXTRA_TRACK_DESIGN))); case WindowClass::TrackDesignList: { RideSelection rideItem; rideItem.Type = intent->GetUIntExtra(INTENT_EXTRA_RIDE_TYPE); rideItem.EntryIndex = intent->GetUIntExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX); - return WindowTrackListOpen(rideItem); + return TrackListOpen(rideItem); } case WindowClass::ScenarioSelect: - return WindowScenarioselectOpen( + return ScenarioselectOpen( reinterpret_cast(intent->GetPointerExtra(INTENT_EXTRA_CALLBACK))); case WindowClass::Null: @@ -301,7 +301,7 @@ public: case INTENT_ACTION_NEW_RIDE_OF_TYPE: { // Open ride list window - auto w = WindowNewRideOpen(); + auto w = NewRideOpen(); // Switch to right tab and scroll to ride location RideSelection rideItem; @@ -324,7 +324,7 @@ public: if (!ToolSet(*tlbrWindow, WC_TOP_TOOLBAR__WIDX_SCENERY, Tool::Arrow)) { InputSetFlag(INPUT_FLAG_6, true); - window = WindowSceneryOpen(); + window = SceneryOpen(); } } } @@ -346,9 +346,9 @@ public: switch (intent->GetWindowDetail()) { case WD_VEHICLE: - return WindowRideOpenVehicle(static_cast(intent->GetPointerExtra(INTENT_EXTRA_VEHICLE))); + return RideOpenVehicle(static_cast(intent->GetPointerExtra(INTENT_EXTRA_VEHICLE))); case WD_TRACK: - return WindowRideOpenTrack(static_cast(intent->GetPointerExtra(INTENT_EXTRA_TILE_ELEMENT))); + return RideOpenTrack(static_cast(intent->GetPointerExtra(INTENT_EXTRA_TILE_ELEMENT))); case WD_NULL: // Intent does not hold an window detail @@ -511,6 +511,10 @@ public: WindowInvalidateByClass(WindowClass::Research); break; + case INTENT_ACTION_UPDATE_VEHICLE_SOUNDS: + OpenRCT2::Audio::UpdateVehicleSounds(); + break; + case INTENT_ACTION_TRACK_DESIGN_REMOVE_PROVISIONAL: TrackPlaceClearProvisionalTemporarily(); break; @@ -587,7 +591,7 @@ public: mainWindow->viewport_target_sprite = EntityId::GetNull(); mainWindow->savedViewPos = viewPos; viewport->zoom = zoom; - gCurrentRotation = rotation; + viewport->rotation = rotation; if (zoomDifference != ZoomLevel{ 0 }) { diff --git a/src/openrct2-ui/audio/AudioContext.cpp b/src/openrct2-ui/audio/AudioContext.cpp index 9fcb5e3926..829fffc754 100644 --- a/src/openrct2-ui/audio/AudioContext.cpp +++ b/src/openrct2-ui/audio/AudioContext.cpp @@ -34,7 +34,7 @@ namespace OpenRCT2::Audio { if (SDL_Init(SDL_INIT_AUDIO) < 0) { - SDLException::Throw("SDL_Init(SDL_INIT_AUDIO)"); + Ui::SDLException::Throw("SDL_Init(SDL_INIT_AUDIO)"); } _audioMixer = std::make_unique(); } diff --git a/src/openrct2-ui/drawing/BitmapReader.cpp b/src/openrct2-ui/drawing/BitmapReader.cpp index 185fba6fec..242d5b8fb6 100644 --- a/src/openrct2-ui/drawing/BitmapReader.cpp +++ b/src/openrct2-ui/drawing/BitmapReader.cpp @@ -15,90 +15,93 @@ #include #include -static std::vector ReadToVector(std::istream& stream) +namespace OpenRCT2::Ui { - std::vector result; - if (!stream.eof() && !stream.fail()) + static std::vector ReadToVector(std::istream& stream) { - stream.seekg(0, std::ios_base::end); - auto size = stream.tellg(); - result.resize(size); - stream.seekg(0, std::ios_base::beg); - stream.read(reinterpret_cast(result.data()), size); - } - return result; -} - -// TODO Bitmaps aren't very complicated to read so we should probably just write our -// own implementation in libopenrct2 and spare the AOT implementation registration. -static Image ReadBitmap(std::istream& istream, IMAGE_FORMAT format) -{ - auto buffer = ReadToVector(istream); - auto sdlStream = SDL_RWFromConstMem(buffer.data(), static_cast(buffer.size())); - auto bitmap = SDL_LoadBMP_RW(sdlStream, 1); - if (bitmap != nullptr) - { - auto numChannels = bitmap->format->BytesPerPixel; - if (numChannels < 3 || bitmap->format->BitsPerPixel < 24) + std::vector result; + if (!stream.eof() && !stream.fail()) { - SDL_FreeSurface(bitmap); - throw std::runtime_error("Only 24-bit bitmaps are supported."); + stream.seekg(0, std::ios_base::end); + auto size = stream.tellg(); + result.resize(size); + stream.seekg(0, std::ios_base::beg); + stream.read(reinterpret_cast(result.data()), size); } + return result; + } - // Copy pixels over, then discard the surface - if (SDL_LockSurface(bitmap) == 0) + // TODO Bitmaps aren't very complicated to read so we should probably just write our + // own implementation in libopenrct2 and spare the AOT implementation registration. + static Image ReadBitmap(std::istream& istream, IMAGE_FORMAT format) + { + auto buffer = ReadToVector(istream); + auto sdlStream = SDL_RWFromConstMem(buffer.data(), static_cast(buffer.size())); + auto bitmap = SDL_LoadBMP_RW(sdlStream, 1); + if (bitmap != nullptr) { - Image image; - image.Width = bitmap->w; - image.Height = bitmap->h; - image.Depth = 32; - image.Pixels.resize(bitmap->w * bitmap->h * 4); - image.Stride = bitmap->w * 4; - - // Clear image with 0xFF - std::fill(image.Pixels.begin(), image.Pixels.end(), 0xFF); - - // Copy pixels over - auto src = static_cast(bitmap->pixels); - auto dst = image.Pixels.data(); - if (numChannels == 4) + auto numChannels = bitmap->format->BytesPerPixel; + if (numChannels < 3 || bitmap->format->BitsPerPixel < 24) { - for (int32_t y = 0; y < bitmap->h; y++) - { - std::memcpy(dst, src, bitmap->w); - src += bitmap->pitch; - dst += bitmap->w; - } + SDL_FreeSurface(bitmap); + throw std::runtime_error("Only 24-bit bitmaps are supported."); } - else + + // Copy pixels over, then discard the surface + if (SDL_LockSurface(bitmap) == 0) { - for (int32_t y = 0; y < bitmap->h; y++) + Image image; + image.Width = bitmap->w; + image.Height = bitmap->h; + image.Depth = 32; + image.Pixels.resize(bitmap->w * bitmap->h * 4); + image.Stride = bitmap->w * 4; + + // Clear image with 0xFF + std::fill(image.Pixels.begin(), image.Pixels.end(), 0xFF); + + // Copy pixels over + auto src = static_cast(bitmap->pixels); + auto dst = image.Pixels.data(); + if (numChannels == 4) { - for (int32_t x = 0; x < bitmap->w; x++) + for (int32_t y = 0; y < bitmap->h; y++) { - std::memcpy(dst, src, 3); - src += 3; - dst += 4; + std::memcpy(dst, src, bitmap->w); + src += bitmap->pitch; + dst += bitmap->w; } - src += bitmap->pitch - (bitmap->w * 3); } + else + { + for (int32_t y = 0; y < bitmap->h; y++) + { + for (int32_t x = 0; x < bitmap->w; x++) + { + std::memcpy(dst, src, 3); + src += 3; + dst += 4; + } + src += bitmap->pitch - (bitmap->w * 3); + } + } + SDL_UnlockSurface(bitmap); + SDL_FreeSurface(bitmap); + + return image; } - SDL_UnlockSurface(bitmap); + SDL_FreeSurface(bitmap); - - return image; + throw std::runtime_error("Unable to lock surface."); + } + else + { + throw std::runtime_error(SDL_GetError()); } - - SDL_FreeSurface(bitmap); - throw std::runtime_error("Unable to lock surface."); } - else + + void RegisterBitmapReader() { - throw std::runtime_error(SDL_GetError()); + Imaging::SetReader(IMAGE_FORMAT::BITMAP, ReadBitmap); } -} - -void RegisterBitmapReader() -{ - Imaging::SetReader(IMAGE_FORMAT::BITMAP, ReadBitmap); -} +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/BitmapReader.h b/src/openrct2-ui/drawing/BitmapReader.h index 18d6adcf36..75ba243ad8 100644 --- a/src/openrct2-ui/drawing/BitmapReader.h +++ b/src/openrct2-ui/drawing/BitmapReader.h @@ -9,4 +9,7 @@ #pragma once -void RegisterBitmapReader(); +namespace OpenRCT2::Ui +{ + void RegisterBitmapReader(); +} diff --git a/src/openrct2-ui/drawing/engines/DrawingEngineFactory.hpp b/src/openrct2-ui/drawing/engines/DrawingEngineFactory.hpp index d535b8464b..f852816c87 100644 --- a/src/openrct2-ui/drawing/engines/DrawingEngineFactory.hpp +++ b/src/openrct2-ui/drawing/engines/DrawingEngineFactory.hpp @@ -13,41 +13,38 @@ #include #include -namespace OpenRCT2 +namespace OpenRCT2::Ui { - namespace Ui + struct IUiContext; + + [[nodiscard]] std::unique_ptr CreateSoftwareDrawingEngine( + const std::shared_ptr& uiContext); + [[nodiscard]] std::unique_ptr CreateHardwareDisplayDrawingEngine( + const std::shared_ptr& uiContext); +#ifndef DISABLE_OPENGL + [[nodiscard]] std::unique_ptr CreateOpenGLDrawingEngine( + const std::shared_ptr& uiContext); +#endif + + class DrawingEngineFactory final : public Drawing::IDrawingEngineFactory { - using namespace OpenRCT2::Drawing; - - struct IUiContext; - - [[nodiscard]] std::unique_ptr CreateSoftwareDrawingEngine(const std::shared_ptr& uiContext); - [[nodiscard]] std::unique_ptr CreateHardwareDisplayDrawingEngine( - const std::shared_ptr& uiContext); -#ifndef DISABLE_OPENGL - [[nodiscard]] std::unique_ptr CreateOpenGLDrawingEngine(const std::shared_ptr& uiContext); -#endif - - class DrawingEngineFactory final : public IDrawingEngineFactory + public: + [[nodiscard]] std::unique_ptr Create( + DrawingEngine type, const std::shared_ptr& uiContext) override { - public: - [[nodiscard]] std::unique_ptr Create( - DrawingEngine type, const std::shared_ptr& uiContext) override + switch (type) { - switch (type) - { - case DrawingEngine::Software: - return CreateSoftwareDrawingEngine(uiContext); - case DrawingEngine::SoftwareWithHardwareDisplay: - return CreateHardwareDisplayDrawingEngine(uiContext); + case DrawingEngine::Software: + return CreateSoftwareDrawingEngine(uiContext); + case DrawingEngine::SoftwareWithHardwareDisplay: + return CreateHardwareDisplayDrawingEngine(uiContext); #ifndef DISABLE_OPENGL - case DrawingEngine::OpenGL: - return CreateOpenGLDrawingEngine(uiContext); + case DrawingEngine::OpenGL: + return CreateOpenGLDrawingEngine(uiContext); #endif - default: - return nullptr; - } + default: + return nullptr; } - }; - } // namespace Ui -} // namespace OpenRCT2 + } + }; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp index fc75168840..bcd74090c7 100644 --- a/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp @@ -11,6 +11,8 @@ # include "ApplyPaletteShader.h" +using namespace OpenRCT2::Ui; + namespace { struct VDStruct diff --git a/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.h b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.h index c7c94e95b4..a05aea4219 100644 --- a/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.h +++ b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.h @@ -12,27 +12,30 @@ #include "GLSLTypes.h" #include "OpenGLShaderProgram.h" -class ApplyPaletteShader final : public OpenGLShaderProgram +namespace OpenRCT2::Ui { -private: - GLuint uTexture; - GLuint uPalette; + class ApplyPaletteShader final : public OpenGLShaderProgram + { + private: + GLuint uTexture; + GLuint uPalette; - GLuint vPosition; - GLuint vTextureCoordinate; + GLuint vPosition; + GLuint vTextureCoordinate; - GLuint _vbo; - GLuint _vao; + GLuint _vbo; + GLuint _vao; -public: - ApplyPaletteShader(); - ~ApplyPaletteShader() override; + public: + ApplyPaletteShader(); + ~ApplyPaletteShader() override; - static void SetTexture(GLuint texture); - void SetPalette(const vec4* glPalette); + static void SetTexture(GLuint texture); + void SetPalette(const vec4* glPalette); - void Draw(); + void Draw(); -private: - void GetLocations(); -}; + private: + void GetLocations(); + }; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp b/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp index 86451d6917..7bbb1f2f4b 100644 --- a/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp @@ -11,6 +11,8 @@ # include "ApplyTransparencyShader.h" +using namespace OpenRCT2::Ui; + namespace { struct VDStruct diff --git a/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.h b/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.h index 9ef4305460..430ed3903c 100644 --- a/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.h +++ b/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.h @@ -11,32 +11,34 @@ #include "GLSLTypes.h" #include "OpenGLShaderProgram.h" - -class ApplyTransparencyShader final : public OpenGLShaderProgram +namespace OpenRCT2::Ui { -private: - GLuint uOpaqueTex; - GLuint uOpaqueDepth; - GLuint uTransparentTex; - GLuint uTransparentDepth; - GLuint uPaletteTex; - GLuint uBlendPaletteTex; + class ApplyTransparencyShader final : public OpenGLShaderProgram + { + private: + GLuint uOpaqueTex; + GLuint uOpaqueDepth; + GLuint uTransparentTex; + GLuint uTransparentDepth; + GLuint uPaletteTex; + GLuint uBlendPaletteTex; - GLuint vPosition; - GLuint vTextureCoordinate; + GLuint vPosition; + GLuint vTextureCoordinate; - GLuint _vbo; - GLuint _vao; + GLuint _vbo; + GLuint _vao; -public: - ApplyTransparencyShader(); - ~ApplyTransparencyShader() override; + public: + ApplyTransparencyShader(); + ~ApplyTransparencyShader() override; - static void SetTextures( - GLuint opaqueTex, GLuint opaqueDepth, GLuint transparentTex, GLuint transparentDepth, GLuint paletteTex, - GLuint blendPaletteTex); - void Draw(); + static void SetTextures( + GLuint opaqueTex, GLuint opaqueDepth, GLuint transparentTex, GLuint transparentDepth, GLuint paletteTex, + GLuint blendPaletteTex); + void Draw(); -private: - void GetLocations(); -}; + private: + void GetLocations(); + }; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/DrawCommands.h b/src/openrct2-ui/drawing/engines/opengl/DrawCommands.h index d343938eef..e53baea7d3 100644 --- a/src/openrct2-ui/drawing/engines/opengl/DrawCommands.h +++ b/src/openrct2-ui/drawing/engines/opengl/DrawCommands.h @@ -15,114 +15,116 @@ #include #include - -template class CommandBatch +namespace OpenRCT2::Ui { -private: - std::vector _instances; - size_t _numInstances; + template class CommandBatch + { + private: + std::vector _instances; + size_t _numInstances; -public: - CommandBatch() - : _numInstances(0) - { - } - - [[nodiscard]] bool empty() const // NOLINT(readability-identifier-naming) - { - return _numInstances == 0; - } - void clear() // NOLINT(readability-identifier-naming) - { - _numInstances = 0; - } - T& allocate() // NOLINT(readability-identifier-naming) - { - if (_numInstances + 1 > _instances.size()) + public: + CommandBatch() + : _numInstances(0) { - _instances.resize((_numInstances + 1) << 1); } - return _instances[_numInstances++]; - } - T& insert(const T& value) // NOLINT(readability-identifier-naming) - { - if (_numInstances + 1 > _instances.size()) + + [[nodiscard]] bool empty() const // NOLINT(readability-identifier-naming) { - _instances.resize((_numInstances + 1) << 1); + return _numInstances == 0; + } + void clear() // NOLINT(readability-identifier-naming) + { + _numInstances = 0; + } + T& allocate() // NOLINT(readability-identifier-naming) + { + if (_numInstances + 1 > _instances.size()) + { + _instances.resize((_numInstances + 1) << 1); + } + return _instances[_numInstances++]; + } + T& insert(const T& value) // NOLINT(readability-identifier-naming) + { + if (_numInstances + 1 > _instances.size()) + { + _instances.resize((_numInstances + 1) << 1); + } + return _instances[_numInstances++] = value; + } + [[nodiscard]] size_t size() const // NOLINT(readability-identifier-naming) + { + return _numInstances; + } + const T* data() const // NOLINT(readability-identifier-naming) + { + return _instances.data(); + } + const T& operator[](size_t idx) const + { + return _instances.at(idx); } - return _instances[_numInstances++] = value; - } - [[nodiscard]] size_t size() const // NOLINT(readability-identifier-naming) - { - return _numInstances; - } - const T* data() const // NOLINT(readability-identifier-naming) - { - return _instances.data(); - } - const T& operator[](size_t idx) const - { - return _instances.at(idx); - } - typename std::vector::iterator begin() // NOLINT(readability-identifier-naming) - { - return _instances.begin(); - } - typename std::vector::const_iterator begin() const // NOLINT(readability-identifier-naming) - { - return _instances.cbegin(); - } - typename std::vector::const_iterator cbegin() const // NOLINT(readability-identifier-naming) - { - return _instances.cbegin(); - } - typename std::vector::iterator end() // NOLINT(readability-identifier-naming) - { - return _instances.begin() + _numInstances; - } - typename std::vector::const_iterator end() const // NOLINT(readability-identifier-naming) - { - return _instances.cbegin() + _numInstances; - } - typename std::vector::const_iterator cend() const // NOLINT(readability-identifier-naming) - { - return _instances.cbegin() + _numInstances; - } -}; - -struct DrawLineCommand -{ - ivec4 clip; - ivec4 bounds; - GLuint colour; - GLint depth; -}; - -// Per-instance data for images -struct DrawRectCommand -{ - ivec4 clip; - GLint texColourAtlas; - vec4 texColourBounds; - GLint texMaskAtlas; - vec4 texMaskBounds; - ivec3 palettes; - GLint flags; - GLuint colour; - ivec4 bounds; - GLint depth; - - enum - { - FLAG_NO_TEXTURE = (1u << 2u), - FLAG_MASK = (1u << 3u), - FLAG_CROSS_HATCH = (1u << 4u), - FLAG_TTF_TEXT = (1u << 5u), - // bits 8 to 16 used to store hinting threshold. - FLAG_TTF_HINTING_THRESHOLD_MASK = 0xff00 + typename std::vector::iterator begin() // NOLINT(readability-identifier-naming) + { + return _instances.begin(); + } + typename std::vector::const_iterator begin() const // NOLINT(readability-identifier-naming) + { + return _instances.cbegin(); + } + typename std::vector::const_iterator cbegin() const // NOLINT(readability-identifier-naming) + { + return _instances.cbegin(); + } + typename std::vector::iterator end() // NOLINT(readability-identifier-naming) + { + return _instances.begin() + _numInstances; + } + typename std::vector::const_iterator end() const // NOLINT(readability-identifier-naming) + { + return _instances.cbegin() + _numInstances; + } + typename std::vector::const_iterator cend() const // NOLINT(readability-identifier-naming) + { + return _instances.cbegin() + _numInstances; + } }; -}; -using LineCommandBatch = CommandBatch; -using RectCommandBatch = CommandBatch; + struct DrawLineCommand + { + ivec4 clip; + ivec4 bounds; + GLuint colour; + GLint depth; + }; + + // Per-instance data for images + struct DrawRectCommand + { + ivec4 clip; + GLint texColourAtlas; + vec4 texColourBounds; + GLint texMaskAtlas; + vec4 texMaskBounds; + ivec3 palettes; + GLint flags; + GLuint colour; + ivec4 bounds; + GLint depth; + + enum + { + FLAG_NO_TEXTURE = (1u << 2u), + FLAG_MASK = (1u << 3u), + FLAG_CROSS_HATCH = (1u << 4u), + FLAG_TTF_TEXT = (1u << 5u), + // bits 8 to 16 used to store hinting threshold. + FLAG_TTF_HINTING_THRESHOLD_MASK = 0xff00 + }; + }; + + using LineCommandBatch = CommandBatch; + using RectCommandBatch = CommandBatch; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp b/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp index c5f81310de..2b687d764e 100644 --- a/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp @@ -13,6 +13,8 @@ # include "OpenGLFramebuffer.h" +using namespace OpenRCT2::Ui; + namespace { struct VDStruct diff --git a/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.h b/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.h index 6ddaa94b53..0150b1ad7a 100644 --- a/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.h +++ b/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.h @@ -12,30 +12,32 @@ #include "DrawCommands.h" #include "GLSLTypes.h" #include "OpenGLShaderProgram.h" - -class DrawLineShader final : public OpenGLShaderProgram +namespace OpenRCT2::Ui { -private: - GLuint uScreenSize; + class DrawLineShader final : public OpenGLShaderProgram + { + private: + GLuint uScreenSize; - GLuint vClip; - GLuint vBounds; - GLuint vColour; - GLuint vDepth; + GLuint vClip; + GLuint vBounds; + GLuint vColour; + GLuint vDepth; - GLuint vVertMat; + GLuint vVertMat; - GLuint _vbo; - GLuint _vboInstances; - GLuint _vao; + GLuint _vbo; + GLuint _vboInstances; + GLuint _vao; -public: - DrawLineShader(); - ~DrawLineShader() override; + public: + DrawLineShader(); + ~DrawLineShader() override; - void SetScreenSize(int32_t width, int32_t height); - void DrawInstances(const LineCommandBatch& instances); + void SetScreenSize(int32_t width, int32_t height); + void DrawInstances(const LineCommandBatch& instances); -private: - void GetLocations(); -}; + private: + void GetLocations(); + }; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp b/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp index 5b760f7da5..ed43dddb34 100644 --- a/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp @@ -11,6 +11,8 @@ # include "DrawRectShader.h" +using namespace OpenRCT2::Ui; + namespace { struct VDStruct diff --git a/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.h b/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.h index 76a8a83335..bf4dd07668 100644 --- a/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.h +++ b/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.h @@ -14,49 +14,51 @@ #include "OpenGLShaderProgram.h" #include - -class DrawRectShader final : public OpenGLShaderProgram +namespace OpenRCT2::Ui { -private: - GLuint uScreenSize; - GLuint uTexture; - GLuint uPaletteTex; + class DrawRectShader final : public OpenGLShaderProgram + { + private: + GLuint uScreenSize; + GLuint uTexture; + GLuint uPaletteTex; - GLuint uPeelingTex; - GLuint uPeeling; + GLuint uPeelingTex; + GLuint uPeeling; - GLuint vVertMat; - GLuint vVertVec; + GLuint vVertMat; + GLuint vVertVec; - GLuint vClip; - GLuint vTexColourAtlas; - GLuint vTexColourBounds; - GLuint vTexMaskAtlas; - GLuint vTexMaskBounds; - GLuint vPalettes; - GLuint vFlags; - GLuint vColour; - GLuint vBounds; - GLuint vDepth; + GLuint vClip; + GLuint vTexColourAtlas; + GLuint vTexColourBounds; + GLuint vTexMaskAtlas; + GLuint vTexMaskBounds; + GLuint vPalettes; + GLuint vFlags; + GLuint vColour; + GLuint vBounds; + GLuint vDepth; - GLuint _vbo; - GLuint _vboInstances; - GLuint _vao; + GLuint _vbo; + GLuint _vboInstances; + GLuint _vao; - GLsizei _instanceCount = 0; - size_t _maxInstancesBufferSize; + GLsizei _instanceCount = 0; + size_t _maxInstancesBufferSize; -public: - DrawRectShader(); - ~DrawRectShader() override; + public: + DrawRectShader(); + ~DrawRectShader() override; - void SetScreenSize(int32_t width, int32_t height); - void EnablePeeling(GLuint peelingTex); - void DisablePeeling(); + void SetScreenSize(int32_t width, int32_t height); + void EnablePeeling(GLuint peelingTex); + void DisablePeeling(); - void SetInstances(const RectCommandBatch& instances); - void DrawInstances(); + void SetInstances(const RectCommandBatch& instances); + void DrawInstances(); -private: - void GetLocations(); -}; + private: + void GetLocations(); + }; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/GLSLTypes.h b/src/openrct2-ui/drawing/engines/opengl/GLSLTypes.h index 96dba238c8..624c295550 100644 --- a/src/openrct2-ui/drawing/engines/opengl/GLSLTypes.h +++ b/src/openrct2-ui/drawing/engines/opengl/GLSLTypes.h @@ -13,100 +13,102 @@ #include -#pragma pack(push, 1) - -namespace detail +namespace OpenRCT2::Ui { - template struct Vec2 +#pragma pack(push, 1) + namespace detail { - using ValueType = T_; - - union + template struct Vec2 { - ValueType x; - ValueType s; - ValueType r; + using ValueType = T_; + + union + { + ValueType x; + ValueType s; + ValueType r; + }; + union + { + ValueType y; + ValueType t; + ValueType g; + }; }; - union + + template struct Vec2; + template struct Vec2; + + template struct Vec3 { - ValueType y; - ValueType t; - ValueType g; + using ValueType = T_; + + union + { + ValueType x; + ValueType s; + ValueType r; + }; + union + { + ValueType y; + ValueType t; + ValueType g; + }; + union + { + ValueType z; + ValueType p; + ValueType b; + }; }; - }; - template struct Vec2; - template struct Vec2; + template struct Vec3; + template struct Vec3; - template struct Vec3 - { - using ValueType = T_; - - union + template struct Vec4 { - ValueType x; - ValueType s; - ValueType r; + using ValueType = T_; + + union + { + ValueType x; + ValueType s; + ValueType r; + }; + union + { + ValueType y; + ValueType t; + ValueType g; + }; + union + { + ValueType z; + ValueType p; + ValueType b; + }; + union + { + ValueType w; + ValueType q; + ValueType a; + }; }; - union - { - ValueType y; - ValueType t; - ValueType g; - }; - union - { - ValueType z; - ValueType p; - ValueType b; - }; - }; - template struct Vec3; - template struct Vec3; + template struct Vec4; + template struct Vec4; - template struct Vec4 - { - using ValueType = T_; + } // namespace detail - union - { - ValueType x; - ValueType s; - ValueType r; - }; - union - { - ValueType y; - ValueType t; - ValueType g; - }; - union - { - ValueType z; - ValueType p; - ValueType b; - }; - union - { - ValueType w; - ValueType q; - ValueType a; - }; - }; + using vec2 = detail::Vec2; + using ivec2 = detail::Vec2; - template struct Vec4; - template struct Vec4; + using vec3 = detail::Vec3; + using ivec3 = detail::Vec3; -} // namespace detail - -using vec2 = detail::Vec2; -using ivec2 = detail::Vec2; - -using vec3 = detail::Vec3; -using ivec3 = detail::Vec3; - -using vec4 = detail::Vec4; -using ivec4 = detail::Vec4; + using vec4 = detail::Vec4; + using ivec4 = detail::Vec4; #pragma pack(pop) +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.cpp index 7e074e29cb..d54f1c70cc 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.cpp @@ -38,7 +38,9 @@ static const char* TryLoadAllProcAddresses() # endif /* #if OPENGL_NO_LINK */ -namespace OpenGLState +using namespace OpenRCT2::Ui; + +namespace OpenRCT2::Ui::OpenGLState { uint16_t ActiveTexture; GLuint CurrentProgram; @@ -48,7 +50,7 @@ namespace OpenGLState ActiveTexture = UINT16_MAX; CurrentProgram = UINT32_MAX; } -} // namespace OpenGLState +} // namespace OpenRCT2::Ui::OpenGLState void OpenGLAPI::SetTexture(uint16_t index, GLenum type, GLuint texture) { diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h index 86e3c1be12..8791fb6567 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h @@ -113,26 +113,29 @@ using PFNGLGETTEXIMAGEPROC = void(APIENTRYP)(GLenum target, GLint level, GLenum #endif /* OPENGL_NO_LINK */ -inline void CheckGLError() +namespace OpenRCT2::Ui { - GLenum error = glGetError(); - while (error != GL_NO_ERROR) + inline void CheckGLError() { - LOG_ERROR("OpenGL Error 0x%04X", error); - error = glGetError(); + GLenum error = glGetError(); + while (error != GL_NO_ERROR) + { + LOG_ERROR("OpenGL Error 0x%04X", error); + error = glGetError(); + } } -} -namespace OpenGLAPI -{ - bool Initialise(); - void SetTexture(uint16_t index, GLenum type, GLuint texture); -} // namespace OpenGLAPI + namespace OpenGLAPI + { + bool Initialise(); + void SetTexture(uint16_t index, GLenum type, GLuint texture); + } // namespace OpenGLAPI -namespace OpenGLState -{ - extern uint16_t ActiveTexture; - extern GLuint CurrentProgram; + namespace OpenGLState + { + extern uint16_t ActiveTexture; + extern GLuint CurrentProgram; - void Reset(); -} // namespace OpenGLState + void Reset(); + } // namespace OpenGLState +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 8d537e66f3..a06afd3ef2 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -37,7 +37,6 @@ # include # include # include -# include using namespace OpenRCT2; using namespace OpenRCT2::Drawing; @@ -74,6 +73,8 @@ private: int32_t _drawCount = 0; + uint32_t _ttfGlId = 0; + struct { LineCommandBatch lines; @@ -99,26 +100,25 @@ public: void ResetPalette(); void StartNewDraw(); - void Clear(DrawPixelInfo* dpi, uint8_t paletteIndex) override; - void FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t x, int32_t y, int32_t w, int32_t h) override; + void Clear(DrawPixelInfo& dpi, uint8_t paletteIndex) override; + void FillRect(DrawPixelInfo& dpi, uint32_t colour, int32_t x, int32_t y, int32_t w, int32_t h) override; void FilterRect( - DrawPixelInfo* dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) override; - void DrawLine(DrawPixelInfo* dpi, uint32_t colour, const ScreenLine& line) override; - void DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, int32_t x, int32_t y) override; + DrawPixelInfo& dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) override; + void DrawLine(DrawPixelInfo& dpi, uint32_t colour, const ScreenLine& line) override; + void DrawSprite(DrawPixelInfo& dpi, const ImageId imageId, int32_t x, int32_t y) override; void DrawSpriteRawMasked( - DrawPixelInfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) override; - void DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) override; - void DrawGlyph(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette) override; + DrawPixelInfo& dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) override; + void DrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) override; + void DrawGlyph(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette) override; void DrawTTFBitmap( - DrawPixelInfo* dpi, TextDrawInfo* info, ImageIndex image, const void* pixels, int32_t width, int32_t height, int32_t x, - int32_t y, uint8_t hinting_threshold) override; + DrawPixelInfo& dpi, TextDrawInfo* info, TTFSurface* surface, int32_t x, int32_t y, uint8_t hintingThreshold) override; void FlushCommandBuffers(); void FlushLines(); void FlushRectangles(); void HandleTransparency(); - void CalculcateClipping(DrawPixelInfo* dpi); + void CalculcateClipping(DrawPixelInfo& dpi); }; class OpenGLWeatherDrawer final : public IWeatherDrawer @@ -161,7 +161,7 @@ public: int32_t pixelX = xPixelOffset % dpi.width; int32_t pixelY = (xPixelOffset / dpi.width) % dpi.height; - _drawingContext->DrawLine(&dpi, patternPixel, { { pixelX, pixelY }, { pixelX + 1, pixelY + 1 } }); + _drawingContext->DrawLine(dpi, patternPixel, { { pixelX, pixelY }, { pixelX + 1, pixelY + 1 } }); } } @@ -285,7 +285,7 @@ public: assert(_screenFramebuffer != nullptr); _drawingContext->StartNewDraw(); - _drawingContext->CalculcateClipping(&_bitsDPI); + _drawingContext->CalculcateClipping(_bitsDPI); } void EndDraw() override @@ -323,7 +323,7 @@ public: void PaintWindows() override { - _drawingContext->CalculcateClipping(&_bitsDPI); + _drawingContext->CalculcateClipping(_bitsDPI); WindowUpdateAllViewports(); WindowDrawAll(_bitsDPI, 0, 0, _width, _height); @@ -331,7 +331,7 @@ public: void PaintWeather() override { - _drawingContext->CalculcateClipping(&_bitsDPI); + _drawingContext->CalculcateClipping(_bitsDPI); DrawWeather(_bitsDPI, &_weatherDrawer); } @@ -509,7 +509,7 @@ void OpenGLDrawingContext::StartNewDraw() _swapFramebuffer->Clear(); } -void OpenGLDrawingContext::Clear(DrawPixelInfo* dpi, uint8_t paletteIndex) +void OpenGLDrawingContext::Clear(DrawPixelInfo& dpi, uint8_t paletteIndex) { CalculcateClipping(dpi); @@ -517,7 +517,7 @@ void OpenGLDrawingContext::Clear(DrawPixelInfo* dpi, uint8_t paletteIndex) } void OpenGLDrawingContext::FillRect( - DrawPixelInfo* dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom) + DrawPixelInfo& dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom) { CalculcateClipping(dpi); @@ -552,7 +552,7 @@ void OpenGLDrawingContext::FillRect( } void OpenGLDrawingContext::FilterRect( - DrawPixelInfo* dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) + DrawPixelInfo& dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) { CalculcateClipping(dpi); @@ -575,7 +575,7 @@ void OpenGLDrawingContext::FilterRect( command.depth = _drawCount++; } -void OpenGLDrawingContext::DrawLine(DrawPixelInfo* dpi, uint32_t colour, const ScreenLine& line) +void OpenGLDrawingContext::DrawLine(DrawPixelInfo& dpi, uint32_t colour, const ScreenLine& line) { CalculcateClipping(dpi); @@ -587,7 +587,7 @@ void OpenGLDrawingContext::DrawLine(DrawPixelInfo* dpi, uint32_t colour, const S command.depth = _drawCount++; } -void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, int32_t x, int32_t y) +void OpenGLDrawingContext::DrawSprite(DrawPixelInfo& dpi, const ImageId imageId, int32_t x, int32_t y) { CalculcateClipping(dpi); @@ -597,19 +597,19 @@ void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, return; } - if (dpi->zoom_level > ZoomLevel{ 0 }) + if (dpi.zoom_level > ZoomLevel{ 0 }) { if (g1Element->flags & G1_FLAG_HAS_ZOOM_SPRITE) { DrawPixelInfo zoomedDPI; - zoomedDPI.bits = dpi->bits; - zoomedDPI.x = dpi->x >> 1; - zoomedDPI.y = dpi->y >> 1; - zoomedDPI.height = dpi->height >> 1; - zoomedDPI.width = dpi->width >> 1; - zoomedDPI.pitch = dpi->pitch; - zoomedDPI.zoom_level = dpi->zoom_level - 1; - DrawSprite(&zoomedDPI, imageId.WithIndex(imageId.GetIndex() - g1Element->zoomed_offset), x >> 1, y >> 1); + zoomedDPI.bits = dpi.bits; + zoomedDPI.x = dpi.x >> 1; + zoomedDPI.y = dpi.y >> 1; + zoomedDPI.height = dpi.height >> 1; + zoomedDPI.width = dpi.width >> 1; + zoomedDPI.pitch = dpi.pitch; + zoomedDPI.zoom_level = dpi.zoom_level - 1; + DrawSprite(zoomedDPI, imageId.WithIndex(imageId.GetIndex() - g1Element->zoomed_offset), x >> 1, y >> 1); return; } if (g1Element->flags & G1_FLAG_NO_ZOOM_DRAW) @@ -622,11 +622,11 @@ void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, int32_t top = y + g1Element->y_offset; int32_t zoom_mask; - if (dpi->zoom_level >= ZoomLevel{ 0 }) - zoom_mask = dpi->zoom_level.ApplyTo(0xFFFFFFFF); + if (dpi.zoom_level >= ZoomLevel{ 0 }) + zoom_mask = dpi.zoom_level.ApplyTo(0xFFFFFFFF); else zoom_mask = 0xFFFFFFFF; - if (dpi->zoom_level != ZoomLevel{ 0 } && (g1Element->flags & G1_FLAG_RLE_COMPRESSION)) + if (dpi.zoom_level != ZoomLevel{ 0 } && (g1Element->flags & G1_FLAG_RLE_COMPRESSION)) { top -= ~zoom_mask; } @@ -642,7 +642,7 @@ void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, int32_t right = left + g1Element->width; int32_t bottom = top + g1Element->height; - if (dpi->zoom_level != ZoomLevel{ 0 } && (g1Element->flags & G1_FLAG_RLE_COMPRESSION)) + if (dpi.zoom_level != ZoomLevel{ 0 } && (g1Element->flags & G1_FLAG_RLE_COMPRESSION)) { bottom += top & ~zoom_mask; } @@ -656,15 +656,15 @@ void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, std::swap(top, bottom); } - left -= dpi->x; - top -= dpi->y; - right -= dpi->x; - bottom -= dpi->y; + left -= dpi.x; + top -= dpi.y; + right -= dpi.x; + bottom -= dpi.y; - left = dpi->zoom_level.ApplyInversedTo(left); - top = dpi->zoom_level.ApplyInversedTo(top); - right = dpi->zoom_level.ApplyInversedTo(right); - bottom = dpi->zoom_level.ApplyInversedTo(bottom); + left = dpi.zoom_level.ApplyInversedTo(left); + top = dpi.zoom_level.ApplyInversedTo(top); + right = dpi.zoom_level.ApplyInversedTo(right); + bottom = dpi.zoom_level.ApplyInversedTo(bottom); left += _spriteOffset.x; top += _spriteOffset.y; @@ -738,7 +738,7 @@ void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, } void OpenGLDrawingContext::DrawSpriteRawMasked( - DrawPixelInfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) + DrawPixelInfo& dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) { CalculcateClipping(dpi); @@ -771,15 +771,15 @@ void OpenGLDrawingContext::DrawSpriteRawMasked( std::swap(top, bottom); } - left -= dpi->x; - top -= dpi->y; - right -= dpi->x; - bottom -= dpi->y; + left -= dpi.x; + top -= dpi.y; + right -= dpi.x; + bottom -= dpi.y; - left = dpi->zoom_level.ApplyInversedTo(left); - top = dpi->zoom_level.ApplyInversedTo(top); - right = dpi->zoom_level.ApplyInversedTo(right); - bottom = dpi->zoom_level.ApplyInversedTo(bottom); + left = dpi.zoom_level.ApplyInversedTo(left); + top = dpi.zoom_level.ApplyInversedTo(top); + right = dpi.zoom_level.ApplyInversedTo(right); + bottom = dpi.zoom_level.ApplyInversedTo(bottom); left += _spriteOffset.x; top += _spriteOffset.y; @@ -800,7 +800,7 @@ void OpenGLDrawingContext::DrawSpriteRawMasked( command.depth = _drawCount++; } -void OpenGLDrawingContext::DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) +void OpenGLDrawingContext::DrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) { CalculcateClipping(dpi); @@ -852,7 +852,7 @@ void OpenGLDrawingContext::DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId ima command.depth = _drawCount++; } -void OpenGLDrawingContext::DrawGlyph(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette) +void OpenGLDrawingContext::DrawGlyph(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette) { CalculcateClipping(dpi); @@ -878,15 +878,15 @@ void OpenGLDrawingContext::DrawGlyph(DrawPixelInfo* dpi, const ImageId image, in std::swap(top, bottom); } - left -= dpi->x; - top -= dpi->y; - right -= dpi->x; - bottom -= dpi->y; + left -= dpi.x; + top -= dpi.y; + right -= dpi.x; + bottom -= dpi.y; - left = dpi->zoom_level.ApplyInversedTo(left); - top = dpi->zoom_level.ApplyInversedTo(top); - right = dpi->zoom_level.ApplyInversedTo(right); - bottom = dpi->zoom_level.ApplyInversedTo(bottom); + left = dpi.zoom_level.ApplyInversedTo(left); + top = dpi.zoom_level.ApplyInversedTo(top); + right = dpi.zoom_level.ApplyInversedTo(right); + bottom = dpi.zoom_level.ApplyInversedTo(bottom); left += _spriteOffset.x; top += _spriteOffset.y; @@ -908,17 +908,25 @@ void OpenGLDrawingContext::DrawGlyph(DrawPixelInfo* dpi, const ImageId image, in } void OpenGLDrawingContext::DrawTTFBitmap( - DrawPixelInfo* dpi, TextDrawInfo* info, ImageIndex image, const void* pixels, int32_t width, int32_t height, int32_t x, - int32_t y, uint8_t hinting_threshold) + DrawPixelInfo& dpi, TextDrawInfo* info, TTFSurface* surface, int32_t x, int32_t y, uint8_t hintingThreshold) { +# ifndef NO_TTF CalculcateClipping(dpi); - const auto texture = _textureCache->GetOrLoadBitmapTexture(image, pixels, width, height); + auto baseId = uint32_t(0x7FFFF) - 1024; + auto imageId = baseId + _ttfGlId; + _engine.InvalidateImage(imageId); + const auto texture = _textureCache->GetOrLoadBitmapTexture(imageId, surface->pixels, surface->w, surface->h); + _ttfGlId++; + if (_ttfGlId >= 1023) + { + _ttfGlId = 0; + } int32_t drawOffsetX = 0; int32_t drawOffsetY = 0; - int32_t drawWidth = static_cast(width); - int32_t drawHeight = static_cast(height); + int32_t drawWidth = static_cast(surface->w); + int32_t drawHeight = static_cast(surface->h); int32_t left = x + drawOffsetX; int32_t top = y + drawOffsetY; @@ -976,7 +984,7 @@ void OpenGLDrawingContext::DrawTTFBitmap( command.bounds = { left + 1, top + 1, right + 1, bottom + 1 }; command.depth = _drawCount++; } - auto& cmdBuf = hinting_threshold > 0 ? _commandBuffers.transparent : _commandBuffers.rects; + auto& cmdBuf = hintingThreshold > 0 ? _commandBuffers.transparent : _commandBuffers.rects; DrawRectCommand& command = cmdBuf.allocate(); command.clip = { _clipLeft, _clipTop, _clipRight, _clipBottom }; command.texColourAtlas = texture.index; @@ -984,10 +992,11 @@ void OpenGLDrawingContext::DrawTTFBitmap( command.texMaskAtlas = 0; command.texMaskBounds = { 0.0f, 0.0f, 0.0f, 0.0f }; command.palettes = { 0, 0, 0 }; - command.flags = DrawRectCommand::FLAG_TTF_TEXT | (hinting_threshold << 8); + command.flags = DrawRectCommand::FLAG_TTF_TEXT | (hintingThreshold << 8); command.colour = info->palette[1]; command.bounds = { left, top, right, bottom }; command.depth = _drawCount++; +# endif // NO_TTF } void OpenGLDrawingContext::FlushCommandBuffers() @@ -1067,24 +1076,24 @@ void OpenGLDrawingContext::HandleTransparency() _commandBuffers.transparent.clear(); } -void OpenGLDrawingContext::CalculcateClipping(DrawPixelInfo* dpi) +void OpenGLDrawingContext::CalculcateClipping(DrawPixelInfo& dpi) { auto screenDPI = _engine.GetDPI(); auto bytesPerRow = screenDPI->GetBytesPerRow(); - auto bitsOffset = static_cast(dpi->bits - screenDPI->bits); + auto bitsOffset = static_cast(dpi.bits - screenDPI->bits); # ifndef NDEBUG auto bitsSize = static_cast(screenDPI->height) * bytesPerRow; assert(bitsOffset < bitsSize); # endif - _clipLeft = static_cast(bitsOffset % bytesPerRow) + dpi->remX; - _clipTop = static_cast(bitsOffset / bytesPerRow) + dpi->remY; - _clipRight = _clipLeft + dpi->zoom_level.ApplyInversedTo(dpi->width); - _clipBottom = _clipTop + dpi->zoom_level.ApplyInversedTo(dpi->height); - _offsetX = _clipLeft - dpi->x; - _offsetY = _clipTop - dpi->y; - _spriteOffset.x = _clipLeft - dpi->remX; - _spriteOffset.y = _clipTop - dpi->remY; + _clipLeft = static_cast(bitsOffset % bytesPerRow) + dpi.remX; + _clipTop = static_cast(bitsOffset / bytesPerRow) + dpi.remY; + _clipRight = _clipLeft + dpi.zoom_level.ApplyInversedTo(dpi.width); + _clipBottom = _clipTop + dpi.zoom_level.ApplyInversedTo(dpi.height); + _offsetX = _clipLeft - dpi.x; + _offsetY = _clipTop - dpi.y; + _spriteOffset.x = _clipLeft - dpi.remX; + _spriteOffset.y = _clipTop - dpi.remY; } #endif /* DISABLE_OPENGL */ diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp index 70771ef501..f1845cbdfa 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp @@ -16,6 +16,8 @@ # include # include +using namespace OpenRCT2::Ui; + constexpr GLuint BACKBUFFER_ID = 0; OpenGLFramebuffer::OpenGLFramebuffer(SDL_Window* window) diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h index c13971fbc4..6999f997d9 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h @@ -16,49 +16,51 @@ #include struct SDL_Window; - -class OpenGLFramebuffer +namespace OpenRCT2::Ui { -private: - GLuint _id; - GLuint _texture; - GLuint _depth; - int32_t _width; - int32_t _height; - -public: - explicit OpenGLFramebuffer(SDL_Window* window); - OpenGLFramebuffer(int32_t width, int32_t height, bool depth = true, bool integer = true, bool word = false); - ~OpenGLFramebuffer(); - - OpenGLFramebuffer(const OpenGLFramebuffer&) = delete; - OpenGLFramebuffer& operator=(const OpenGLFramebuffer&) = delete; - - GLuint GetWidth() const + class OpenGLFramebuffer { - return _width; - } - GLuint GetHeight() const - { - return _height; - } - GLuint GetTexture() const - { - return _texture; - } - GLuint GetDepthTexture() const - { - return _depth; - } + private: + GLuint _id; + GLuint _texture; + GLuint _depth; + int32_t _width; + int32_t _height; - void Bind() const; - void BindDraw() const; - void BindRead() const; - void GetPixels(DrawPixelInfo& dpi) const; + public: + explicit OpenGLFramebuffer(SDL_Window* window); + OpenGLFramebuffer(int32_t width, int32_t height, bool depth = true, bool integer = true, bool word = false); + ~OpenGLFramebuffer(); - void SwapColourBuffer(OpenGLFramebuffer& other); - GLuint SwapDepthTexture(GLuint depth); - void Copy(OpenGLFramebuffer& src, GLenum filter); + OpenGLFramebuffer(const OpenGLFramebuffer&) = delete; + OpenGLFramebuffer& operator=(const OpenGLFramebuffer&) = delete; - static GLuint CreateDepthTexture(int32_t width, int32_t height); -}; + GLuint GetWidth() const + { + return _width; + } + GLuint GetHeight() const + { + return _height; + } + GLuint GetTexture() const + { + return _texture; + } + GLuint GetDepthTexture() const + { + return _depth; + } + + void Bind() const; + void BindDraw() const; + void BindRead() const; + void GetPixels(DrawPixelInfo& dpi) const; + + void SwapColourBuffer(OpenGLFramebuffer& other); + GLuint SwapDepthTexture(GLuint depth); + void Copy(OpenGLFramebuffer& src, GLenum filter); + + static GLuint CreateDepthTexture(int32_t width, int32_t height); + }; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp index 8647c110f3..7e9278087d 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp @@ -18,7 +18,7 @@ # include # include -using namespace OpenRCT2; +using namespace OpenRCT2::Ui; OpenGLShader::OpenGLShader(const char* name, GLenum type) : _type(type) diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.h index 1cded5b523..141276f7cc 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.h +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.h @@ -14,43 +14,45 @@ #include #include #include - -class OpenGLShader final +namespace OpenRCT2::Ui { -private: - static constexpr uint64_t MaxSourceSize = 8 * 1024 * 1024; // 8 MiB + class OpenGLShader final + { + private: + static constexpr uint64_t MaxSourceSize = 8 * 1024 * 1024; // 8 MiB - GLenum _type; - GLuint _id = 0; + GLenum _type; + GLuint _id = 0; -public: - OpenGLShader(const char* name, GLenum type); - ~OpenGLShader(); + public: + OpenGLShader(const char* name, GLenum type); + ~OpenGLShader(); - GLuint GetShaderId(); + GLuint GetShaderId(); -private: - std::string GetPath(const std::string& name); - static std::string ReadSourceCode(const std::string& path); -}; + private: + std::string GetPath(const std::string& name); + static std::string ReadSourceCode(const std::string& path); + }; -class OpenGLShaderProgram -{ -private: - GLuint _id = 0; - std::unique_ptr _vertexShader; - std::unique_ptr _fragmentShader; + class OpenGLShaderProgram + { + private: + GLuint _id = 0; + std::unique_ptr _vertexShader; + std::unique_ptr _fragmentShader; -public: - explicit OpenGLShaderProgram(const char* name); - explicit OpenGLShaderProgram(const OpenGLShaderProgram&) = delete; - explicit OpenGLShaderProgram(OpenGLShaderProgram&&) = default; - virtual ~OpenGLShaderProgram(); + public: + explicit OpenGLShaderProgram(const char* name); + explicit OpenGLShaderProgram(const OpenGLShaderProgram&) = delete; + explicit OpenGLShaderProgram(OpenGLShaderProgram&&) = default; + virtual ~OpenGLShaderProgram(); - GLuint GetAttributeLocation(const char* name); - GLuint GetUniformLocation(const char* name); - void Use(); + GLuint GetAttributeLocation(const char* name); + GLuint GetUniformLocation(const char* name); + void Use(); -private: - bool Link(); -}; + private: + bool Link(); + }; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp b/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp index bdccec25c5..cf44c003b5 100644 --- a/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp @@ -13,6 +13,8 @@ # include "OpenGLFramebuffer.h" +using namespace OpenRCT2::Ui; + constexpr GLfloat depthValue[1] = { 1.0f }; constexpr GLfloat depthValueTransparent[1] = { 0.0f }; constexpr GLuint indexValue[4] = { 0, 0, 0, 0 }; diff --git a/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.h b/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.h index c13d5fb5a9..cfc23ded77 100644 --- a/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.h +++ b/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.h @@ -14,44 +14,46 @@ #include "OpenGLFramebuffer.h" #include - -/** - * Class to maintain two different framebuffers where the active framebuffer - * will swap between the two, copying the other's pixels in the process for - * performing pre-processing filters. - * - * When you need to bind the current frame to a shader, call SwapCopy and - * then bind the value of GetSourceTexture to your shader. - */ -class SwapFramebuffer final +namespace OpenRCT2::Ui { -private: - OpenGLFramebuffer _opaqueFramebuffer; - OpenGLFramebuffer _transparentFramebuffer; - OpenGLFramebuffer _mixFramebuffer; - GLuint _backDepth; + /** + * Class to maintain two different framebuffers where the active framebuffer + * will swap between the two, copying the other's pixels in the process for + * performing pre-processing filters. + * + * When you need to bind the current frame to a shader, call SwapCopy and + * then bind the value of GetSourceTexture to your shader. + */ + class SwapFramebuffer final + { + private: + OpenGLFramebuffer _opaqueFramebuffer; + OpenGLFramebuffer _transparentFramebuffer; + OpenGLFramebuffer _mixFramebuffer; + GLuint _backDepth; -public: - SwapFramebuffer(int32_t width, int32_t height); - ~SwapFramebuffer(); + public: + SwapFramebuffer(int32_t width, int32_t height); + ~SwapFramebuffer(); - const OpenGLFramebuffer& GetFinalFramebuffer() const - { - return _opaqueFramebuffer; - } - GLuint GetBackDepthTexture() const - { - return _backDepth; - } - void BindOpaque() - { - _opaqueFramebuffer.Bind(); - } - void BindTransparent() - { - _transparentFramebuffer.Bind(); - } + const OpenGLFramebuffer& GetFinalFramebuffer() const + { + return _opaqueFramebuffer; + } + GLuint GetBackDepthTexture() const + { + return _backDepth; + } + void BindOpaque() + { + _opaqueFramebuffer.Bind(); + } + void BindTransparent() + { + _transparentFramebuffer.Bind(); + } - void ApplyTransparency(ApplyTransparencyShader& shader, GLuint paletteTex, GLuint blendPaletteTex); - void Clear(); -}; + void ApplyTransparency(ApplyTransparencyShader& shader, GLuint paletteTex, GLuint blendPaletteTex); + void Clear(); + }; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp index c66173d30e..bbfad0be1e 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp @@ -19,6 +19,8 @@ # include # include +using namespace OpenRCT2::Ui; + constexpr uint32_t UNUSED_INDEX = 0xFFFFFFFF; TextureCache::TextureCache() diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h index da3df3d33b..097e4f98b9 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h +++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h @@ -29,220 +29,223 @@ struct DrawPixelInfo; struct PaletteMap; enum class FilterPaletteID : int32_t; -struct GlyphId +namespace OpenRCT2::Ui { - ImageIndex Image; - uint64_t Palette; - - struct Hash + struct GlyphId { - size_t operator()(const GlyphId& k) const + ImageIndex Image; + uint64_t Palette; + + struct Hash { - size_t hash = k.Image * 7; - hash += (k.Palette & 0xFFFFFFFFUL) * 13; - hash += (k.Palette >> 32uL) * 23; - return hash; + size_t operator()(const GlyphId& k) const + { + size_t hash = k.Image * 7; + hash += (k.Palette & 0xFFFFFFFFUL) * 13; + hash += (k.Palette >> 32uL) * 23; + return hash; + } + }; + + struct Equal + { + bool operator()(const GlyphId& lhs, const GlyphId& rhs) const + { + return lhs.Image == rhs.Image && lhs.Palette == rhs.Palette; + } + }; + }; + + // This is the maximum width and height of each atlas, basically the + // granularity at which new atlases are allocated (2048 -> 4 MB of VRAM) + constexpr int32_t TEXTURE_CACHE_MAX_ATLAS_SIZE = 2048; + + // Pixel dimensions of smallest supported slots in texture atlases + // Must be a power of 2! + constexpr int32_t TEXTURE_CACHE_SMALLEST_SLOT = 32; + + struct BasicTextureInfo + { + GLuint index; + vec4 normalizedBounds; + }; + + // Location of an image (texture atlas index, slot and normalized coordinates) + struct AtlasTextureInfo : public BasicTextureInfo + { + GLuint slot; + ivec4 bounds; + ImageIndex image; + }; + + // Represents a texture atlas that images of a given maximum size can be allocated from + // Atlases are all stored in the same 2D texture array, occupying the specified index + // Slots in atlases are always squares. + class Atlas final + { + private: + GLuint _index = 0; + int32_t _imageSize = 0; + int32_t _atlasWidth = 0; + int32_t _atlasHeight = 0; + std::vector _freeSlots; + + int32_t _cols = 0; + int32_t _rows = 0; + + public: + Atlas(GLuint index, int32_t imageSize) + : _index(index) + , _imageSize(imageSize) + { + } + + void Initialise(int32_t atlasWidth, int32_t atlasHeight) + { + _atlasWidth = atlasWidth; + _atlasHeight = atlasHeight; + + _cols = std::max(1, _atlasWidth / _imageSize); + _rows = std::max(1, _atlasHeight / _imageSize); + + _freeSlots.resize(_cols * _rows); + for (size_t i = 0; i < _freeSlots.size(); i++) + { + _freeSlots[i] = static_cast(i); + } + } + + AtlasTextureInfo Allocate(int32_t actualWidth, int32_t actualHeight) + { + assert(!_freeSlots.empty()); + + GLuint slot = _freeSlots.back(); + _freeSlots.pop_back(); + + auto bounds = GetSlotCoordinates(slot, actualWidth, actualHeight); + + AtlasTextureInfo info{}; + info.index = _index; + info.slot = slot; + info.bounds = bounds; + info.normalizedBounds = NormalizeCoordinates(bounds); + + return info; + } + + void Free(const AtlasTextureInfo& info) + { + assert(_index == info.index); + + _freeSlots.push_back(info.slot); + } + + // Checks if specified image would be tightly packed in this atlas + // by checking if it is within the right power of 2 range + [[nodiscard]] bool IsImageSuitable(int32_t actualWidth, int32_t actualHeight) const + { + int32_t imageOrder = CalculateImageSizeOrder(actualWidth, actualHeight); + int32_t atlasOrder = log2(_imageSize); + + return imageOrder == atlasOrder; + } + + [[nodiscard]] int32_t GetFreeSlots() const + { + return static_cast(_freeSlots.size()); + } + + static int32_t CalculateImageSizeOrder(int32_t actualWidth, int32_t actualHeight) + { + int32_t actualSize = std::max(actualWidth, actualHeight); + + if (actualSize < TEXTURE_CACHE_SMALLEST_SLOT) + { + actualSize = TEXTURE_CACHE_SMALLEST_SLOT; + } + + return static_cast(ceil(log2f(static_cast(actualSize)))); + } + + private: + [[nodiscard]] ivec4 GetSlotCoordinates(GLuint slot, int32_t actualWidth, int32_t actualHeight) const + { + int32_t row = slot / _cols; + int32_t col = slot % _cols; + + return ivec4{ + _imageSize * col, + _imageSize * row, + _imageSize * col + actualWidth, + _imageSize * row + actualHeight, + }; + } + + [[nodiscard]] vec4 NormalizeCoordinates(const ivec4& coords) const + { + return vec4{ + coords.x / static_cast(_atlasWidth), + coords.y / static_cast(_atlasHeight), + coords.z / static_cast(_atlasWidth), + coords.w / static_cast(_atlasHeight), + }; } }; - struct Equal + class TextureCache final { - bool operator()(const GlyphId& lhs, const GlyphId& rhs) const - { - return lhs.Image == rhs.Image && lhs.Palette == rhs.Palette; - } - }; -}; + private: + bool _initialized = false; -// This is the maximum width and height of each atlas, basically the -// granularity at which new atlases are allocated (2048 -> 4 MB of VRAM) -constexpr int32_t TEXTURE_CACHE_MAX_ATLAS_SIZE = 2048; + GLuint _atlasesTexture = 0; + GLint _atlasesTextureDimensions = 0; + GLuint _atlasesTextureCapacity = 0; + GLuint _atlasesTextureIndices = 0; + GLint _atlasesTextureIndicesLimit = 0; + std::vector _atlases; + std::unordered_map _glyphTextureMap; + std::vector _textureCache; + std::array _indexMap; -// Pixel dimensions of smallest supported slots in texture atlases -// Must be a power of 2! -constexpr int32_t TEXTURE_CACHE_SMALLEST_SLOT = 32; - -struct BasicTextureInfo -{ - GLuint index; - vec4 normalizedBounds; -}; - -// Location of an image (texture atlas index, slot and normalized coordinates) -struct AtlasTextureInfo : public BasicTextureInfo -{ - GLuint slot; - ivec4 bounds; - ImageIndex image; -}; - -// Represents a texture atlas that images of a given maximum size can be allocated from -// Atlases are all stored in the same 2D texture array, occupying the specified index -// Slots in atlases are always squares. -class Atlas final -{ -private: - GLuint _index = 0; - int32_t _imageSize = 0; - int32_t _atlasWidth = 0; - int32_t _atlasHeight = 0; - std::vector _freeSlots; - - int32_t _cols = 0; - int32_t _rows = 0; - -public: - Atlas(GLuint index, int32_t imageSize) - : _index(index) - , _imageSize(imageSize) - { - } - - void Initialise(int32_t atlasWidth, int32_t atlasHeight) - { - _atlasWidth = atlasWidth; - _atlasHeight = atlasHeight; - - _cols = std::max(1, _atlasWidth / _imageSize); - _rows = std::max(1, _atlasHeight / _imageSize); - - _freeSlots.resize(_cols * _rows); - for (size_t i = 0; i < _freeSlots.size(); i++) - { - _freeSlots[i] = static_cast(i); - } - } - - AtlasTextureInfo Allocate(int32_t actualWidth, int32_t actualHeight) - { - assert(!_freeSlots.empty()); - - GLuint slot = _freeSlots.back(); - _freeSlots.pop_back(); - - auto bounds = GetSlotCoordinates(slot, actualWidth, actualHeight); - - AtlasTextureInfo info{}; - info.index = _index; - info.slot = slot; - info.bounds = bounds; - info.normalizedBounds = NormalizeCoordinates(bounds); - - return info; - } - - void Free(const AtlasTextureInfo& info) - { - assert(_index == info.index); - - _freeSlots.push_back(info.slot); - } - - // Checks if specified image would be tightly packed in this atlas - // by checking if it is within the right power of 2 range - [[nodiscard]] bool IsImageSuitable(int32_t actualWidth, int32_t actualHeight) const - { - int32_t imageOrder = CalculateImageSizeOrder(actualWidth, actualHeight); - int32_t atlasOrder = log2(_imageSize); - - return imageOrder == atlasOrder; - } - - [[nodiscard]] int32_t GetFreeSlots() const - { - return static_cast(_freeSlots.size()); - } - - static int32_t CalculateImageSizeOrder(int32_t actualWidth, int32_t actualHeight) - { - int32_t actualSize = std::max(actualWidth, actualHeight); - - if (actualSize < TEXTURE_CACHE_SMALLEST_SLOT) - { - actualSize = TEXTURE_CACHE_SMALLEST_SLOT; - } - - return static_cast(ceil(log2f(static_cast(actualSize)))); - } - -private: - [[nodiscard]] ivec4 GetSlotCoordinates(GLuint slot, int32_t actualWidth, int32_t actualHeight) const - { - int32_t row = slot / _cols; - int32_t col = slot % _cols; - - return ivec4{ - _imageSize * col, - _imageSize * row, - _imageSize * col + actualWidth, - _imageSize * row + actualHeight, - }; - } - - [[nodiscard]] vec4 NormalizeCoordinates(const ivec4& coords) const - { - return vec4{ - coords.x / static_cast(_atlasWidth), - coords.y / static_cast(_atlasHeight), - coords.z / static_cast(_atlasWidth), - coords.w / static_cast(_atlasHeight), - }; - } -}; - -class TextureCache final -{ -private: - bool _initialized = false; - - GLuint _atlasesTexture = 0; - GLint _atlasesTextureDimensions = 0; - GLuint _atlasesTextureCapacity = 0; - GLuint _atlasesTextureIndices = 0; - GLint _atlasesTextureIndicesLimit = 0; - std::vector _atlases; - std::unordered_map _glyphTextureMap; - std::vector _textureCache; - std::array _indexMap; - - GLuint _paletteTexture = 0; - GLuint _blendPaletteTexture = 0; + GLuint _paletteTexture = 0; + GLuint _blendPaletteTexture = 0; #ifndef __MACOSX__ - std::shared_mutex _mutex; - using shared_lock = std::shared_lock; - using unique_lock = std::unique_lock; + std::shared_mutex _mutex; + using shared_lock = std::shared_lock; + using unique_lock = std::unique_lock; #else - std::mutex _mutex; - using shared_lock = std::unique_lock; - using unique_lock = std::unique_lock; + std::mutex _mutex; + using shared_lock = std::unique_lock; + using unique_lock = std::unique_lock; #endif -public: - TextureCache(); - ~TextureCache(); - void InvalidateImage(ImageIndex image); - BasicTextureInfo GetOrLoadImageTexture(const ImageId imageId); - BasicTextureInfo GetOrLoadGlyphTexture(const ImageId imageId, const PaletteMap& paletteMap); - BasicTextureInfo GetOrLoadBitmapTexture(ImageIndex image, const void* pixels, size_t width, size_t height); + public: + TextureCache(); + ~TextureCache(); + void InvalidateImage(ImageIndex image); + BasicTextureInfo GetOrLoadImageTexture(const ImageId imageId); + BasicTextureInfo GetOrLoadGlyphTexture(const ImageId imageId, const PaletteMap& paletteMap); + BasicTextureInfo GetOrLoadBitmapTexture(ImageIndex image, const void* pixels, size_t width, size_t height); - GLuint GetAtlasesTexture(); - GLuint GetPaletteTexture(); - GLuint GetBlendPaletteTexture(); - static GLint PaletteToY(FilterPaletteID palette); + GLuint GetAtlasesTexture(); + GLuint GetPaletteTexture(); + GLuint GetBlendPaletteTexture(); + static GLint PaletteToY(FilterPaletteID palette); -private: - void CreateTextures(); - void GeneratePaletteTexture(); - void EnlargeAtlasesTexture(GLuint newEntries); - AtlasTextureInfo LoadImageTexture(const ImageId image); - 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 DrawPixelInfo GetImageAsDPI(const ImageId imageId); - static DrawPixelInfo GetGlyphAsDPI(const ImageId imageId, const PaletteMap& paletteMap); - void FreeTextures(); + private: + void CreateTextures(); + void GeneratePaletteTexture(); + void EnlargeAtlasesTexture(GLuint newEntries); + AtlasTextureInfo LoadImageTexture(const ImageId image); + 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 DrawPixelInfo GetImageAsDPI(const ImageId imageId); + static DrawPixelInfo GetGlyphAsDPI(const ImageId imageId, const PaletteMap& paletteMap); + void FreeTextures(); - static DrawPixelInfo CreateDPI(int32_t width, int32_t height); - static void DeleteDPI(DrawPixelInfo dpi); -}; + static DrawPixelInfo CreateDPI(int32_t width, int32_t height); + static void DeleteDPI(DrawPixelInfo dpi); + }; +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp b/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp index aa9db60ee1..bd113014b2 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp @@ -15,194 +15,196 @@ # include # include -/* - * Structure to store locations of vertical bounding box edge. - */ -struct XData +namespace OpenRCT2::Ui { - int32_t xposition; - bool begin; - int32_t top, bottom; -}; -using SweepLine = std::vector; - -/* - * Creates a list of vertical bounding box edges, stored as xdata and sorted - * from left to right. If multiple edges are at the same x coordinate, Then - * edges for boxes to the left will appear before edges for boxes to the right. - */ -static inline SweepLine CreateXList(const RectCommandBatch& transparent) -{ - SweepLine x_sweep; - x_sweep.reserve(transparent.size() * 2); - - for (const DrawRectCommand& command : transparent) + /* + * Structure to store locations of vertical bounding box edge. + */ + struct XData { - int32_t left = std::min(std::max(command.bounds.x, command.clip.x), command.clip.z); - int32_t top = std::min(std::max(command.bounds.y, command.clip.y), command.clip.w); - int32_t right = std::min(std::max(command.bounds.z, command.clip.x), command.clip.z); - int32_t bottom = std::min(std::max(command.bounds.w, command.clip.y), command.clip.w); + int32_t xposition; + bool begin; + int32_t top, bottom; + }; + using SweepLine = std::vector; - assert(left <= right); - assert(top <= bottom); - if (left == right) - continue; - if (top == bottom) - continue; - - x_sweep.push_back({ left, true, top, bottom }); - x_sweep.push_back({ right, false, top, bottom }); - } - - std::sort(x_sweep.begin(), x_sweep.end(), [](const XData& a, const XData& b) -> bool { - if (a.xposition != b.xposition) - return a.xposition < b.xposition; - - return !a.begin && b.begin; - }); - - return x_sweep; -} - -/* - * Structure that stores intervals. YData.count stores how many intervals have - * an endpoint at this position, and YData.depth stores how many intervals - * intersect on the left limit of this point. In other words, IntervalTree - * stores half-closed intervals, with the left endpoint open, and the right - * endpoint closed. The IntervalTree uses std::map because it stores the values - * sorted, and we can traverse it in order using its bidirectional iterators. - */ -struct YData -{ - int32_t count, depth; -}; -using IntervalTree = std::map; - -/* - * Inserts the interval's top endpoint into the interval tree. If the endpoint - * already exists in the interval tree, it stacks the endpoints. - */ -static inline IntervalTree::iterator InsertTopEndpoint(IntervalTree& y_intersect, int32_t top) -{ - auto top_in = y_intersect.insert({ top, { 1, 0 } }); - IntervalTree::iterator top_it = top_in.first; - if (top_in.second) + /* + * Creates a list of vertical bounding box edges, stored as xdata and sorted + * from left to right. If multiple edges are at the same x coordinate, Then + * edges for boxes to the left will appear before edges for boxes to the right. + */ + static inline SweepLine CreateXList(const RectCommandBatch& transparent) { - IntervalTree::iterator top_next = std::next(top_it); - if (top_next != y_intersect.end()) + SweepLine x_sweep; + x_sweep.reserve(transparent.size() * 2); + + for (const DrawRectCommand& command : transparent) { - top_it->second.depth = top_next->second.depth; + int32_t left = std::min(std::max(command.bounds.x, command.clip.x), command.clip.z); + int32_t top = std::min(std::max(command.bounds.y, command.clip.y), command.clip.w); + int32_t right = std::min(std::max(command.bounds.z, command.clip.x), command.clip.z); + int32_t bottom = std::min(std::max(command.bounds.w, command.clip.y), command.clip.w); + + assert(left <= right); + assert(top <= bottom); + if (left == right) + continue; + if (top == bottom) + continue; + + x_sweep.push_back({ left, true, top, bottom }); + x_sweep.push_back({ right, false, top, bottom }); } - } - else - { - ++top_it->second.count; - } - return top_it; -} -/* - * Inserts the interval's bottom endpoint into the interval tree. If the - * endpoint already exists in the interval tree, it stacks the endpoint. - * This function can produce a new maximum depth. - */ -static inline IntervalTree::iterator InsertBottomEndpoint(IntervalTree& y_intersect, int32_t bottom) -{ - auto bottom_in = y_intersect.insert({ bottom, { 1, 1 } }); - IntervalTree::iterator bottom_it = bottom_in.first; - if (bottom_in.second) + std::sort(x_sweep.begin(), x_sweep.end(), [](const XData& a, const XData& b) -> bool { + if (a.xposition != b.xposition) + return a.xposition < b.xposition; + + return !a.begin && b.begin; + }); + + return x_sweep; + } + + /* + * Structure that stores intervals. YData.count stores how many intervals have + * an endpoint at this position, and YData.depth stores how many intervals + * intersect on the left limit of this point. In other words, IntervalTree + * stores half-closed intervals, with the left endpoint open, and the right + * endpoint closed. The IntervalTree uses std::map because it stores the values + * sorted, and we can traverse it in order using its bidirectional iterators. + */ + struct YData { - IntervalTree::iterator bottom_next = std::next(bottom_it); - if (bottom_next != y_intersect.end()) + int32_t count, depth; + }; + using IntervalTree = std::map; + + /* + * Inserts the interval's top endpoint into the interval tree. If the endpoint + * already exists in the interval tree, it stacks the endpoints. + */ + static inline IntervalTree::iterator InsertTopEndpoint(IntervalTree& y_intersect, int32_t top) + { + auto top_in = y_intersect.insert({ top, { 1, 0 } }); + IntervalTree::iterator top_it = top_in.first; + if (top_in.second) { - bottom_it->second.depth = bottom_next->second.depth + 1; - } - } - else - { - ++bottom_it->second.count; - ++bottom_it->second.depth; - } - return bottom_it; -} - -/* - * Removes the interval's top endpoint, handling stacked endpoints. - */ -static inline void RemoveTopEndpoint(IntervalTree& y_intersect, IntervalTree::iterator top_it) -{ - if (top_it->second.count == 1) - { - y_intersect.erase(top_it); - } - else - { - --top_it->second.count; - } -} - -/* - * Removes the interval's bottom endpoint, handling stacked endpoints. - */ -static inline void RemoveBottomEndpoint(IntervalTree& y_intersect, IntervalTree::iterator bottom_it) -{ - if (bottom_it->second.count == 1) - { - y_intersect.erase(bottom_it); - } - else - { - --bottom_it->second.count; - --bottom_it->second.depth; - } -} - -/* - * Determines an approximation of the number of depth peeling iterations needed - * to render the command batch. It will never underestimate the number of - * iterations, but it can overestimate, usually by no more than +2. - */ -int32_t MaxTransparencyDepth(const RectCommandBatch& transparent) -{ - int32_t max_depth = 1; - SweepLine x_sweep = CreateXList(transparent); - IntervalTree y_intersect{}; - - for (const XData& x : x_sweep) - { - if (x.begin) - { - IntervalTree::iterator top_it = InsertTopEndpoint(y_intersect, x.top); - IntervalTree::iterator bottom_it = InsertBottomEndpoint(y_intersect, x.bottom); - max_depth = std::max(max_depth, bottom_it->second.depth); - - /* - * Increment the depth for endpoings that intersect this interval - */ - for (IntervalTree::iterator it = std::next(top_it); it != bottom_it && it != std::end(y_intersect); ++it) + IntervalTree::iterator top_next = std::next(top_it); + if (top_next != y_intersect.end()) { - max_depth = std::max(max_depth, ++it->second.depth); + top_it->second.depth = top_next->second.depth; } } else { - IntervalTree::iterator top_it = y_intersect.find(x.top); - IntervalTree::iterator bottom_it = y_intersect.find(x.bottom); + ++top_it->second.count; + } + return top_it; + } - /* - * Decrement the depth for endpoings that intersected this interval - */ - for (IntervalTree::iterator it = std::next(top_it); it != bottom_it && it != std::end(y_intersect); ++it) + /* + * Inserts the interval's bottom endpoint into the interval tree. If the + * endpoint already exists in the interval tree, it stacks the endpoint. + * This function can produce a new maximum depth. + */ + static inline IntervalTree::iterator InsertBottomEndpoint(IntervalTree& y_intersect, int32_t bottom) + { + auto bottom_in = y_intersect.insert({ bottom, { 1, 1 } }); + IntervalTree::iterator bottom_it = bottom_in.first; + if (bottom_in.second) + { + IntervalTree::iterator bottom_next = std::next(bottom_it); + if (bottom_next != y_intersect.end()) { - --it->second.depth; + bottom_it->second.depth = bottom_next->second.depth + 1; } + } + else + { + ++bottom_it->second.count; + ++bottom_it->second.depth; + } + return bottom_it; + } - RemoveTopEndpoint(y_intersect, top_it); - RemoveBottomEndpoint(y_intersect, bottom_it); + /* + * Removes the interval's top endpoint, handling stacked endpoints. + */ + static inline void RemoveTopEndpoint(IntervalTree& y_intersect, IntervalTree::iterator top_it) + { + if (top_it->second.count == 1) + { + y_intersect.erase(top_it); + } + else + { + --top_it->second.count; } } - return max_depth; -} + /* + * Removes the interval's bottom endpoint, handling stacked endpoints. + */ + static inline void RemoveBottomEndpoint(IntervalTree& y_intersect, IntervalTree::iterator bottom_it) + { + if (bottom_it->second.count == 1) + { + y_intersect.erase(bottom_it); + } + else + { + --bottom_it->second.count; + --bottom_it->second.depth; + } + } + /* + * Determines an approximation of the number of depth peeling iterations needed + * to render the command batch. It will never underestimate the number of + * iterations, but it can overestimate, usually by no more than +2. + */ + int32_t MaxTransparencyDepth(const RectCommandBatch& transparent) + { + int32_t max_depth = 1; + SweepLine x_sweep = CreateXList(transparent); + IntervalTree y_intersect{}; + + for (const XData& x : x_sweep) + { + if (x.begin) + { + IntervalTree::iterator top_it = InsertTopEndpoint(y_intersect, x.top); + IntervalTree::iterator bottom_it = InsertBottomEndpoint(y_intersect, x.bottom); + max_depth = std::max(max_depth, bottom_it->second.depth); + + /* + * Increment the depth for endpoings that intersect this interval + */ + for (IntervalTree::iterator it = std::next(top_it); it != bottom_it && it != std::end(y_intersect); ++it) + { + max_depth = std::max(max_depth, ++it->second.depth); + } + } + else + { + IntervalTree::iterator top_it = y_intersect.find(x.top); + IntervalTree::iterator bottom_it = y_intersect.find(x.bottom); + + /* + * Decrement the depth for endpoings that intersected this interval + */ + for (IntervalTree::iterator it = std::next(top_it); it != bottom_it && it != std::end(y_intersect); ++it) + { + --it->second.depth; + } + + RemoveTopEndpoint(y_intersect, top_it); + RemoveBottomEndpoint(y_intersect, bottom_it); + } + } + + return max_depth; + } +} // namespace OpenRCT2::Ui #endif /* DISABLE_OPENGL */ diff --git a/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.h b/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.h index 053b36f538..3ae4bb017b 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.h +++ b/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.h @@ -13,9 +13,12 @@ #include -/* - * Determines an approximation of the number of depth peeling iterations needed - * to render the command batch. It will never underestimate the number of - * iterations, but it can overestimate, usually by no more than +2. - */ -int32_t MaxTransparencyDepth(const RectCommandBatch& transparent); +namespace OpenRCT2::Ui +{ + /* + * Determines an approximation of the number of depth peeling iterations needed + * to render the command batch. It will never underestimate the number of + * iterations, but it can overestimate, usually by no more than +2. + */ + int32_t MaxTransparencyDepth(const RectCommandBatch& transparent); +} // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/input/InputManager.cpp b/src/openrct2-ui/input/InputManager.cpp index cf0c612ec6..8c4b32fec6 100644 --- a/src/openrct2-ui/input/InputManager.cpp +++ b/src/openrct2-ui/input/InputManager.cpp @@ -202,7 +202,7 @@ void InputManager::Process(const InputEvent& e) { if (e.State == InputEventState::Release) { - WindowTextInputKey(w, e.Button); + OpenRCT2::Ui::Windows::WindowTextInputKey(w, e.Button); } return; } diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index b31e8c2e18..03b44c2b8a 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -34,6 +34,8 @@ #include #include +using namespace OpenRCT2::Ui::Windows; + struct RCTMouseData { uint32_t x; @@ -390,7 +392,7 @@ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState break; } - WindowEventToolDragCall(w, gCurrentToolWidget.widget_index, screenCoords); + w->OnToolDrag(gCurrentToolWidget.widget_index, screenCoords); break; case MouseState::LeftRelease: _inputState = InputState::Reset; @@ -401,7 +403,7 @@ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState w = WindowFindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number); if (w != nullptr) { - WindowEventToolUpCall(w, gCurrentToolWidget.widget_index, screenCoords); + w->OnToolUp(gCurrentToolWidget.widget_index, screenCoords); } } else if (!(_inputFlags & INPUT_FLAG_4)) @@ -482,7 +484,7 @@ static void InputWindowPositionEnd(WindowBase& w, const ScreenCoordsXY& screenCo _inputState = InputState::Normal; gTooltipCloseTimeout = 0; gTooltipWidget = _dragWidget; - WindowEventMovedCall(&w, screenCoords); + w.OnMoved(screenCoords); } static void InputWindowResizeBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) @@ -625,10 +627,10 @@ static void InputScrollBegin(WindowBase& w, WidgetIndex widgetIndex, const Scree _currentScrollArea = scroll_area; _currentScrollIndex = scroll_id; - WindowEventScrollSelectCall(&w, scroll_id, scroll_area); + w.OnScrollSelect(scroll_id, scroll_area); if (scroll_area == SCROLL_PART_VIEW) { - WindowEventScrollMousedownCall(&w, scroll_id, scrollCoords); + w.OnScrollMouseDown(scroll_id, scrollCoords); return; } @@ -637,12 +639,12 @@ static void InputScrollBegin(WindowBase& w, WidgetIndex widgetIndex, const Scree int32_t widget_width = widg.width() - 1; if (scroll.flags & VSCROLLBAR_VISIBLE) - widget_width -= SCROLLBAR_WIDTH + 1; + widget_width -= kScrollBarWidth + 1; int32_t widget_content_width = std::max(scroll.h_right - widget_width, 0); int32_t widget_height = widg.bottom - widg.top - 1; if (scroll.flags & HSCROLLBAR_VISIBLE) - widget_height -= SCROLLBAR_WIDTH + 1; + widget_height -= kScrollBarWidth + 1; int32_t widget_content_height = std::max(scroll.v_bottom - widget_height, 0); switch (scroll_area) @@ -718,7 +720,7 @@ static void InputScrollContinue(WindowBase& w, WidgetIndex widgetIndex, const Sc switch (scroll_part) { case SCROLL_PART_VIEW: - WindowEventScrollMousedragCall(&w, scroll_id, newScreenCoords); + w.OnScrollMouseDrag(scroll_id, newScreenCoords); break; case SCROLL_PART_HSCROLLBAR_LEFT: InputScrollPartUpdateHLeft(w, widgetIndex, scroll_id); @@ -757,7 +759,7 @@ static void InputScrollPartUpdateHThumb(WindowBase& w, WidgetIndex widgetIndex, newLeft *= x; x = widget.width() - 21; if (scroll.flags & VSCROLLBAR_VISIBLE) - x -= SCROLLBAR_WIDTH + 1; + x -= kScrollBarWidth + 1; newLeft /= x; x = newLeft; scroll.flags |= HSCROLLBAR_THUMB_PRESSED; @@ -767,7 +769,7 @@ static void InputScrollPartUpdateHThumb(WindowBase& w, WidgetIndex widgetIndex, newLeft = 0; x = widget.width() - 1; if (scroll.flags & VSCROLLBAR_VISIBLE) - x -= SCROLLBAR_WIDTH + 1; + x -= kScrollBarWidth + 1; x *= -1; x += scroll.h_right; if (x < 0) @@ -796,7 +798,7 @@ static void InputScrollPartUpdateVThumb(WindowBase& w, WidgetIndex widgetIndex, newTop *= y; y = widget.height() - 21; if (scroll.flags & HSCROLLBAR_VISIBLE) - y -= SCROLLBAR_WIDTH + 1; + y -= kScrollBarWidth + 1; newTop /= y; y = newTop; scroll.flags |= VSCROLLBAR_THUMB_PRESSED; @@ -806,7 +808,7 @@ static void InputScrollPartUpdateVThumb(WindowBase& w, WidgetIndex widgetIndex, newTop = 0; y = widget.height() - 1; if (scroll.flags & HSCROLLBAR_VISIBLE) - y -= SCROLLBAR_WIDTH + 1; + y -= kScrollBarWidth + 1; y *= -1; y += scroll.v_bottom; if (y < 0) @@ -850,7 +852,7 @@ static void InputScrollPartUpdateHRight(WindowBase& w, WidgetIndex widgetIndex, scroll.h_left += 3; int32_t newLeft = widget.width() - 1; if (scroll.flags & VSCROLLBAR_VISIBLE) - newLeft -= SCROLLBAR_WIDTH + 1; + newLeft -= kScrollBarWidth + 1; newLeft *= -1; newLeft += scroll.h_right; if (newLeft < 0) @@ -893,7 +895,7 @@ static void InputScrollPartUpdateVBottom(WindowBase& w, WidgetIndex widgetIndex, scroll.v_top += 3; int32_t newTop = widget.height() - 1; if (scroll.flags & HSCROLLBAR_VISIBLE) - newTop -= SCROLLBAR_WIDTH + 1; + newTop -= kScrollBarWidth + 1; newTop *= -1; newTop += scroll.v_bottom; if (newTop < 0) @@ -938,7 +940,7 @@ static void InputWidgetOver(const ScreenCoordsXY& screenCoords, WindowBase* w, W WindowTooltipClose(); else { - WindowEventScrollMouseoverCall(w, scrollId, newScreenCoords); + w->OnScrollMouseOver(scrollId, newScreenCoords); InputUpdateTooltip(w, widgetIndex, screenCoords); } } @@ -985,7 +987,7 @@ static void InputWidgetOverFlatbuttonInvalidate() WindowBase* w = WindowFindByNumber(gHoverWidget.window_classification, gHoverWidget.window_number); if (w != nullptr) { - WindowEventOnPrepareDrawCall(w); + w->OnPrepareDraw(); if (w->widgets[gHoverWidget.widget_index].type == WindowWidgetType::FlatBtn) { WidgetInvalidateByNumber(gHoverWidget.window_classification, gHoverWidget.window_number, gHoverWidget.widget_index); @@ -1047,7 +1049,7 @@ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, W if (w != nullptr) { InputSetFlag(INPUT_FLAG_4, true); - WindowEventToolDownCall(w, gCurrentToolWidget.widget_index, screenCoords); + w->OnToolDown(gCurrentToolWidget.widget_index, screenCoords); } } break; @@ -1091,7 +1093,7 @@ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, W _clickRepeatTicks = gCurrentRealTimeTicks; WidgetInvalidateByNumber(windowClass, windowNumber, widgetIndex); - WindowEventMouseDownCall(w, widgetIndex); + w->OnMouseDown(widgetIndex); } break; } @@ -1162,13 +1164,13 @@ void ProcessMouseOver(const ScreenCoordsXY& screenCoords) break; } // Same as default but with scroll_x/y - cursorId = WindowEventCursorCall(window, widgetId, scrollCoords); + cursorId = window->OnCursor(widgetId, scrollCoords, CursorID::Arrow); if (cursorId == CursorID::Undefined) cursorId = CursorID::Arrow; break; } default: - cursorId = WindowEventCursorCall(window, widgetId, screenCoords); + cursorId = window->OnCursor(widgetId, screenCoords, CursorID::Arrow); if (cursorId == CursorID::Undefined) cursorId = CursorID::Arrow; break; @@ -1193,7 +1195,7 @@ void ProcessMouseTool(const ScreenCoordsXY& screenCoords) if (w == nullptr) ToolCancel(); else if (InputGetState() != InputState::ViewportRight) - WindowEventToolUpdateCall(w, gCurrentToolWidget.widget_index, screenCoords); + w->OnToolUpdate(gCurrentToolWidget.widget_index, screenCoords); } } @@ -1323,7 +1325,7 @@ void InputStateWidgetPressed( { if (WidgetIsHoldable(*w, widgetIndex)) { - WindowEventMouseDownCall(w, widgetIndex); + w->OnMouseDown(widgetIndex); } // Subtract initial delay from here on we want the event each third tick. @@ -1413,7 +1415,7 @@ void InputStateWidgetPressed( dropdown_index = gDropdownDefaultIndex; } } - WindowEventDropdownCall(cursor_w, cursor_widgetIndex, dropdown_index); + cursor_w->OnDropdown(cursor_widgetIndex, dropdown_index); } } } @@ -1445,7 +1447,7 @@ void InputStateWidgetPressed( break; WidgetInvalidateByNumber(cursor_w_class, cursor_w_number, widgetIndex); - WindowEventMouseUpCall(w, widgetIndex); + w->OnMouseUp(widgetIndex); return; default: @@ -1688,18 +1690,18 @@ void InputScrollViewport(const ScreenCoordsXY& scrollScreenCoords) int32_t y = mainWindow->savedViewPos.y + viewport->view_height / 2; int32_t y_dy = mainWindow->savedViewPos.y + viewport->view_height / 2 + dy; - auto mapCoord = ViewportPosToMapPos({ x, y }, 0); - auto mapCoord_dy = ViewportPosToMapPos({ x, y_dy }, 0); + auto mapCoord = ViewportPosToMapPos({ x, y }, 0, viewport->rotation); + auto mapCoord_dy = ViewportPosToMapPos({ x, y_dy }, 0, viewport->rotation); // Check if we're crossing the boundary // Clamp to the map minimum value int32_t at_map_edge = 0; int32_t at_map_edge_dy = 0; - if (mapCoord.x < MAP_MINIMUM_X_Y || mapCoord.y < MAP_MINIMUM_X_Y) + if (mapCoord.x < kMapMinimumXY || mapCoord.y < kMapMinimumXY) { at_map_edge = 1; } - if (mapCoord_dy.x < MAP_MINIMUM_X_Y || mapCoord_dy.y < MAP_MINIMUM_X_Y) + if (mapCoord_dy.x < kMapMinimumXY || mapCoord_dy.y < kMapMinimumXY) { at_map_edge_dy = 1; } diff --git a/src/openrct2-ui/input/ShortcutIds.h b/src/openrct2-ui/input/ShortcutIds.h index 5aa7b9bffb..4cd02eb3f8 100644 --- a/src/openrct2-ui/input/ShortcutIds.h +++ b/src/openrct2-ui/input/ShortcutIds.h @@ -108,6 +108,7 @@ namespace OpenRCT2::Ui::ShortcutId constexpr std::string_view WindowTileInspectorToggleInvisibility = "window.tileinspector.toggle_invisibility"; constexpr std::string_view WindowTileInspectorCopy = "window.tileinspector.copy"; constexpr std::string_view WindowTileInspectorPaste = "window.tileinspector.paste"; + constexpr std::string_view WindowTileInspectorSort = "window.tileinspector.sort"; constexpr std::string_view WindowTileInspectorRemove = "window.tileinspector.remove"; constexpr std::string_view WindowTileInspectorMoveUp = "window.tileinspector.move_up"; constexpr std::string_view WindowTileInspectorMoveDown = "window.tileinspector.move_down"; diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index 35e3805dba..386a7f34e1 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ using namespace OpenRCT2; using namespace OpenRCT2::Ui; +using namespace OpenRCT2::Ui::Windows; #pragma region Shortcut Commands @@ -62,11 +64,7 @@ static void RotateCamera(int32_t direction) { if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) { - auto window = WindowGetMain(); - if (window != nullptr) - { - WindowRotateCamera(*window, direction); - } + ViewportRotateAll(direction); } } @@ -93,7 +91,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !WidgetIsDisabled(*w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON) && w->widgets[WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON); + w->OnMouseUp(WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON); return; } @@ -105,7 +103,7 @@ static void ShortcutRotateConstructionObject() // Check if building a maze... if (w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].tooltip != STR_RIDE_CONSTRUCTION_BUILD_MAZE_IN_THIS_DIRECTION_TIP) { - WindowEventMouseUpCall(w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE); + w->OnMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ROTATE); return; } } @@ -115,7 +113,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !WidgetIsDisabled(*w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE) && w->widgets[WC_TRACK_DESIGN_LIST__WIDX_ROTATE].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE); + w->OnMouseUp(WC_TRACK_DESIGN_LIST__WIDX_ROTATE); return; } @@ -124,7 +122,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !WidgetIsDisabled(*w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE) && w->widgets[WC_TRACK_DESIGN_PLACE__WIDX_ROTATE].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE); + w->OnMouseUp(WC_TRACK_DESIGN_PLACE__WIDX_ROTATE); return; } @@ -133,7 +131,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !WidgetIsDisabled(*w, WC_MAP__WIDX_ROTATE_90) && w->widgets[WC_MAP__WIDX_ROTATE_90].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, WC_MAP__WIDX_ROTATE_90); + w->OnMouseUp(WC_MAP__WIDX_ROTATE_90); return; } @@ -142,7 +140,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !WidgetIsDisabled(*w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE) && w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE); + w->OnMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE); return; } } @@ -202,7 +200,7 @@ static void ShortcutAdjustLand() if (window != nullptr) { window->Invalidate(); - WindowEventMouseUpCall(window, WC_TOP_TOOLBAR__WIDX_LAND); + window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_LAND); } } } @@ -221,7 +219,7 @@ static void ShortcutAdjustWater() if (window != nullptr) { window->Invalidate(); - WindowEventMouseUpCall(window, WC_TOP_TOOLBAR__WIDX_WATER); + window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_WATER); } } } @@ -240,7 +238,7 @@ static void ShortcutBuildScenery() if (window != nullptr) { window->Invalidate(); - WindowEventMouseUpCall(window, WC_TOP_TOOLBAR__WIDX_SCENERY); + window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_SCENERY); } } } @@ -393,7 +391,7 @@ static void ShortcutOpenCheatWindow() static void ShortcutOpenKeyboardShortcutsWindow() { - WindowShortcutKeysOpen(); + ShortcutKeysOpen(); } static void ShortcutOpenTransparencyWindow() @@ -417,7 +415,7 @@ static void ShortcutClearScenery() if (window != nullptr) { window->Invalidate(); - WindowEventMouseUpCall(window, WC_TOP_TOOLBAR__WIDX_CLEAR_SCENERY); + window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_CLEAR_SCENERY); } } } @@ -462,16 +460,15 @@ static void ShortcutOpenSceneryPicker() if (window_toolbar != nullptr) { window_toolbar->Invalidate(); - WindowEventMouseUpCall(window_toolbar, WC_TOP_TOOLBAR__WIDX_SCENERY); + window_toolbar->OnMouseUp(WC_TOP_TOOLBAR__WIDX_SCENERY); } } window_scenery = WindowFindByClass(WindowClass::Scenery); if (window_scenery != nullptr && !WidgetIsDisabled(*window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON) - && window_scenery->widgets[WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON].type != WindowWidgetType::Empty && !gWindowSceneryEyedropperEnabled) { - WindowEventMouseUpCall(window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON); + window_scenery->OnMouseUp(WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON); return; } } @@ -501,7 +498,7 @@ static void TileInspectorMouseUp(WidgetIndex widgetIndex) auto w = WindowFindByClass(WindowClass::TileInspector); if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, widgetIndex); + w->OnMouseUp(widgetIndex); } } @@ -510,7 +507,7 @@ static void TileInspectorMouseDown(WidgetIndex widgetIndex) auto w = WindowFindByClass(WindowClass::TileInspector); if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, widgetIndex); + w->OnMouseDown(widgetIndex); } } @@ -530,6 +527,12 @@ static void ShortcutToggleWallSlope() return; } + // Ensure a wall can be built on a slope + if (tileElement->AsWall()->GetEntry()->flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE) + { + return; + } + int32_t currSlopeValue = tileElement->AsWall()->GetSlope(); int32_t newSlopeValue = (currSlopeValue + 1) % 3; @@ -573,7 +576,7 @@ static void ShortcutIncreaseElementHeight() break; } if (action != -1 && !WidgetIsDisabled(*w, action) && w->widgets[action].type != WindowWidgetType::Empty) - WindowEventMouseDownCall(w, action); + w->OnMouseDown(action); return; } } @@ -612,14 +615,15 @@ static void ShortcutDecreaseElementHeight() break; } if (action != -1 && !WidgetIsDisabled(*w, action) && w->widgets[action].type != WindowWidgetType::Empty) - WindowEventMouseDownCall(w, action); + w->OnMouseDown(action); return; } } static void ShortcutToggleClearanceChecks() { - auto cheatSetAction = CheatSetAction(CheatType::DisableClearanceChecks, gCheatsDisableClearanceChecks ? 0 : 1); + auto cheatSetAction = CheatSetAction( + CheatType::DisableClearanceChecks, GetGameState().Cheats.DisableClearanceChecks ? 0 : 1); GameActions::Execute(&cheatSetAction); } @@ -878,6 +882,7 @@ void ShortcutManager::RegisterDefaultShortcuts() RegisterShortcut(ShortcutId::WindowTileInspectorToggleInvisibility, STR_SHORTCUT_TOGGLE_INVISIBILITY, WindowTileInspectorKeyboardShortcutToggleInvisibility); RegisterShortcut(ShortcutId::WindowTileInspectorCopy, STR_SHORTCUT_COPY_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_COPY)); RegisterShortcut(ShortcutId::WindowTileInspectorPaste, STR_SHORTCUT_PASTE_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE)); + RegisterShortcut(ShortcutId::WindowTileInspectorSort, STR_SHORTCUT_SORT_ELEMENTS, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_SORT)); RegisterShortcut(ShortcutId::WindowTileInspectorRemove, STR_SHORTCUT_REMOVE_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE)); RegisterShortcut(ShortcutId::WindowTileInspectorMoveUp, STR_SHORTCUT_MOVE_ELEMENT_UP, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP)); RegisterShortcut(ShortcutId::WindowTileInspectorMoveDown, STR_SHORTCUT_MOVE_ELEMENT_DOWN, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN)); diff --git a/src/openrct2-ui/interface/Dropdown.h b/src/openrct2-ui/interface/Dropdown.h index 38a52af3d3..d902d37dcc 100644 --- a/src/openrct2-ui/interface/Dropdown.h +++ b/src/openrct2-ui/interface/Dropdown.h @@ -37,29 +37,33 @@ namespace Dropdown void SetImage(int32_t index, ImageId image); } // namespace Dropdown -extern int32_t gDropdownNumItems; -extern Dropdown::Item gDropdownItems[Dropdown::ItemsMaxSize]; -extern bool gDropdownIsColour; -extern int32_t gDropdownLastColourHover; -extern int32_t gDropdownHighlightedIndex; -extern int32_t gDropdownDefaultIndex; +namespace OpenRCT2::Ui::Windows +{ + extern int32_t gDropdownNumItems; + extern Dropdown::Item gDropdownItems[Dropdown::ItemsMaxSize]; + extern bool gDropdownIsColour; + extern int32_t gDropdownLastColourHover; + extern int32_t gDropdownHighlightedIndex; + extern int32_t gDropdownDefaultIndex; -void WindowDropdownShowText(const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t flags, size_t num_items); -void WindowDropdownShowTextCustomWidth( - const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t custom_height, uint8_t flags, size_t num_items, - int32_t width); -void WindowDropdownShowImage( - int32_t x, int32_t y, int32_t extray, uint8_t colour, uint8_t flags, int32_t numItems, int32_t itemWidth, - int32_t itemHeight, int32_t numColumns); -void WindowDropdownClose(); -int32_t DropdownIndexFromPoint(const ScreenCoordsXY& loc, WindowBase* w); -void WindowDropdownShowColour(WindowBase* w, Widget* widget, uint8_t dropdownColour, uint8_t selectedColour); -void WindowDropdownShowColourAvailable( - WindowBase* w, Widget* widget, uint8_t dropdownColour, uint8_t selectedColour, uint32_t availableColours); -uint32_t DropdownGetAppropriateImageDropdownItemsPerRow(uint32_t numItems); -bool WindowDropDownHasMultipleColumns(size_t numItems); + void WindowDropdownShowText( + const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t flags, size_t num_items); + void WindowDropdownShowTextCustomWidth( + const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t custom_height, uint8_t flags, size_t num_items, + int32_t width); + void WindowDropdownShowImage( + int32_t x, int32_t y, int32_t extray, uint8_t colour, uint8_t flags, int32_t numItems, int32_t itemWidth, + int32_t itemHeight, int32_t numColumns); + void WindowDropdownClose(); + int32_t DropdownIndexFromPoint(const ScreenCoordsXY& loc, WindowBase* w); + void WindowDropdownShowColour(WindowBase* w, Widget* widget, uint8_t dropdownColour, uint8_t selectedColour); + void WindowDropdownShowColourAvailable( + WindowBase* w, Widget* widget, uint8_t dropdownColour, uint8_t selectedColour, uint32_t availableColours); + uint32_t DropdownGetAppropriateImageDropdownItemsPerRow(uint32_t numItems); + bool WindowDropDownHasMultipleColumns(size_t numItems); -colour_t ColourDropDownIndexToColour(uint8_t ddidx); + colour_t ColourDropDownIndexToColour(uint8_t ddidx); +} // namespace OpenRCT2::Ui::Windows namespace Dropdown { @@ -120,8 +124,8 @@ namespace Dropdown for (int i = 0; i < N; ++i) { const ItemExt& item = items[i]; - gDropdownItems[i].Format = item.itemFormat; - gDropdownItems[i].Args = item.stringId; + OpenRCT2::Ui::Windows::gDropdownItems[i].Format = item.itemFormat; + OpenRCT2::Ui::Windows::gDropdownItems[i].Args = item.stringId; } } diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index 0ac1b943d1..9e483837b6 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -21,6 +21,7 @@ #include #include #include +#include using namespace OpenRCT2::Ui; @@ -36,10 +37,10 @@ static int32_t InGameConsoleGetLineHeight() return FontGetLineHeight(InGameConsoleGetFontStyle()); } -InGameConsole::InGameConsole() +void InGameConsole::WriteInitial() { InteractiveConsole::WriteLine(OPENRCT2_NAME " " OPENRCT2_VERSION); - InteractiveConsole::WriteLine("Type 'help' for a list of available commands. Type 'hide' to hide the console."); + InteractiveConsole::WriteLine(LanguageGetString(STR_CONSOLE_HELPER_TEXT)); InteractiveConsole::WriteLine(""); WritePrompt(); } @@ -176,6 +177,12 @@ void InGameConsole::ClearLine() void InGameConsole::Open() { + if (!_isInitialised) + { + WriteInitial(); + _isInitialised = true; + } + _isOpen = true; ScrollToEnd(); RefreshCaret(); diff --git a/src/openrct2-ui/interface/InGameConsole.h b/src/openrct2-ui/interface/InGameConsole.h index 9d4966d1b2..d51a24f407 100644 --- a/src/openrct2-ui/interface/InGameConsole.h +++ b/src/openrct2-ui/interface/InGameConsole.h @@ -26,6 +26,7 @@ namespace OpenRCT2::Ui static constexpr int32_t CONSOLE_EDGE_PADDING = 4; static constexpr int32_t CONSOLE_CARET_WIDTH = 6; + bool _isInitialised = false; bool _isOpen = false; ScreenCoordsXY _consoleTopLeft; ScreenCoordsXY _consoleBottomRight; @@ -45,7 +46,7 @@ namespace OpenRCT2::Ui int32_t _caretScreenPosX = 0; public: - InGameConsole(); + InGameConsole() = default; InGameConsole(const InGameConsole& src) = delete; bool IsOpen() const @@ -71,6 +72,7 @@ namespace OpenRCT2::Ui void ClearInput(); void ClearLine(); void HistoryAdd(const u8string& src); + void WriteInitial(); void WritePrompt(); void ScrollToEnd(); void Invalidate() const; diff --git a/src/openrct2-ui/interface/LandTool.cpp b/src/openrct2-ui/interface/LandTool.cpp index 35a224adf9..8298660472 100644 --- a/src/openrct2-ui/interface/LandTool.cpp +++ b/src/openrct2-ui/interface/LandTool.cpp @@ -22,6 +22,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Ui::Windows; // clang-format off static uint16_t toolSizeSpriteIndices[] = diff --git a/src/openrct2-ui/interface/Objective.cpp b/src/openrct2-ui/interface/Objective.cpp new file mode 100644 index 0000000000..0e48b81c95 --- /dev/null +++ b/src/openrct2-ui/interface/Objective.cpp @@ -0,0 +1,53 @@ +/***************************************************************************** + * Copyright (c) 2014-2024 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "Objective.h" + +#include +#include +#include +#include +#include +#include + +void formatObjective(Formatter& ft, Objective objective) +{ + if (objective.Type == OBJECTIVE_BUILD_THE_BEST) + { + StringId rideTypeString = STR_NONE; + auto rideTypeId = objective.RideId; + if (rideTypeId != RIDE_TYPE_NULL && rideTypeId < RIDE_TYPE_COUNT) + { + rideTypeString = GetRideTypeDescriptor(rideTypeId).Naming.Name; + } + ft.Add(rideTypeString); + } + else if (objective.Type == OBJECTIVE_GUESTS_BY) + { + ft.Add(objective.NumGuests); + ft.Add(DateGetTotalMonths(MONTH_OCTOBER, objective.Year)); + } + else if (objective.Type == OBJECTIVE_GUESTS_AND_RATING) + { + ft.Add(objective.NumGuests); + } + else if (objective.Type == OBJECTIVE_10_ROLLERCOASTERS_LENGTH) + { + ft.Add(objective.MinimumLength); + } + else + { + ft.Add(objective.NumGuests); + ft.Add(DateGetTotalMonths(MONTH_OCTOBER, objective.Year)); + if (objective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS) + ft.Add(objective.MinimumExcitement); + else + ft.Add(objective.Currency); + } +} diff --git a/src/openrct2-ui/interface/Objective.h b/src/openrct2-ui/interface/Objective.h new file mode 100644 index 0000000000..d7cf2da51f --- /dev/null +++ b/src/openrct2-ui/interface/Objective.h @@ -0,0 +1,17 @@ +/***************************************************************************** + * Copyright (c) 2014-2024 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +class Formatter; +struct Objective; + +void formatObjective(Formatter& ft, Objective objective); diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 77d11d6fd5..7c763eab7b 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -53,6 +53,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Ui::Windows; static void ViewportInteractionRemoveScenery(const SmallSceneryElement& smallSceneryElement, const CoordsXY& mapCoords); static void ViewportInteractionRemoveFootpath(const PathElement& pathElement, const CoordsXY& mapCoords); @@ -66,7 +67,7 @@ static Peep* ViewportInteractionGetClosestPeep(ScreenCoordsXY screenCoords, int3 * * rct2: 0x006ED9D0 */ -InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoords) +static InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoords) { InteractionInfo info{}; // No click input for scenario editor or track manager @@ -250,7 +251,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) * * rct2: 0x006EDE88 */ -InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoords) +static InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoords) { Ride* ride; int32_t i; @@ -364,7 +365,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor else { // FIXME: Why does it *2 the value? - if (!gCheatsSandboxMode && !MapIsLocationOwned({ info.Loc, tileElement->GetBaseZ() * 2 })) + if (!GetGameState().Cheats.SandboxMode && !MapIsLocationOwned({ info.Loc, tileElement->GetBaseZ() * 2 })) { info.SpriteType = ViewportInteractionItem::None; return info; @@ -494,7 +495,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor return info; } case ViewportInteractionItem::ParkEntrance: - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) break; if (tileElement->GetType() != TileElementType::Entrance) @@ -718,16 +719,21 @@ struct PeepDistance }; template -PeepDistance GetClosestPeep(const ScreenCoordsXY& viewportCoords, const int32_t maxDistance, PeepDistance goal) +static PeepDistance GetClosestPeep( + const ScreenCoordsXY& viewportCoords, uint8_t rotation, const int32_t maxDistance, PeepDistance goal) { for (auto peep : EntityList()) { if (peep->x == LOCATION_NULL) continue; - auto distance = abs(((peep->SpriteData.SpriteRect.GetLeft() + peep->SpriteData.SpriteRect.GetRight()) / 2) - - viewportCoords.x) - + abs(((peep->SpriteData.SpriteRect.GetTop() + peep->SpriteData.SpriteRect.GetBottom()) / 2) - viewportCoords.y); + auto screenCoords = Translate3DTo2DWithZ(rotation, peep->GetLocation()); + auto spriteRect = ScreenRect( + screenCoords - ScreenCoordsXY{ peep->SpriteData.Width, peep->SpriteData.HeightMin }, + screenCoords + ScreenCoordsXY{ peep->SpriteData.Width, peep->SpriteData.HeightMax }); + + auto distance = abs(((spriteRect.GetLeft() + spriteRect.GetRight()) / 2) - viewportCoords.x) + + abs(((spriteRect.GetTop() + spriteRect.GetBottom()) / 2) - viewportCoords.y); if (distance > maxDistance) continue; @@ -754,9 +760,9 @@ static Peep* ViewportInteractionGetClosestPeep(ScreenCoordsXY screenCoords, int3 PeepDistance goal; if (!(viewport->flags & VIEWPORT_FLAG_HIDE_GUESTS)) - goal = GetClosestPeep(viewportCoords, maxDistance, goal); + goal = GetClosestPeep(viewportCoords, viewport->rotation, maxDistance, goal); if (!(viewport->flags & VIEWPORT_FLAG_HIDE_STAFF)) - goal = GetClosestPeep(viewportCoords, maxDistance, goal); + goal = GetClosestPeep(viewportCoords, viewport->rotation, maxDistance, goal); return goal.peep; } @@ -800,7 +806,7 @@ CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoo { z = TileElementHeight(mapPos); } - mapPos = ViewportPosToMapPos(initialVPPos, z); + mapPos = ViewportPosToMapPos(initialVPPos, z, viewport->rotation); mapPos.x = std::clamp(mapPos.x, initialPos.x, initialPos.x + 31); mapPos.y = std::clamp(mapPos.y, initialPos.y, initialPos.y + 31); } diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 31a1167135..f85879ecdb 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -687,21 +687,21 @@ static void WidgetScrollDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widg // Horizontal scrollbar if (scroll.flags & HSCROLLBAR_VISIBLE) WidgetHScrollbarDraw( - dpi, scroll, topLeft.x, bottomRight.y - SCROLLBAR_WIDTH, - ((scroll.flags & VSCROLLBAR_VISIBLE) ? bottomRight.x - (SCROLLBAR_WIDTH + 1) : bottomRight.x), bottomRight.y, + dpi, scroll, topLeft.x, bottomRight.y - kScrollBarWidth, + ((scroll.flags & VSCROLLBAR_VISIBLE) ? bottomRight.x - (kScrollBarWidth + 1) : bottomRight.x), bottomRight.y, colour); // Vertical scrollbar if (scroll.flags & VSCROLLBAR_VISIBLE) WidgetVScrollbarDraw( - dpi, scroll, bottomRight.x - SCROLLBAR_WIDTH, topLeft.y, bottomRight.x, - ((scroll.flags & HSCROLLBAR_VISIBLE) ? bottomRight.y - (SCROLLBAR_WIDTH + 1) : bottomRight.y), colour); + dpi, scroll, bottomRight.x - kScrollBarWidth, topLeft.y, bottomRight.x, + ((scroll.flags & HSCROLLBAR_VISIBLE) ? bottomRight.y - (kScrollBarWidth + 1) : bottomRight.y), colour); // Contents if (scroll.flags & HSCROLLBAR_VISIBLE) - bottomRight.y -= (SCROLLBAR_WIDTH + 1); + bottomRight.y -= (kScrollBarWidth + 1); if (scroll.flags & VSCROLLBAR_VISIBLE) - bottomRight.x -= (SCROLLBAR_WIDTH + 1); + bottomRight.x -= (kScrollBarWidth + 1); bottomRight.y++; bottomRight.x++; @@ -726,7 +726,7 @@ static void WidgetScrollDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widg // Draw the scroll contents if (scroll_dpi.width > 0 && scroll_dpi.height > 0) - WindowEventScrollDrawCall(&w, scroll_dpi, scrollIndex); + w.OnScrollDraw(scrollIndex, scroll_dpi); } static void WidgetHScrollbarDraw( @@ -734,25 +734,25 @@ static void WidgetHScrollbarDraw( { colour &= 0x7F; // Trough - GfxFillRect(dpi, { { l + SCROLLBAR_WIDTH, t }, { r - SCROLLBAR_WIDTH, b } }, ColourMapA[colour].lighter); - GfxFillRect(dpi, { { l + SCROLLBAR_WIDTH, t }, { r - SCROLLBAR_WIDTH, b } }, 0x1000000 | ColourMapA[colour].mid_dark); - GfxFillRect(dpi, { { l + SCROLLBAR_WIDTH, t + 2 }, { r - SCROLLBAR_WIDTH, t + 2 } }, ColourMapA[colour].mid_dark); - GfxFillRect(dpi, { { l + SCROLLBAR_WIDTH, t + 3 }, { r - SCROLLBAR_WIDTH, t + 3 } }, ColourMapA[colour].lighter); - GfxFillRect(dpi, { { l + SCROLLBAR_WIDTH, t + 7 }, { r - SCROLLBAR_WIDTH, t + 7 } }, ColourMapA[colour].mid_dark); - GfxFillRect(dpi, { { l + SCROLLBAR_WIDTH, t + 8 }, { r - SCROLLBAR_WIDTH, t + 8 } }, ColourMapA[colour].lighter); + GfxFillRect(dpi, { { l + kScrollBarWidth, t }, { r - kScrollBarWidth, b } }, ColourMapA[colour].lighter); + GfxFillRect(dpi, { { l + kScrollBarWidth, t }, { r - kScrollBarWidth, b } }, 0x1000000 | ColourMapA[colour].mid_dark); + GfxFillRect(dpi, { { l + kScrollBarWidth, t + 2 }, { r - kScrollBarWidth, t + 2 } }, ColourMapA[colour].mid_dark); + GfxFillRect(dpi, { { l + kScrollBarWidth, t + 3 }, { r - kScrollBarWidth, t + 3 } }, ColourMapA[colour].lighter); + GfxFillRect(dpi, { { l + kScrollBarWidth, t + 7 }, { r - kScrollBarWidth, t + 7 } }, ColourMapA[colour].mid_dark); + GfxFillRect(dpi, { { l + kScrollBarWidth, t + 8 }, { r - kScrollBarWidth, t + 8 } }, ColourMapA[colour].lighter); // Left button { uint8_t flags = (scroll.flags & HSCROLLBAR_LEFT_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0; - GfxFillRectInset(dpi, { { l, t }, { l + (SCROLLBAR_WIDTH - 1), b } }, colour, flags); + GfxFillRectInset(dpi, { { l, t }, { l + (kScrollBarWidth - 1), b } }, colour, flags); GfxDrawString(dpi, { l + 1, t }, static_cast(BlackLeftArrowString), {}); } // Thumb { - int16_t left = std::max(l + SCROLLBAR_WIDTH, l + scroll.h_thumb_left - 1); - int16_t right = std::min(r - SCROLLBAR_WIDTH, l + scroll.h_thumb_right - 1); + int16_t left = std::max(l + kScrollBarWidth, l + scroll.h_thumb_left - 1); + int16_t right = std::min(r - kScrollBarWidth, l + scroll.h_thumb_right - 1); uint8_t flags = (scroll.flags & HSCROLLBAR_THUMB_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0; GfxFillRectInset(dpi, { { left, t }, { right, b } }, colour, flags); @@ -762,7 +762,7 @@ static void WidgetHScrollbarDraw( { uint8_t flags = (scroll.flags & HSCROLLBAR_RIGHT_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0; - GfxFillRectInset(dpi, { { r - (SCROLLBAR_WIDTH - 1), t }, { r, b } }, colour, flags); + GfxFillRectInset(dpi, { { r - (kScrollBarWidth - 1), t }, { r, b } }, colour, flags); GfxDrawString(dpi, { r - 6, t }, static_cast(BlackRightArrowString), {}); } } @@ -772,31 +772,31 @@ static void WidgetVScrollbarDraw( { colour &= 0x7F; // Trough - GfxFillRect(dpi, { { l, t + SCROLLBAR_WIDTH }, { r, b - SCROLLBAR_WIDTH } }, ColourMapA[colour].lighter); - GfxFillRect(dpi, { { l, t + SCROLLBAR_WIDTH }, { r, b - SCROLLBAR_WIDTH } }, 0x1000000 | ColourMapA[colour].mid_dark); - GfxFillRect(dpi, { { l + 2, t + SCROLLBAR_WIDTH }, { l + 2, b - SCROLLBAR_WIDTH } }, ColourMapA[colour].mid_dark); - GfxFillRect(dpi, { { l + 3, t + SCROLLBAR_WIDTH }, { l + 3, b - SCROLLBAR_WIDTH } }, ColourMapA[colour].lighter); - GfxFillRect(dpi, { { l + 7, t + SCROLLBAR_WIDTH }, { l + 7, b - SCROLLBAR_WIDTH } }, ColourMapA[colour].mid_dark); - GfxFillRect(dpi, { { l + 8, t + SCROLLBAR_WIDTH }, { l + 8, b - SCROLLBAR_WIDTH } }, ColourMapA[colour].lighter); + GfxFillRect(dpi, { { l, t + kScrollBarWidth }, { r, b - kScrollBarWidth } }, ColourMapA[colour].lighter); + GfxFillRect(dpi, { { l, t + kScrollBarWidth }, { r, b - kScrollBarWidth } }, 0x1000000 | ColourMapA[colour].mid_dark); + GfxFillRect(dpi, { { l + 2, t + kScrollBarWidth }, { l + 2, b - kScrollBarWidth } }, ColourMapA[colour].mid_dark); + GfxFillRect(dpi, { { l + 3, t + kScrollBarWidth }, { l + 3, b - kScrollBarWidth } }, ColourMapA[colour].lighter); + GfxFillRect(dpi, { { l + 7, t + kScrollBarWidth }, { l + 7, b - kScrollBarWidth } }, ColourMapA[colour].mid_dark); + GfxFillRect(dpi, { { l + 8, t + kScrollBarWidth }, { l + 8, b - kScrollBarWidth } }, ColourMapA[colour].lighter); // Up button GfxFillRectInset( - dpi, { { l, t }, { r, t + (SCROLLBAR_WIDTH - 1) } }, colour, + dpi, { { l, t }, { r, t + (kScrollBarWidth - 1) } }, colour, ((scroll.flags & VSCROLLBAR_UP_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0)); GfxDrawString(dpi, { l + 1, t - 1 }, static_cast(BlackUpArrowString), {}); // Thumb GfxFillRectInset( dpi, - { { l, std::max(t + SCROLLBAR_WIDTH, t + scroll.v_thumb_top - 1) }, - { r, std::min(b - SCROLLBAR_WIDTH, t + scroll.v_thumb_bottom - 1) } }, + { { l, std::max(t + kScrollBarWidth, t + scroll.v_thumb_top - 1) }, + { r, std::min(b - kScrollBarWidth, t + scroll.v_thumb_bottom - 1) } }, colour, ((scroll.flags & VSCROLLBAR_THUMB_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0)); // Down button GfxFillRectInset( - dpi, { { l, b - (SCROLLBAR_WIDTH - 1) }, { r, b } }, colour, + dpi, { { l, b - (kScrollBarWidth - 1) }, { r, b } }, colour, ((scroll.flags & VSCROLLBAR_DOWN_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0)); - GfxDrawString(dpi, { l + 1, b - (SCROLLBAR_WIDTH - 1) }, static_cast(BlackDownArrowString), {}); + GfxDrawString(dpi, { l + 1, b - (kScrollBarWidth - 1) }, static_cast(BlackDownArrowString), {}); } /** @@ -829,12 +829,12 @@ static void WidgetDrawImage(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widge // Draw greyed out (light border bottom right shadow) colour = w.colours[widget.colour]; colour = ColourMapA[NOT_TRANSLUCENT(colour)].lighter; - GfxDrawSpriteSolid(&dpi, image, screenCoords + ScreenCoordsXY{ 1, 1 }, colour); + GfxDrawSpriteSolid(dpi, image, screenCoords + ScreenCoordsXY{ 1, 1 }, colour); // Draw greyed out (dark) colour = w.colours[widget.colour]; colour = ColourMapA[NOT_TRANSLUCENT(colour)].mid_light; - GfxDrawSpriteSolid(&dpi, image, screenCoords, colour); + GfxDrawSpriteSolid(dpi, image, screenCoords, colour); } else { @@ -952,15 +952,15 @@ void WidgetScrollGetPart( } const auto& scroll = w.scrolls[*scroll_id]; - if ((scroll.flags & HSCROLLBAR_VISIBLE) && screenCoords.y >= (w.windowPos.y + widget->bottom - (SCROLLBAR_WIDTH + 1))) + if ((scroll.flags & HSCROLLBAR_VISIBLE) && screenCoords.y >= (w.windowPos.y + widget->bottom - (kScrollBarWidth + 1))) { // horizontal scrollbar int32_t rightOffset = 0; - int32_t iteratorLeft = widget->left + w.windowPos.x + SCROLLBAR_WIDTH; - int32_t iteratorRight = widget->right + w.windowPos.x - SCROLLBAR_WIDTH; + int32_t iteratorLeft = widget->left + w.windowPos.x + kScrollBarWidth; + int32_t iteratorRight = widget->right + w.windowPos.x - kScrollBarWidth; if (!(scroll.flags & VSCROLLBAR_VISIBLE)) { - rightOffset = SCROLLBAR_WIDTH + 1; + rightOffset = kScrollBarWidth + 1; } if (screenCoords.x <= iteratorLeft) @@ -971,7 +971,7 @@ void WidgetScrollGetPart( { *output_scroll_area = SCROLL_PART_NONE; } - else if (screenCoords.x >= iteratorRight + rightOffset - SCROLLBAR_WIDTH) + else if (screenCoords.x >= iteratorRight + rightOffset - kScrollBarWidth) { *output_scroll_area = SCROLL_PART_HSCROLLBAR_RIGHT; } @@ -988,15 +988,15 @@ void WidgetScrollGetPart( *output_scroll_area = SCROLL_PART_HSCROLLBAR_THUMB; } } - else if ((scroll.flags & VSCROLLBAR_VISIBLE) && (screenCoords.x >= w.windowPos.x + widget->right - (SCROLLBAR_WIDTH + 1))) + else if ((scroll.flags & VSCROLLBAR_VISIBLE) && (screenCoords.x >= w.windowPos.x + widget->right - (kScrollBarWidth + 1))) { // vertical scrollbar int32_t bottomOffset = 0; - int32_t iteratorTop = widget->top + w.windowPos.y + SCROLLBAR_WIDTH; + int32_t iteratorTop = widget->top + w.windowPos.y + kScrollBarWidth; int32_t iteratorBottom = widget->bottom + w.windowPos.y; if (scroll.flags & HSCROLLBAR_VISIBLE) { - bottomOffset = (SCROLLBAR_WIDTH + 1); + bottomOffset = (kScrollBarWidth + 1); } if (screenCoords.y <= iteratorTop) @@ -1007,7 +1007,7 @@ void WidgetScrollGetPart( { *output_scroll_area = SCROLL_PART_NONE; } - else if (screenCoords.y >= (iteratorBottom - bottomOffset - SCROLLBAR_WIDTH)) + else if (screenCoords.y >= (iteratorBottom - bottomOffset - kScrollBarWidth)) { *output_scroll_area = SCROLL_PART_VSCROLLBAR_BOTTOM; } diff --git a/src/openrct2-ui/interface/Widget.h b/src/openrct2-ui/interface/Widget.h index e253ba8af7..8273375012 100644 --- a/src/openrct2-ui/interface/Widget.h +++ b/src/openrct2-ui/interface/Widget.h @@ -9,8 +9,147 @@ #pragma once -#include +#include "Window.h" + +#include #include +#include ImageId GetColourButtonImage(colour_t colour); Widget* GetWidgetByIndex(const WindowBase& w, WidgetIndex widgetIndex); + +constexpr auto kWidgetsEnd = Widget{ WindowWidgetType::Last, 0, 0, 0, 0, 0, 0, 0 }; +constexpr auto kBarBlink = (1u << 31); + +enum class WindowColour : uint8_t +{ + Primary, + Secondary, + Tertiary, + Quaternary, +}; + +constexpr uint8_t kScrollBarWidth = 10; + +constexpr ScreenSize kTabSize = { 31, 27 }; + +constexpr Widget MakeWidget( + const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, + uint32_t content = 0xFFFFFFFF, StringId tooltip = STR_NONE) +{ + Widget out = {}; + out.left = origin.x; + out.right = origin.x + size.width - 1; + out.top = origin.y; + out.bottom = origin.y + size.height - 1; + out.type = type; + out.colour = static_cast(colour); + out.content = content; + out.tooltip = tooltip; + + return out; +} + +constexpr Widget MakeWidget( + const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, ImageId image, + StringId tooltip = STR_NONE) +{ + Widget out = {}; + out.left = origin.x; + out.right = origin.x + size.width - 1; + out.top = origin.y; + out.bottom = origin.y + size.height - 1; + out.type = type; + out.colour = static_cast(colour); + out.image = image; + out.tooltip = tooltip; + + return out; +} + +constexpr Widget MakeRemapWidget( + const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, ImageIndex content, + StringId tooltip = STR_NONE) +{ + return MakeWidget(origin, size, type, colour, ImageId(content, FilterPaletteID::PaletteNull), tooltip); +} + +constexpr Widget MakeTab(const ScreenCoordsXY& origin, StringId tooltip = STR_NONE) +{ + const ScreenSize size = kTabSize; + const WindowWidgetType type = WindowWidgetType::Tab; + const WindowColour colour = WindowColour::Secondary; + const auto content = ImageId(ImageIndexUndefined); + + return MakeWidget(origin, size, type, colour, content, tooltip); +} + +// NOLINTBEGIN +#define MakeSpinnerWidgets(...) \ + MakeWidget(__VA_ARGS__), MakeSpinnerIncreaseWidget(__VA_ARGS__), MakeSpinnerDecreaseWidget(__VA_ARGS__) +// NOLINTEND + +constexpr Widget MakeSpinnerDecreaseWidget( + const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour, + [[maybe_unused]] uint32_t content = 0xFFFFFFFF, StringId tooltip = STR_NONE) +{ + const int16_t xPos = origin.x + size.width - 26; + const int16_t yPos = origin.y + 1; + const uint16_t width = 13; + const uint16_t height = size.height - 2; + + return MakeWidget({ xPos, yPos }, { width, height }, WindowWidgetType::Button, colour, STR_NUMERIC_DOWN, tooltip); +} + +constexpr Widget MakeSpinnerIncreaseWidget( + const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour, + [[maybe_unused]] uint32_t content = 0xFFFFFFFF, StringId tooltip = STR_NONE) +{ + const int16_t xPos = origin.x + size.width - 13; + const int16_t yPos = origin.y + 1; + const uint16_t width = 12; + const uint16_t height = size.height - 2; + + return MakeWidget({ xPos, yPos }, { width, height }, WindowWidgetType::Button, colour, STR_NUMERIC_UP, tooltip); +} + +// NOLINTNEXTLINE +#define MakeDropdownWidgets(...) MakeDropdownBoxWidget(__VA_ARGS__), MakeDropdownButtonWidget(__VA_ARGS__) + +constexpr Widget MakeDropdownBoxWidget( + const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour, + [[maybe_unused]] uint32_t content = 0xFFFFFFFF, StringId tooltip = STR_NONE) +{ + return MakeWidget(origin, size, type, colour, content); +} + +constexpr Widget MakeDropdownButtonWidget( + const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour, + [[maybe_unused]] uint32_t content = 0xFFFFFFFF, StringId tooltip = STR_NONE) +{ + const int16_t xPos = origin.x + size.width - 11; + const int16_t yPos = origin.y + 1; + const uint16_t width = 11; + const uint16_t height = 10; + + return MakeWidget({ xPos, yPos }, { width, height }, WindowWidgetType::Button, colour, STR_DROPDOWN_GLYPH, tooltip); +} + +void WidgetDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widgetIndex); + +bool WidgetIsDisabled(const WindowBase& w, WidgetIndex widgetIndex); +bool WidgetIsHoldable(const WindowBase& w, WidgetIndex widgetIndex); +bool WidgetIsVisible(const WindowBase& w, WidgetIndex widgetIndex); +bool WidgetIsPressed(const WindowBase& w, WidgetIndex widgetIndex); +bool WidgetIsHighlighted(const WindowBase& w, WidgetIndex widgetIndex); +bool WidgetIsActiveTool(const WindowBase& w, WidgetIndex widgetIndex); +void WidgetScrollGetPart( + WindowBase& w, const Widget* widget, const ScreenCoordsXY& screenCoords, ScreenCoordsXY& retScreenCoords, + int32_t* output_scroll_area, int32_t* scroll_id); + +void WidgetSetEnabled(WindowBase& w, WidgetIndex widgetIndex, bool enabled); +void WidgetSetDisabled(WindowBase& w, WidgetIndex widgetIndex, bool value); +void WidgetSetHoldable(WindowBase& w, WidgetIndex widgetIndex, bool value); +void WidgetSetVisible(WindowBase& w, WidgetIndex widgetIndex, bool value); +void WidgetSetPressed(WindowBase& w, WidgetIndex widgetIndex, bool value); +void WidgetSetCheckboxValue(WindowBase& w, WidgetIndex widgetIndex, bool value); diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 1bc3333010..f8c2936f76 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -10,6 +10,8 @@ #include "Window.h" #include "Theme.h" +#include "Widget.h" +#include "openrct2/world/Location.hpp" #include #include @@ -503,7 +505,7 @@ static bool WindowOtherWheelInput(WindowBase& w, WidgetIndex widgetIndex, int32_ return false; } - WindowEventMouseDownCall(&w, buttonWidgetIndex); + w.OnMouseDown(buttonWidgetIndex); return true; } @@ -580,7 +582,6 @@ void WindowInitScrollWidgets(WindowBase& w) { Widget* widget; int32_t widget_index, scroll_index; - int32_t width, height; widget_index = 0; scroll_index = 0; @@ -594,13 +595,11 @@ void WindowInitScrollWidgets(WindowBase& w) auto& scroll = w.scrolls[scroll_index]; scroll.flags = 0; - width = 0; - height = 0; - WindowGetScrollSize(&w, scroll_index, &width, &height); + ScreenSize scrollSize = w.OnScrollGetSize(scroll_index); scroll.h_left = 0; - scroll.h_right = width + 1; + scroll.h_right = scrollSize.width + 1; scroll.v_top = 0; - scroll.v_bottom = height + 1; + scroll.v_bottom = scrollSize.height + 1; if (widget->content & SCROLL_HORIZONTAL) scroll.flags |= HSCROLLBAR_VISIBLE; @@ -639,10 +638,7 @@ void WindowDrawWidgets(WindowBase& w, DrawPixelInfo& dpi) { if (w.windowPos.y + widget->top < dpi.y + dpi.height && w.windowPos.y + widget->bottom >= dpi.y) { - if (w.IsLegacy()) - WidgetDraw(dpi, w, widgetIndex); - else - w.OnDrawWidget(widgetIndex, dpi); + w.OnDrawWidget(widgetIndex, dpi); } } } @@ -688,15 +684,10 @@ void InvalidateAllWindowsAfterInput() WindowVisitEach([](WindowBase* w) { WindowUpdateScrollWidgets(*w); WindowInvalidatePressedImageButton(*w); - WindowEventResizeCall(w); + w->OnResize(); }); } -bool Window::IsLegacy() -{ - return false; -} - void Window::OnDraw(DrawPixelInfo& dpi) { WindowDrawWidgets(*this, dpi); @@ -808,7 +799,8 @@ void Window::TextInputOpen( WidgetIndex callWidget, StringId title, StringId description, const Formatter& descriptionArgs, StringId existingText, uintptr_t existingArgs, int32_t maxLength) { - WindowTextInputOpen(this, callWidget, title, description, descriptionArgs, existingText, existingArgs, maxLength); + OpenRCT2::Ui::Windows::WindowTextInputOpen( + this, callWidget, title, description, descriptionArgs, existingText, existingArgs, maxLength); } void WindowAlignTabs(WindowBase* w, WidgetIndex start_tab_id, WidgetIndex end_tab_id) @@ -840,3 +832,31 @@ ScreenCoordsXY WindowGetViewportSoundIconPos(WindowBase& w) const uint8_t buttonOffset = (gConfigInterface.WindowButtonsOnTheLeft) ? CloseButtonWidth + 2 : 0; return w.windowPos + ScreenCoordsXY{ 2 + buttonOffset, 2 }; } + +namespace OpenRCT2::Ui::Windows +{ + WindowBase* WindowGetListening() + { + for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++) + { + auto& w = **it; + if (w.flags & WF_DEAD) + continue; + + auto viewport = w.viewport; + if (viewport != nullptr) + { + if (viewport->flags & VIEWPORT_FLAG_SOUND_ON) + { + return &w; + } + } + } + return nullptr; + } + + WindowClass WindowGetClassification(const WindowBase& window) + { + return window.classification; + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/interface/Window.h b/src/openrct2-ui/interface/Window.h index c3a3d18d7e..4542f32638 100644 --- a/src/openrct2-ui/interface/Window.h +++ b/src/openrct2-ui/interface/Window.h @@ -14,7 +14,6 @@ struct Window : WindowBase { - virtual bool IsLegacy() override; virtual void OnDraw(DrawPixelInfo& dpi) override; virtual void OnDrawWidget(WidgetIndex widgetIndex, DrawPixelInfo& dpi) override; @@ -41,3 +40,37 @@ void WindowAllWheelInput(); void ApplyScreenSaverLockSetting(); void WindowAlignTabs(WindowBase* w, WidgetIndex start_tab_id, WidgetIndex end_tab_id); ScreenCoordsXY WindowGetViewportSoundIconPos(WindowBase& w); + +namespace OpenRCT2::Ui::Windows +{ + void RideConstructionToolupdateEntranceExit(const ScreenCoordsXY& screenCoords); + void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords); + void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords); + void UpdateGhostTrackAndArrow(); + void WindowRideConstructionKeyboardShortcutTurnLeft(); + void WindowRideConstructionKeyboardShortcutTurnRight(); + void WindowRideConstructionKeyboardShortcutUseTrackDefault(); + void WindowRideConstructionKeyboardShortcutSlopeDown(); + void WindowRideConstructionKeyboardShortcutSlopeUp(); + void WindowRideConstructionKeyboardShortcutChainLiftToggle(); + void WindowRideConstructionKeyboardShortcutBankLeft(); + void WindowRideConstructionKeyboardShortcutBankRight(); + void WindowRideConstructionKeyboardShortcutPreviousTrack(); + void WindowRideConstructionKeyboardShortcutNextTrack(); + void WindowRideConstructionKeyboardShortcutBuildCurrent(); + void WindowRideConstructionKeyboardShortcutDemolishCurrent(); + + void WindowFootpathKeyboardShortcutTurnLeft(); + void WindowFootpathKeyboardShortcutTurnRight(); + void WindowFootpathKeyboardShortcutSlopeDown(); + void WindowFootpathKeyboardShortcutSlopeUp(); + void WindowFootpathKeyboardShortcutBuildCurrent(); + void WindowFootpathKeyboardShortcutDemolishCurrent(); + + void WindowTileInspectorKeyboardShortcutToggleInvisibility(); + + extern const StringId ColourSchemeNames[4]; + + WindowBase* WindowGetListening(); + WindowClass WindowGetClassification(const WindowBase& window); +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/libopenrct2ui.vcxproj b/src/openrct2-ui/libopenrct2ui.vcxproj index 358c1577d7..986e72712f 100644 --- a/src/openrct2-ui/libopenrct2ui.vcxproj +++ b/src/openrct2-ui/libopenrct2ui.vcxproj @@ -69,11 +69,13 @@ + + @@ -128,11 +130,13 @@ + + @@ -246,4 +250,4 @@ - \ No newline at end of file + diff --git a/src/openrct2-ui/ride/Construction.cpp b/src/openrct2-ui/ride/Construction.cpp index 7029aa0986..42b6817922 100644 --- a/src/openrct2-ui/ride/Construction.cpp +++ b/src/openrct2-ui/ride/Construction.cpp @@ -9,6 +9,7 @@ #include "Construction.h" +#include #include #include #include @@ -28,7 +29,8 @@ void RideConstructNew(RideSelection listItem) int32_t colour1 = RideGetRandomColourPresetIndex(listItem.Type); int32_t colour2 = RideGetUnusedPresetVehicleColour(rideEntryIndex); - auto gameAction = RideCreateAction(listItem.Type, listItem.EntryIndex, colour1, colour2, gLastEntranceStyle); + auto gameAction = RideCreateAction( + listItem.Type, listItem.EntryIndex, colour1, colour2, OpenRCT2::GetGameState().LastEntranceStyle); gameAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { if (result->Error != GameActions::Status::Ok) diff --git a/src/openrct2-ui/ride/VehicleSounds.cpp b/src/openrct2-ui/ride/VehicleSounds.cpp new file mode 100644 index 0000000000..e848ffd36d --- /dev/null +++ b/src/openrct2-ui/ride/VehicleSounds.cpp @@ -0,0 +1,605 @@ +#include "VehicleSounds.h" + +#include "../interface/Viewport.h" +#include "../interface/Window.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace OpenRCT2::Audio +{ + namespace + { + template class TrainIterator; + template class Train + { + public: + explicit Train(T* vehicle) + : FirstCar(vehicle) + { + assert(FirstCar->IsHead()); + } + int32_t GetMass() const; + + friend class TrainIterator; + using iterator = TrainIterator; + iterator begin() const + { + return iterator{ FirstCar }; + } + iterator end() const + { + return iterator{}; + } + + private: + T* FirstCar; + }; + template class TrainIterator + { + public: + using iterator = TrainIterator; + using iterator_category = std::forward_iterator_tag; + using value_type = T; + using pointer = T*; + using reference = T&; + + TrainIterator() = default; + explicit TrainIterator(T* vehicle) + : Current(vehicle) + { + } + reference operator*() const + { + return *Current; + } + iterator& operator++() + { + Current = GetEntity(NextVehicleId); + if (Current != nullptr) + { + NextVehicleId = Current->next_vehicle_on_train; + } + return *this; + } + iterator operator++(int) + { + iterator temp = *this; + ++*this; + return temp; + } + bool operator!=(const iterator& other) const + { + return Current != other.Current; + } + + private: + T* Current = nullptr; + EntityId NextVehicleId = EntityId::GetNull(); + }; + } // namespace + + template int32_t Train::GetMass() const + { + return std::accumulate( + begin(), end(), 0, [](int32_t totalMass, const Vehicle& vehicle) { return totalMass + vehicle.mass; }); + } + + static bool SoundCanPlay(const Vehicle& vehicle) + { + if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + return false; + + if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) + return false; + + if (vehicle.sound1_id == SoundId::Null && vehicle.sound2_id == SoundId::Null) + return false; + + if (vehicle.x == LOCATION_NULL) + return false; + + if (g_music_tracking_viewport == nullptr) + return false; + + const auto quarter_w = g_music_tracking_viewport->view_width / 4; + const auto quarter_h = g_music_tracking_viewport->view_height / 4; + + auto left = g_music_tracking_viewport->viewPos.x; + auto bottom = g_music_tracking_viewport->viewPos.y; + + if (Ui::Windows::WindowGetClassification(*gWindowAudioExclusive) == WindowClass::MainWindow) + { + left -= quarter_w; + bottom -= quarter_h; + } + + if (left >= vehicle.SpriteData.SpriteRect.GetRight() || bottom >= vehicle.SpriteData.SpriteRect.GetBottom()) + return false; + + auto right = g_music_tracking_viewport->view_width + left; + auto top = g_music_tracking_viewport->view_height + bottom; + + if (Ui::Windows::WindowGetClassification(*gWindowAudioExclusive) == WindowClass::MainWindow) + { + right += quarter_w + quarter_w; + top += quarter_h + quarter_h; + } + + if (right < vehicle.SpriteData.SpriteRect.GetRight() || top < vehicle.SpriteData.SpriteRect.GetTop()) + return false; + + return true; + } + + /** + * + * rct2: 0x006BC2F3 + */ + static uint16_t GetSoundPriority(const Vehicle& vehicle) + { + int32_t result = Train(&vehicle).GetMass() + (std::abs(vehicle.velocity) >> 13); + + for (const auto& vehicleSound : gVehicleSoundList) + { + if (vehicleSound.id == vehicle.Id.ToUnderlying()) + { + // Vehicle sounds will get higher priority if they are already playing + return result + 300; + } + } + + return result; + } + + static VehicleSoundParams CreateSoundParam(const Vehicle& vehicle, uint16_t priority) + { + VehicleSoundParams param; + param.priority = priority; + int32_t panX = (vehicle.SpriteData.SpriteRect.GetLeft() / 2) + (vehicle.SpriteData.SpriteRect.GetRight() / 2) + - g_music_tracking_viewport->viewPos.x; + panX = g_music_tracking_viewport->zoom.ApplyInversedTo(panX); + panX += g_music_tracking_viewport->pos.x; + + uint16_t screenWidth = ContextGetWidth(); + if (screenWidth < 64) + { + screenWidth = 64; + } + param.pan_x = ((((panX * 65536) / screenWidth) - 0x8000) >> 4); + + int32_t panY = (vehicle.SpriteData.SpriteRect.GetTop() / 2) + (vehicle.SpriteData.SpriteRect.GetBottom() / 2) + - g_music_tracking_viewport->viewPos.y; + panY = g_music_tracking_viewport->zoom.ApplyInversedTo(panY); + panY += g_music_tracking_viewport->pos.y; + + uint16_t screenHeight = ContextGetHeight(); + if (screenHeight < 64) + { + screenHeight = 64; + } + param.pan_y = ((((panY * 65536) / screenHeight) - 0x8000) >> 4); + + int32_t frequency = std::abs(vehicle.velocity); + + const auto* rideType = vehicle.GetRideEntry(); + if (rideType != nullptr) + { + if (rideType->Cars[vehicle.vehicle_type].double_sound_frequency & 1) + { + frequency *= 2; + } + } + + // * 0.0105133... + frequency >>= 5; // /32 + frequency *= 5512; + frequency >>= 14; // /16384 + + frequency += 11025; + frequency += 16 * vehicle.sound_vector_factor; + param.frequency = static_cast(frequency); + param.id = vehicle.Id.ToUnderlying(); + param.volume = 0; + + if (vehicle.x != LOCATION_NULL) + { + auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ vehicle.x, vehicle.y }); + + // vehicle underground + if (surfaceElement != nullptr && surfaceElement->GetBaseZ() > vehicle.z) + { + param.volume = 0x30; + } + } + return param; + } + + /** + * + * rct2: 0x006BB9FF + */ + static void UpdateSoundParams( + const Vehicle& vehicle, FixedVector& vehicleSoundParamsList) + { + if (!SoundCanPlay(vehicle)) + return; + + uint16_t soundPriority = GetSoundPriority(vehicle); + // Find a sound param of lower priority to use + auto soundParamIter = std::find_if( + vehicleSoundParamsList.begin(), vehicleSoundParamsList.end(), + [soundPriority](const auto& param) { return soundPriority > param.priority; }); + + if (soundParamIter == std::end(vehicleSoundParamsList)) + { + if (vehicleSoundParamsList.size() < MaxVehicleSounds) + { + vehicleSoundParamsList.push_back(CreateSoundParam(vehicle, soundPriority)); + } + } + else + { + if (vehicleSoundParamsList.size() < MaxVehicleSounds) + { + // Shift all sound params down one if using a free space + vehicleSoundParamsList.insert(soundParamIter, CreateSoundParam(vehicle, soundPriority)); + } + else + { + *soundParamIter = CreateSoundParam(vehicle, soundPriority); + } + } + } + + static void VehicleSoundsUpdateWindowSetup() + { + g_music_tracking_viewport = nullptr; + + WindowBase* window = Ui::Windows::WindowGetListening(); + if (window == nullptr) + { + return; + } + + Viewport* viewport = WindowGetViewport(window); + if (viewport == nullptr) + { + return; + } + + g_music_tracking_viewport = viewport; + gWindowAudioExclusive = window; + if (viewport->zoom <= ZoomLevel{ 0 }) + gVolumeAdjustZoom = 0; + else if (viewport->zoom == ZoomLevel{ 1 }) + gVolumeAdjustZoom = 35; + else + gVolumeAdjustZoom = 70; + } + + static uint8_t VehicleSoundsUpdateGetPanVolume(VehicleSoundParams* sound_params) + { + uint8_t vol1 = 0xFF; + uint8_t vol2 = 0xFF; + + int16_t pan_y = std::abs(sound_params->pan_y); + pan_y = std::min(static_cast(0xFFF), pan_y); + pan_y -= 0x800; + if (pan_y > 0) + { + pan_y = (0x400 - pan_y) / 4; + vol1 = LoByte(pan_y); + if (static_cast(HiByte(pan_y)) != 0) + { + vol1 = 0xFF; + if (static_cast(HiByte(pan_y)) < 0) + { + vol1 = 0; + } + } + } + + int16_t pan_x = std::abs(sound_params->pan_x); + pan_x = std::min(static_cast(0xFFF), pan_x); + pan_x -= 0x800; + + if (pan_x > 0) + { + pan_x = (0x400 - pan_x) / 4; + vol2 = LoByte(pan_x); + if (static_cast(HiByte(pan_x)) != 0) + { + vol2 = 0xFF; + if (static_cast(HiByte(pan_x)) < 0) + { + vol2 = 0; + } + } + } + + vol1 = std::min(vol1, vol2); + return std::max(0, vol1 - gVolumeAdjustZoom); + } + + /* Returns the vehicle sound for a sound_param. + * + * If already playing returns sound. + * If not playing allocates a sound slot to sound_param->id. + * If no free slots returns nullptr. + */ + static VehicleSound* VehicleSoundsUpdateGetVehicleSound(VehicleSoundParams* sound_params) + { + // Search for already playing vehicle sound + for (auto& vehicleSound : gVehicleSoundList) + { + if (vehicleSound.id == sound_params->id) + return &vehicleSound; + } + + // No sound already playing + for (auto& vehicleSound : gVehicleSoundList) + { + // Use free slot + if (vehicleSound.id == SoundIdNull) + { + vehicleSound.id = sound_params->id; + vehicleSound.TrackSound.Id = SoundId::Null; + vehicleSound.OtherSound.Id = SoundId::Null; + vehicleSound.volume = 0x30; + return &vehicleSound; + } + } + + return nullptr; + } + + static bool IsLoopingSound(SoundId id) + { + switch (id) + { + case SoundId::LiftClassic: + case SoundId::TrackFrictionClassicWood: + case SoundId::FrictionClassic: + case SoundId::LiftFrictionWheels: + case SoundId::GoKartEngine: + case SoundId::TrackFrictionTrain: + case SoundId::TrackFrictionWater: + case SoundId::LiftArrow: + case SoundId::LiftWood: + case SoundId::TrackFrictionWood: + case SoundId::LiftWildMouse: + case SoundId::LiftBM: + case SoundId::TrackFrictionBM: + case SoundId::LiftRMC: + case SoundId::TrackFrictionRMC: + return true; + default: + return false; + } + } + + static bool IsFixedFrequencySound(SoundId id) + { + switch (id) + { + case SoundId::Scream1: + case SoundId::Scream2: + case SoundId::Scream3: + case SoundId::Scream4: + case SoundId::Scream5: + case SoundId::Scream6: + case SoundId::Scream7: + case SoundId::Scream8: + case SoundId::TrainWhistle: + case SoundId::TrainDeparting: + case SoundId::Tram: + return true; + default: + return false; + } + } + + static bool IsSpecialFrequencySound(SoundId id) + { + switch (id) + { + case SoundId::TrackFrictionBM: + case SoundId::TrackFrictionRMC: + return true; + default: + return false; + } + } + + enum class SoundType + { + TrackNoises, + OtherNoises, // e.g. Screams + }; + + template static uint16_t SoundFrequency(const SoundId id, uint16_t baseFrequency) + { + if constexpr (type == SoundType::TrackNoises) + { + if (IsSpecialFrequencySound(id)) + { + return (baseFrequency / 2) + 4000; + } + return baseFrequency; + } + else + { + if (IsFixedFrequencySound(id)) + { + return 22050; + } + return std::min((baseFrequency * 2) - 3248, 25700); + } + } + + template static bool ShouldUpdateChannelRate(const SoundId id) + { + return type == SoundType::TrackNoises || !IsFixedFrequencySound(id); + } + + template + static void UpdateSound(const SoundId id, int32_t volume, VehicleSoundParams* sound_params, Sound& sound, uint8_t panVol) + { + volume *= panVol; + volume = volume / 8; + volume = std::max(volume - 0x1FFF, -10000); + + if (sound.Channel != nullptr && sound.Channel->IsDone()) + { + sound.Id = SoundId::Null; + sound.Channel = nullptr; + } + if (id != sound.Id && sound.Id != SoundId::Null) + { + sound.Id = SoundId::Null; + sound.Channel->Stop(); + } + if (id == SoundId::Null) + { + return; + } + + if (sound.Id == SoundId::Null) + { + auto frequency = SoundFrequency(id, sound_params->frequency); + auto looping = IsLoopingSound(id); + auto pan = sound_params->pan_x; + auto channel = CreateAudioChannel( + id, looping, DStoMixerVolume(volume), DStoMixerPan(pan), DStoMixerRate(frequency), false); + if (channel != nullptr) + { + sound.Id = id; + sound.Pan = sound_params->pan_x; + sound.Volume = volume; + sound.Frequency = sound_params->frequency; + sound.Channel = channel; + } + else + { + sound.Id = SoundId::Null; + } + return; + } + if (volume != sound.Volume) + { + sound.Volume = volume; + sound.Channel->SetVolume(DStoMixerVolume(volume)); + } + if (sound_params->pan_x != sound.Pan) + { + sound.Pan = sound_params->pan_x; + sound.Channel->SetPan(DStoMixerPan(sound_params->pan_x)); + } + if (!(GetGameState().CurrentTicks & 3) && sound_params->frequency != sound.Frequency) + { + sound.Frequency = sound_params->frequency; + if (ShouldUpdateChannelRate(id)) + { + uint16_t frequency = SoundFrequency(id, sound_params->frequency); + sound.Channel->SetRate(DStoMixerRate(frequency)); + } + } + } + + /** + * + * rct2: 0x006BBC6B + */ + void UpdateVehicleSounds() + { + PROFILED_FUNCTION(); + + if (!IsAvailable()) + return; + + FixedVector vehicleSoundParamsList; + + VehicleSoundsUpdateWindowSetup(); + + for (auto vehicle : TrainManager::View()) + { + UpdateSoundParams(*vehicle, vehicleSoundParamsList); + } + + // Stop all playing sounds that no longer have priority to play after vehicle_update_sound_params + for (auto& vehicleSound : gVehicleSoundList) + { + if (vehicleSound.id != SoundIdNull) + { + bool keepPlaying = false; + for (auto vehicleSoundParams : vehicleSoundParamsList) + { + if (vehicleSound.id == vehicleSoundParams.id) + { + keepPlaying = true; + break; + } + } + + if (keepPlaying) + continue; + + if (vehicleSound.TrackSound.Id != SoundId::Null) + { + vehicleSound.TrackSound.Channel->Stop(); + } + if (vehicleSound.OtherSound.Id != SoundId::Null) + { + vehicleSound.OtherSound.Channel->Stop(); + } + vehicleSound.id = SoundIdNull; + } + } + + for (auto& vehicleSoundParams : vehicleSoundParamsList) + { + uint8_t panVol = VehicleSoundsUpdateGetPanVolume(&vehicleSoundParams); + + auto* vehicleSound = VehicleSoundsUpdateGetVehicleSound(&vehicleSoundParams); + // No free vehicle sound slots (RCT2 corrupts the pointer here) + if (vehicleSound == nullptr) + continue; + + // Move the Sound Volume towards the SoundsParam Volume + int32_t tempvolume = vehicleSound->volume; + if (tempvolume != vehicleSoundParams.volume) + { + if (tempvolume < vehicleSoundParams.volume) + { + tempvolume += 4; + } + else + { + tempvolume -= 4; + } + } + vehicleSound->volume = tempvolume; + panVol = std::max(0, panVol - tempvolume); + + Vehicle* vehicle = GetEntity(EntityId::FromUnderlying(vehicleSoundParams.id)); + if (vehicle != nullptr) + { + UpdateSound( + vehicle->sound1_id, vehicle->sound1_volume, &vehicleSoundParams, vehicleSound->TrackSound, panVol); + UpdateSound( + vehicle->sound2_id, vehicle->sound2_volume, &vehicleSoundParams, vehicleSound->OtherSound, panVol); + } + } + } +} // namespace OpenRCT2::Audio diff --git a/src/openrct2-ui/ride/VehicleSounds.h b/src/openrct2-ui/ride/VehicleSounds.h new file mode 100644 index 0000000000..509aa6006a --- /dev/null +++ b/src/openrct2-ui/ride/VehicleSounds.h @@ -0,0 +1,6 @@ +#pragma once + +namespace OpenRCT2::Audio +{ + void UpdateVehicleSounds(); +} diff --git a/src/openrct2-ui/scripting/CustomImages.cpp b/src/openrct2-ui/scripting/CustomImages.cpp index e2700b8740..c3839c7cae 100644 --- a/src/openrct2-ui/scripting/CustomImages.cpp +++ b/src/openrct2-ui/scripting/CustomImages.cpp @@ -275,6 +275,21 @@ namespace OpenRCT2::Scripting return unpadded; } + static ImportMode getImportModeFromPalette(const PixelDataPaletteKind& palette) + { + switch (palette) + { + case PixelDataPaletteKind::Closest: + return ImportMode::Closest; + case PixelDataPaletteKind::Dither: + return ImportMode::Dithering; + case PixelDataPaletteKind::None: + case PixelDataPaletteKind::Keep: + default: + return ImportMode::Default; + } + } + static std::vector GetBufferFromPixelData(duk_context* ctx, PixelData& pixelData) { std::vector imageData; @@ -303,18 +318,14 @@ namespace OpenRCT2::Scripting case PixelDataKind::Png: { auto imageFormat = pixelData.Palette == PixelDataPaletteKind::Keep ? IMAGE_FORMAT::PNG : IMAGE_FORMAT::PNG_32; - auto palette = pixelData.Palette == PixelDataPaletteKind::Keep ? ImageImporter::Palette::KeepIndices - : ImageImporter::Palette::OpenRCT2; - auto importMode = ImageImporter::ImportMode::Default; - if (pixelData.Palette == PixelDataPaletteKind::Closest) - importMode = ImageImporter::ImportMode::Closest; - else if (pixelData.Palette == PixelDataPaletteKind::Dither) - importMode = ImageImporter::ImportMode::Dithering; + auto palette = pixelData.Palette == PixelDataPaletteKind::Keep ? Palette::KeepIndices : Palette::OpenRCT2; + auto importMode = getImportModeFromPalette(pixelData.Palette); auto pngData = DukGetDataFromBufferLikeObject(pixelData.Data); auto image = Imaging::ReadFromBuffer(pngData, imageFormat); + ImageImportMeta meta = { { 0, 0 }, palette, ImportFlags::RLE, importMode }; ImageImporter importer; - auto importResult = importer.Import(image, 0, 0, palette, ImageImporter::ImportFlags::RLE, importMode); + auto importResult = importer.Import(image, meta); pixelData.Type = PixelDataKind::Rle; pixelData.Width = importResult.Element.width; diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index ad4bf16a7d..ba513ce796 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -508,11 +508,11 @@ namespace OpenRCT2::Ui::Windows if (listView.GetScrollbars() == ScrollbarType::Horizontal || listView.GetScrollbars() == ScrollbarType::Both) { - wheight -= SCROLLBAR_WIDTH + 1; + wheight -= kScrollBarWidth + 1; } if (listView.GetScrollbars() == ScrollbarType::Vertical || listView.GetScrollbars() == ScrollbarType::Both) { - wwidth -= SCROLLBAR_WIDTH + 1; + wwidth -= kScrollBarWidth + 1; } listView.Resize({ wwidth, wheight }); scrollIndex++; @@ -745,8 +745,8 @@ namespace OpenRCT2::Ui::Windows RefreshWidgets(); Invalidate(); - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); + OnResize(); + OnPrepareDraw(); WindowInitScrollWidgets(*this); Invalidate(); @@ -931,7 +931,7 @@ namespace OpenRCT2::Ui::Windows } } - widgetList.push_back(WIDGETS_END); + widgetList.push_back(kWidgetsEnd); widgets = widgetList.data(); WindowInitScrollWidgets(*this); diff --git a/src/openrct2-ui/scripting/ScGraphicsContext.hpp b/src/openrct2-ui/scripting/ScGraphicsContext.hpp index 9d444c5b12..9115d1033c 100644 --- a/src/openrct2-ui/scripting/ScGraphicsContext.hpp +++ b/src/openrct2-ui/scripting/ScGraphicsContext.hpp @@ -175,7 +175,7 @@ namespace OpenRCT2::Scripting void clear() { - GfxClear(&_dpi, _fill); + GfxClear(_dpi, _fill); } void clip(int32_t x, int32_t y, int32_t width, int32_t height) diff --git a/src/openrct2-ui/scripting/ScUi.hpp b/src/openrct2-ui/scripting/ScUi.hpp index 05c4b508f6..f77003dfab 100644 --- a/src/openrct2-ui/scripting/ScUi.hpp +++ b/src/openrct2-ui/scripting/ScUi.hpp @@ -231,7 +231,7 @@ namespace OpenRCT2::Scripting void showError(const std::string& title, const std::string& message) { - WindowErrorOpen(title, message); + ErrorOpen(title, message); } void showTextInput(const DukValue& desc) @@ -282,7 +282,7 @@ namespace OpenRCT2::Scripting else throw DukException(); - WindowLoadsaveOpen( + LoadsaveOpen( loadSaveType, defaultPath, [this, plugin, callback](int32_t result, std::string_view path) { if (result == MODAL_RESULT_OK) @@ -304,7 +304,7 @@ namespace OpenRCT2::Scripting auto plugin = _scriptEngine.GetExecInfo().GetCurrentPlugin(); auto callback = desc["callback"]; - WindowScenarioselectOpen([this, plugin, callback](std::string_view path) { + ScenarioselectOpen([this, plugin, callback](std::string_view path) { auto dukValue = GetScenarioFile(path); _scriptEngine.ExecutePluginCall(plugin, callback, { dukValue }, false); }); diff --git a/src/openrct2-ui/scripting/ScViewport.hpp b/src/openrct2-ui/scripting/ScViewport.hpp index 6781c16e96..828e9639fe 100644 --- a/src/openrct2-ui/scripting/ScViewport.hpp +++ b/src/openrct2-ui/scripting/ScViewport.hpp @@ -111,7 +111,12 @@ namespace OpenRCT2::Scripting int32_t rotation_get() const { - return GetCurrentRotation(); + auto viewport = GetViewport(); + if (viewport != nullptr) + { + return viewport->rotation; + } + return 0; } void rotation_set(int32_t value) { @@ -120,9 +125,9 @@ namespace OpenRCT2::Scripting auto w = GetWindow(); if (w != nullptr) { - while (GetCurrentRotation() != value) + while (w->viewport->rotation != value) { - WindowRotateCamera(*w, 1); + ViewportRotateSingle(w, 1); } } } @@ -179,7 +184,7 @@ namespace OpenRCT2::Scripting if (viewport != nullptr) { auto centre = viewport->viewPos + ScreenCoordsXY{ viewport->view_width / 2, viewport->view_height / 2 }; - auto coords = ViewportPosToMapPos(centre, 24); + auto coords = ViewportPosToMapPos(centre, 24, viewport->rotation); auto ctx = GetContext()->GetScriptEngine().GetContext(); auto obj = duk_push_object(ctx); @@ -203,7 +208,7 @@ namespace OpenRCT2::Scripting auto coords = GetCoordsFromObject(position); if (coords) { - auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), *coords); + auto screenCoords = Translate3DTo2DWithZ(viewport->rotation, *coords); auto left = screenCoords.x - (viewport->view_width / 2); auto top = screenCoords.y - (viewport->view_height / 2); SetViewLeftTop(left, top); diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index a7652fc4de..aa6f6ec439 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -19,14 +19,14 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr int32_t WW = 400; + static constexpr int32_t WH = 450; + static constexpr StringId WINDOW_TITLE = STR_ABOUT; + static constexpr int32_t TABHEIGHT = 50; -static constexpr int32_t WW = 400; -static constexpr int32_t WH = 450; -static constexpr StringId WINDOW_TITLE = STR_ABOUT; -static constexpr int32_t TABHEIGHT = 50; - -// clang-format off + // clang-format off enum { WINDOW_ABOUT_PAGE_OPENRCT2, @@ -70,12 +70,12 @@ static Widget _windowAboutOpenRCT2Widgets[] = { MakeWidget({168, 115 + 40}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGELOG_ELLIPSIS), // changelog button MakeWidget({168, 115 + 60}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_JOIN_DISCORD ), // "join discord" button MakeWidget({168, 115 + 80}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CONTRIBUTORS_WINDOW_BUTTON), // "contributors" button - WIDGETS_END, + kWidgetsEnd, }; static Widget _windowAboutRCT2Widgets[] = { WIDGETS_MAIN, - WIDGETS_END, + kWidgetsEnd, }; static Widget *_windowAboutPageWidgets[] = { @@ -83,205 +83,207 @@ static Widget *_windowAboutPageWidgets[] = { _windowAboutRCT2Widgets, }; -// clang-format on + // clang-format on -class AboutWindow final : public Window -{ -public: - void OnOpen() override + class AboutWindow final : public Window { - widgets = _windowAboutOpenRCT2Widgets; - - WindowInitScrollWidgets(*this); - SetPage(WINDOW_ABOUT_PAGE_OPENRCT2); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_CLOSE: - Close(); - break; - case WIDX_TAB_ABOUT_OPENRCT2: - case WIDX_TAB_ABOUT_RCT2: - SetPage(widgetIndex - WIDX_TAB_ABOUT_OPENRCT2); - break; - case WIDX_JOIN_DISCORD: - OpenRCT2::GetContext()->GetUiContext()->OpenURL("https://discord.gg/ZXZd8D8"); - break; - case WIDX_CHANGELOG: - ContextOpenWindow(WindowClass::Changelog); - break; - case WIDX_NEW_VERSION: - ContextOpenWindowView(WV_NEW_VERSION_INFO); - break; - case WIDX_COPY_BUILD_INFO: - SDL_SetClipboardText(gVersionInfoFull); - break; - case WIDX_CONTRIBUTORS_BUTTON: - ContextOpenWindowView(WV_CONTRIBUTORS); - break; + widgets = _windowAboutOpenRCT2Widgets; + + WindowInitScrollWidgets(*this); + SetPage(WINDOW_ABOUT_PAGE_OPENRCT2); } - } - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - const auto& aboutOpenRCT2 = widgets[WIDX_TAB_ABOUT_OPENRCT2]; - const auto& aboutRCT2 = widgets[WIDX_TAB_ABOUT_RCT2]; - - int32_t y = windowPos.y + aboutOpenRCT2.midY() - 3; - ScreenCoordsXY aboutOpenRCT2Coords(windowPos.x + aboutOpenRCT2.left + 45, y); - ScreenCoordsXY aboutRCT2Coords(windowPos.x + aboutRCT2.left + 45, y); - - // Draw tab names + void OnMouseUp(WidgetIndex widgetIndex) override { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_TAB_ABOUT_OPENRCT2: + case WIDX_TAB_ABOUT_RCT2: + SetPage(widgetIndex - WIDX_TAB_ABOUT_OPENRCT2); + break; + case WIDX_JOIN_DISCORD: + OpenRCT2::GetContext()->GetUiContext()->OpenURL("https://discord.gg/ZXZd8D8"); + break; + case WIDX_CHANGELOG: + ContextOpenWindow(WindowClass::Changelog); + break; + case WIDX_NEW_VERSION: + ContextOpenWindowView(WV_NEW_VERSION_INFO); + break; + case WIDX_COPY_BUILD_INFO: + SDL_SetClipboardText(gVersionInfoFull); + break; + case WIDX_CONTRIBUTORS_BUTTON: + ContextOpenWindowView(WV_CONTRIBUTORS); + break; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + const auto& aboutOpenRCT2 = widgets[WIDX_TAB_ABOUT_OPENRCT2]; + const auto& aboutRCT2 = widgets[WIDX_TAB_ABOUT_RCT2]; + + int32_t y = windowPos.y + aboutOpenRCT2.midY() - 3; + ScreenCoordsXY aboutOpenRCT2Coords(windowPos.x + aboutOpenRCT2.left + 45, y); + ScreenCoordsXY aboutRCT2Coords(windowPos.x + aboutRCT2.left + 45, y); + + // Draw tab names + { + auto ft = Formatter(); + ft.Add(STR_TITLE_SEQUENCE_OPENRCT2); + DrawTextWrapped( + dpi, aboutOpenRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, + { COLOUR_AQUAMARINE, TextAlignment::CENTRE }); + } + { + auto ft = Formatter(); + ft.Add(STR_TITLE_SEQUENCE_RCT2); + DrawTextWrapped( + dpi, aboutRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, { COLOUR_AQUAMARINE, TextAlignment::CENTRE }); + } + + if (page == WINDOW_ABOUT_PAGE_OPENRCT2) + { + DrawOpenRCT2Info(dpi); + } + else if (page == WINDOW_ABOUT_PAGE_RCT2) + { + DrawRCT2Info(dpi); + } + } + + private: + /** + * @brief Set which tab to show + */ + void SetPage(int32_t p) + { + page = p; + frame_no = 0; + pressed_widgets = 0; + widgets = _windowAboutPageWidgets[p]; + + switch (p) + { + case WINDOW_ABOUT_PAGE_OPENRCT2: + pressed_widgets |= (1uLL << WIDX_TAB_ABOUT_OPENRCT2); + break; + case WINDOW_ABOUT_PAGE_RCT2: + pressed_widgets |= (1uLL << WIDX_TAB_ABOUT_RCT2); + break; + } + + WindowInitScrollWidgets(*this); + Invalidate(); + } + + /** + * @brief Draw OpenRCT2 info on open tab + */ + void DrawOpenRCT2Info(DrawPixelInfo& dpi) + { + // Draw logo on placeholder widget + ScreenCoordsXY logoCoords = windowPos + + ScreenCoordsXY(widgets[WIDX_OPENRCT2_LOGO].left, widgets[WIDX_OPENRCT2_LOGO].top); + GfxDrawSprite(dpi, ImageId(SPR_G2_LOGO), logoCoords); + // Version info + utf8 buffer[256]; + utf8* ch = buffer; + OpenRCT2WriteFullVersionInfo(ch, sizeof(buffer) - (ch - buffer)); auto ft = Formatter(); - ft.Add(STR_TITLE_SEQUENCE_OPENRCT2); - DrawTextWrapped( - dpi, aboutOpenRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, { COLOUR_AQUAMARINE, TextAlignment::CENTRE }); - } - { - auto ft = Formatter(); - ft.Add(STR_TITLE_SEQUENCE_RCT2); - DrawTextWrapped( - dpi, aboutRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, { COLOUR_AQUAMARINE, TextAlignment::CENTRE }); + ft.Add(buffer); + + auto const& versionPlaceholder = widgets[WIDX_VERSION]; + auto versionPlaceHolderWidth = versionPlaceholder.right - versionPlaceholder.left; + auto centreX = versionPlaceholder.left + versionPlaceHolderWidth / 2; + auto centreY = (versionPlaceholder.top + versionPlaceholder.bottom - FontGetLineHeight(FontStyle::Medium)) / 2; + auto centrePos = windowPos + ScreenCoordsXY(centreX, centreY); + DrawTextWrapped(dpi, centrePos, versionPlaceHolderWidth, STR_STRING, ft, { colours[1], TextAlignment::CENTRE }); + + // Shows the update available button + if (OpenRCT2::GetContext()->HasNewVersionInfo()) + { + widgets[WIDX_NEW_VERSION].type = WindowWidgetType::Button; + _windowAboutOpenRCT2Widgets[WIDX_NEW_VERSION].type = WindowWidgetType::Button; + } + + // Draw the rest of the text + Formatter ft2{}; + TextPaint tp{ colours[1], TextAlignment::CENTRE }; + auto textCoords = windowPos + ScreenCoordsXY((width / 2) - 1, 240); + auto textWidth = WW - 20; + + textCoords += ScreenCoordsXY( + 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_OPENRCT2_DESCRIPTION_2, ft2, tp) + 5); // More info + textCoords += ScreenCoordsXY( + 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_OPENRCT2_DESCRIPTION_3, ft2, tp) + 5); // Copyright + textCoords += ScreenCoordsXY( + 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_OPENRCT2_TITLE, ft2, tp) + 5); // Title Theme + textCoords += ScreenCoordsXY( + 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_FAIRGROUND_ORGAN, ft2, tp) + 5); // Fairground organ + textCoords += ScreenCoordsXY( + 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_SPECIAL_THANKS_1, ft2, tp)); // Special Thanks + textCoords += ScreenCoordsXY( + 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_SPECIAL_THANKS_2, ft2, tp)); // Company names } - if (page == WINDOW_ABOUT_PAGE_OPENRCT2) + /** + * @brief Draw RCT2 info on open tab + */ + void DrawRCT2Info(DrawPixelInfo& dpi) { - DrawOpenRCT2Info(dpi); - } - else if (page == WINDOW_ABOUT_PAGE_RCT2) - { - DrawRCT2Info(dpi); - } - } + int32_t yPage = windowPos.y + widgets[WIDX_PAGE_BACKGROUND].top + 5; -private: - /** - * @brief Set which tab to show - */ - void SetPage(int32_t p) - { - page = p; - frame_no = 0; - pressed_widgets = 0; - widgets = _windowAboutPageWidgets[p]; + auto screenCoords = ScreenCoordsXY{ windowPos.x + 200, yPage + 5 }; - switch (p) - { - case WINDOW_ABOUT_PAGE_OPENRCT2: - pressed_widgets |= (1uLL << WIDX_TAB_ABOUT_OPENRCT2); - break; - case WINDOW_ABOUT_PAGE_RCT2: - pressed_widgets |= (1uLL << WIDX_TAB_ABOUT_RCT2); - break; + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + + // Credits + DrawTextBasic(dpi, screenCoords, STR_COPYRIGHT_CS, {}, { TextAlignment::CENTRE }); + screenCoords.y += lineHeight + 74; + DrawTextBasic(dpi, screenCoords, STR_DESIGNED_AND_PROGRAMMED_BY_CS, {}, { TextAlignment::CENTRE }); + screenCoords.y += lineHeight; + DrawTextBasic(dpi, screenCoords, STR_GRAPHICS_BY_SF, {}, { TextAlignment::CENTRE }); + screenCoords.y += lineHeight; + DrawTextBasic(dpi, screenCoords, STR_SOUND_AND_MUSIC_BY_AB, {}, { TextAlignment::CENTRE }); + screenCoords.y += lineHeight; + DrawTextBasic(dpi, screenCoords, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, {}, { TextAlignment::CENTRE }); + screenCoords.y += lineHeight + 3; + DrawTextBasic(dpi, screenCoords, STR_REPRESENTATION_BY_JL, {}, { TextAlignment::CENTRE }); + screenCoords.y += 2 * lineHeight + 5; + DrawTextBasic(dpi, screenCoords, STR_THANKS_TO, {}, { TextAlignment::CENTRE }); + screenCoords.y += lineHeight; + DrawTextBasic(dpi, screenCoords, STR_THANKS_TO_PEOPLE, {}, { TextAlignment::CENTRE }); + screenCoords.y += 2 * lineHeight + 5; + DrawTextBasic(dpi, screenCoords, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, {}, { TextAlignment::CENTRE }); + + // Images + GfxDrawSprite(dpi, ImageId(SPR_CREDITS_CHRIS_SAWYER_SMALL), { windowPos.x + 92, yPage + 24 }); + + // Licence } - WindowInitScrollWidgets(*this); - Invalidate(); - } + void OnResize() override + { + ResizeFrameWithPage(); + } + }; /** - * @brief Draw OpenRCT2 info on open tab + * + * rct2: 0x0066D2AC */ - void DrawOpenRCT2Info(DrawPixelInfo& dpi) + WindowBase* AboutOpen() { - // Draw logo on placeholder widget - ScreenCoordsXY logoCoords = windowPos - + ScreenCoordsXY(widgets[WIDX_OPENRCT2_LOGO].left, widgets[WIDX_OPENRCT2_LOGO].top); - GfxDrawSprite(dpi, ImageId(SPR_G2_LOGO), logoCoords); - // Version info - utf8 buffer[256]; - utf8* ch = buffer; - OpenRCT2WriteFullVersionInfo(ch, sizeof(buffer) - (ch - buffer)); - auto ft = Formatter(); - ft.Add(buffer); - - auto const& versionPlaceholder = widgets[WIDX_VERSION]; - auto versionPlaceHolderWidth = versionPlaceholder.right - versionPlaceholder.left; - auto centreX = versionPlaceholder.left + versionPlaceHolderWidth / 2; - auto centreY = (versionPlaceholder.top + versionPlaceholder.bottom - FontGetLineHeight(FontStyle::Medium)) / 2; - auto centrePos = windowPos + ScreenCoordsXY(centreX, centreY); - DrawTextWrapped(dpi, centrePos, versionPlaceHolderWidth, STR_STRING, ft, { colours[1], TextAlignment::CENTRE }); - - // Shows the update available button - if (OpenRCT2::GetContext()->HasNewVersionInfo()) - { - widgets[WIDX_NEW_VERSION].type = WindowWidgetType::Button; - _windowAboutOpenRCT2Widgets[WIDX_NEW_VERSION].type = WindowWidgetType::Button; - } - - // Draw the rest of the text - Formatter ft2{}; - TextPaint tp{ colours[1], TextAlignment::CENTRE }; - auto textCoords = windowPos + ScreenCoordsXY((width / 2) - 1, 240); - auto textWidth = WW - 20; - - textCoords += ScreenCoordsXY( - 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_OPENRCT2_DESCRIPTION_2, ft2, tp) + 5); // More info - textCoords += ScreenCoordsXY( - 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_OPENRCT2_DESCRIPTION_3, ft2, tp) + 5); // Copyright - textCoords += ScreenCoordsXY( - 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_OPENRCT2_TITLE, ft2, tp) + 5); // Title Theme - textCoords += ScreenCoordsXY( - 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_FAIRGROUND_ORGAN, ft2, tp) + 5); // Fairground organ - textCoords += ScreenCoordsXY( - 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_SPECIAL_THANKS_1, ft2, tp)); // Special Thanks - textCoords += ScreenCoordsXY( - 0, DrawTextWrapped(dpi, textCoords, textWidth, STR_ABOUT_SPECIAL_THANKS_2, ft2, tp)); // Company names + return WindowFocusOrCreate(WindowClass::About, WW, WH, WF_CENTRE_SCREEN); } - - /** - * @brief Draw RCT2 info on open tab - */ - void DrawRCT2Info(DrawPixelInfo& dpi) - { - int32_t yPage = windowPos.y + widgets[WIDX_PAGE_BACKGROUND].top + 5; - - auto screenCoords = ScreenCoordsXY{ windowPos.x + 200, yPage + 5 }; - - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); - - // Credits - DrawTextBasic(dpi, screenCoords, STR_COPYRIGHT_CS, {}, { TextAlignment::CENTRE }); - screenCoords.y += lineHeight + 74; - DrawTextBasic(dpi, screenCoords, STR_DESIGNED_AND_PROGRAMMED_BY_CS, {}, { TextAlignment::CENTRE }); - screenCoords.y += lineHeight; - DrawTextBasic(dpi, screenCoords, STR_GRAPHICS_BY_SF, {}, { TextAlignment::CENTRE }); - screenCoords.y += lineHeight; - DrawTextBasic(dpi, screenCoords, STR_SOUND_AND_MUSIC_BY_AB, {}, { TextAlignment::CENTRE }); - screenCoords.y += lineHeight; - DrawTextBasic(dpi, screenCoords, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, {}, { TextAlignment::CENTRE }); - screenCoords.y += lineHeight + 3; - DrawTextBasic(dpi, screenCoords, STR_REPRESENTATION_BY_JL, {}, { TextAlignment::CENTRE }); - screenCoords.y += 2 * lineHeight + 5; - DrawTextBasic(dpi, screenCoords, STR_THANKS_TO, {}, { TextAlignment::CENTRE }); - screenCoords.y += lineHeight; - DrawTextBasic(dpi, screenCoords, STR_THANKS_TO_PEOPLE, {}, { TextAlignment::CENTRE }); - screenCoords.y += 2 * lineHeight + 5; - DrawTextBasic(dpi, screenCoords, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, {}, { TextAlignment::CENTRE }); - - // Images - GfxDrawSprite(dpi, ImageId(SPR_CREDITS_CHRIS_SAWYER_SMALL), { windowPos.x + 92, yPage + 24 }); - - // Licence - } - - void OnResize() override - { - ResizeFrameWithPage(); - } -}; - -/** - * - * rct2: 0x0066D2AC - */ -WindowBase* WindowAboutOpen() -{ - return WindowFocusOrCreate(WindowClass::About, WW, WH, WF_CENTRE_SCREEN); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/AssetPacks.cpp b/src/openrct2-ui/windows/AssetPacks.cpp index db8988ed34..2c425e8172 100644 --- a/src/openrct2-ui/windows/AssetPacks.cpp +++ b/src/openrct2-ui/windows/AssetPacks.cpp @@ -18,13 +18,13 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_ASSET_PACKS; + static constexpr int32_t WW = 400; + static constexpr int32_t WH = 200; -static constexpr StringId WINDOW_TITLE = STR_ASSET_PACKS; -static constexpr int32_t WW = 400; -static constexpr int32_t WH = 200; - -// clang-format off + // clang-format off enum WindowAssetPacksWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -45,300 +45,303 @@ static Widget WindowAssetPacksWidgets[] = { MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_ARROW_UP), STR_INCREASE_PRIOTITY_TIP), MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_ARROW_DOWN), STR_DECREASE_PRIOTITY_TIP), MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_RELOAD), STR_RELOAD_ASSET_PACKS_TIP), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class AssetPacksWindow final : public Window -{ -private: - static constexpr int32_t ItemHeight = SCROLLABLE_ROW_HEIGHT + 1; - static constexpr int32_t ItemCheckBoxSize = ItemHeight - 3; - std::optional _highlightedIndex; - std::optional _selectedIndex; - -public: - void OnOpen() override + class AssetPacksWindow final : public Window { - widgets = WindowAssetPacksWidgets; - WindowInitScrollWidgets(*this); - } + private: + static constexpr int32_t ItemHeight = SCROLLABLE_ROW_HEIGHT + 1; + static constexpr int32_t ItemCheckBoxSize = ItemHeight - 3; + std::optional _highlightedIndex; + std::optional _selectedIndex; - void OnClose() override - { - Apply(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_CLOSE: - Close(); - break; - case WIDX_MOVE_UP: - ReorderSelectedAssetPack(-1); - break; - case WIDX_MOVE_DOWN: - ReorderSelectedAssetPack(1); - break; - case WIDX_APPLY: - Apply(); - break; - } - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - ScreenSize result; - auto assetPackManager = GetContext()->GetAssetPackManager(); - if (assetPackManager != nullptr) - { - auto numAssetPacks = assetPackManager->GetCount() + 1; // +1 for the base assets item - result.height = static_cast(numAssetPacks * ItemHeight); + widgets = WindowAssetPacksWidgets; + WindowInitScrollWidgets(*this); } - if (_highlightedIndex) + void OnClose() override { - _highlightedIndex = {}; - Invalidate(); + Apply(); } - return result; - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - auto isCheckBox = false; - auto index = GetAssetPackIndexFromPosition(screenCoords, isCheckBox); - - // Click on checkbox - if (index && isCheckBox) + void OnMouseUp(WidgetIndex widgetIndex) override { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_MOVE_UP: + ReorderSelectedAssetPack(-1); + break; + case WIDX_MOVE_DOWN: + ReorderSelectedAssetPack(1); + break; + case WIDX_APPLY: + Apply(); + break; + } + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + ScreenSize result; auto assetPackManager = GetContext()->GetAssetPackManager(); if (assetPackManager != nullptr) { - auto assetPack = assetPackManager->GetAssetPack(*index); - if (assetPack != nullptr) + auto numAssetPacks = assetPackManager->GetCount() + 1; // +1 for the base assets item + result.height = static_cast(numAssetPacks * ItemHeight); + } + + if (_highlightedIndex) + { + _highlightedIndex = {}; + Invalidate(); + } + + return result; + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + auto isCheckBox = false; + auto index = GetAssetPackIndexFromPosition(screenCoords, isCheckBox); + + // Click on checkbox + if (index && isCheckBox) + { + auto assetPackManager = GetContext()->GetAssetPackManager(); + if (assetPackManager != nullptr) { - assetPack->SetEnabled(!assetPack->IsEnabled()); - Invalidate(); + auto assetPack = assetPackManager->GetAssetPack(*index); + if (assetPack != nullptr) + { + assetPack->SetEnabled(!assetPack->IsEnabled()); + Invalidate(); + } } } - } - // Select item - if (_selectedIndex != index) - { - _selectedIndex = index; - Invalidate(); - } - } - - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - auto isCheckBox = false; - auto index = GetAssetPackIndexFromPosition(screenCoords, isCheckBox); - if (_highlightedIndex != index) - { - _highlightedIndex = index; - Invalidate(); - } - } - - void OnPrepareDraw() override - { - ResizeFrame(); - - auto& list = widgets[WIDX_LIST]; - list.left = 6; - list.top = 20 + 11 + 3; - list.right = width - 2 - 24 - 1; - list.bottom = height - 6 - 11 - 3; - - widgets[WIDX_HIGH_LABEL].bottom = list.top - 1; - widgets[WIDX_HIGH_LABEL].top = widgets[WIDX_HIGH_LABEL].bottom - 11 - 3; - widgets[WIDX_HIGH_LABEL].left = list.left; - widgets[WIDX_HIGH_LABEL].right = list.right; - widgets[WIDX_LOW_LABEL].top = list.bottom + 1 + 3; - widgets[WIDX_LOW_LABEL].bottom = widgets[WIDX_LOW_LABEL].top + 11 + 3; - widgets[WIDX_LOW_LABEL].left = list.left; - widgets[WIDX_LOW_LABEL].right = list.right; - - auto toolstripY = 20; - auto toolstripRight = width - 2; - auto toolstripLeft = toolstripRight - 24; - for (WidgetIndex i = WIDX_MOVE_UP; i <= WIDX_APPLY; i++) - { - widgets[i].top = toolstripY; - widgets[i].bottom = toolstripY + 24; - widgets[i].left = toolstripLeft; - widgets[i].right = toolstripRight; - toolstripY += 24; - } - - SetWidgetDisabled(WIDX_MOVE_UP, !_selectedIndex || _selectedIndex == 0u); - SetWidgetDisabled(WIDX_MOVE_DOWN, !_selectedIndex || _selectedIndex >= GetNumAssetPacks() - 1); - - widgets[WIDX_APPLY].bottom = widgets[WIDX_LIST].bottom; - widgets[WIDX_APPLY].top = widgets[WIDX_APPLY].bottom - 24; - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - } - - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; - GfxFillRect( - dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width - 1, dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); - - auto assetPackManager = GetContext()->GetAssetPackManager(); - if (assetPackManager == nullptr) - return; - - auto numAssetPacks = assetPackManager->GetCount(); - auto y = 0; - for (size_t i = 0; i <= numAssetPacks; i++) - { - if (y > dpi.y + dpi.height) - break; - if (y + 11 < dpi.y) - continue; - - auto isSelected = i == _selectedIndex; - auto isHighlighted = i == _highlightedIndex; - if (i == numAssetPacks) + // Select item + if (_selectedIndex != index) { - auto ft = Formatter(); - ft.Add(STR_BASE_GRAPHICS_MUSIC_SOUND); - PaintItem(dpi, y, ft, true, isSelected, isHighlighted); + _selectedIndex = index; + Invalidate(); } - else + } + + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + auto isCheckBox = false; + auto index = GetAssetPackIndexFromPosition(screenCoords, isCheckBox); + if (_highlightedIndex != index) { - auto assetPack = assetPackManager->GetAssetPack(i); - if (assetPack != nullptr) + _highlightedIndex = index; + Invalidate(); + } + } + + void OnPrepareDraw() override + { + ResizeFrame(); + + auto& list = widgets[WIDX_LIST]; + list.left = 6; + list.top = 20 + 11 + 3; + list.right = width - 2 - 24 - 1; + list.bottom = height - 6 - 11 - 3; + + widgets[WIDX_HIGH_LABEL].bottom = list.top - 1; + widgets[WIDX_HIGH_LABEL].top = widgets[WIDX_HIGH_LABEL].bottom - 11 - 3; + widgets[WIDX_HIGH_LABEL].left = list.left; + widgets[WIDX_HIGH_LABEL].right = list.right; + widgets[WIDX_LOW_LABEL].top = list.bottom + 1 + 3; + widgets[WIDX_LOW_LABEL].bottom = widgets[WIDX_LOW_LABEL].top + 11 + 3; + widgets[WIDX_LOW_LABEL].left = list.left; + widgets[WIDX_LOW_LABEL].right = list.right; + + auto toolstripY = 20; + auto toolstripRight = width - 2; + auto toolstripLeft = toolstripRight - 24; + for (WidgetIndex i = WIDX_MOVE_UP; i <= WIDX_APPLY; i++) + { + widgets[i].top = toolstripY; + widgets[i].bottom = toolstripY + 24; + widgets[i].left = toolstripLeft; + widgets[i].right = toolstripRight; + toolstripY += 24; + } + + SetWidgetDisabled(WIDX_MOVE_UP, !_selectedIndex || _selectedIndex == 0u); + SetWidgetDisabled(WIDX_MOVE_DOWN, !_selectedIndex || _selectedIndex >= GetNumAssetPacks() - 1); + + widgets[WIDX_APPLY].bottom = widgets[WIDX_LIST].bottom; + widgets[WIDX_APPLY].top = widgets[WIDX_APPLY].bottom - 24; + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; + GfxFillRect( + dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width - 1, dpi.height - 1 } }, + ColourMapA[colours[1]].mid_light); + + auto assetPackManager = GetContext()->GetAssetPackManager(); + if (assetPackManager == nullptr) + return; + + auto numAssetPacks = assetPackManager->GetCount(); + auto y = 0; + for (size_t i = 0; i <= numAssetPacks; i++) + { + if (y > dpi.y + dpi.height) + break; + if (y + 11 < dpi.y) + continue; + + auto isSelected = i == _selectedIndex; + auto isHighlighted = i == _highlightedIndex; + if (i == numAssetPacks) { - auto isChecked = assetPack->IsEnabled(); auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(assetPack->Name.c_str()); - PaintItem(dpi, y, ft, isChecked, isSelected, isHighlighted); + ft.Add(STR_BASE_GRAPHICS_MUSIC_SOUND); + PaintItem(dpi, y, ft, true, isSelected, isHighlighted); + } + else + { + auto assetPack = assetPackManager->GetAssetPack(i); + if (assetPack != nullptr) + { + auto isChecked = assetPack->IsEnabled(); + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(assetPack->Name.c_str()); + PaintItem(dpi, y, ft, isChecked, isSelected, isHighlighted); + } + } + y += ItemHeight; + } + } + + private: + void PaintItem(DrawPixelInfo& dpi, int32_t y, Formatter& ft, bool isChecked, bool isSelected, bool isHighlighted) + { + auto listWidth = dpi.width - 1; + auto stringId = STR_BLACK_STRING; + auto fillRectangle = ScreenRect{ { 0, y }, { listWidth, y + ItemHeight - 1 } }; + if (isSelected) + { + GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark); + stringId = STR_WINDOW_COLOUR_2_STRINGID; + } + else if (isHighlighted) + { + GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark); + } + + DrawTextEllipsised(dpi, { 16, y + 1 }, listWidth, stringId, ft); + + auto checkboxSize = ItemHeight - 3; + PaintCheckbox(dpi, { { 2, y + 1 }, { 2 + checkboxSize + 1, y + 1 + checkboxSize } }, isChecked); + } + + void PaintCheckbox(DrawPixelInfo& dpi, const ScreenRect& rect, bool checked) + { + GfxFillRectInset(dpi, rect, colours[1], INSET_RECT_F_E0); + if (checked) + { + auto checkmark = Formatter(); + checkmark.Add(STR_STRING); + checkmark.Add(CheckBoxMarkString); + DrawTextBasic( + dpi, ScreenCoordsXY{ rect.GetLeft() + 1, rect.GetTop() }, STR_WINDOW_COLOUR_2_STRINGID, checkmark); + } + } + + std::optional GetAssetPackIndexFromPosition(const ScreenCoordsXY& pos, bool& isCheckBox) + { + const auto index = pos.y / ItemHeight; + if (index < 0 || static_cast(index) >= GetNumAssetPacks()) + return std::nullopt; + + isCheckBox = pos.x >= 2 && pos.x <= 2 + ItemCheckBoxSize + 1; + return static_cast(index); + } + + size_t GetNumAssetPacks() const + { + auto assetPackManager = GetContext()->GetAssetPackManager(); + if (assetPackManager == nullptr) + return 0; + return assetPackManager->GetCount(); + } + + bool IsSelectedAssetPackEnabled() const + { + if (_selectedIndex) + { + auto assetPackManager = GetContext()->GetAssetPackManager(); + if (assetPackManager != nullptr) + { + auto assetPack = assetPackManager->GetAssetPack(*_selectedIndex); + if (assetPack != nullptr) + { + return assetPack->IsEnabled(); + } } } - y += ItemHeight; - } - } - -private: - void PaintItem(DrawPixelInfo& dpi, int32_t y, Formatter& ft, bool isChecked, bool isSelected, bool isHighlighted) - { - auto listWidth = dpi.width - 1; - auto stringId = STR_BLACK_STRING; - auto fillRectangle = ScreenRect{ { 0, y }, { listWidth, y + ItemHeight - 1 } }; - if (isSelected) - { - GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark); - stringId = STR_WINDOW_COLOUR_2_STRINGID; - } - else if (isHighlighted) - { - GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark); + return false; } - DrawTextEllipsised(dpi, { 16, y + 1 }, listWidth, stringId, ft); - - auto checkboxSize = ItemHeight - 3; - PaintCheckbox(dpi, { { 2, y + 1 }, { 2 + checkboxSize + 1, y + 1 + checkboxSize } }, isChecked); - } - - void PaintCheckbox(DrawPixelInfo& dpi, const ScreenRect& rect, bool checked) - { - GfxFillRectInset(dpi, rect, colours[1], INSET_RECT_F_E0); - if (checked) + void ReorderSelectedAssetPack(int32_t direction) { - auto checkmark = Formatter(); - checkmark.Add(STR_STRING); - checkmark.Add(CheckBoxMarkString); - DrawTextBasic(dpi, ScreenCoordsXY{ rect.GetLeft() + 1, rect.GetTop() }, STR_WINDOW_COLOUR_2_STRINGID, checkmark); + if (!_selectedIndex) + return; + + auto assetPackManager = GetContext()->GetAssetPackManager(); + if (assetPackManager == nullptr) + return; + + if (direction < 0 && *_selectedIndex > 0) + { + assetPackManager->Swap(*_selectedIndex, *_selectedIndex - 1); + (*_selectedIndex)--; + Invalidate(); + } + else if (direction > 0 && *_selectedIndex < assetPackManager->GetCount() - 1) + { + assetPackManager->Swap(*_selectedIndex, *_selectedIndex + 1); + (*_selectedIndex)++; + Invalidate(); + } } - } - std::optional GetAssetPackIndexFromPosition(const ScreenCoordsXY& pos, bool& isCheckBox) - { - const auto index = pos.y / ItemHeight; - if (index < 0 || static_cast(index) >= GetNumAssetPacks()) - return std::nullopt; - - isCheckBox = pos.x >= 2 && pos.x <= 2 + ItemCheckBoxSize + 1; - return static_cast(index); - } - - size_t GetNumAssetPacks() const - { - auto assetPackManager = GetContext()->GetAssetPackManager(); - if (assetPackManager == nullptr) - return 0; - return assetPackManager->GetCount(); - } - - bool IsSelectedAssetPackEnabled() const - { - if (_selectedIndex) + void Apply() { + auto& objectManager = GetContext()->GetObjectManager(); + objectManager.ResetObjects(); + auto assetPackManager = GetContext()->GetAssetPackManager(); if (assetPackManager != nullptr) { - auto assetPack = assetPackManager->GetAssetPack(*_selectedIndex); - if (assetPack != nullptr) - { - return assetPack->IsEnabled(); - } + assetPackManager->SaveEnabledAssetPacks(); } } - return false; - } + }; - void ReorderSelectedAssetPack(int32_t direction) + WindowBase* AssetPacksOpen() { - if (!_selectedIndex) - return; - - auto assetPackManager = GetContext()->GetAssetPackManager(); - if (assetPackManager == nullptr) - return; - - if (direction < 0 && *_selectedIndex > 0) - { - assetPackManager->Swap(*_selectedIndex, *_selectedIndex - 1); - (*_selectedIndex)--; - Invalidate(); - } - else if (direction > 0 && *_selectedIndex < assetPackManager->GetCount() - 1) - { - assetPackManager->Swap(*_selectedIndex, *_selectedIndex + 1); - (*_selectedIndex)++; - Invalidate(); - } + auto flags = WF_AUTO_POSITION | WF_CENTRE_SCREEN; + return WindowFocusOrCreate(WindowClass::AssetPacks, WW, WH, flags); } - - void Apply() - { - auto& objectManager = GetContext()->GetObjectManager(); - objectManager.ResetObjects(); - - auto assetPackManager = GetContext()->GetAssetPackManager(); - if (assetPackManager != nullptr) - { - assetPackManager->SaveEnabledAssetPacks(); - } - } -}; - -WindowBase* WindowAssetPacksOpen() -{ - auto flags = WF_AUTO_POSITION | WF_CENTRE_SCREEN; - return WindowFocusOrCreate(WindowClass::AssetPacks, WW, WH, flags); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Banner.cpp b/src/openrct2-ui/windows/Banner.cpp index b6d9a70dc7..c454f7c4d6 100644 --- a/src/openrct2-ui/windows/Banner.cpp +++ b/src/openrct2-ui/windows/Banner.cpp @@ -22,12 +22,13 @@ #include #include #include +namespace OpenRCT2::Ui::Windows +{ + static constexpr int32_t WW = 113; + static constexpr int32_t WH = 96; + static constexpr StringId WINDOW_TITLE = STR_BANNER_WINDOW_TITLE; -static constexpr int32_t WW = 113; -static constexpr int32_t WH = 96; -static constexpr StringId WINDOW_TITLE = STR_BANNER_WINDOW_TITLE; - -// clang-format off + // clang-format off enum WindowBannerWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -67,256 +68,258 @@ static Widget window_banner_widgets[] = { MakeWidget({ 5, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_MAIN_SIGN_COLOUR_TIP), // high money MakeWidget({ 43, WH - 16}, {39, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // high money MakeWidget({ 70, WH - 15}, {11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_TEXT_COLOUR_TIP ), // high money - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class BannerWindow final : public Window -{ -private: - CoordsXYZ _bannerViewPos; - - void CreateViewport() + class BannerWindow final : public Window { - Widget* viewportWidget = &window_banner_widgets[WIDX_VIEWPORT]; - ViewportCreate( - this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, - (viewportWidget->width()) - 1, (viewportWidget->height()) - 1, Focus(_bannerViewPos)); + private: + CoordsXYZ _bannerViewPos; - if (viewport != nullptr) - viewport->flags = gConfigGeneral.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : 0; - Invalidate(); - } - - BannerIndex GetBannerIndex() const - { - return BannerIndex::FromUnderlying(number); - } - - BannerElement* GetBannerElement() - { - auto* banner = GetBanner(GetBannerIndex()); - if (banner == nullptr) + void CreateViewport() { - return nullptr; + Widget* viewportWidget = &window_banner_widgets[WIDX_VIEWPORT]; + ViewportCreate( + this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, + (viewportWidget->width()) - 1, (viewportWidget->height()) - 1, Focus(_bannerViewPos)); + + if (viewport != nullptr) + viewport->flags = gConfigGeneral.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE; + Invalidate(); } - TileElement* tileElement = MapGetFirstElementAt(banner->position); - if (tileElement == nullptr) + BannerIndex GetBannerIndex() const { - return nullptr; + return BannerIndex::FromUnderlying(number); } - do + BannerElement* GetBannerElement() { - auto* bannerElement = tileElement->AsBanner(); - if (bannerElement == nullptr) + auto* banner = GetBanner(GetBannerIndex()); + if (banner == nullptr) { - continue; + return nullptr; } - if (bannerElement->GetIndex() == GetBannerIndex()) + + TileElement* tileElement = MapGetFirstElementAt(banner->position); + if (tileElement == nullptr) { - return bannerElement; + return nullptr; } - } while (!(tileElement++)->IsLastForTile()); - return nullptr; - } - -public: - void OnOpen() override - { - widgets = window_banner_widgets; - WindowInitScrollWidgets(*this); - } - - void Initialise(rct_windownumber _number) - { - number = _number; - auto* banner = GetBanner(BannerIndex::FromUnderlying(number)); - - auto* bannerElement = GetBannerElement(); - if (bannerElement == nullptr) - return; - - _bannerViewPos = CoordsXYZ{ banner->position.ToCoordsXY().ToTileCentre(), bannerElement->GetBaseZ() }; - CreateViewport(); - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - Widget* widget = &widgets[widgetIndex]; - auto* banner = GetBanner(GetBannerIndex()); - if (banner == nullptr) - { - Close(); - return; - } - switch (widgetIndex) - { - case WIDX_MAIN_COLOUR: - WindowDropdownShowColour(this, widget, TRANSLUCENT(colours[1]), banner->colour); - break; - case WIDX_TEXT_COLOUR_DROPDOWN_BUTTON: - - for (int32_t i = 0; i < 13; ++i) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = BannerColouredTextFormats[i + 1]; - } - - // Switch to the dropdown box widget. - widget--; - - WindowDropdownShowTextCustomWidth( - { widget->left + windowPos.x, widget->top + windowPos.y }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, 13, widget->width() - 3); - - Dropdown::SetChecked(banner->text_colour - 1, true); - break; - } - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - auto* banner = GetBanner(GetBannerIndex()); - if (banner == nullptr) - { - Close(); - return; - } - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_BANNER_DEMOLISH: + do { - auto* bannerElement = GetBannerElement(); + auto* bannerElement = tileElement->AsBanner(); if (bannerElement == nullptr) - break; + { + continue; + } + if (bannerElement->GetIndex() == GetBannerIndex()) + { + return bannerElement; + } + } while (!(tileElement++)->IsLastForTile()); - auto bannerRemoveAction = BannerRemoveAction( - { banner->position.ToCoordsXY(), bannerElement->GetBaseZ(), bannerElement->GetPosition() }); - GameActions::Execute(&bannerRemoveAction); - break; - } - case WIDX_BANNER_TEXT: - WindowTextInputRawOpen( - this, WIDX_BANNER_TEXT, STR_BANNER_TEXT, STR_ENTER_BANNER_TEXT, {}, banner->GetText().c_str(), 32); - break; - case WIDX_BANNER_NO_ENTRY: + return nullptr; + } + + public: + void OnOpen() override + { + widgets = window_banner_widgets; + WindowInitScrollWidgets(*this); + } + + void Initialise(rct_windownumber _number) + { + number = _number; + auto* banner = GetBanner(BannerIndex::FromUnderlying(number)); + + auto* bannerElement = GetBannerElement(); + if (bannerElement == nullptr) + return; + + _bannerViewPos = CoordsXYZ{ banner->position.ToCoordsXY().ToTileCentre(), bannerElement->GetBaseZ() }; + CreateViewport(); + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + Widget* widget = &widgets[widgetIndex]; + auto* banner = GetBanner(GetBannerIndex()); + if (banner == nullptr) { - TextinputCancel(); - auto bannerSetStyle = BannerSetStyleAction( - BannerSetStyleType::NoEntry, GetBannerIndex(), banner->flags ^ BANNER_FLAG_NO_ENTRY); - GameActions::Execute(&bannerSetStyle); - break; + Close(); + return; } - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - switch (widgetIndex) - { - case WIDX_MAIN_COLOUR: + switch (widgetIndex) { - if (dropdownIndex == -1) + case WIDX_MAIN_COLOUR: + WindowDropdownShowColour(this, widget, TRANSLUCENT(colours[1]), banner->colour); break; + case WIDX_TEXT_COLOUR_DROPDOWN_BUTTON: - auto bannerSetStyle = BannerSetStyleAction( - BannerSetStyleType::PrimaryColour, GetBannerIndex(), ColourDropDownIndexToColour(dropdownIndex)); - GameActions::Execute(&bannerSetStyle); - break; + for (int32_t i = 0; i < 13; ++i) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = BannerColouredTextFormats[i + 1]; + } + + // Switch to the dropdown box widget. + widget--; + + WindowDropdownShowTextCustomWidth( + { widget->left + windowPos.x, widget->top + windowPos.y }, widget->height() + 1, colours[1], 0, + Dropdown::Flag::StayOpen, 13, widget->width() - 3); + + Dropdown::SetChecked(banner->text_colour - 1, true); + break; } - case WIDX_TEXT_COLOUR_DROPDOWN_BUTTON: + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + auto* banner = GetBanner(GetBannerIndex()); + if (banner == nullptr) { - if (dropdownIndex == -1) + Close(); + return; + } + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); break; - auto bannerSetStyle = BannerSetStyleAction(BannerSetStyleType::TextColour, GetBannerIndex(), dropdownIndex + 1); - GameActions::Execute(&bannerSetStyle); - break; + case WIDX_BANNER_DEMOLISH: + { + auto* bannerElement = GetBannerElement(); + if (bannerElement == nullptr) + break; + + auto bannerRemoveAction = BannerRemoveAction( + { banner->position.ToCoordsXY(), bannerElement->GetBaseZ(), bannerElement->GetPosition() }); + GameActions::Execute(&bannerRemoveAction); + break; + } + case WIDX_BANNER_TEXT: + WindowTextInputRawOpen( + this, WIDX_BANNER_TEXT, STR_BANNER_TEXT, STR_ENTER_BANNER_TEXT, {}, banner->GetText().c_str(), 32); + break; + case WIDX_BANNER_NO_ENTRY: + { + TextinputCancel(); + auto bannerSetStyle = BannerSetStyleAction( + BannerSetStyleType::NoEntry, GetBannerIndex(), banner->flags ^ BANNER_FLAG_NO_ENTRY); + GameActions::Execute(&bannerSetStyle); + break; + } } } - } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (widgetIndex == WIDX_BANNER_TEXT) + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { - auto bannerSetNameAction = BannerSetNameAction(GetBannerIndex(), std::string(text)); - GameActions::Execute(&bannerSetNameAction); + switch (widgetIndex) + { + case WIDX_MAIN_COLOUR: + { + if (dropdownIndex == -1) + break; + + auto bannerSetStyle = BannerSetStyleAction( + BannerSetStyleType::PrimaryColour, GetBannerIndex(), ColourDropDownIndexToColour(dropdownIndex)); + GameActions::Execute(&bannerSetStyle); + break; + } + case WIDX_TEXT_COLOUR_DROPDOWN_BUTTON: + { + if (dropdownIndex == -1) + break; + auto bannerSetStyle = BannerSetStyleAction( + BannerSetStyleType::TextColour, GetBannerIndex(), dropdownIndex + 1); + GameActions::Execute(&bannerSetStyle); + break; + } + } } - } - void OnViewportRotate() override - { - RemoveViewport(); - CreateViewport(); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - if (viewport != nullptr) + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override { - WindowDrawViewport(dpi, *this); + if (widgetIndex == WIDX_BANNER_TEXT) + { + auto bannerSetNameAction = BannerSetNameAction(GetBannerIndex(), std::string(text)); + GameActions::Execute(&bannerSetNameAction); + } } - } - void OnPrepareDraw() override + void OnViewportRotate() override + { + RemoveViewport(); + CreateViewport(); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + if (viewport != nullptr) + { + WindowDrawViewport(dpi, *this); + } + } + + void OnPrepareDraw() override + { + auto* banner = GetBanner(GetBannerIndex()); + if (banner == nullptr) + { + return; + } + Widget* colourBtn = &window_banner_widgets[WIDX_MAIN_COLOUR]; + colourBtn->type = WindowWidgetType::Empty; + + auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(banner->type); + if (bannerEntry != nullptr && (bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR)) + { + colourBtn->type = WindowWidgetType::ColourBtn; + } + pressed_widgets &= ~(1uLL << WIDX_BANNER_NO_ENTRY); + disabled_widgets &= ~( + (1uLL << WIDX_BANNER_TEXT) | (1uLL << WIDX_TEXT_COLOUR_DROPDOWN) | (1uLL << WIDX_TEXT_COLOUR_DROPDOWN_BUTTON)); + if (banner->flags & BANNER_FLAG_NO_ENTRY) + { + pressed_widgets |= (1uLL << WIDX_BANNER_NO_ENTRY); + disabled_widgets |= (1uLL << WIDX_BANNER_TEXT) | (1uLL << WIDX_TEXT_COLOUR_DROPDOWN) + | (1uLL << WIDX_TEXT_COLOUR_DROPDOWN_BUTTON); + } + colourBtn->image = GetColourButtonImage(banner->colour); + Widget* dropDownWidget = &window_banner_widgets[WIDX_TEXT_COLOUR_DROPDOWN]; + dropDownWidget->text = BannerColouredTextFormats[banner->text_colour]; + } + + void OnResize() override + { + ResizeFrame(); + } + }; + + /** + * + * rct2: 0x006BA305 + */ + WindowBase* BannerOpen(rct_windownumber number) { - auto* banner = GetBanner(GetBannerIndex()); - if (banner == nullptr) - { - return; - } - Widget* colourBtn = &window_banner_widgets[WIDX_MAIN_COLOUR]; - colourBtn->type = WindowWidgetType::Empty; + auto w = static_cast(WindowBringToFrontByNumber(WindowClass::Banner, number)); - auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(banner->type); - if (bannerEntry != nullptr && (bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR)) - { - colourBtn->type = WindowWidgetType::ColourBtn; - } - pressed_widgets &= ~(1uLL << WIDX_BANNER_NO_ENTRY); - disabled_widgets &= ~( - (1uLL << WIDX_BANNER_TEXT) | (1uLL << WIDX_TEXT_COLOUR_DROPDOWN) | (1uLL << WIDX_TEXT_COLOUR_DROPDOWN_BUTTON)); - if (banner->flags & BANNER_FLAG_NO_ENTRY) - { - pressed_widgets |= (1uLL << WIDX_BANNER_NO_ENTRY); - disabled_widgets |= (1uLL << WIDX_BANNER_TEXT) | (1uLL << WIDX_TEXT_COLOUR_DROPDOWN) - | (1uLL << WIDX_TEXT_COLOUR_DROPDOWN_BUTTON); - } - colourBtn->image = GetColourButtonImage(banner->colour); - Widget* dropDownWidget = &window_banner_widgets[WIDX_TEXT_COLOUR_DROPDOWN]; - dropDownWidget->text = BannerColouredTextFormats[banner->text_colour]; - } + if (w != nullptr) + return w; - void OnResize() override - { - ResizeFrame(); - } -}; + w = WindowCreate(WindowClass::Banner, WW, WH, 0); -/** - * - * rct2: 0x006BA305 - */ -WindowBase* WindowBannerOpen(rct_windownumber number) -{ - auto w = static_cast(WindowBringToFrontByNumber(WindowClass::Banner, number)); + if (w != nullptr) + w->Initialise(number); - if (w != nullptr) return w; - - w = WindowCreate(WindowClass::Banner, WW, WH, 0); - - if (w != nullptr) - w->Initialise(number); - - return w; -} + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 2a3c8aa2b4..4c227c27bc 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -25,9 +25,9 @@ #include #include -using namespace OpenRCT2; - -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum { WIDX_BACKGROUND, WIDX_TITLE, @@ -48,292 +48,293 @@ static Widget _windowChangelogWidgets[] = { MakeWidget({0, 14}, {500, 382}, WindowWidgetType::Resize, WindowColour::Secondary ), // content panel MakeWidget({3, 16}, {495, 366}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ), // scroll area MakeWidget({3, 473}, {300, 14}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_NEW_RELEASE_DOWNLOAD_PAGE), // changelog button - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class ChangelogWindow final : public Window -{ - const NewVersionInfo* _newVersionInfo; - std::vector _changelogLines; - int32_t _changelogLongestLineWidth = 0; - int _personality = 0; - -public: - /** - * @brief Retrieves the changelog contents. - */ - const std::string GetText(PATHID pathId) + class ChangelogWindow final : public Window { - auto env = GetContext()->GetPlatformEnvironment(); - auto path = env->GetFilePath(pathId); - auto fs = std::ifstream(fs::u8path(path), std::ios::in); - if (!fs.is_open()) + const NewVersionInfo* _newVersionInfo; + std::vector _changelogLines; + int32_t _changelogLongestLineWidth = 0; + int _personality = 0; + + public: + /** + * @brief Retrieves the changelog contents. + */ + const std::string GetText(PATHID pathId) { - throw std::runtime_error("Unable to open " + path); + auto env = GetContext()->GetPlatformEnvironment(); + auto path = env->GetFilePath(pathId); + auto fs = std::ifstream(fs::u8path(path), std::ios::in); + if (!fs.is_open()) + { + throw std::runtime_error("Unable to open " + path); + } + fs.seekg(0, fs.end); + auto length = fs.tellg(); + fs.seekg(0, fs.beg); + std::unique_ptr buffer = std::make_unique(length); + fs.read(buffer.get(), length); + auto result = std::string(buffer.get(), buffer.get() + length); + return result; } - fs.seekg(0, fs.end); - auto length = fs.tellg(); - fs.seekg(0, fs.beg); - std::unique_ptr buffer = std::make_unique(length); - fs.read(buffer.get(), length); - auto result = std::string(buffer.get(), buffer.get() + length); - return result; - } - /** - * @brief Set the Changelog Window's Personality, should be called just after creation. Returns true on success - * - * @param personality - */ - bool SetPersonality(int personality) - { - switch (personality) + /** + * @brief Set the Changelog Window's Personality, should be called just after creation. Returns true on success + * + * @param personality + */ + bool SetPersonality(int personality) { - case WV_NEW_VERSION_INFO: - if (!GetContext()->HasNewVersionInfo()) - { - return false; - } - _personality = WV_NEW_VERSION_INFO; - NewVersionProcessInfo(); - widgets[WIDX_OPEN_URL].type = WindowWidgetType::Button; - return true; + switch (personality) + { + case WV_NEW_VERSION_INFO: + if (!GetContext()->HasNewVersionInfo()) + { + return false; + } + _personality = WV_NEW_VERSION_INFO; + NewVersionProcessInfo(); + widgets[WIDX_OPEN_URL].type = WindowWidgetType::Button; + return true; - case WV_CHANGELOG: - if (!ReadFile(PATHID::CHANGELOG)) - { - return false; - } - _personality = WV_CHANGELOG; - widgets[WIDX_TITLE].text = STR_CHANGELOG_TITLE; - return true; + case WV_CHANGELOG: + if (!ReadFile(PATHID::CHANGELOG)) + { + return false; + } + _personality = WV_CHANGELOG; + widgets[WIDX_TITLE].text = STR_CHANGELOG_TITLE; + return true; - case WV_CONTRIBUTORS: - if (!ReadFile(PATHID::CONTRIBUTORS)) - { - return false; - } - _personality = WV_CONTRIBUTORS; - widgets[WIDX_TITLE].text = STR_CONTRIBUTORS_WINDOW; - return true; + case WV_CONTRIBUTORS: + if (!ReadFile(PATHID::CONTRIBUTORS)) + { + return false; + } + _personality = WV_CONTRIBUTORS; + widgets[WIDX_TITLE].text = STR_CONTRIBUTORS_WINDOW; + return true; - default: - LOG_ERROR("Invalid personality for changelog window: %d", personality); + default: + LOG_ERROR("Invalid personality for changelog window: %d", personality); + return false; + } + } + + void OnOpen() override + { + widgets = _windowChangelogWidgets; + + WindowInitScrollWidgets(*this); + min_width = MIN_WW; + min_height = MIN_WH; + max_width = MIN_WW; + max_height = MIN_WH; + } + + void OnResize() override + { + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + + max_width = (screenWidth * 4) / 5; + max_height = (screenHeight * 4) / 5; + + min_width = MIN_WW; + min_height = MIN_WH; + + auto download_button_width = widgets[WIDX_OPEN_URL].width(); + widgets[WIDX_OPEN_URL].left = (width - download_button_width) / 2; + widgets[WIDX_OPEN_URL].right = widgets[WIDX_OPEN_URL].left + download_button_width; + + if (width < min_width) + { + Invalidate(); + width = min_width; + } + if (height < min_height) + { + Invalidate(); + height = min_height; + } + } + + void OnPrepareDraw() override + { + ResizeFrameWithPage(); + widgets[WIDX_SCROLL].right = width - 3; + widgets[WIDX_SCROLL].bottom = height - 22; + widgets[WIDX_OPEN_URL].bottom = height - 5; + widgets[WIDX_OPEN_URL].top = height - 19; + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_OPEN_URL: + if (_newVersionInfo != nullptr) + { + GetContext()->GetUiContext()->OpenURL(_newVersionInfo->url); + } + else + { + LOG_ERROR("Cannot open URL: NewVersionInfo for ChangelogWindow is undefined!"); + } + break; + } + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + const int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + + ScreenCoordsXY screenCoords(3, 3 - lineHeight); + for (const auto& line : _changelogLines) + { + screenCoords.y += lineHeight; + if (screenCoords.y + lineHeight < dpi.y || screenCoords.y >= dpi.y + dpi.height) + continue; + + GfxDrawString(dpi, screenCoords, line.c_str(), { colours[0] }); + } + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + return ScreenSize( + _changelogLongestLineWidth + 4, + static_cast(_changelogLines.size()) * FontGetLineHeight(FontStyle::Medium)); + } + + // TODO: This probably should be a utility function defined elsewhere for reusability + /** + * @brief Reimplementation of Window's GetCentrePositionForNewWindow for ChangelogWindow. + * + * @return ScreenCoordsXY + */ + static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t height) + { + auto uiContext = GetContext()->GetUiContext(); + auto screenWidth = uiContext->GetWidth(); + auto screenHeight = uiContext->GetHeight(); + return ScreenCoordsXY{ (screenWidth - width) / 2, std::max(TOP_TOOLBAR_HEIGHT + 1, (screenHeight - height) / 2) }; + } + + private: + /** + * @brief Converts NewVersionInfo into changelog lines + * + */ + void NewVersionProcessInfo() + { + _newVersionInfo = GetContext()->GetNewVersionInfo(); + if (_newVersionInfo != nullptr) + { + char version_info[256]; + + const char* version_info_ptr = _newVersionInfo->name.c_str(); + FormatStringLegacy(version_info, 256, STR_NEW_RELEASE_VERSION_INFO, &version_info_ptr); + + _changelogLines.emplace_back(version_info); + _changelogLines.emplace_back(""); + + ProcessText(_newVersionInfo->changelog); + } + else + { + LOG_ERROR("ChangelogWindow: Could not process NewVersionInfo, result was undefined"); + } + } + + /** + * @brief Get the absolute path for the changelog file + * + * @return std::string + */ + std::string GetChangelogPath() + { + auto env = GetContext()->GetPlatformEnvironment(); + return env->GetFilePath(PATHID::CHANGELOG); + } + + /** + * @brief Attempts to read the changelog file, returns true on success + * + */ + bool ReadFile(PATHID pathId) + { + std::string _text; + try + { + _text = GetText(pathId); + } + catch (const std::bad_alloc&) + { + LOG_ERROR("Unable to allocate memory for text file"); return false; + } + catch (const std::exception&) + { + LOG_ERROR("Unable to read text file"); + return false; + } + + ProcessText(_text); + return true; } - } - void OnOpen() override - { - widgets = _windowChangelogWidgets; - - WindowInitScrollWidgets(*this); - min_width = MIN_WW; - min_height = MIN_WH; - max_width = MIN_WW; - max_height = MIN_WH; - } - - void OnResize() override - { - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - - max_width = (screenWidth * 4) / 5; - max_height = (screenHeight * 4) / 5; - - min_width = MIN_WW; - min_height = MIN_WH; - - auto download_button_width = widgets[WIDX_OPEN_URL].width(); - widgets[WIDX_OPEN_URL].left = (width - download_button_width) / 2; - widgets[WIDX_OPEN_URL].right = widgets[WIDX_OPEN_URL].left + download_button_width; - - if (width < min_width) + /** + * @brief Ingests a string of text and splits it into lines for the changelog and updates the longest line width for + * scrolling purposes + * + * @param text + */ + void ProcessText(const std::string& text) { - Invalidate(); - width = min_width; - } - if (height < min_height) - { - Invalidate(); - height = min_height; - } - } + std::string::size_type pos = 0; + std::string::size_type prev = 0; + while ((pos = text.find('\n', prev)) != std::string::npos) + { + _changelogLines.push_back(text.substr(prev, pos - prev)); + prev = pos + 1; + } - void OnPrepareDraw() override + // To get the last substring (or only, if delimiter is not found) + _changelogLines.push_back(text.substr(prev)); + + _changelogLongestLineWidth = 0; + for (const auto& line : _changelogLines) + { + int32_t linewidth = GfxGetStringWidth(line.c_str(), FontStyle::Medium); + _changelogLongestLineWidth = std::max(linewidth, _changelogLongestLineWidth); + } + } + }; + + WindowBase* ChangelogOpen(int personality) { - ResizeFrameWithPage(); - widgets[WIDX_SCROLL].right = width - 3; - widgets[WIDX_SCROLL].bottom = height - 22; - widgets[WIDX_OPEN_URL].bottom = height - 5; - widgets[WIDX_OPEN_URL].top = height - 19; - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + auto* window = WindowBringToFrontByClass(WindowClass::Changelog); + if (window == nullptr) { - case WIDX_CLOSE: - Close(); - break; - case WIDX_OPEN_URL: - if (_newVersionInfo != nullptr) - { - GetContext()->GetUiContext()->OpenURL(_newVersionInfo->url); - } - else - { - LOG_ERROR("Cannot open URL: NewVersionInfo for ChangelogWindow is undefined!"); - } - break; + // Create a new centred window + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + int32_t width = (screenWidth * 4) / 5; + int32_t height = (screenHeight * 4) / 5; + + auto pos = ChangelogWindow::GetCentrePositionForNewWindow(width, height); + auto* newWindow = WindowCreate(WindowClass::Changelog, pos, width, height, WF_RESIZABLE); + newWindow->SetPersonality(personality); + return newWindow; } + return window; } - - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - const int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); - - ScreenCoordsXY screenCoords(3, 3 - lineHeight); - for (const auto& line : _changelogLines) - { - screenCoords.y += lineHeight; - if (screenCoords.y + lineHeight < dpi.y || screenCoords.y >= dpi.y + dpi.height) - continue; - - GfxDrawString(dpi, screenCoords, line.c_str(), { colours[0] }); - } - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - return ScreenSize( - _changelogLongestLineWidth + 4, - static_cast(_changelogLines.size()) * FontGetLineHeight(FontStyle::Medium)); - } - - // TODO: This probably should be a utility function defined elsewhere for reusability - /** - * @brief Reimplementation of Window's GetCentrePositionForNewWindow for ChangelogWindow. - * - * @return ScreenCoordsXY - */ - static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t height) - { - auto uiContext = GetContext()->GetUiContext(); - auto screenWidth = uiContext->GetWidth(); - auto screenHeight = uiContext->GetHeight(); - return ScreenCoordsXY{ (screenWidth - width) / 2, std::max(TOP_TOOLBAR_HEIGHT + 1, (screenHeight - height) / 2) }; - } - -private: - /** - * @brief Converts NewVersionInfo into changelog lines - * - */ - void NewVersionProcessInfo() - { - _newVersionInfo = GetContext()->GetNewVersionInfo(); - if (_newVersionInfo != nullptr) - { - char version_info[256]; - - const char* version_info_ptr = _newVersionInfo->name.c_str(); - FormatStringLegacy(version_info, 256, STR_NEW_RELEASE_VERSION_INFO, &version_info_ptr); - - _changelogLines.emplace_back(version_info); - _changelogLines.emplace_back(""); - - ProcessText(_newVersionInfo->changelog); - } - else - { - LOG_ERROR("ChangelogWindow: Could not process NewVersionInfo, result was undefined"); - } - } - - /** - * @brief Get the absolute path for the changelog file - * - * @return std::string - */ - std::string GetChangelogPath() - { - auto env = GetContext()->GetPlatformEnvironment(); - return env->GetFilePath(PATHID::CHANGELOG); - } - - /** - * @brief Attempts to read the changelog file, returns true on success - * - */ - bool ReadFile(PATHID pathId) - { - std::string _text; - try - { - _text = GetText(pathId); - } - catch (const std::bad_alloc&) - { - LOG_ERROR("Unable to allocate memory for text file"); - return false; - } - catch (const std::exception&) - { - LOG_ERROR("Unable to read text file"); - return false; - } - - ProcessText(_text); - return true; - } - - /** - * @brief Ingests a string of text and splits it into lines for the changelog and updates the longest line width for - * scrolling purposes - * - * @param text - */ - void ProcessText(const std::string& text) - { - std::string::size_type pos = 0; - std::string::size_type prev = 0; - while ((pos = text.find('\n', prev)) != std::string::npos) - { - _changelogLines.push_back(text.substr(prev, pos - prev)); - prev = pos + 1; - } - - // To get the last substring (or only, if delimiter is not found) - _changelogLines.push_back(text.substr(prev)); - - _changelogLongestLineWidth = 0; - for (const auto& line : _changelogLines) - { - int32_t linewidth = GfxGetStringWidth(line.c_str(), FontStyle::Medium); - _changelogLongestLineWidth = std::max(linewidth, _changelogLongestLineWidth); - } - } -}; - -WindowBase* WindowChangelogOpen(int personality) -{ - auto* window = WindowBringToFrontByClass(WindowClass::Changelog); - if (window == nullptr) - { - // Create a new centred window - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - int32_t width = (screenWidth * 4) / 5; - int32_t height = (screenHeight * 4) / 5; - - auto pos = ChangelogWindow::GetCentrePositionForNewWindow(width, height); - auto* newWindow = WindowCreate(WindowClass::Changelog, pos, width, height, WF_RESIZABLE); - newWindow->SetPersonality(personality); - return newWindow; - } - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 31641e2c83..3291f90931 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -28,13 +28,13 @@ #include #include -using namespace OpenRCT2; using OpenRCT2::Date; +namespace OpenRCT2::Ui::Windows +{ + constexpr auto CHEATS_MONEY_DEFAULT = 10000.00_GBP; + constexpr auto CHEATS_MONEY_INCREMENT_DIV = 5000.00_GBP; -constexpr auto CHEATS_MONEY_DEFAULT = 10000.00_GBP; -constexpr auto CHEATS_MONEY_INCREMENT_DIV = 5000.00_GBP; - -// clang-format off + // clang-format off enum { WINDOW_CHEATS_PAGE_MONEY, @@ -219,7 +219,7 @@ static Widget window_cheats_money_widgets[] = MakeSpinnerWidgets({120, 239}, CHEAT_SPINNER, WindowWidgetType::Spinner, WindowColour::Secondary ), // Day box MakeWidget ({ 11, 258}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_DATE_SET ), // Set Date MakeWidget ({127, 258}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_DATE_RESET ), // Reset Date - WIDGETS_END, + kWidgetsEnd, }; static Widget window_cheats_guests_widgets[] = @@ -252,7 +252,7 @@ static Widget window_cheats_guests_widgets[] = MakeWidget({127, 384}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_SHOP_ITEM_PLURAL_UMBRELLA ), // give guests umbrellas MakeWidget({ 11, 426}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_LARGE_TRAM_GUESTS, STR_CHEAT_LARGE_TRAM_GUESTS_TIP), // large tram MakeWidget({127, 426}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_REMOVE_ALL_GUESTS, STR_CHEAT_REMOVE_ALL_GUESTS_TIP), // remove all guests - WIDGETS_END, + kWidgetsEnd, }; //Strings for following moved to window_cheats_paint() @@ -293,7 +293,7 @@ static Widget window_cheats_misc_widgets[] = MakeWidget ({ 11, 407}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_PATH_AS_QUEUE, STR_CHEAT_ALLOW_PATH_AS_QUEUE_TIP ), // Allow regular footpaths as queue path MakeWidget ({ 11, 428}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES, STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES_TIP ), // Allow special colours in dropdown - WIDGETS_END, + kWidgetsEnd, }; static Widget window_cheats_rides_widgets[] = { @@ -319,7 +319,7 @@ static Widget window_cheats_rides_widgets[] = MakeWidget({ 11, 384}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES ), // Show vehicles from other track types MakeWidget({ 11, 405}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_TRAIN_LENGTH_LIMIT, STR_CHEAT_DISABLE_TRAIN_LENGTH_LIMIT_TIP ), // Disable train length limits MakeWidget({ 11, 426}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_IGNORE_RESEARCH_STATUS, STR_CHEAT_IGNORE_RESEARCH_STATUS_TIP ), // Ignore Research Status - WIDGETS_END, + kWidgetsEnd, }; static Widget *window_cheats_page_widgets[] = @@ -355,793 +355,807 @@ static StringId window_cheats_page_titles[] = { STR_CHEAT_TITLE_PARK, STR_CHEAT_TITLE_RIDE, }; -// clang-format on + // clang-format on -class CheatsWindow final : public Window -{ -private: - char _moneySpinnerText[MONEY_STRING_MAXLENGTH]{}; - money64 _moneySpinnerValue = CHEATS_MONEY_DEFAULT; - int32_t _parkRatingSpinnerValue{}; - int32_t _yearSpinnerValue = 1; - int32_t _monthSpinnerValue = 1; - int32_t _daySpinnerValue = 1; - -public: - void OnOpen() override + class CheatsWindow final : public Window { - SetPage(WINDOW_CHEATS_PAGE_MONEY); - _parkRatingSpinnerValue = ParkGetForcedRating() >= 0 ? ParkGetForcedRating() : 999; - } + private: + char _moneySpinnerText[MONEY_STRING_MAXLENGTH]{}; + money64 _moneySpinnerValue = CHEATS_MONEY_DEFAULT; + int32_t _parkRatingSpinnerValue{}; + int32_t _yearSpinnerValue = 1; + int32_t _monthSpinnerValue = 1; + int32_t _daySpinnerValue = 1; - void OnUpdate() override - { - frame_no++; - InvalidateWidget(WIDX_TAB_1 + page); - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (page) + public: + void OnOpen() override { - case WINDOW_CHEATS_PAGE_MONEY: - OnMouseDownMoney(widgetIndex); - break; - case WINDOW_CHEATS_PAGE_MISC: - OnMouseDownMisc(widgetIndex); - break; + SetPage(WINDOW_CHEATS_PAGE_MONEY); + _parkRatingSpinnerValue = ParkGetForcedRating() >= 0 ? ParkGetForcedRating() : 999; } - } - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + void OnUpdate() override { - case WIDX_CLOSE: - Close(); - break; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - SetPage(widgetIndex - WIDX_TAB_1); - break; - default: - switch (page) + frame_no++; + InvalidateWidget(WIDX_TAB_1 + page); + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (page) + { + case WINDOW_CHEATS_PAGE_MONEY: + OnMouseDownMoney(widgetIndex); + break; + case WINDOW_CHEATS_PAGE_MISC: + OnMouseDownMisc(widgetIndex); + break; + } + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + SetPage(widgetIndex - WIDX_TAB_1); + break; + default: + switch (page) + { + case WINDOW_CHEATS_PAGE_MONEY: + OnMouseUpMoney(widgetIndex); + break; + case WINDOW_CHEATS_PAGE_GUESTS: + OnMouseUpGuests(widgetIndex); + break; + case WINDOW_CHEATS_PAGE_MISC: + OnMouseUpMisc(widgetIndex); + break; + case WINDOW_CHEATS_PAGE_RIDES: + OnMouseUpRides(widgetIndex); + break; + } + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + if (page == WINDOW_CHEATS_PAGE_MISC) + { + OnDropdownMisc(widgetIndex, selectedIndex); + } + } + + void OnPrepareDraw() override + { + auto* targetWidgets = window_cheats_page_widgets[page]; + if (widgets != targetWidgets) + { + widgets = targetWidgets; + WindowInitScrollWidgets(*this); + } + + pressed_widgets = 0; + disabled_widgets = 0; + + // Set correct active tab + for (auto i = 0; i < WINDOW_CHEATS_PAGE_COUNT; i++) + SetWidgetPressed(WIDX_TAB_1 + i, false); + SetWidgetPressed(WIDX_TAB_1 + page, true); + + // Set title + widgets[WIDX_TITLE].text = window_cheats_page_titles[page]; + + auto& gameState = GetGameState(); + switch (page) + { + case WINDOW_CHEATS_PAGE_MONEY: { - case WINDOW_CHEATS_PAGE_MONEY: - OnMouseUpMoney(widgetIndex); - break; - case WINDOW_CHEATS_PAGE_GUESTS: - OnMouseUpGuests(widgetIndex); - break; - case WINDOW_CHEATS_PAGE_MISC: - OnMouseUpMisc(widgetIndex); - break; - case WINDOW_CHEATS_PAGE_RIDES: - OnMouseUpRides(widgetIndex); - break; + auto moneyDisabled = (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) != 0; + SetCheckboxValue(WIDX_NO_MONEY, moneyDisabled); + SetWidgetDisabled(WIDX_ADD_SET_MONEY_GROUP, moneyDisabled); + SetWidgetDisabled(WIDX_MONEY_SPINNER, moneyDisabled); + SetWidgetDisabled(WIDX_MONEY_SPINNER_INCREMENT, moneyDisabled); + SetWidgetDisabled(WIDX_MONEY_SPINNER_DECREMENT, moneyDisabled); + SetWidgetDisabled(WIDX_ADD_MONEY, moneyDisabled); + SetWidgetDisabled(WIDX_SET_MONEY, moneyDisabled); + SetWidgetDisabled(WIDX_CLEAR_LOAN, moneyDisabled); + break; } - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - if (page == WINDOW_CHEATS_PAGE_MISC) - { - OnDropdownMisc(widgetIndex, selectedIndex); - } - } - - void OnPrepareDraw() override - { - auto* targetWidgets = window_cheats_page_widgets[page]; - if (widgets != targetWidgets) - { - widgets = targetWidgets; - WindowInitScrollWidgets(*this); - } - - pressed_widgets = 0; - disabled_widgets = 0; - - // Set correct active tab - for (auto i = 0; i < WINDOW_CHEATS_PAGE_COUNT; i++) - SetWidgetPressed(WIDX_TAB_1 + i, false); - SetWidgetPressed(WIDX_TAB_1 + page, true); - - // Set title - widgets[WIDX_TITLE].text = window_cheats_page_titles[page]; - - auto& gameState = GetGameState(); - switch (page) - { - case WINDOW_CHEATS_PAGE_MONEY: - { - auto moneyDisabled = (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) != 0; - SetCheckboxValue(WIDX_NO_MONEY, moneyDisabled); - SetWidgetDisabled(WIDX_ADD_SET_MONEY_GROUP, moneyDisabled); - SetWidgetDisabled(WIDX_MONEY_SPINNER, moneyDisabled); - SetWidgetDisabled(WIDX_MONEY_SPINNER_INCREMENT, moneyDisabled); - SetWidgetDisabled(WIDX_MONEY_SPINNER_DECREMENT, moneyDisabled); - SetWidgetDisabled(WIDX_ADD_MONEY, moneyDisabled); - SetWidgetDisabled(WIDX_SET_MONEY, moneyDisabled); - SetWidgetDisabled(WIDX_CLEAR_LOAN, moneyDisabled); - break; - } - case WINDOW_CHEATS_PAGE_GUESTS: - { - auto ft = Formatter::Common(); - ft.Add(1000.00_GBP); - SetCheckboxValue(WIDX_GUEST_IGNORE_RIDE_INTENSITY, gCheatsIgnoreRideIntensity); - SetCheckboxValue(WIDX_DISABLE_VANDALISM, gCheatsDisableVandalism); - SetCheckboxValue(WIDX_DISABLE_LITTERING, gCheatsDisableLittering); - break; - } - case WINDOW_CHEATS_PAGE_MISC: - widgets[WIDX_OPEN_CLOSE_PARK].text = (gameState.ParkFlags & PARK_FLAGS_PARK_OPEN) ? STR_CHEAT_CLOSE_PARK - : STR_CHEAT_OPEN_PARK; - SetCheckboxValue(WIDX_FORCE_PARK_RATING, ParkGetForcedRating() >= 0); - SetCheckboxValue(WIDX_FREEZE_WEATHER, gCheatsFreezeWeather); - SetCheckboxValue(WIDX_NEVERENDING_MARKETING, gCheatsNeverendingMarketing); - SetCheckboxValue(WIDX_DISABLE_PLANT_AGING, gCheatsDisablePlantAging); - SetCheckboxValue(WIDX_ALLOW_REGULAR_PATH_AS_QUEUE, gCheatsAllowRegularPathAsQueue); - SetCheckboxValue(WIDX_ALLOW_SPECIAL_COLOUR_SCHEMES, gCheatsAllowSpecialColourSchemes); - break; - case WINDOW_CHEATS_PAGE_RIDES: - SetCheckboxValue(WIDX_UNLOCK_OPERATING_LIMITS, gCheatsUnlockOperatingLimits); - SetCheckboxValue(WIDX_DISABLE_BRAKES_FAILURE, gCheatsDisableBrakesFailure); - SetCheckboxValue(WIDX_DISABLE_ALL_BREAKDOWNS, gCheatsDisableAllBreakdowns); - SetCheckboxValue(WIDX_BUILD_IN_PAUSE_MODE, gCheatsBuildInPauseMode); - SetCheckboxValue(WIDX_SHOW_ALL_OPERATING_MODES, gCheatsShowAllOperatingModes); - SetCheckboxValue(WIDX_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES, gCheatsShowVehiclesFromOtherTrackTypes); - SetCheckboxValue(WIDX_DISABLE_TRAIN_LENGTH_LIMITS, gCheatsDisableTrainLengthLimit); - SetCheckboxValue(WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK, gCheatsEnableChainLiftOnAllTrack); - SetCheckboxValue(WIDX_ENABLE_ARBITRARY_RIDE_TYPE_CHANGES, gCheatsAllowArbitraryRideTypeChanges); - SetCheckboxValue(WIDX_DISABLE_RIDE_VALUE_AGING, gCheatsDisableRideValueAging); - SetCheckboxValue(WIDX_IGNORE_RESEARCH_STATUS, gCheatsIgnoreResearchStatus); - SetCheckboxValue(WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES, gCheatsEnableAllDrawableTrackPieces); - SetCheckboxValue(WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, gCheatsAllowTrackPlaceInvalidHeights); - SetCheckboxValue(WIDX_MAKE_DESTRUCTIBLE, gCheatsMakeAllDestructible); - break; - } - - // Current weather - window_cheats_misc_widgets[WIDX_WEATHER].text = WeatherTypes[EnumValue( - OpenRCT2::GetGameState().ClimateCurrent.Weather)]; - // Staff speed - window_cheats_misc_widgets[WIDX_STAFF_SPEED].text = _staffSpeedNames[EnumValue(gCheatsSelectedStaffSpeed)]; - - if (gScreenFlags & SCREEN_FLAGS_EDITOR) - { - SetWidgetDisabled(WIDX_TAB_2, true); - SetWidgetDisabled(WIDX_TAB_3, true); - SetWidgetDisabled(WIDX_NO_MONEY, true); - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - UpdateTabPositions(); - DrawWidgets(dpi); - DrawTabImages(dpi); - - static constexpr int16_t _xLcol = 14; - static constexpr int16_t _xRcol = 208; - - if (page == WINDOW_CHEATS_PAGE_MONEY) - { - auto colour = colours[1]; - auto ft = Formatter(); - ft.Add(_moneySpinnerValue); - if (IsWidgetDisabled(WIDX_MONEY_SPINNER)) - { - colour |= COLOUR_FLAG_INSET; - } - int32_t actual_month = _monthSpinnerValue - 1; - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 93 }, STR_BOTTOM_TOOLBAR_CASH, ft, { colour }); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 198 }, STR_YEAR); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 219 }, STR_MONTH); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 240 }, STR_DAY); - ft = Formatter(); - ft.Add(_yearSpinnerValue); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ _xRcol, 198 }, STR_FORMAT_INTEGER, ft, { colours[1], TextAlignment::RIGHT }); - ft = Formatter(); - ft.Add(actual_month); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ _xRcol, 219 }, STR_FORMAT_MONTH, ft, { colours[1], TextAlignment::RIGHT }); - ft = Formatter(); - ft.Add(_daySpinnerValue); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ _xRcol, 240 }, STR_FORMAT_INTEGER, ft, { colours[1], TextAlignment::RIGHT }); - } - else if (page == WINDOW_CHEATS_PAGE_MISC) - { - { - auto& widget = widgets[WIDX_WEATHER]; - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol - 3, widget.top + 1 }, STR_CHANGE_WEATHER); + case WINDOW_CHEATS_PAGE_GUESTS: + { + auto ft = Formatter::Common(); + ft.Add(1000.00_GBP); + SetCheckboxValue(WIDX_GUEST_IGNORE_RIDE_INTENSITY, gameState.Cheats.IgnoreRideIntensity); + SetCheckboxValue(WIDX_DISABLE_VANDALISM, gameState.Cheats.DisableVandalism); + SetCheckboxValue(WIDX_DISABLE_LITTERING, gameState.Cheats.DisableLittering); + break; + } + case WINDOW_CHEATS_PAGE_MISC: + widgets[WIDX_OPEN_CLOSE_PARK].text = (gameState.ParkFlags & PARK_FLAGS_PARK_OPEN) ? STR_CHEAT_CLOSE_PARK + : STR_CHEAT_OPEN_PARK; + SetCheckboxValue(WIDX_FORCE_PARK_RATING, ParkGetForcedRating() >= 0); + SetCheckboxValue(WIDX_FREEZE_WEATHER, gameState.Cheats.FreezeWeather); + SetCheckboxValue(WIDX_NEVERENDING_MARKETING, gameState.Cheats.NeverendingMarketing); + SetCheckboxValue(WIDX_DISABLE_PLANT_AGING, gameState.Cheats.DisablePlantAging); + SetCheckboxValue(WIDX_ALLOW_REGULAR_PATH_AS_QUEUE, gameState.Cheats.AllowRegularPathAsQueue); + SetCheckboxValue(WIDX_ALLOW_SPECIAL_COLOUR_SCHEMES, gameState.Cheats.AllowSpecialColourSchemes); + break; + case WINDOW_CHEATS_PAGE_RIDES: + SetCheckboxValue(WIDX_UNLOCK_OPERATING_LIMITS, gameState.Cheats.UnlockOperatingLimits); + SetCheckboxValue(WIDX_DISABLE_BRAKES_FAILURE, gameState.Cheats.DisableBrakesFailure); + SetCheckboxValue(WIDX_DISABLE_ALL_BREAKDOWNS, gameState.Cheats.DisableAllBreakdowns); + SetCheckboxValue(WIDX_BUILD_IN_PAUSE_MODE, gameState.Cheats.BuildInPauseMode); + SetCheckboxValue(WIDX_SHOW_ALL_OPERATING_MODES, gameState.Cheats.ShowAllOperatingModes); + SetCheckboxValue( + WIDX_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES, gameState.Cheats.ShowVehiclesFromOtherTrackTypes); + SetCheckboxValue(WIDX_DISABLE_TRAIN_LENGTH_LIMITS, gameState.Cheats.DisableTrainLengthLimit); + SetCheckboxValue(WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK, gameState.Cheats.EnableChainLiftOnAllTrack); + SetCheckboxValue(WIDX_ENABLE_ARBITRARY_RIDE_TYPE_CHANGES, gameState.Cheats.AllowArbitraryRideTypeChanges); + SetCheckboxValue(WIDX_DISABLE_RIDE_VALUE_AGING, gameState.Cheats.DisableRideValueAging); + SetCheckboxValue(WIDX_IGNORE_RESEARCH_STATUS, gameState.Cheats.IgnoreResearchStatus); + SetCheckboxValue(WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES, gameState.Cheats.EnableAllDrawableTrackPieces); + SetCheckboxValue(WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, gameState.Cheats.AllowTrackPlaceInvalidHeights); + SetCheckboxValue(WIDX_MAKE_DESTRUCTIBLE, gameState.Cheats.MakeAllDestructible); + break; } + // Current weather + window_cheats_misc_widgets[WIDX_WEATHER].text = WeatherTypes[EnumValue(gameState.ClimateCurrent.Weather)]; + // Staff speed + window_cheats_misc_widgets[WIDX_STAFF_SPEED].text = _staffSpeedNames[EnumValue( + gameState.Cheats.SelectedStaffSpeed)]; + + if (gScreenFlags & SCREEN_FLAGS_EDITOR) { + SetWidgetDisabled(WIDX_TAB_2, true); + SetWidgetDisabled(WIDX_TAB_3, true); + SetWidgetDisabled(WIDX_NO_MONEY, true); + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + UpdateTabPositions(); + DrawWidgets(dpi); + DrawTabImages(dpi); + + static constexpr int16_t _xLcol = 14; + static constexpr int16_t _xRcol = 208; + + if (page == WINDOW_CHEATS_PAGE_MONEY) + { + auto colour = colours[1]; auto ft = Formatter(); - ft.Add(_parkRatingSpinnerValue); - - auto& widget = widgets[WIDX_PARK_RATING_SPINNER]; + ft.Add(_moneySpinnerValue); + if (IsWidgetDisabled(WIDX_MONEY_SPINNER)) + { + colour |= COLOUR_FLAG_INSET; + } + int32_t actual_month = _monthSpinnerValue - 1; + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 93 }, STR_BOTTOM_TOOLBAR_CASH, ft, { colour }); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 198 }, STR_YEAR); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 219 }, STR_MONTH); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 240 }, STR_DAY); + ft = Formatter(); + ft.Add(_yearSpinnerValue); DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 2 }, STR_FORMAT_INTEGER, ft, { colours[1] }); + dpi, windowPos + ScreenCoordsXY{ _xRcol, 198 }, STR_FORMAT_INTEGER, ft, + { colours[1], TextAlignment::RIGHT }); + ft = Formatter(); + ft.Add(actual_month); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ _xRcol, 219 }, STR_FORMAT_MONTH, ft, { colours[1], TextAlignment::RIGHT }); + ft = Formatter(); + ft.Add(_daySpinnerValue); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ _xRcol, 240 }, STR_FORMAT_INTEGER, ft, + { colours[1], TextAlignment::RIGHT }); } - + else if (page == WINDOW_CHEATS_PAGE_MISC) { - auto& widget = widgets[WIDX_STAFF_SPEED]; - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol - 3, widget.top + 1 }, STR_CHEAT_STAFF_SPEED); + { + auto& widget = widgets[WIDX_WEATHER]; + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol - 3, widget.top + 1 }, STR_CHANGE_WEATHER); + } + + { + auto ft = Formatter(); + ft.Add(_parkRatingSpinnerValue); + + auto& widget = widgets[WIDX_PARK_RATING_SPINNER]; + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 2 }, STR_FORMAT_INTEGER, ft, + { colours[1] }); + } + + { + auto& widget = widgets[WIDX_STAFF_SPEED]; + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol - 3, widget.top + 1 }, STR_CHEAT_STAFF_SPEED); + } + } + else if (page == WINDOW_CHEATS_PAGE_GUESTS) + { + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 72 }, STR_CHEAT_GUEST_HAPPINESS); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 93 }, STR_CHEAT_GUEST_ENERGY); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 114 }, STR_CHEAT_GUEST_HUNGER); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 135 }, STR_CHEAT_GUEST_THIRST); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 156 }, STR_CHEAT_GUEST_NAUSEA); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 177 }, STR_CHEAT_GUEST_NAUSEA_TOLERANCE); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 198 }, STR_CHEAT_GUEST_TOILET); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 219 }, STR_CHEAT_GUEST_PREFERRED_INTENSITY); } } - else if (page == WINDOW_CHEATS_PAGE_GUESTS) - { - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 72 }, STR_CHEAT_GUEST_HAPPINESS); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 93 }, STR_CHEAT_GUEST_ENERGY); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 114 }, STR_CHEAT_GUEST_HUNGER); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 135 }, STR_CHEAT_GUEST_THIRST); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 156 }, STR_CHEAT_GUEST_NAUSEA); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 177 }, STR_CHEAT_GUEST_NAUSEA_TOLERANCE); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 198 }, STR_CHEAT_GUEST_TOILET); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 219 }, STR_CHEAT_GUEST_PREFERRED_INTENSITY); - } - } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (page == WINDOW_CHEATS_PAGE_MONEY && widgetIndex == WIDX_MONEY_SPINNER) + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override { - auto val = StringToMoney(std::string(text).c_str()); - if (val != kMoney64Undefined) + if (page == WINDOW_CHEATS_PAGE_MONEY && widgetIndex == WIDX_MONEY_SPINNER) { - _moneySpinnerValue = val; + auto val = StringToMoney(std::string(text).c_str()); + if (val != kMoney64Undefined) + { + _moneySpinnerValue = val; + } + Invalidate(); } + } + + OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override + { + if (page == WINDOW_CHEATS_PAGE_RIDES && widgetIndex == WIDX_UNLOCK_OPERATING_LIMITS) + { + auto ft = Formatter{}; + ft.Add(255); + return { fallback, ft }; + } + return { fallback, {} }; + } + + private: + void SetPage(int32_t p) + { + page = p; + frame_no = 0; + + hold_down_widgets = window_cheats_page_hold_down_widgets[p]; + pressed_widgets = 0; + widgets = window_cheats_page_widgets[p]; + + auto maxY = 0; + auto* widget = &widgets[WIDX_TAB_CONTENT]; + while (widget->type != WindowWidgetType::Last) + { + maxY = std::max(maxY, widget->bottom); + widget++; + } + maxY += 6; + + Invalidate(); + height = maxY; + widgets[WIDX_BACKGROUND].bottom = maxY - 1; + widgets[WIDX_PAGE_BACKGROUND].bottom = maxY - 1; Invalidate(); } - } - OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override - { - if (page == WINDOW_CHEATS_PAGE_RIDES && widgetIndex == WIDX_UNLOCK_OPERATING_LIMITS) + void UpdateTabPositions() { - auto ft = Formatter{}; - ft.Add(255); - return { fallback, ft }; - } - return { fallback, {} }; - } + constexpr uint16_t tabs[] = { + WIDX_TAB_1, + WIDX_TAB_2, + WIDX_TAB_3, + WIDX_TAB_4, + }; -private: - void SetPage(int32_t p) - { - page = p; - frame_no = 0; - - hold_down_widgets = window_cheats_page_hold_down_widgets[p]; - pressed_widgets = 0; - widgets = window_cheats_page_widgets[p]; - - auto maxY = 0; - auto* widget = &widgets[WIDX_TAB_CONTENT]; - while (widget->type != WindowWidgetType::Last) - { - maxY = std::max(maxY, widget->bottom); - widget++; - } - maxY += 6; - - Invalidate(); - height = maxY; - widgets[WIDX_BACKGROUND].bottom = maxY - 1; - widgets[WIDX_PAGE_BACKGROUND].bottom = maxY - 1; - Invalidate(); - } - - void UpdateTabPositions() - { - constexpr uint16_t tabs[] = { - WIDX_TAB_1, - WIDX_TAB_2, - WIDX_TAB_3, - WIDX_TAB_4, - }; - - auto left = TAB_START; - for (auto tab : tabs) - { - widgets[tab].left = left; - if (!IsWidgetDisabled(tab)) + auto left = TAB_START; + for (auto tab : tabs) { - left += TAB_WIDTH; + widgets[tab].left = left; + if (!IsWidgetDisabled(tab)) + { + left += TAB_WIDTH; + } } } - } - void DrawTabImages(DrawPixelInfo& dpi) - { - // Money tab - if (!IsWidgetDisabled(WIDX_TAB_1)) + void DrawTabImages(DrawPixelInfo& dpi) { - uint32_t sprite_idx = SPR_TAB_FINANCES_SUMMARY_0; - if (page == WINDOW_CHEATS_PAGE_MONEY) - sprite_idx += (frame_no / 2) % 8; - GfxDrawSprite( - dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].left, widgets[WIDX_TAB_1].top }); - } - - // Guests tab - if (!IsWidgetDisabled(WIDX_TAB_2)) - { - uint32_t sprite_idx = SPR_TAB_GUESTS_0; - if (page == WINDOW_CHEATS_PAGE_GUESTS) - sprite_idx += (frame_no / 3) % 8; - GfxDrawSprite( - dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top }); - } - - // Misc tab - if (!IsWidgetDisabled(WIDX_TAB_3)) - { - GfxDrawSprite( - dpi, ImageId(SPR_TAB_PARK), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_3].left, widgets[WIDX_TAB_3].top }); - } - - // Rides tab - if (!IsWidgetDisabled(WIDX_TAB_4)) - { - uint32_t sprite_idx = SPR_TAB_RIDE_0; - if (page == WINDOW_CHEATS_PAGE_RIDES) - sprite_idx += (frame_no / 4) % 16; - GfxDrawSprite( - dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_4].left, widgets[WIDX_TAB_4].top }); - } - } - - void OnMouseDownMoney(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_MONEY_SPINNER_INCREMENT: - _moneySpinnerValue = AddClamp_money64( - CHEATS_MONEY_INCREMENT_DIV * (_moneySpinnerValue / CHEATS_MONEY_INCREMENT_DIV), CHEATS_MONEY_INCREMENT_DIV); - InvalidateWidget(WIDX_MONEY_SPINNER); - break; - case WIDX_MONEY_SPINNER_DECREMENT: - _moneySpinnerValue = AddClamp_money64( - CHEATS_MONEY_INCREMENT_DIV * (_moneySpinnerValue / CHEATS_MONEY_INCREMENT_DIV), - -CHEATS_MONEY_INCREMENT_DIV); - InvalidateWidget(WIDX_MONEY_SPINNER); - break; - case WIDX_ADD_MONEY: - CheatsSet(CheatType::AddMoney, _moneySpinnerValue); - break; - case WIDX_YEAR_UP: - _yearSpinnerValue++; - _yearSpinnerValue = std::clamp(_yearSpinnerValue, 1, kMaxYear); - InvalidateWidget(WIDX_YEAR_BOX); - break; - case WIDX_YEAR_DOWN: - _yearSpinnerValue--; - _yearSpinnerValue = std::clamp(_yearSpinnerValue, 1, kMaxYear); - InvalidateWidget(WIDX_YEAR_BOX); - break; - case WIDX_MONTH_UP: - _monthSpinnerValue++; - _monthSpinnerValue = std::clamp(_monthSpinnerValue, 1, static_cast(MONTH_COUNT)); - _daySpinnerValue = std::clamp( - _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); - InvalidateWidget(WIDX_MONTH_BOX); - InvalidateWidget(WIDX_DAY_BOX); - break; - case WIDX_MONTH_DOWN: - _monthSpinnerValue--; - _monthSpinnerValue = std::clamp(_monthSpinnerValue, 1, static_cast(MONTH_COUNT)); - _daySpinnerValue = std::clamp( - _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); - InvalidateWidget(WIDX_MONTH_BOX); - InvalidateWidget(WIDX_DAY_BOX); - break; - case WIDX_DAY_UP: - _daySpinnerValue++; - _daySpinnerValue = std::clamp( - _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); - InvalidateWidget(WIDX_DAY_BOX); - break; - case WIDX_DAY_DOWN: - _daySpinnerValue--; - _daySpinnerValue = std::clamp( - _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); - InvalidateWidget(WIDX_DAY_BOX); - break; - case WIDX_DATE_SET: + // Money tab + if (!IsWidgetDisabled(WIDX_TAB_1)) { - auto setDateAction = ParkSetDateAction(_yearSpinnerValue - 1, _monthSpinnerValue - 1, _daySpinnerValue - 1); - GameActions::Execute(&setDateAction); - WindowInvalidateByClass(WindowClass::BottomToolbar); - break; + uint32_t sprite_idx = SPR_TAB_FINANCES_SUMMARY_0; + if (page == WINDOW_CHEATS_PAGE_MONEY) + sprite_idx += (frame_no / 2) % 8; + GfxDrawSprite( + dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].left, widgets[WIDX_TAB_1].top }); } - case WIDX_DATE_RESET: + + // Guests tab + if (!IsWidgetDisabled(WIDX_TAB_2)) { - auto setDateAction = ParkSetDateAction(0, 0, 0); - GameActions::Execute(&setDateAction); - WindowInvalidateByClass(WindowClass::BottomToolbar); - InvalidateWidget(WIDX_YEAR_BOX); - InvalidateWidget(WIDX_MONTH_BOX); - InvalidateWidget(WIDX_DAY_BOX); - break; + uint32_t sprite_idx = SPR_TAB_GUESTS_0; + if (page == WINDOW_CHEATS_PAGE_GUESTS) + sprite_idx += (frame_no / 3) % 8; + GfxDrawSprite( + dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top }); + } + + // Misc tab + if (!IsWidgetDisabled(WIDX_TAB_3)) + { + GfxDrawSprite( + dpi, ImageId(SPR_TAB_PARK), + windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_3].left, widgets[WIDX_TAB_3].top }); + } + + // Rides tab + if (!IsWidgetDisabled(WIDX_TAB_4)) + { + uint32_t sprite_idx = SPR_TAB_RIDE_0; + if (page == WINDOW_CHEATS_PAGE_RIDES) + sprite_idx += (frame_no / 4) % 16; + GfxDrawSprite( + dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_4].left, widgets[WIDX_TAB_4].top }); } } - } - void OnMouseUpMoney(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void OnMouseDownMoney(WidgetIndex widgetIndex) { - case WIDX_NO_MONEY: - CheatsSet(CheatType::NoMoney, GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY ? 0 : 1); - break; - case WIDX_MONEY_SPINNER: - MoneyToString(_moneySpinnerValue, _moneySpinnerText, MONEY_STRING_MAXLENGTH, false); - WindowTextInputRawOpen( - this, WIDX_MONEY_SPINNER, STR_ENTER_NEW_VALUE, STR_ENTER_NEW_VALUE, {}, _moneySpinnerText, - MONEY_STRING_MAXLENGTH); - break; - case WIDX_SET_MONEY: - CheatsSet(CheatType::SetMoney, _moneySpinnerValue); - break; - case WIDX_CLEAR_LOAN: - CheatsSet(CheatType::ClearLoan); - break; - } - } - - void OnMouseDownMisc(WidgetIndex widgetIndex) - { - auto* widget = &widgets[widgetIndex]; - switch (widgetIndex) - { - case WIDX_INCREASE_PARK_RATING: - _parkRatingSpinnerValue = std::min(999, 10 * (_parkRatingSpinnerValue / 10 + 1)); - InvalidateWidget(WIDX_PARK_RATING_SPINNER); - if (ParkGetForcedRating() >= 0) - { - auto cheatSetAction = CheatSetAction(CheatType::SetForcedParkRating, _parkRatingSpinnerValue); - GameActions::Execute(&cheatSetAction); - } - break; - case WIDX_DECREASE_PARK_RATING: - _parkRatingSpinnerValue = std::max(0, 10 * (_parkRatingSpinnerValue / 10 - 1)); - InvalidateWidget(WIDX_PARK_RATING_SPINNER); - if (ParkGetForcedRating() >= 0) - { - CheatsSet(CheatType::SetForcedParkRating, _parkRatingSpinnerValue); - } - break; - case WIDX_WEATHER_DROPDOWN_BUTTON: + switch (widgetIndex) { - Widget* dropdownWidget = widget - 1; - - for (size_t i = 0; i < std::size(WeatherTypes); i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = WeatherTypes[i]; - } - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, std::size(WeatherTypes), dropdownWidget->width() - 3); - - auto currentWeather = OpenRCT2::GetGameState().ClimateCurrent.Weather; - Dropdown::SetChecked(EnumValue(currentWeather), true); - } - break; - case WIDX_STAFF_SPEED_DROPDOWN_BUTTON: - { - Widget* dropdownWidget; - - dropdownWidget = widget - 1; - - for (size_t i = 0; i < std::size(_staffSpeedNames); i++) - { - gDropdownItems[i].Args = _staffSpeedNames[i]; - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3); - Dropdown::SetChecked(EnumValue(gCheatsSelectedStaffSpeed), true); - } - } - } - - void OnMouseUpMisc(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_FREEZE_WEATHER: - CheatsSet(CheatType::FreezeWeather, !gCheatsFreezeWeather); - break; - case WIDX_OPEN_CLOSE_PARK: - CheatsSet(CheatType::OpenClosePark); - break; - case WIDX_CREATE_DUCKS: - CheatsSet(CheatType::CreateDucks, kCheatsDuckIncrement); - break; - case WIDX_REMOVE_DUCKS: - CheatsSet(CheatType::RemoveDucks); - break; - case WIDX_CLEAR_GRASS: - CheatsSet(CheatType::SetGrassLength, GRASS_LENGTH_CLEAR_0); - break; - case WIDX_MOWED_GRASS: - CheatsSet(CheatType::SetGrassLength, GRASS_LENGTH_MOWED); - break; - case WIDX_WATER_PLANTS: - CheatsSet(CheatType::WaterPlants); - break; - case WIDX_FIX_VANDALISM: - CheatsSet(CheatType::FixVandalism); - break; - case WIDX_REMOVE_LITTER: - CheatsSet(CheatType::RemoveLitter); - break; - case WIDX_DISABLE_PLANT_AGING: - CheatsSet(CheatType::DisablePlantAging, !gCheatsDisablePlantAging); - break; - case WIDX_WIN_SCENARIO: - CheatsSet(CheatType::WinScenario); - break; - case WIDX_HAVE_FUN: - CheatsSet(CheatType::HaveFun); - break; - case WIDX_OWN_ALL_LAND: - CheatsSet(CheatType::OwnAllLand); - break; - case WIDX_NEVERENDING_MARKETING: - CheatsSet(CheatType::NeverEndingMarketing, !gCheatsNeverendingMarketing); - break; - case WIDX_FORCE_PARK_RATING: - if (ParkGetForcedRating() >= 0) - { - CheatsSet(CheatType::SetForcedParkRating, -1); - } - else - { - CheatsSet(CheatType::SetForcedParkRating, _parkRatingSpinnerValue); - } - break; - case WIDX_ALLOW_REGULAR_PATH_AS_QUEUE: - CheatsSet(CheatType::AllowRegularPathAsQueue, !gCheatsAllowRegularPathAsQueue); - break; - case WIDX_ALLOW_SPECIAL_COLOUR_SCHEMES: - CheatsSet(CheatType::AllowSpecialColourSchemes, !gCheatsAllowSpecialColourSchemes); - break; - } - } - - void OnDropdownMisc(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - if (dropdownIndex == -1) - { - return; - } - - if (widgetIndex == WIDX_WEATHER_DROPDOWN_BUTTON) - { - CheatsSet(CheatType::ForceWeather, dropdownIndex); - } - if (widgetIndex == WIDX_STAFF_SPEED_DROPDOWN_BUTTON) - { - int32_t speed = kCheatsStaffNormalSpeed; - switch (dropdownIndex) - { - case 0: - gCheatsSelectedStaffSpeed = StaffSpeedCheat::None; - speed = kCheatsStaffNormalSpeed; + case WIDX_MONEY_SPINNER_INCREMENT: + _moneySpinnerValue = AddClamp_money64( + CHEATS_MONEY_INCREMENT_DIV * (_moneySpinnerValue / CHEATS_MONEY_INCREMENT_DIV), + CHEATS_MONEY_INCREMENT_DIV); + InvalidateWidget(WIDX_MONEY_SPINNER); break; - - case 1: - gCheatsSelectedStaffSpeed = StaffSpeedCheat::Frozen; - speed = kCheatsStaffFreezeSpeed; + case WIDX_MONEY_SPINNER_DECREMENT: + _moneySpinnerValue = AddClamp_money64( + CHEATS_MONEY_INCREMENT_DIV * (_moneySpinnerValue / CHEATS_MONEY_INCREMENT_DIV), + -CHEATS_MONEY_INCREMENT_DIV); + InvalidateWidget(WIDX_MONEY_SPINNER); break; - - case 2: - gCheatsSelectedStaffSpeed = StaffSpeedCheat::Fast; - speed = kCheatsStaffFastSpeed; + case WIDX_ADD_MONEY: + CheatsSet(CheatType::AddMoney, _moneySpinnerValue); + break; + case WIDX_YEAR_UP: + _yearSpinnerValue++; + _yearSpinnerValue = std::clamp(_yearSpinnerValue, 1, kMaxYear); + InvalidateWidget(WIDX_YEAR_BOX); + break; + case WIDX_YEAR_DOWN: + _yearSpinnerValue--; + _yearSpinnerValue = std::clamp(_yearSpinnerValue, 1, kMaxYear); + InvalidateWidget(WIDX_YEAR_BOX); + break; + case WIDX_MONTH_UP: + _monthSpinnerValue++; + _monthSpinnerValue = std::clamp(_monthSpinnerValue, 1, static_cast(MONTH_COUNT)); + _daySpinnerValue = std::clamp( + _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); + InvalidateWidget(WIDX_MONTH_BOX); + InvalidateWidget(WIDX_DAY_BOX); + break; + case WIDX_MONTH_DOWN: + _monthSpinnerValue--; + _monthSpinnerValue = std::clamp(_monthSpinnerValue, 1, static_cast(MONTH_COUNT)); + _daySpinnerValue = std::clamp( + _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); + InvalidateWidget(WIDX_MONTH_BOX); + InvalidateWidget(WIDX_DAY_BOX); + break; + case WIDX_DAY_UP: + _daySpinnerValue++; + _daySpinnerValue = std::clamp( + _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); + InvalidateWidget(WIDX_DAY_BOX); + break; + case WIDX_DAY_DOWN: + _daySpinnerValue--; + _daySpinnerValue = std::clamp( + _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); + InvalidateWidget(WIDX_DAY_BOX); + break; + case WIDX_DATE_SET: + { + auto setDateAction = ParkSetDateAction(_yearSpinnerValue - 1, _monthSpinnerValue - 1, _daySpinnerValue - 1); + GameActions::Execute(&setDateAction); + WindowInvalidateByClass(WindowClass::BottomToolbar); + break; + } + case WIDX_DATE_RESET: + { + auto setDateAction = ParkSetDateAction(0, 0, 0); + GameActions::Execute(&setDateAction); + WindowInvalidateByClass(WindowClass::BottomToolbar); + InvalidateWidget(WIDX_YEAR_BOX); + InvalidateWidget(WIDX_MONTH_BOX); + InvalidateWidget(WIDX_DAY_BOX); + break; + } } - CheatsSet(CheatType::SetStaffSpeed, speed); } - } - void OnMouseUpGuests(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void OnMouseUpMoney(WidgetIndex widgetIndex) { - case WIDX_GUEST_HAPPINESS_MAX: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_HAPPINESS, PEEP_MAX_HAPPINESS); - break; - case WIDX_GUEST_HAPPINESS_MIN: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_HAPPINESS, 0); - break; - case WIDX_GUEST_ENERGY_MAX: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_ENERGY, PEEP_MAX_ENERGY); - break; - case WIDX_GUEST_ENERGY_MIN: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_ENERGY, PEEP_MIN_ENERGY); - break; - case WIDX_GUEST_HUNGER_MAX: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_HUNGER, 0); - break; - case WIDX_GUEST_HUNGER_MIN: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_HUNGER, PEEP_MAX_HUNGER); - break; - case WIDX_GUEST_THIRST_MAX: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_THIRST, 0); - break; - case WIDX_GUEST_THIRST_MIN: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_THIRST, PEEP_MAX_THIRST); - break; - case WIDX_GUEST_NAUSEA_MAX: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_NAUSEA, PEEP_MAX_NAUSEA); - break; - case WIDX_GUEST_NAUSEA_MIN: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_NAUSEA, 0); - break; - case WIDX_GUEST_NAUSEA_TOLERANCE_MAX: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_NAUSEA_TOLERANCE, EnumValue(PeepNauseaTolerance::High)); - break; - case WIDX_GUEST_NAUSEA_TOLERANCE_MIN: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_NAUSEA_TOLERANCE, EnumValue(PeepNauseaTolerance::None)); - break; - case WIDX_GUEST_TOILET_MAX: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_TOILET, PEEP_MAX_TOILET); - break; - case WIDX_GUEST_TOILET_MIN: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_TOILET, 0); - break; - case WIDX_GUEST_RIDE_INTENSITY_MORE_THAN_1: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_PREFERRED_RIDE_INTENSITY, 1); - break; - case WIDX_GUEST_RIDE_INTENSITY_LESS_THAN_15: - CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_PREFERRED_RIDE_INTENSITY, 0); - break; - case WIDX_TRAM_GUESTS: - CheatsSet(CheatType::GenerateGuests, kCheatsTramIncrement); - break; - case WIDX_REMOVE_ALL_GUESTS: - CheatsSet(CheatType::RemoveAllGuests); - break; - case WIDX_GIVE_GUESTS_MONEY: - CheatsSet(CheatType::GiveAllGuests, OBJECT_MONEY); - break; - case WIDX_GIVE_GUESTS_PARK_MAPS: - CheatsSet(CheatType::GiveAllGuests, OBJECT_PARK_MAP); - break; - case WIDX_GIVE_GUESTS_BALLOONS: - CheatsSet(CheatType::GiveAllGuests, OBJECT_BALLOON); - break; - case WIDX_GIVE_GUESTS_UMBRELLAS: - CheatsSet(CheatType::GiveAllGuests, OBJECT_UMBRELLA); - break; - case WIDX_GUEST_IGNORE_RIDE_INTENSITY: - CheatsSet(CheatType::IgnoreRideIntensity, !gCheatsIgnoreRideIntensity); - break; - case WIDX_DISABLE_VANDALISM: - CheatsSet(CheatType::DisableVandalism, !gCheatsDisableVandalism); - break; - case WIDX_DISABLE_LITTERING: - CheatsSet(CheatType::DisableLittering, !gCheatsDisableLittering); - break; + switch (widgetIndex) + { + case WIDX_NO_MONEY: + CheatsSet(CheatType::NoMoney, GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY ? 0 : 1); + break; + case WIDX_MONEY_SPINNER: + MoneyToString(_moneySpinnerValue, _moneySpinnerText, MONEY_STRING_MAXLENGTH, false); + WindowTextInputRawOpen( + this, WIDX_MONEY_SPINNER, STR_ENTER_NEW_VALUE, STR_ENTER_NEW_VALUE, {}, _moneySpinnerText, + MONEY_STRING_MAXLENGTH); + break; + case WIDX_SET_MONEY: + CheatsSet(CheatType::SetMoney, _moneySpinnerValue); + break; + case WIDX_CLEAR_LOAN: + CheatsSet(CheatType::ClearLoan); + break; + } } - } - void OnMouseUpRides(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void OnMouseDownMisc(WidgetIndex widgetIndex) { - case WIDX_RENEW_RIDES: - CheatsSet(CheatType::RenewRides); - break; - case WIDX_MAKE_DESTRUCTIBLE: - CheatsSet(CheatType::MakeDestructible, !gCheatsMakeAllDestructible); - break; - case WIDX_FIX_ALL: - CheatsSet(CheatType::FixRides); - break; - case WIDX_UNLOCK_OPERATING_LIMITS: - CheatsSet(CheatType::FastLiftHill, !gCheatsUnlockOperatingLimits); - break; - case WIDX_DISABLE_BRAKES_FAILURE: - CheatsSet(CheatType::DisableBrakesFailure, !gCheatsDisableBrakesFailure); - break; - case WIDX_DISABLE_ALL_BREAKDOWNS: - CheatsSet(CheatType::DisableAllBreakdowns, !gCheatsDisableAllBreakdowns); - break; - case WIDX_BUILD_IN_PAUSE_MODE: - CheatsSet(CheatType::BuildInPauseMode, !gCheatsBuildInPauseMode); - break; - case WIDX_RESET_CRASH_STATUS: - CheatsSet(CheatType::ResetCrashStatus); - break; - case WIDX_10_MINUTE_INSPECTIONS: - CheatsSet(CheatType::TenMinuteInspections); - break; - case WIDX_SHOW_ALL_OPERATING_MODES: + auto* widget = &widgets[widgetIndex]; + auto& gameState = GetGameState(); + switch (widgetIndex) { - if (!gCheatsShowAllOperatingModes) + case WIDX_INCREASE_PARK_RATING: + _parkRatingSpinnerValue = std::min(999, 10 * (_parkRatingSpinnerValue / 10 + 1)); + InvalidateWidget(WIDX_PARK_RATING_SPINNER); + if (ParkGetForcedRating() >= 0) + { + auto cheatSetAction = CheatSetAction(CheatType::SetForcedParkRating, _parkRatingSpinnerValue); + GameActions::Execute(&cheatSetAction); + } + break; + case WIDX_DECREASE_PARK_RATING: + _parkRatingSpinnerValue = std::max(0, 10 * (_parkRatingSpinnerValue / 10 - 1)); + InvalidateWidget(WIDX_PARK_RATING_SPINNER); + if (ParkGetForcedRating() >= 0) + { + CheatsSet(CheatType::SetForcedParkRating, _parkRatingSpinnerValue); + } + break; + case WIDX_WEATHER_DROPDOWN_BUTTON: { - ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + Widget* dropdownWidget = widget - 1; + + for (size_t i = 0; i < std::size(WeatherTypes); i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = WeatherTypes[i]; + } + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, std::size(WeatherTypes), dropdownWidget->width() - 3); + + auto currentWeather = gameState.ClimateCurrent.Weather; + Dropdown::SetChecked(EnumValue(currentWeather), true); } - CheatsSet(CheatType::ShowAllOperatingModes, !gCheatsShowAllOperatingModes); - } - break; - case WIDX_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES: - { - if (!gCheatsShowVehiclesFromOtherTrackTypes) - { - ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); - } - CheatsSet(CheatType::ShowVehiclesFromOtherTrackTypes, !gCheatsShowVehiclesFromOtherTrackTypes); - } - break; - case WIDX_DISABLE_TRAIN_LENGTH_LIMITS: - { - if (!gCheatsDisableTrainLengthLimit) - { - ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); - } - CheatsSet(CheatType::DisableTrainLengthLimit, !gCheatsDisableTrainLengthLimit); - } - break; - case WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK: - CheatsSet(CheatType::EnableChainLiftOnAllTrack, !gCheatsEnableChainLiftOnAllTrack); break; - case WIDX_ENABLE_ARBITRARY_RIDE_TYPE_CHANGES: - { - if (!gCheatsAllowArbitraryRideTypeChanges) + case WIDX_STAFF_SPEED_DROPDOWN_BUTTON: { - ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + Widget* dropdownWidget; + + dropdownWidget = widget - 1; + + for (size_t i = 0; i < std::size(_staffSpeedNames); i++) + { + gDropdownItems[i].Args = _staffSpeedNames[i]; + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3); + Dropdown::SetChecked(EnumValue(gameState.Cheats.SelectedStaffSpeed), true); } - CheatsSet(CheatType::AllowArbitraryRideTypeChanges, !gCheatsAllowArbitraryRideTypeChanges); } - break; - case WIDX_DISABLE_RIDE_VALUE_AGING: - CheatsSet(CheatType::DisableRideValueAging, !gCheatsDisableRideValueAging); - break; - case WIDX_IGNORE_RESEARCH_STATUS: - CheatsSet(CheatType::IgnoreResearchStatus, !gCheatsIgnoreResearchStatus); - break; - case WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES: - CheatsSet(CheatType::EnableAllDrawableTrackPieces, !gCheatsEnableAllDrawableTrackPieces); - break; - case WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS: - { - if (!gCheatsAllowTrackPlaceInvalidHeights) - { - ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); - } - CheatsSet(CheatType::AllowTrackPlaceInvalidHeights, !gCheatsAllowTrackPlaceInvalidHeights); - } - break; } - } - void OnResize() override - { - ResizeFrameWithPage(); - } -}; + void OnMouseUpMisc(WidgetIndex widgetIndex) + { + auto& gameState = GetGameState(); + switch (widgetIndex) + { + case WIDX_FREEZE_WEATHER: + CheatsSet(CheatType::FreezeWeather, !gameState.Cheats.FreezeWeather); + break; + case WIDX_OPEN_CLOSE_PARK: + CheatsSet(CheatType::OpenClosePark); + break; + case WIDX_CREATE_DUCKS: + CheatsSet(CheatType::CreateDucks, kCheatsDuckIncrement); + break; + case WIDX_REMOVE_DUCKS: + CheatsSet(CheatType::RemoveDucks); + break; + case WIDX_CLEAR_GRASS: + CheatsSet(CheatType::SetGrassLength, GRASS_LENGTH_CLEAR_0); + break; + case WIDX_MOWED_GRASS: + CheatsSet(CheatType::SetGrassLength, GRASS_LENGTH_MOWED); + break; + case WIDX_WATER_PLANTS: + CheatsSet(CheatType::WaterPlants); + break; + case WIDX_FIX_VANDALISM: + CheatsSet(CheatType::FixVandalism); + break; + case WIDX_REMOVE_LITTER: + CheatsSet(CheatType::RemoveLitter); + break; + case WIDX_DISABLE_PLANT_AGING: + CheatsSet(CheatType::DisablePlantAging, !gameState.Cheats.DisablePlantAging); + break; + case WIDX_WIN_SCENARIO: + CheatsSet(CheatType::WinScenario); + break; + case WIDX_HAVE_FUN: + CheatsSet(CheatType::HaveFun); + break; + case WIDX_OWN_ALL_LAND: + CheatsSet(CheatType::OwnAllLand); + break; + case WIDX_NEVERENDING_MARKETING: + CheatsSet(CheatType::NeverEndingMarketing, !gameState.Cheats.NeverendingMarketing); + break; + case WIDX_FORCE_PARK_RATING: + if (ParkGetForcedRating() >= 0) + { + CheatsSet(CheatType::SetForcedParkRating, -1); + } + else + { + CheatsSet(CheatType::SetForcedParkRating, _parkRatingSpinnerValue); + } + break; + case WIDX_ALLOW_REGULAR_PATH_AS_QUEUE: + CheatsSet(CheatType::AllowRegularPathAsQueue, !gameState.Cheats.AllowRegularPathAsQueue); + break; + case WIDX_ALLOW_SPECIAL_COLOUR_SCHEMES: + CheatsSet(CheatType::AllowSpecialColourSchemes, !gameState.Cheats.AllowSpecialColourSchemes); + break; + } + } -WindowBase* WindowCheatsOpen() -{ - auto* window = WindowBringToFrontByClass(WindowClass::Cheats); - if (window == nullptr) + void OnDropdownMisc(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + if (dropdownIndex == -1) + { + return; + } + + if (widgetIndex == WIDX_WEATHER_DROPDOWN_BUTTON) + { + CheatsSet(CheatType::ForceWeather, dropdownIndex); + } + if (widgetIndex == WIDX_STAFF_SPEED_DROPDOWN_BUTTON) + { + int32_t speed = kCheatsStaffNormalSpeed; + auto& gameState = GetGameState(); + switch (dropdownIndex) + { + case 0: + gameState.Cheats.SelectedStaffSpeed = StaffSpeedCheat::None; + speed = kCheatsStaffNormalSpeed; + break; + + case 1: + gameState.Cheats.SelectedStaffSpeed = StaffSpeedCheat::Frozen; + speed = kCheatsStaffFreezeSpeed; + break; + + case 2: + gameState.Cheats.SelectedStaffSpeed = StaffSpeedCheat::Fast; + speed = kCheatsStaffFastSpeed; + } + CheatsSet(CheatType::SetStaffSpeed, speed); + } + } + + void OnMouseUpGuests(WidgetIndex widgetIndex) + { + auto& gameState = GetGameState(); + switch (widgetIndex) + { + case WIDX_GUEST_HAPPINESS_MAX: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_HAPPINESS, PEEP_MAX_HAPPINESS); + break; + case WIDX_GUEST_HAPPINESS_MIN: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_HAPPINESS, 0); + break; + case WIDX_GUEST_ENERGY_MAX: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_ENERGY, PEEP_MAX_ENERGY); + break; + case WIDX_GUEST_ENERGY_MIN: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_ENERGY, PEEP_MIN_ENERGY); + break; + case WIDX_GUEST_HUNGER_MAX: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_HUNGER, 0); + break; + case WIDX_GUEST_HUNGER_MIN: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_HUNGER, PEEP_MAX_HUNGER); + break; + case WIDX_GUEST_THIRST_MAX: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_THIRST, 0); + break; + case WIDX_GUEST_THIRST_MIN: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_THIRST, PEEP_MAX_THIRST); + break; + case WIDX_GUEST_NAUSEA_MAX: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_NAUSEA, PEEP_MAX_NAUSEA); + break; + case WIDX_GUEST_NAUSEA_MIN: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_NAUSEA, 0); + break; + case WIDX_GUEST_NAUSEA_TOLERANCE_MAX: + CheatsSet( + CheatType::SetGuestParameter, GUEST_PARAMETER_NAUSEA_TOLERANCE, EnumValue(PeepNauseaTolerance::High)); + break; + case WIDX_GUEST_NAUSEA_TOLERANCE_MIN: + CheatsSet( + CheatType::SetGuestParameter, GUEST_PARAMETER_NAUSEA_TOLERANCE, EnumValue(PeepNauseaTolerance::None)); + break; + case WIDX_GUEST_TOILET_MAX: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_TOILET, PEEP_MAX_TOILET); + break; + case WIDX_GUEST_TOILET_MIN: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_TOILET, 0); + break; + case WIDX_GUEST_RIDE_INTENSITY_MORE_THAN_1: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_PREFERRED_RIDE_INTENSITY, 1); + break; + case WIDX_GUEST_RIDE_INTENSITY_LESS_THAN_15: + CheatsSet(CheatType::SetGuestParameter, GUEST_PARAMETER_PREFERRED_RIDE_INTENSITY, 0); + break; + case WIDX_TRAM_GUESTS: + CheatsSet(CheatType::GenerateGuests, kCheatsTramIncrement); + break; + case WIDX_REMOVE_ALL_GUESTS: + CheatsSet(CheatType::RemoveAllGuests); + break; + case WIDX_GIVE_GUESTS_MONEY: + CheatsSet(CheatType::GiveAllGuests, OBJECT_MONEY); + break; + case WIDX_GIVE_GUESTS_PARK_MAPS: + CheatsSet(CheatType::GiveAllGuests, OBJECT_PARK_MAP); + break; + case WIDX_GIVE_GUESTS_BALLOONS: + CheatsSet(CheatType::GiveAllGuests, OBJECT_BALLOON); + break; + case WIDX_GIVE_GUESTS_UMBRELLAS: + CheatsSet(CheatType::GiveAllGuests, OBJECT_UMBRELLA); + break; + case WIDX_GUEST_IGNORE_RIDE_INTENSITY: + CheatsSet(CheatType::IgnoreRideIntensity, !gameState.Cheats.IgnoreRideIntensity); + break; + case WIDX_DISABLE_VANDALISM: + CheatsSet(CheatType::DisableVandalism, !gameState.Cheats.DisableVandalism); + break; + case WIDX_DISABLE_LITTERING: + CheatsSet(CheatType::DisableLittering, !gameState.Cheats.DisableLittering); + break; + } + } + + void OnMouseUpRides(WidgetIndex widgetIndex) + { + auto& gameState = GetGameState(); + switch (widgetIndex) + { + case WIDX_RENEW_RIDES: + CheatsSet(CheatType::RenewRides); + break; + case WIDX_MAKE_DESTRUCTIBLE: + CheatsSet(CheatType::MakeDestructible, !gameState.Cheats.MakeAllDestructible); + break; + case WIDX_FIX_ALL: + CheatsSet(CheatType::FixRides); + break; + case WIDX_UNLOCK_OPERATING_LIMITS: + CheatsSet(CheatType::FastLiftHill, !gameState.Cheats.UnlockOperatingLimits); + break; + case WIDX_DISABLE_BRAKES_FAILURE: + CheatsSet(CheatType::DisableBrakesFailure, !gameState.Cheats.DisableBrakesFailure); + break; + case WIDX_DISABLE_ALL_BREAKDOWNS: + CheatsSet(CheatType::DisableAllBreakdowns, !gameState.Cheats.DisableAllBreakdowns); + break; + case WIDX_BUILD_IN_PAUSE_MODE: + CheatsSet(CheatType::BuildInPauseMode, !gameState.Cheats.BuildInPauseMode); + break; + case WIDX_RESET_CRASH_STATUS: + CheatsSet(CheatType::ResetCrashStatus); + break; + case WIDX_10_MINUTE_INSPECTIONS: + CheatsSet(CheatType::TenMinuteInspections); + break; + case WIDX_SHOW_ALL_OPERATING_MODES: + { + if (!gameState.Cheats.ShowAllOperatingModes) + { + ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + } + CheatsSet(CheatType::ShowAllOperatingModes, !gameState.Cheats.ShowAllOperatingModes); + } + break; + case WIDX_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES: + { + if (!gameState.Cheats.ShowVehiclesFromOtherTrackTypes) + { + ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + } + CheatsSet(CheatType::ShowVehiclesFromOtherTrackTypes, !gameState.Cheats.ShowVehiclesFromOtherTrackTypes); + } + break; + case WIDX_DISABLE_TRAIN_LENGTH_LIMITS: + { + if (!gameState.Cheats.DisableTrainLengthLimit) + { + ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + } + CheatsSet(CheatType::DisableTrainLengthLimit, !gameState.Cheats.DisableTrainLengthLimit); + } + break; + case WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK: + CheatsSet(CheatType::EnableChainLiftOnAllTrack, !gameState.Cheats.EnableChainLiftOnAllTrack); + break; + case WIDX_ENABLE_ARBITRARY_RIDE_TYPE_CHANGES: + { + if (!gameState.Cheats.AllowArbitraryRideTypeChanges) + { + ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + } + CheatsSet(CheatType::AllowArbitraryRideTypeChanges, !gameState.Cheats.AllowArbitraryRideTypeChanges); + } + break; + case WIDX_DISABLE_RIDE_VALUE_AGING: + CheatsSet(CheatType::DisableRideValueAging, !gameState.Cheats.DisableRideValueAging); + break; + case WIDX_IGNORE_RESEARCH_STATUS: + CheatsSet(CheatType::IgnoreResearchStatus, !gameState.Cheats.IgnoreResearchStatus); + break; + case WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES: + CheatsSet(CheatType::EnableAllDrawableTrackPieces, !gameState.Cheats.EnableAllDrawableTrackPieces); + break; + case WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS: + { + if (!gameState.Cheats.AllowTrackPlaceInvalidHeights) + { + ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + } + CheatsSet(CheatType::AllowTrackPlaceInvalidHeights, !gameState.Cheats.AllowTrackPlaceInvalidHeights); + } + break; + } + } + + void OnResize() override + { + ResizeFrameWithPage(); + } + }; + + WindowBase* CheatsOpen() { - window = WindowCreate(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH); + auto* window = WindowBringToFrontByClass(WindowClass::Cheats); + if (window == nullptr) + { + window = WindowCreate(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH); + } + return window; } - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index bd06d6c4af..7efe3ae5a7 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -18,205 +18,208 @@ #include #include -using namespace OpenRCT2; - -enum WindowClearSceneryWidgetIdx +namespace OpenRCT2::Ui::Windows { - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_PREVIEW, - WIDX_DECREMENT, - WIDX_INCREMENT, - WIDX_SMALL_SCENERY, - WIDX_LARGE_SCENERY, - WIDX_FOOTPATH -}; -// clang-format on -static constexpr StringId WINDOW_TITLE = STR_CLEAR_SCENERY; -static constexpr int32_t WW = 98; -static constexpr int32_t WH = 94; - -static constexpr ScreenSize CLEAR_SCENERY_BUTTON = { 24, 24 }; - -static Widget window_clear_scenery_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), - MakeWidget( - { 27, 17 }, { 44, 32 }, WindowWidgetType::ImgBtn, WindowColour::Primary, SPR_LAND_TOOL_SIZE_0, STR_NONE), // preview box - MakeRemapWidget( - { 28, 18 }, { 16, 16 }, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_DECREASE, - STR_ADJUST_SMALLER_LAND_TIP), // decrement size - MakeRemapWidget( - { 54, 32 }, { 16, 16 }, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_INCREASE, - STR_ADJUST_LARGER_LAND_TIP), // increment size - MakeRemapWidget( - { 7, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_TREES, - STR_CLEAR_SCENERY_REMOVE_SMALL_SCENERY_TIP), // small scenery - MakeRemapWidget( - { 37, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_LARGE_SCENERY, - STR_CLEAR_SCENERY_REMOVE_LARGE_SCENERY_TIP), // large scenery - MakeRemapWidget( - { 67, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_FOOTPATH, - STR_CLEAR_SCENERY_REMOVE_FOOTPATHS_TIP), // footpaths - WIDGETS_END, -}; - -class CleanSceneryWindow final : public Window -{ -public: - void OnOpen() override + enum WindowClearSceneryWidgetIdx { - widgets = window_clear_scenery_widgets; - hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); - WindowInitScrollWidgets(*this); - WindowPushOthersBelow(*this); + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_PREVIEW, + WIDX_DECREMENT, + WIDX_INCREMENT, + WIDX_SMALL_SCENERY, + WIDX_LARGE_SCENERY, + WIDX_FOOTPATH + }; + // clang-format on + static constexpr StringId WINDOW_TITLE = STR_CLEAR_SCENERY; + static constexpr int32_t WW = 98; + static constexpr int32_t WH = 94; - gLandToolSize = 2; - gClearSceneryCost = kMoney64Undefined; + static constexpr ScreenSize CLEAR_SCENERY_BUTTON = { 24, 24 }; - gClearSmallScenery = true; - gClearLargeScenery = false; - gClearFootpath = false; + static Widget window_clear_scenery_widgets[] = { + WINDOW_SHIM(WINDOW_TITLE, WW, WH), + MakeWidget( + { 27, 17 }, { 44, 32 }, WindowWidgetType::ImgBtn, WindowColour::Primary, SPR_LAND_TOOL_SIZE_0, + STR_NONE), // preview box + MakeRemapWidget( + { 28, 18 }, { 16, 16 }, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_DECREASE, + STR_ADJUST_SMALLER_LAND_TIP), // decrement size + MakeRemapWidget( + { 54, 32 }, { 16, 16 }, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_INCREASE, + STR_ADJUST_LARGER_LAND_TIP), // increment size + MakeRemapWidget( + { 7, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_TREES, + STR_CLEAR_SCENERY_REMOVE_SMALL_SCENERY_TIP), // small scenery + MakeRemapWidget( + { 37, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_LARGE_SCENERY, + STR_CLEAR_SCENERY_REMOVE_LARGE_SCENERY_TIP), // large scenery + MakeRemapWidget( + { 67, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_FOOTPATH, + STR_CLEAR_SCENERY_REMOVE_FOOTPATHS_TIP), // footpaths + kWidgetsEnd, + }; - Invalidate(); - } - - void OnClose() override + class CleanSceneryWindow final : public Window { - if (ClearSceneryToolIsActive()) - ToolCancel(); - } - - void OnMouseUp(const WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_CLOSE: - Close(); - break; - case WIDX_PREVIEW: - { - Formatter ft; - ft.Add(kLandToolMinimumSize); - ft.Add(kLandToolMaximumSize); - TextInputOpen(WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); - break; - } - case WIDX_SMALL_SCENERY: - gClearSmallScenery ^= 1; - Invalidate(); - break; - case WIDX_LARGE_SCENERY: - gClearLargeScenery ^= 1; - Invalidate(); - break; - case WIDX_FOOTPATH: - gClearFootpath ^= 1; - Invalidate(); - break; - } - } + widgets = window_clear_scenery_widgets; + hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); + WindowInitScrollWidgets(*this); + WindowPushOthersBelow(*this); - void OnMouseDown(const WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_DECREMENT: - // Decrement land tool size, if it stays within the limit - gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); + gLandToolSize = 2; + gClearSceneryCost = kMoney64Undefined; - // Invalidate the window - Invalidate(); - break; - case WIDX_INCREMENT: - // Increment land tool size, if it stays within the limit - gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); + gClearSmallScenery = true; + gClearLargeScenery = false; + gClearFootpath = false; - // Invalidate the window - Invalidate(); - break; - } - } - - void OnTextInput(const WidgetIndex widgetIndex, const std::string_view text) override - { - if (widgetIndex != WIDX_PREVIEW || text.empty()) - return; - - try - { - int32_t size = std::stol(std::string(text)); - size = std::clamp(size, kLandToolMinimumSize, kLandToolMaximumSize); - gLandToolSize = size; Invalidate(); } - catch (const std::logic_error&) + + void OnClose() override { - // std::stol can throw std::out_of_range or std::invalid_argument - } - } - - void OnUpdate() override - { - frame_no++; - // Close window if another tool is open - if (!ClearSceneryToolIsActive()) - Close(); - } - - void Invalidate() - { - // Set the preview image button to be pressed down - pressed_widgets = (1uLL << WIDX_PREVIEW) | (gClearSmallScenery ? (1uLL << WIDX_SMALL_SCENERY) : 0) - | (gClearLargeScenery ? (1uLL << WIDX_LARGE_SCENERY) : 0) | (gClearFootpath ? (1uLL << WIDX_FOOTPATH) : 0); - - // Update the preview image (for tool sizes up to 7) - window_clear_scenery_widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - // Draw number for tool sizes bigger than 7 - ScreenCoordsXY screenCoords = { windowPos.x + window_clear_scenery_widgets[WIDX_PREVIEW].midX(), - windowPos.y + window_clear_scenery_widgets[WIDX_PREVIEW].midY() }; - if (gLandToolSize > kLandToolMaximumSizeWithSprite) - { - auto ft = Formatter(); - ft.Add(gLandToolSize); - DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + if (ClearSceneryToolIsActive()) + ToolCancel(); } - // Draw cost amount - if (gClearSceneryCost != kMoney64Undefined && gClearSceneryCost != 0 - && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + void OnMouseUp(const WidgetIndex widgetIndex) override { - auto ft = Formatter(); - ft.Add(gClearSceneryCost); - screenCoords.x = window_clear_scenery_widgets[WIDX_PREVIEW].midX() + windowPos.x; - screenCoords.y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 + 27; - DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_PREVIEW: + { + Formatter ft; + ft.Add(kLandToolMinimumSize); + ft.Add(kLandToolMaximumSize); + TextInputOpen(WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); + break; + } + case WIDX_SMALL_SCENERY: + gClearSmallScenery ^= 1; + Invalidate(); + break; + case WIDX_LARGE_SCENERY: + gClearLargeScenery ^= 1; + Invalidate(); + break; + case WIDX_FOOTPATH: + gClearFootpath ^= 1; + Invalidate(); + break; + } } - } - void OnResize() override + void OnMouseDown(const WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_DECREMENT: + // Decrement land tool size, if it stays within the limit + gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); + + // Invalidate the window + Invalidate(); + break; + case WIDX_INCREMENT: + // Increment land tool size, if it stays within the limit + gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); + + // Invalidate the window + Invalidate(); + break; + } + } + + void OnTextInput(const WidgetIndex widgetIndex, const std::string_view text) override + { + if (widgetIndex != WIDX_PREVIEW || text.empty()) + return; + + try + { + int32_t size = std::stol(std::string(text)); + size = std::clamp(size, kLandToolMinimumSize, kLandToolMaximumSize); + gLandToolSize = size; + Invalidate(); + } + catch (const std::logic_error&) + { + // std::stol can throw std::out_of_range or std::invalid_argument + } + } + + void OnUpdate() override + { + frame_no++; + // Close window if another tool is open + if (!ClearSceneryToolIsActive()) + Close(); + } + + void Invalidate() + { + // Set the preview image button to be pressed down + pressed_widgets = (1uLL << WIDX_PREVIEW) | (gClearSmallScenery ? (1uLL << WIDX_SMALL_SCENERY) : 0) + | (gClearLargeScenery ? (1uLL << WIDX_LARGE_SCENERY) : 0) | (gClearFootpath ? (1uLL << WIDX_FOOTPATH) : 0); + + // Update the preview image (for tool sizes up to 7) + window_clear_scenery_widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + // Draw number for tool sizes bigger than 7 + ScreenCoordsXY screenCoords = { windowPos.x + window_clear_scenery_widgets[WIDX_PREVIEW].midX(), + windowPos.y + window_clear_scenery_widgets[WIDX_PREVIEW].midY() }; + if (gLandToolSize > kLandToolMaximumSizeWithSprite) + { + auto ft = Formatter(); + ft.Add(gLandToolSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + } + + // Draw cost amount + if (gClearSceneryCost != kMoney64Undefined && gClearSceneryCost != 0 + && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + auto ft = Formatter(); + ft.Add(gClearSceneryCost); + screenCoords.x = window_clear_scenery_widgets[WIDX_PREVIEW].midX() + windowPos.x; + screenCoords.y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 + 27; + DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + } + } + + void OnResize() override + { + ResizeFrame(); + } + }; + + WindowBase* ClearSceneryOpen() { - ResizeFrame(); + auto* w = static_cast(WindowBringToFrontByClass(WindowClass::ClearScenery)); + + if (w != nullptr) + return w; + + w = WindowCreate(WindowClass::ClearScenery, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); + + if (w != nullptr) + return w; + + return nullptr; } -}; - -WindowBase* WindowClearSceneryOpen() -{ - auto* w = static_cast(WindowBringToFrontByClass(WindowClass::ClearScenery)); - - if (w != nullptr) - return w; - - w = WindowCreate(WindowClass::ClearScenery, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); - - if (w != nullptr) - return w; - - return nullptr; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp index 13f2c64d14..25960fc494 100644 --- a/src/openrct2-ui/windows/CustomCurrency.cpp +++ b/src/openrct2-ui/windows/CustomCurrency.cpp @@ -18,11 +18,13 @@ #include #include -static constexpr StringId WINDOW_TITLE = STR_CUSTOM_CURRENCY_WINDOW_TITLE; -static constexpr int32_t WH = 100; -static constexpr int32_t WW = 400; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_CUSTOM_CURRENCY_WINDOW_TITLE; + static constexpr int32_t WH = 100; + static constexpr int32_t WW = 400; -// clang-format off + // clang-format off enum WindowCustomCurrencyWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -41,191 +43,193 @@ static Widget window_custom_currency_widgets[] = { MakeWidget ({120, 50}, { 81, 11}, WindowWidgetType::Button, WindowColour::Secondary, STR_EMPTY ), MakeWidget ({220, 50}, {131, 11}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), MakeWidget ({339, 51}, { 11, 9}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class CustomCurrencyWindow final : public Window -{ -public: - void OnOpen() override + class CustomCurrencyWindow final : public Window { - widgets = window_custom_currency_widgets; - hold_down_widgets = (1uLL << WIDX_RATE_UP) | (1uLL << WIDX_RATE_DOWN); - WindowInitScrollWidgets(*this); - colours[0] = COLOUR_LIGHT_BROWN; - colours[1] = COLOUR_LIGHT_BROWN; - colours[2] = COLOUR_LIGHT_BROWN; - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - auto* widget = &widgets[widgetIndex - 1]; - - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_CLOSE: - Close(); - break; - case WIDX_RATE_UP: - CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate += 1; - gConfigGeneral.CustomCurrencyRate = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate; - ConfigSaveDefault(); - WindowInvalidateAll(); - break; - case WIDX_RATE_DOWN: - if (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate > 1) - { - CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate -= 1; + widgets = window_custom_currency_widgets; + hold_down_widgets = (1uLL << WIDX_RATE_UP) | (1uLL << WIDX_RATE_DOWN); + WindowInitScrollWidgets(*this); + colours[0] = COLOUR_LIGHT_BROWN; + colours[1] = COLOUR_LIGHT_BROWN; + colours[2] = COLOUR_LIGHT_BROWN; + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + auto* widget = &widgets[widgetIndex - 1]; + + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_RATE_UP: + CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate += 1; gConfigGeneral.CustomCurrencyRate = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate; ConfigSaveDefault(); WindowInvalidateAll(); - } - break; - case WIDX_AFFIX_DROPDOWN_BUTTON: - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_PREFIX; + break; + case WIDX_RATE_DOWN: + if (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate > 1) + { + CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate -= 1; + gConfigGeneral.CustomCurrencyRate = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate; + ConfigSaveDefault(); + WindowInvalidateAll(); + } + break; + case WIDX_AFFIX_DROPDOWN_BUTTON: + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_PREFIX; - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Args = STR_SUFFIX; + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Args = STR_SUFFIX; - WindowDropdownShowTextCustomWidth( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, 2, widget->width() - 3); + WindowDropdownShowTextCustomWidth( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, + Dropdown::Flag::StayOpen, 2, widget->width() - 3); - if (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode == CurrencyAffix::Prefix) - { - Dropdown::SetChecked(0, true); - } - else - { - Dropdown::SetChecked(1, true); - } + if (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode == CurrencyAffix::Prefix) + { + Dropdown::SetChecked(0, true); + } + else + { + Dropdown::SetChecked(1, true); + } - break; - case WIDX_SYMBOL_TEXT: - WindowTextInputRawOpen( - this, WIDX_SYMBOL_TEXT, STR_CUSTOM_CURRENCY_SYMBOL_INPUT_TITLE, STR_CUSTOM_CURRENCY_SYMBOL_INPUT_DESC, {}, - CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode, CURRENCY_SYMBOL_MAX_SIZE); - break; - } - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_RATE: - WindowTextInputOpen( - this, WIDX_RATE, STR_RATE_INPUT_TITLE, STR_RATE_INPUT_DESC, {}, STR_FORMAT_INTEGER, - static_cast(CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate), - CURRENCY_RATE_MAX_NUM_DIGITS); - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - if (dropdownIndex == -1) - return; - - if (widgetIndex == WIDX_AFFIX_DROPDOWN_BUTTON) - { - if (dropdownIndex == 0) - { - CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_ascii = CurrencyAffix::Prefix; - CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode = CurrencyAffix::Prefix; + break; + case WIDX_SYMBOL_TEXT: + WindowTextInputRawOpen( + this, WIDX_SYMBOL_TEXT, STR_CUSTOM_CURRENCY_SYMBOL_INPUT_TITLE, STR_CUSTOM_CURRENCY_SYMBOL_INPUT_DESC, + {}, CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode, CURRENCY_SYMBOL_MAX_SIZE); + break; } - else if (dropdownIndex == 1) - { - CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_ascii = CurrencyAffix::Suffix; - CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode = CurrencyAffix::Suffix; - } - - gConfigGeneral.CustomCurrencyAffix = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode; - ConfigSaveDefault(); - - WindowInvalidateAll(); } - } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (text.empty()) - return; - - int32_t rate; - - switch (widgetIndex) + void OnMouseUp(WidgetIndex widgetIndex) override { - case WIDX_SYMBOL_TEXT: - SafeStrCpy( - CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode, std::string(text).c_str(), - CURRENCY_SYMBOL_MAX_SIZE); + switch (widgetIndex) + { + case WIDX_RATE: + WindowTextInputOpen( + this, WIDX_RATE, STR_RATE_INPUT_TITLE, STR_RATE_INPUT_DESC, {}, STR_FORMAT_INTEGER, + static_cast(CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate), + CURRENCY_RATE_MAX_NUM_DIGITS); + break; + } + } - gConfigGeneral.CustomCurrencySymbol = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode; + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + { + if (dropdownIndex == -1) + return; + if (widgetIndex == WIDX_AFFIX_DROPDOWN_BUTTON) + { + if (dropdownIndex == 0) + { + CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_ascii = CurrencyAffix::Prefix; + CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode = CurrencyAffix::Prefix; + } + else if (dropdownIndex == 1) + { + CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_ascii = CurrencyAffix::Suffix; + CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode = CurrencyAffix::Suffix; + } + + gConfigGeneral.CustomCurrencyAffix = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode; ConfigSaveDefault(); - WindowInvalidateAll(); - break; - case WIDX_RATE: - const auto res = String::Parse(text); - if (res.has_value()) - { - rate = res.value(); - CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate = rate; - gConfigGeneral.CustomCurrencyRate = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate; + WindowInvalidateAll(); + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (text.empty()) + return; + + int32_t rate; + + switch (widgetIndex) + { + case WIDX_SYMBOL_TEXT: + SafeStrCpy( + CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode, std::string(text).c_str(), + CURRENCY_SYMBOL_MAX_SIZE); + + gConfigGeneral.CustomCurrencySymbol = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode; + ConfigSaveDefault(); WindowInvalidateAll(); - } - break; + break; + + case WIDX_RATE: + const auto res = String::Parse(text); + if (res.has_value()) + { + rate = res.value(); + CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate = rate; + gConfigGeneral.CustomCurrencyRate = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate; + ConfigSaveDefault(); + WindowInvalidateAll(); + } + break; + } } - } - void OnDraw(DrawPixelInfo& dpi) override + void OnDraw(DrawPixelInfo& dpi) override + { + auto ft = Formatter::Common(); + ft.Add(10.00_GBP); + + DrawWidgets(dpi); + + auto screenCoords = windowPos + ScreenCoordsXY{ 10, 30 }; + + DrawTextBasic(dpi, screenCoords, STR_RATE, {}, { colours[1] }); + + int32_t baseExchange = CurrencyDescriptors[EnumValue(CurrencyType::Pounds)].rate; + ft = Formatter(); + ft.Add(baseExchange); + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 200, 0 }, STR_CUSTOM_CURRENCY_EQUIVALENCY, ft, { colours[1] }); + + screenCoords.y += 20; + + DrawTextBasic(dpi, screenCoords, STR_CURRENCY_SYMBOL_TEXT, {}, { colours[1] }); + + screenCoords = windowPos + + ScreenCoordsXY{ window_custom_currency_widgets[WIDX_SYMBOL_TEXT].left + 1, + window_custom_currency_widgets[WIDX_SYMBOL_TEXT].top }; + + GfxDrawString( + dpi, screenCoords, CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode, { colours[1] }); + + auto drawPos = windowPos + + ScreenCoordsXY{ window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].left + 1, + window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].top }; + StringId stringId = (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode == CurrencyAffix::Prefix) + ? STR_PREFIX + : STR_SUFFIX; + DrawTextBasic(dpi, drawPos, stringId, {}, { colours[1] }); + } + + void OnResize() override + { + ResizeFrame(); + } + }; + + WindowBase* CustomCurrencyOpen() { - auto ft = Formatter::Common(); - ft.Add(10.00_GBP); - - DrawWidgets(dpi); - - auto screenCoords = windowPos + ScreenCoordsXY{ 10, 30 }; - - DrawTextBasic(dpi, screenCoords, STR_RATE, {}, { colours[1] }); - - int32_t baseExchange = CurrencyDescriptors[EnumValue(CurrencyType::Pounds)].rate; - ft = Formatter(); - ft.Add(baseExchange); - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 200, 0 }, STR_CUSTOM_CURRENCY_EQUIVALENCY, ft, { colours[1] }); - - screenCoords.y += 20; - - DrawTextBasic(dpi, screenCoords, STR_CURRENCY_SYMBOL_TEXT, {}, { colours[1] }); - - screenCoords = windowPos - + ScreenCoordsXY{ window_custom_currency_widgets[WIDX_SYMBOL_TEXT].left + 1, - window_custom_currency_widgets[WIDX_SYMBOL_TEXT].top }; - - GfxDrawString(dpi, screenCoords, CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode, { colours[1] }); - - auto drawPos = windowPos - + ScreenCoordsXY{ window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].left + 1, - window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].top }; - StringId stringId = (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode == CurrencyAffix::Prefix) - ? STR_PREFIX - : STR_SUFFIX; - DrawTextBasic(dpi, drawPos, stringId, {}, { colours[1] }); + return WindowFocusOrCreate(WindowClass::CustomCurrencyConfig, WW, WH, WF_CENTRE_SCREEN); } - - void OnResize() override - { - ResizeFrame(); - } -}; - -WindowBase* CustomCurrencyWindowOpen() -{ - return WindowFocusOrCreate(WindowClass::CustomCurrencyConfig, WW, WH, WF_CENTRE_SCREEN); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index a6adcada05..42627d6003 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -19,7 +19,9 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum WindowDebugPaintWidgetIdx { WIDX_BACKGROUND, @@ -40,114 +42,116 @@ static Widget window_debug_paint_widgets[] = { MakeWidget({8, 8 + 15 * 2}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_SHOW_SEGMENT_HEIGHTS), MakeWidget({8, 8 + 15 * 3}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_SHOW_BOUND_BOXES ), MakeWidget({8, 8 + 15 * 4}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_SHOW_DIRTY_VISUALS ), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class DebugPaintWindow final : public Window -{ -private: - int32_t ResizeLanguage = LANGUAGE_UNDEFINED; - -public: - void OnOpen() override + class DebugPaintWindow final : public Window { - widgets = window_debug_paint_widgets; + private: + int32_t ResizeLanguage = LANGUAGE_UNDEFINED; - InitScrollWidgets(); - WindowPushOthersBelow(*this); - - colours[0] = TRANSLUCENT(COLOUR_BLACK); - colours[1] = COLOUR_GREY; - - ResizeLanguage = LANGUAGE_UNDEFINED; - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_TOGGLE_SHOW_WIDE_PATHS: - gPaintWidePathsAsGhost = !gPaintWidePathsAsGhost; - GfxInvalidateScreen(); - break; + widgets = window_debug_paint_widgets; - case WIDX_TOGGLE_SHOW_BLOCKED_TILES: - gPaintBlockedTiles = !gPaintBlockedTiles; - GfxInvalidateScreen(); - break; + InitScrollWidgets(); + WindowPushOthersBelow(*this); - case WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS: - gShowSupportSegmentHeights = !gShowSupportSegmentHeights; - GfxInvalidateScreen(); - break; + colours[0] = TRANSLUCENT(COLOUR_BLACK); + colours[1] = COLOUR_GREY; - case WIDX_TOGGLE_SHOW_BOUND_BOXES: - gPaintBoundingBoxes = !gPaintBoundingBoxes; - GfxInvalidateScreen(); - break; - - case WIDX_TOGGLE_SHOW_DIRTY_VISUALS: - gShowDirtyVisuals = !gShowDirtyVisuals; - GfxInvalidateScreen(); - break; + ResizeLanguage = LANGUAGE_UNDEFINED; } - } - void OnPrepareDraw() override - { - const auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); - const auto currentLanguage = ls.GetCurrentLanguage(); - if (ResizeLanguage != currentLanguage) + void OnMouseUp(WidgetIndex widgetIndex) override { - ResizeLanguage = currentLanguage; - Invalidate(); - - // Find the width of the longest string - int16_t newWidth = 0; - for (size_t widgetIndex = WIDX_TOGGLE_SHOW_WIDE_PATHS; widgetIndex <= WIDX_TOGGLE_SHOW_DIRTY_VISUALS; widgetIndex++) + switch (widgetIndex) { - const auto& stringIdx = widgets[widgetIndex].text; - auto string = ls.GetString(stringIdx); - Guard::ArgumentNotNull(string); - const auto strWidth = GfxGetStringWidth(string, FontStyle::Medium); - newWidth = std::max(strWidth, newWidth); + case WIDX_TOGGLE_SHOW_WIDE_PATHS: + gPaintWidePathsAsGhost = !gPaintWidePathsAsGhost; + GfxInvalidateScreen(); + break; + + case WIDX_TOGGLE_SHOW_BLOCKED_TILES: + gPaintBlockedTiles = !gPaintBlockedTiles; + GfxInvalidateScreen(); + break; + + case WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS: + gShowSupportSegmentHeights = !gShowSupportSegmentHeights; + GfxInvalidateScreen(); + break; + + case WIDX_TOGGLE_SHOW_BOUND_BOXES: + gPaintBoundingBoxes = !gPaintBoundingBoxes; + GfxInvalidateScreen(); + break; + + case WIDX_TOGGLE_SHOW_DIRTY_VISUALS: + gShowDirtyVisuals = !gShowDirtyVisuals; + GfxInvalidateScreen(); + break; + } + } + + void OnPrepareDraw() override + { + const auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); + const auto currentLanguage = ls.GetCurrentLanguage(); + if (ResizeLanguage != currentLanguage) + { + ResizeLanguage = currentLanguage; + Invalidate(); + + // Find the width of the longest string + int16_t newWidth = 0; + for (size_t widgetIndex = WIDX_TOGGLE_SHOW_WIDE_PATHS; widgetIndex <= WIDX_TOGGLE_SHOW_DIRTY_VISUALS; + widgetIndex++) + { + const auto& stringIdx = widgets[widgetIndex].text; + auto string = ls.GetString(stringIdx); + Guard::ArgumentNotNull(string); + const auto strWidth = GfxGetStringWidth(string, FontStyle::Medium); + newWidth = std::max(strWidth, newWidth); + } + + // Add padding for both sides (8) and the offset for the text after the checkbox (15) + newWidth += 8 * 2 + 15; + + width = newWidth; + max_width = newWidth; + min_width = newWidth; + widgets[WIDX_BACKGROUND].right = newWidth - 1; + widgets[WIDX_TOGGLE_SHOW_WIDE_PATHS].right = newWidth - 8; + widgets[WIDX_TOGGLE_SHOW_BLOCKED_TILES].right = newWidth - 8; + widgets[WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS].right = newWidth - 8; + widgets[WIDX_TOGGLE_SHOW_BOUND_BOXES].right = newWidth - 8; + widgets[WIDX_TOGGLE_SHOW_DIRTY_VISUALS].right = newWidth - 8; + + Invalidate(); } - // Add padding for both sides (8) and the offset for the text after the checkbox (15) - newWidth += 8 * 2 + 15; - - width = newWidth; - max_width = newWidth; - min_width = newWidth; - widgets[WIDX_BACKGROUND].right = newWidth - 1; - widgets[WIDX_TOGGLE_SHOW_WIDE_PATHS].right = newWidth - 8; - widgets[WIDX_TOGGLE_SHOW_BLOCKED_TILES].right = newWidth - 8; - widgets[WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS].right = newWidth - 8; - widgets[WIDX_TOGGLE_SHOW_BOUND_BOXES].right = newWidth - 8; - widgets[WIDX_TOGGLE_SHOW_DIRTY_VISUALS].right = newWidth - 8; - - Invalidate(); + WidgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_WIDE_PATHS, gPaintWidePathsAsGhost); + WidgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_BLOCKED_TILES, gPaintBlockedTiles); + WidgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS, gShowSupportSegmentHeights); + WidgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_BOUND_BOXES, gPaintBoundingBoxes); + WidgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_DIRTY_VISUALS, gShowDirtyVisuals); } - WidgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_WIDE_PATHS, gPaintWidePathsAsGhost); - WidgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_BLOCKED_TILES, gPaintBlockedTiles); - WidgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS, gShowSupportSegmentHeights); - WidgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_BOUND_BOXES, gPaintBoundingBoxes); - WidgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_DIRTY_VISUALS, gShowDirtyVisuals); - } + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + } + }; - void OnDraw(DrawPixelInfo& dpi) override + WindowBase* DebugPaintOpen() { - DrawWidgets(dpi); + auto* window = WindowFocusOrCreate( + WindowClass::DebugPaint, { 16, ContextGetHeight() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT, + WF_STICK_TO_FRONT | WF_TRANSPARENT); + + return window; } -}; - -WindowBase* WindowDebugPaintOpen() -{ - auto* window = WindowFocusOrCreate( - WindowClass::DebugPaint, { 16, ContextGetHeight() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT, - WF_STICK_TO_FRONT | WF_TRANSPARENT); - - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index cee8a4bd02..e9ab8914f4 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -19,12 +19,12 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr int32_t WW = 200; + static constexpr int32_t WH = 100; -static constexpr int32_t WW = 200; -static constexpr int32_t WH = 100; - -// clang-format off + // clang-format off enum WindowRideDemolishWidgetIdx { WIDX_BACKGROUND, @@ -39,87 +39,89 @@ static Widget window_ride_demolish_widgets[] = WINDOW_SHIM_WHITE(STR_DEMOLISH_RIDE, WW, WH), MakeWidget({ 10, WH - 22}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_DEMOLISH ), MakeWidget({WW - 95, WH - 22}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class DemolishRidePromptWindow final : public Window -{ - money64 _demolishRideCost; - -public: - void SetRide(const Ride& currentRide) + class DemolishRidePromptWindow final : public Window { - rideId = currentRide.id; - _demolishRideCost = -RideGetRefundPrice(currentRide); - } + money64 _demolishRideCost; - void OnOpen() override - { - widgets = window_ride_demolish_widgets; - WindowInitScrollWidgets(*this); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void SetRide(const Ride& currentRide) { - case WIDX_DEMOLISH: + rideId = currentRide.id; + _demolishRideCost = -RideGetRefundPrice(currentRide); + } + + void OnOpen() override + { + widgets = window_ride_demolish_widgets; + WindowInitScrollWidgets(*this); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) { - auto gameAction = RideDemolishAction(rideId, RIDE_MODIFY_DEMOLISH); - GameActions::Execute(&gameAction); - break; + case WIDX_DEMOLISH: + { + auto gameAction = RideDemolishAction(rideId, RIDE_MODIFY_DEMOLISH); + GameActions::Execute(&gameAction); + break; + } + case WIDX_CANCEL: + case WIDX_CLOSE: + Close(); + break; } - case WIDX_CANCEL: - case WIDX_CLOSE: - Close(); - break; } - } - void OnDraw(DrawPixelInfo& dpi) override - { - WindowDrawWidgets(*this, dpi); - - auto currentRide = GetRide(rideId); - if (currentRide != nullptr) + void OnDraw(DrawPixelInfo& dpi) override { - auto stringId = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) ? STR_DEMOLISH_RIDE_ID - : STR_DEMOLISH_RIDE_ID_MONEY; - auto ft = Formatter(); - currentRide->FormatNameTo(ft); - ft.Add(_demolishRideCost); + WindowDrawWidgets(*this, dpi); - ScreenCoordsXY stringCoords(windowPos.x + WW / 2, windowPos.y + (WH / 2) - 3); - DrawTextWrapped(dpi, stringCoords, WW - 4, stringId, ft, { TextAlignment::CENTRE }); + auto currentRide = GetRide(rideId); + if (currentRide != nullptr) + { + auto stringId = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) ? STR_DEMOLISH_RIDE_ID + : STR_DEMOLISH_RIDE_ID_MONEY; + auto ft = Formatter(); + currentRide->FormatNameTo(ft); + ft.Add(_demolishRideCost); + + ScreenCoordsXY stringCoords(windowPos.x + WW / 2, windowPos.y + (WH / 2) - 3); + DrawTextWrapped(dpi, stringCoords, WW - 4, stringId, ft, { TextAlignment::CENTRE }); + } } - } - void OnResize() override + void OnResize() override + { + ResizeFrame(); + } + }; + + WindowBase* RideDemolishPromptOpen(const Ride& ride) { - ResizeFrame(); + WindowBase* w; + DemolishRidePromptWindow* newWindow; + + w = WindowFindByClass(WindowClass::DemolishRidePrompt); + if (w != nullptr) + { + auto windowPos = w->windowPos; + WindowClose(*w); + newWindow = WindowCreate( + WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT); + } + else + { + newWindow = WindowCreate( + WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); + } + + newWindow->SetRide(ride); + + return newWindow; } -}; - -WindowBase* WindowRideDemolishPromptOpen(const Ride& ride) -{ - WindowBase* w; - DemolishRidePromptWindow* newWindow; - - w = WindowFindByClass(WindowClass::DemolishRidePrompt); - if (w != nullptr) - { - auto windowPos = w->windowPos; - WindowClose(*w); - newWindow = WindowCreate(WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT); - } - else - { - newWindow = WindowCreate( - WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); - } - - newWindow->SetRide(ride); - - return newWindow; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 6d138abb58..1d796f5390 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -21,431 +22,381 @@ #include #include -using namespace OpenRCT2; - -// The maximum number of rows to list before items overflow into new columns -constexpr int32_t DROPDOWN_TEXT_MAX_ROWS = 32; - -constexpr int32_t DROPDOWN_ITEM_HEIGHT = 12; - -static constexpr std::array _appropriateImageDropdownItemsPerRow = { - 1, 1, 1, 1, 2, 2, 3, 3, 4, 3, // 10 - 5, 4, 4, 5, 5, 5, 4, 5, 6, 5, // 20 - 5, 7, 4, 5, 6, 5, 6, 6, 6, 6, // 30 - 6, 8, 8, 8, 9, 9, 9, 9, 9, 9, // 40 - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 50 - 9, 9, 9, 9, 9, 9, 9, // 56 -}; - -enum +namespace OpenRCT2::Ui::Windows { - WIDX_BACKGROUND, -}; + // The maximum number of rows to list before items overflow into new columns + constexpr int32_t DROPDOWN_TEXT_MAX_ROWS = 32; -static Widget window_dropdown_widgets[] = { - MakeWidget({ 0, 0 }, { 1, 1 }, WindowWidgetType::ImgBtn, WindowColour::Primary), - WIDGETS_END, -}; + constexpr int32_t DROPDOWN_ITEM_HEIGHT = 12; -int32_t gDropdownNumItems; -Dropdown::Item gDropdownItems[Dropdown::ItemsMaxSize]; -static ImageId _dropdownItemsImages[Dropdown::ItemsMaxSize]; -bool gDropdownIsColour; -int32_t gDropdownLastColourHover; -int32_t gDropdownHighlightedIndex; -int32_t gDropdownDefaultIndex; -static bool _dropdownPrepareUseImages; + static constexpr std::array _appropriateImageDropdownItemsPerRow = { + 1, 1, 1, 1, 2, 2, 3, 3, 4, 3, // 10 + 5, 4, 4, 5, 5, 5, 4, 5, 6, 5, // 20 + 5, 7, 4, 5, 6, 5, 6, 6, 6, 6, // 30 + 6, 8, 8, 8, 9, 9, 9, 9, 9, 9, // 40 + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 50 + 9, 9, 9, 9, 9, 9, 9, // 56 + }; -static void ResetDropdownFlags() -{ - for (size_t i = 0; i < std::size(gDropdownItems); i++) + enum { - gDropdownItems[i].Flags = 0; - } -} + WIDX_BACKGROUND, + }; -bool Dropdown::IsChecked(int32_t index) -{ - if (index < 0 || index >= static_cast(std::size(gDropdownItems))) + static Widget window_dropdown_widgets[] = { + MakeWidget({ 0, 0 }, { 1, 1 }, WindowWidgetType::ImgBtn, WindowColour::Primary), + kWidgetsEnd, + }; + + int32_t gDropdownNumItems; + Dropdown::Item gDropdownItems[Dropdown::ItemsMaxSize]; + static ImageId _dropdownItemsImages[Dropdown::ItemsMaxSize]; + bool gDropdownIsColour; + int32_t gDropdownLastColourHover; + int32_t gDropdownHighlightedIndex; + int32_t gDropdownDefaultIndex; + static bool _dropdownPrepareUseImages; + + static void ResetDropdownFlags() { - return false; - } - return gDropdownItems[index].IsChecked(); -} - -bool Dropdown::IsDisabled(int32_t index) -{ - if (index < 0 || index >= static_cast(std::size(gDropdownItems))) - { - return true; - } - return gDropdownItems[index].IsDisabled(); -} - -void Dropdown::SetChecked(int32_t index, bool value) -{ - if (index < 0 || index >= static_cast(std::size(gDropdownItems))) - { - return; - } - if (value) - gDropdownItems[index].Flags |= EnumValue(Dropdown::ItemFlag::IsChecked); - else - gDropdownItems[index].Flags &= ~EnumValue(Dropdown::ItemFlag::IsChecked); -} - -void Dropdown::SetDisabled(int32_t index, bool value) -{ - if (index < 0 || index >= static_cast(std::size(gDropdownItems))) - { - return; - } - if (value) - gDropdownItems[index].Flags |= EnumValue(Dropdown::ItemFlag::IsDisabled); - else - gDropdownItems[index].Flags &= ~EnumValue(Dropdown::ItemFlag::IsDisabled); -} - -void Dropdown::SetImage(int32_t index, ImageId image) -{ - if (index < 0 || index >= static_cast(std::size(_dropdownItemsImages))) - { - return; - } - _dropdownItemsImages[index] = image; - _dropdownPrepareUseImages = true; -} - -class DropdownWindow final : public Window -{ - bool UseImages; - int32_t NumColumns; - int32_t NumRows; - int32_t ItemWidth; - int32_t ItemHeight; - bool ListVertically; - -public: - void OnOpen() override - { - widgets = window_dropdown_widgets; - - // Input state - gDropdownHighlightedIndex = -1; - ResetDropdownFlags(); - gDropdownIsColour = false; - gDropdownDefaultIndex = -1; - InputSetState(InputState::DropdownActive); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - int32_t highlightedIndex = gDropdownHighlightedIndex; - for (int32_t i = 0; i < gDropdownNumItems; i++) + for (size_t i = 0; i < std::size(gDropdownItems); i++) { - ScreenCoordsXY cellCoords; - if (ListVertically) - cellCoords = { i / NumRows, i % NumRows }; - else - cellCoords = { i % NumColumns, i / NumColumns }; + gDropdownItems[i].Flags = 0; + } + } - ScreenCoordsXY screenCoords = windowPos - + ScreenCoordsXY{ 2 + (cellCoords.x * ItemWidth), 2 + (cellCoords.y * ItemHeight) }; + class DropdownWindow final : public Window + { + bool UseImages; + int32_t NumColumns; + int32_t NumRows; + int32_t ItemWidth; + int32_t ItemHeight; + bool ListVertically; - if (gDropdownItems[i].IsSeparator()) + public: + void OnOpen() override + { + widgets = window_dropdown_widgets; + + // Input state + gDropdownHighlightedIndex = -1; + ResetDropdownFlags(); + gDropdownIsColour = false; + gDropdownDefaultIndex = -1; + InputSetState(InputState::DropdownActive); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + int32_t highlightedIndex = gDropdownHighlightedIndex; + for (int32_t i = 0; i < gDropdownNumItems; i++) { - const ScreenCoordsXY leftTop = screenCoords + ScreenCoordsXY{ 0, (ItemHeight / 2) }; - const ScreenCoordsXY rightBottom = leftTop + ScreenCoordsXY{ ItemWidth - 1, 0 }; - const ScreenCoordsXY shadowOffset{ 0, 1 }; + ScreenCoordsXY cellCoords; + if (ListVertically) + cellCoords = { i / NumRows, i % NumRows }; + else + cellCoords = { i % NumColumns, i / NumColumns }; - if (colours[0] & COLOUR_FLAG_TRANSLUCENT) + ScreenCoordsXY screenCoords = windowPos + + ScreenCoordsXY{ 2 + (cellCoords.x * ItemWidth), 2 + (cellCoords.y * ItemHeight) }; + + if (gDropdownItems[i].IsSeparator()) { - TranslucentWindowPalette palette = TranslucentWindowPalettes[BASE_COLOUR(colours[0])]; - GfxFilterRect(dpi, { leftTop, rightBottom }, palette.highlight); - GfxFilterRect(dpi, { leftTop + shadowOffset, rightBottom + shadowOffset }, palette.shadow); + const ScreenCoordsXY leftTop = screenCoords + ScreenCoordsXY{ 0, (ItemHeight / 2) }; + const ScreenCoordsXY rightBottom = leftTop + ScreenCoordsXY{ ItemWidth - 1, 0 }; + const ScreenCoordsXY shadowOffset{ 0, 1 }; + + if (colours[0] & COLOUR_FLAG_TRANSLUCENT) + { + TranslucentWindowPalette palette = TranslucentWindowPalettes[BASE_COLOUR(colours[0])]; + GfxFilterRect(dpi, { leftTop, rightBottom }, palette.highlight); + GfxFilterRect(dpi, { leftTop + shadowOffset, rightBottom + shadowOffset }, palette.shadow); + } + else + { + GfxFillRect(dpi, { leftTop, rightBottom }, ColourMapA[colours[0]].mid_dark); + GfxFillRect( + dpi, { leftTop + shadowOffset, rightBottom + shadowOffset }, ColourMapA[colours[0]].lightest); + } } else { - GfxFillRect(dpi, { leftTop, rightBottom }, ColourMapA[colours[0]].mid_dark); - GfxFillRect(dpi, { leftTop + shadowOffset, rightBottom + shadowOffset }, ColourMapA[colours[0]].lightest); - } - } - else - { - if (i == highlightedIndex) - { - // Darken the cell's background slightly when highlighted - const ScreenCoordsXY rightBottom = screenCoords + ScreenCoordsXY{ ItemWidth - 1, ItemHeight - 1 }; - GfxFilterRect(dpi, { screenCoords, rightBottom }, FilterPaletteID::PaletteDarken3); - } - - StringId item = gDropdownItems[i].Format; - if (item == Dropdown::FormatLandPicker || item == Dropdown::FormatColourPicker) - { - // Image item - auto image = UseImages ? _dropdownItemsImages[i] - : ImageId::FromUInt32(static_cast(gDropdownItems[i].Args)); - if (item == Dropdown::FormatColourPicker && highlightedIndex == i) - image = image.WithIndexOffset(1); - GfxDrawSprite(dpi, image, screenCoords); - } - else - { - // Text item - if (i < Dropdown::ItemsMaxSize && Dropdown::IsChecked(i)) - item++; - - // Calculate colour - colour_t colour = NOT_TRANSLUCENT(colours[0]); if (i == highlightedIndex) - colour = COLOUR_WHITE; - if (i < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(i)) - colour = NOT_TRANSLUCENT(colours[0]) | COLOUR_FLAG_INSET; + { + // Darken the cell's background slightly when highlighted + const ScreenCoordsXY rightBottom = screenCoords + ScreenCoordsXY{ ItemWidth - 1, ItemHeight - 1 }; + GfxFilterRect(dpi, { screenCoords, rightBottom }, FilterPaletteID::PaletteDarken3); + } - // Draw item string - Formatter ft(reinterpret_cast(&gDropdownItems[i].Args)); - DrawTextEllipsised(dpi, screenCoords, width - 5, item, ft, { colour }); + StringId item = gDropdownItems[i].Format; + if (item == Dropdown::FormatLandPicker || item == Dropdown::FormatColourPicker) + { + // Image item + auto image = UseImages ? _dropdownItemsImages[i] + : ImageId::FromUInt32(static_cast(gDropdownItems[i].Args)); + if (item == Dropdown::FormatColourPicker && highlightedIndex == i) + image = image.WithIndexOffset(1); + GfxDrawSprite(dpi, image, screenCoords); + } + else + { + // Text item + if (i < Dropdown::ItemsMaxSize && Dropdown::IsChecked(i)) + item++; + + // Calculate colour + colour_t colour = NOT_TRANSLUCENT(colours[0]); + if (i == highlightedIndex) + colour = COLOUR_WHITE; + if (i < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(i)) + colour = NOT_TRANSLUCENT(colours[0]) | COLOUR_FLAG_INSET; + + // Draw item string + Formatter ft(reinterpret_cast(&gDropdownItems[i].Args)); + DrawTextEllipsised(dpi, screenCoords, width - 5, item, ft, { colour }); + } } } } - } - void SetTextItems( - const ScreenCoordsXY& screenPos, int32_t extraY, uint8_t colour, uint8_t customHeight, uint8_t txtFlags, - size_t numItems, int32_t itemWidth) + void SetTextItems( + const ScreenCoordsXY& screenPos, int32_t extraY, uint8_t colour, uint8_t customHeight, uint8_t txtFlags, + size_t numItems, int32_t itemWidth) + { + // Set and calculate num items, rows and columns + ItemWidth = itemWidth; + ItemHeight = (txtFlags & Dropdown::Flag::CustomHeight) ? customHeight : DROPDOWN_ITEM_HEIGHT; + gDropdownNumItems = static_cast(numItems); + // There must always be at least one column to prevent dividing by zero + if (gDropdownNumItems == 0) + { + NumColumns = 1; + NumRows = 1; + } + else + { + NumColumns = (gDropdownNumItems + DROPDOWN_TEXT_MAX_ROWS - 1) / DROPDOWN_TEXT_MAX_ROWS; + NumRows = (gDropdownNumItems + NumColumns - 1) / NumColumns; + } + + // Text dropdowns are listed horizontally + ListVertically = true; + + UpdateSizeAndPosition(screenPos, extraY); + + if (colour & COLOUR_FLAG_TRANSLUCENT) + flags |= WF_TRANSPARENT; + colours[0] = colour; + } + + void SetImageItems( + const ScreenCoordsXY& screenPos, int32_t extraY, uint8_t colour, int32_t numItems, int32_t itemWidth, + int32_t itemHeight, int32_t numColumns) + { + UseImages = _dropdownPrepareUseImages; + _dropdownPrepareUseImages = false; + + // Set and calculate num items, rows and columns + ItemWidth = itemWidth; + ItemHeight = itemHeight; + gDropdownNumItems = numItems; + // There must always be at least one column and row to prevent dividing by zero + if (gDropdownNumItems == 0) + { + NumColumns = 1; + NumRows = 1; + } + else + { + NumColumns = std::max(1, numColumns); + NumRows = gDropdownNumItems / NumColumns; + if (gDropdownNumItems % NumColumns != 0) + NumRows++; + } + + // image dropdowns are listed horizontally + ListVertically = false; + + UpdateSizeAndPosition(screenPos, extraY); + + if (colour & COLOUR_FLAG_TRANSLUCENT) + flags |= WF_TRANSPARENT; + colours[0] = colour; + } + + int32_t GetIndexFromPoint(const ScreenCoordsXY& loc) + { + int32_t top = loc.y - windowPos.y - 2; + if (top < 0) + return -1; + + int32_t left = loc.x - windowPos.x; + if (left >= width) + return -1; + left -= 2; + if (left < 0) + return -1; + + int32_t columnNum = left / ItemWidth; + if (columnNum >= NumColumns) + return -1; + + int32_t rowNum = top / ItemHeight; + if (rowNum >= NumRows) + return -1; + + int32_t dropdownIndex; + if (ListVertically) + dropdownIndex = columnNum * NumRows + rowNum; + else + dropdownIndex = rowNum * NumColumns + columnNum; + + if (dropdownIndex >= gDropdownNumItems) + return -1; + + return dropdownIndex; + } + + private: + void UpdateSizeAndPosition(const ScreenCoordsXY& screenPos, const int32_t extraY) + { + // Calculate position and size + const auto ddWidth = ItemWidth * NumColumns + 3; + const auto ddHeight = ItemHeight * NumRows + 3; + + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + auto boundedScreenPos = screenPos; + if (screenPos.x + ddWidth > screenWidth) + boundedScreenPos.x = std::max(0, screenWidth - ddWidth); + if (screenPos.y + ddHeight > screenHeight) + boundedScreenPos.y = std::max(0, screenHeight - ddHeight); + window_dropdown_widgets[WIDX_BACKGROUND].right = ddWidth; + window_dropdown_widgets[WIDX_BACKGROUND].bottom = ddHeight; + + Invalidate(); + width = ddWidth + 1; + height = ddHeight + 1; + windowPos = boundedScreenPos + ScreenCoordsXY{ 0, extraY }; + Invalidate(); + } + }; + + /** + * Shows a text dropdown menu. + * rct2: 0x006ECFB9 + * + * @param x (cx) + * @param y (dx) + * @param extray (di) + * @param flags (bh) + * @param num_items (bx) + * @param colour (al) + */ + void WindowDropdownShowText( + const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t flags, size_t num_items) { - // Set and calculate num items, rows and columns - ItemWidth = itemWidth; - ItemHeight = (txtFlags & Dropdown::Flag::CustomHeight) ? customHeight : DROPDOWN_ITEM_HEIGHT; - gDropdownNumItems = static_cast(numItems); - // There must always be at least one column to prevent dividing by zero - if (gDropdownNumItems == 0) + int32_t string_width, max_string_width; + char buffer[256]; + + // Calculate the longest string width + max_string_width = 0; + for (size_t i = 0; i < num_items; i++) { - NumColumns = 1; - NumRows = 1; - } - else - { - NumColumns = (gDropdownNumItems + DROPDOWN_TEXT_MAX_ROWS - 1) / DROPDOWN_TEXT_MAX_ROWS; - NumRows = (gDropdownNumItems + NumColumns - 1) / NumColumns; + FormatStringLegacy(buffer, 256, gDropdownItems[i].Format, static_cast(&gDropdownItems[i].Args)); + string_width = GfxGetStringWidth(buffer, FontStyle::Medium); + max_string_width = std::max(string_width, max_string_width); } - // Text dropdowns are listed horizontally - ListVertically = true; - - UpdateSizeAndPosition(screenPos, extraY); - - if (colour & COLOUR_FLAG_TRANSLUCENT) - flags |= WF_TRANSPARENT; - colours[0] = colour; + WindowDropdownShowTextCustomWidth(screenPos, extray, colour, 0, flags, num_items, max_string_width + 3); } - void SetImageItems( - const ScreenCoordsXY& screenPos, int32_t extraY, uint8_t colour, int32_t numItems, int32_t itemWidth, + /** + * Shows a text dropdown menu. + * rct2: 0x006ECFB9, although 0x006ECE50 is real version + * + * @param x (cx) + * @param y (dx) + * @param extray (di) + * @param flags (bh) + * @param num_items (bx) + * @param colour (al) + * @param custom_height (ah) requires flag set as well + */ + void WindowDropdownShowTextCustomWidth( + const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t custom_height, uint8_t flags, size_t num_items, + int32_t width) + { + InputSetFlag(static_cast(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false); + if (flags & Dropdown::Flag::StayOpen) + InputSetFlag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true); + + WindowDropdownClose(); + + // Create the window (width/height position are set later) + auto* w = WindowCreate(WindowClass::Dropdown, width, custom_height, WF_STICK_TO_FRONT); + if (w != nullptr) + { + w->SetTextItems(screenPos, extray, colour, custom_height, flags, num_items, width); + } + } + + /** + * Shows an image dropdown menu. + * rct2: 0x006ECFB9 + * + * @param x (cx) + * @param y (dx) + * @param extray (di) + * @param flags (bh) + * @param numItems (bx) + * @param colour (al) + * @param itemWidth (bp) + * @param itemHeight (ah) + * @param numColumns (bl) + */ + void WindowDropdownShowImage( + int32_t x, int32_t y, int32_t extray, uint8_t colour, uint8_t flags, int32_t numItems, int32_t itemWidth, int32_t itemHeight, int32_t numColumns) { - UseImages = _dropdownPrepareUseImages; - _dropdownPrepareUseImages = false; + InputSetFlag(static_cast(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false); + if (flags & Dropdown::Flag::StayOpen) + InputSetFlag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true); - // Set and calculate num items, rows and columns - ItemWidth = itemWidth; - ItemHeight = itemHeight; - gDropdownNumItems = numItems; - // There must always be at least one column and row to prevent dividing by zero - if (gDropdownNumItems == 0) + // Close existing dropdown + WindowDropdownClose(); + + // Create the window (width/height position are set later) + auto* w = WindowCreate(WindowClass::Dropdown, itemWidth, itemHeight, WF_STICK_TO_FRONT); + if (w != nullptr) { - NumColumns = 1; - NumRows = 1; + w->SetImageItems({ x, y }, extray, colour, numItems, itemWidth, itemHeight, numColumns); } - else + } + + void WindowDropdownClose() + { + WindowCloseByClass(WindowClass::Dropdown); + } + + /** + * New function based on 6e914e + * returns -1 if index is invalid + */ + int32_t DropdownIndexFromPoint(const ScreenCoordsXY& loc, WindowBase* w) + { + if (w->classification == WindowClass::Dropdown) { - NumColumns = std::max(1, numColumns); - NumRows = gDropdownNumItems / NumColumns; - if (gDropdownNumItems % NumColumns != 0) - NumRows++; + auto* ddWnd = static_cast(w); + return ddWnd->GetIndexFromPoint(loc); } - - // image dropdowns are listed horizontally - ListVertically = false; - - UpdateSizeAndPosition(screenPos, extraY); - - if (colour & COLOUR_FLAG_TRANSLUCENT) - flags |= WF_TRANSPARENT; - colours[0] = colour; + return -1; } - int32_t GetIndexFromPoint(const ScreenCoordsXY& loc) - { - int32_t top = loc.y - windowPos.y - 2; - if (top < 0) - return -1; - - int32_t left = loc.x - windowPos.x; - if (left >= width) - return -1; - left -= 2; - if (left < 0) - return -1; - - int32_t columnNum = left / ItemWidth; - if (columnNum >= NumColumns) - return -1; - - int32_t rowNum = top / ItemHeight; - if (rowNum >= NumRows) - return -1; - - int32_t dropdownIndex; - if (ListVertically) - dropdownIndex = columnNum * NumRows + rowNum; - else - dropdownIndex = rowNum * NumColumns + columnNum; - - if (dropdownIndex >= gDropdownNumItems) - return -1; - - return dropdownIndex; - } - -private: - void UpdateSizeAndPosition(const ScreenCoordsXY& screenPos, const int32_t extraY) - { - // Calculate position and size - const auto ddWidth = ItemWidth * NumColumns + 3; - const auto ddHeight = ItemHeight * NumRows + 3; - - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - auto boundedScreenPos = screenPos; - if (screenPos.x + ddWidth > screenWidth) - boundedScreenPos.x = std::max(0, screenWidth - ddWidth); - if (screenPos.y + ddHeight > screenHeight) - boundedScreenPos.y = std::max(0, screenHeight - ddHeight); - window_dropdown_widgets[WIDX_BACKGROUND].right = ddWidth; - window_dropdown_widgets[WIDX_BACKGROUND].bottom = ddHeight; - - Invalidate(); - width = ddWidth + 1; - height = ddHeight + 1; - windowPos = boundedScreenPos + ScreenCoordsXY{ 0, extraY }; - Invalidate(); - } -}; - -/** - * Shows a text dropdown menu. - * rct2: 0x006ECFB9 - * - * @param x (cx) - * @param y (dx) - * @param extray (di) - * @param flags (bh) - * @param num_items (bx) - * @param colour (al) - */ -void WindowDropdownShowText(const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t flags, size_t num_items) -{ - int32_t string_width, max_string_width; - char buffer[256]; - - // Calculate the longest string width - max_string_width = 0; - for (size_t i = 0; i < num_items; i++) - { - FormatStringLegacy(buffer, 256, gDropdownItems[i].Format, static_cast(&gDropdownItems[i].Args)); - string_width = GfxGetStringWidth(buffer, FontStyle::Medium); - max_string_width = std::max(string_width, max_string_width); - } - - WindowDropdownShowTextCustomWidth(screenPos, extray, colour, 0, flags, num_items, max_string_width + 3); -} - -/** - * Shows a text dropdown menu. - * rct2: 0x006ECFB9, although 0x006ECE50 is real version - * - * @param x (cx) - * @param y (dx) - * @param extray (di) - * @param flags (bh) - * @param num_items (bx) - * @param colour (al) - * @param custom_height (ah) requires flag set as well - */ -void WindowDropdownShowTextCustomWidth( - const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t custom_height, uint8_t flags, size_t num_items, - int32_t width) -{ - InputSetFlag(static_cast(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false); - if (flags & Dropdown::Flag::StayOpen) - InputSetFlag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true); - - WindowDropdownClose(); - - // Create the window (width/height position are set later) - auto* w = WindowCreate(WindowClass::Dropdown, width, custom_height, WF_STICK_TO_FRONT); - if (w != nullptr) - { - w->SetTextItems(screenPos, extray, colour, custom_height, flags, num_items, width); - } -} - -/** - * Shows an image dropdown menu. - * rct2: 0x006ECFB9 - * - * @param x (cx) - * @param y (dx) - * @param extray (di) - * @param flags (bh) - * @param numItems (bx) - * @param colour (al) - * @param itemWidth (bp) - * @param itemHeight (ah) - * @param numColumns (bl) - */ -void WindowDropdownShowImage( - int32_t x, int32_t y, int32_t extray, uint8_t colour, uint8_t flags, int32_t numItems, int32_t itemWidth, - int32_t itemHeight, int32_t numColumns) -{ - InputSetFlag(static_cast(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false); - if (flags & Dropdown::Flag::StayOpen) - InputSetFlag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true); - - // Close existing dropdown - WindowDropdownClose(); - - // Create the window (width/height position are set later) - auto* w = WindowCreate(WindowClass::Dropdown, itemWidth, itemHeight, WF_STICK_TO_FRONT); - if (w != nullptr) - { - w->SetImageItems({ x, y }, extray, colour, numItems, itemWidth, itemHeight, numColumns); - } -} - -void WindowDropdownClose() -{ - WindowCloseByClass(WindowClass::Dropdown); -} - -/** - * New function based on 6e914e - * returns -1 if index is invalid - */ -int32_t DropdownIndexFromPoint(const ScreenCoordsXY& loc, WindowBase* w) -{ - if (w->classification == WindowClass::Dropdown) - { - auto* ddWnd = static_cast(w); - return ddWnd->GetIndexFromPoint(loc); - } - return -1; -} - -// clang-format off + // clang-format off // colour_t ordered for use in color dropdown static constexpr colour_t kColoursDropdownOrder[] = { COLOUR_BLACK, @@ -511,55 +462,111 @@ static constexpr colour_t kColoursDropdownOrder[] = { COLOUR_INVISIBLE, COLOUR_VOID }; -// clang-format on + // clang-format on -colour_t ColourDropDownIndexToColour(uint8_t ddidx) -{ - return kColoursDropdownOrder[ddidx]; -} - -/** - * rct2: 0x006ED43D - */ -void WindowDropdownShowColour(WindowBase* w, Widget* widget, uint8_t dropdownColour, uint8_t selectedColour) -{ - int32_t defaultIndex = -1; - - auto numColours = (gCheatsAllowSpecialColourSchemes) ? static_cast(COLOUR_COUNT) : COLOUR_NUM_NORMAL; - // Set items - for (uint64_t i = 0; i < numColours; i++) + colour_t ColourDropDownIndexToColour(uint8_t ddidx) { - auto orderedColour = ColourDropDownIndexToColour(i); - if (selectedColour == orderedColour) - defaultIndex = i; - - // Use special graphic for Invisible colour - auto imageId = (orderedColour == COLOUR_INVISIBLE) ? ImageId(SPR_G2_ICON_PALETTE_INVISIBLE, COLOUR_WHITE) - : ImageId(SPR_PALETTE_BTN, orderedColour); - - gDropdownItems[i].Format = Dropdown::FormatColourPicker; - gDropdownItems[i].Args = (i << 32) | imageId.ToUInt32(); + return kColoursDropdownOrder[ddidx]; } - // Show dropdown - WindowDropdownShowImage( - w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, dropdownColour, - Dropdown::Flag::StayOpen, numColours, 12, 12, - DropdownGetAppropriateImageDropdownItemsPerRow(static_cast(numColours))); + /** + * rct2: 0x006ED43D + */ + void WindowDropdownShowColour(WindowBase* w, Widget* widget, uint8_t dropdownColour, uint8_t selectedColour) + { + int32_t defaultIndex = -1; - gDropdownIsColour = true; - gDropdownLastColourHover = -1; - gDropdownDefaultIndex = defaultIndex; -} + auto numColours = (GetGameState().Cheats.AllowSpecialColourSchemes) ? static_cast(COLOUR_COUNT) + : COLOUR_NUM_NORMAL; + // Set items + for (uint64_t i = 0; i < numColours; i++) + { + auto orderedColour = ColourDropDownIndexToColour(i); + if (selectedColour == orderedColour) + defaultIndex = i; -uint32_t DropdownGetAppropriateImageDropdownItemsPerRow(uint32_t numItems) + // Use special graphic for Invisible colour + auto imageId = (orderedColour == COLOUR_INVISIBLE) ? ImageId(SPR_G2_ICON_PALETTE_INVISIBLE, COLOUR_WHITE) + : ImageId(SPR_PALETTE_BTN, orderedColour); + + gDropdownItems[i].Format = Dropdown::FormatColourPicker; + gDropdownItems[i].Args = (i << 32) | imageId.ToUInt32(); + } + + // Show dropdown + WindowDropdownShowImage( + w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, dropdownColour, + Dropdown::Flag::StayOpen, numColours, 12, 12, + DropdownGetAppropriateImageDropdownItemsPerRow(static_cast(numColours))); + + gDropdownIsColour = true; + gDropdownLastColourHover = -1; + gDropdownDefaultIndex = defaultIndex; + } + + uint32_t DropdownGetAppropriateImageDropdownItemsPerRow(uint32_t numItems) + { + // If above the table size return the last element + return _appropriateImageDropdownItemsPerRow[std::min( + numItems, static_cast(std::size(_appropriateImageDropdownItemsPerRow) - 1))]; + } + + bool WindowDropDownHasMultipleColumns(size_t numItems) + { + return numItems > DROPDOWN_TEXT_MAX_ROWS; + } +} // namespace OpenRCT2::Ui::Windows + +using namespace OpenRCT2::Ui::Windows; + +bool Dropdown::IsChecked(int32_t index) { - // If above the table size return the last element - return _appropriateImageDropdownItemsPerRow[std::min( - numItems, static_cast(std::size(_appropriateImageDropdownItemsPerRow) - 1))]; + if (index < 0 || index >= static_cast(std::size(gDropdownItems))) + { + return false; + } + return gDropdownItems[index].IsChecked(); } -bool WindowDropDownHasMultipleColumns(size_t numItems) +bool Dropdown::IsDisabled(int32_t index) { - return numItems > DROPDOWN_TEXT_MAX_ROWS; + if (index < 0 || index >= static_cast(std::size(gDropdownItems))) + { + return true; + } + return gDropdownItems[index].IsDisabled(); +} + +void Dropdown::SetChecked(int32_t index, bool value) +{ + if (index < 0 || index >= static_cast(std::size(gDropdownItems))) + { + return; + } + if (value) + gDropdownItems[index].Flags |= EnumValue(Dropdown::ItemFlag::IsChecked); + else + gDropdownItems[index].Flags &= ~EnumValue(Dropdown::ItemFlag::IsChecked); +} + +void Dropdown::SetDisabled(int32_t index, bool value) +{ + if (index < 0 || index >= static_cast(std::size(gDropdownItems))) + { + return; + } + if (value) + gDropdownItems[index].Flags |= EnumValue(Dropdown::ItemFlag::IsDisabled); + else + gDropdownItems[index].Flags &= ~EnumValue(Dropdown::ItemFlag::IsDisabled); +} + +void Dropdown::SetImage(int32_t index, ImageId image) +{ + if (index < 0 || index >= static_cast(std::size(_dropdownItemsImages))) + { + return; + } + _dropdownItemsImages[index] = image; + _dropdownPrepareUseImages = true; } diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index 9d52496352..b8b3adb368 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -28,9 +28,9 @@ #include #include -using namespace OpenRCT2; - -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum { WIDX_PREVIOUS_IMAGE, // 1 WIDX_PREVIOUS_STEP_BUTTON, // 2 @@ -43,365 +43,347 @@ static Widget _editorBottomToolbarWidgets[] = { MakeWidget({ 2, 2}, {196, 30}, WindowWidgetType::FlatBtn, WindowColour::Primary), MakeWidget({440, 0}, {200, 34}, WindowWidgetType::ImgBtn, WindowColour::Primary), MakeWidget({442, 2}, {196, 30}, WindowWidgetType::FlatBtn, WindowColour::Primary), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class EditorBottomToolbarWindow final : public Window -{ -private: - using FuncPtr = void (EditorBottomToolbarWindow::*)() const; - - static constexpr StringId _editorStepNames[] = { - STR_EDITOR_STEP_OBJECT_SELECTION, STR_EDITOR_STEP_LANDSCAPE_EDITOR, STR_EDITOR_STEP_INVENTIONS_LIST_SET_UP, - STR_EDITOR_STEP_OPTIONS_SELECTION, STR_EDITOR_STEP_OBJECTIVE_SELECTION, STR_EDITOR_STEP_SAVE_SCENARIO, - STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER, STR_EDITOR_STEP_TRACK_DESIGNS_MANAGER, - }; - -public: - void OnOpen() override + class EditorBottomToolbarWindow final : public Window { - widgets = _editorBottomToolbarWidgets; + private: + using FuncPtr = void (EditorBottomToolbarWindow::*)() const; - InitScrollWidgets(); - SetAllSceneryItemsInvented(); - } + static constexpr StringId _editorStepNames[] = { + STR_EDITOR_STEP_OBJECT_SELECTION, STR_EDITOR_STEP_LANDSCAPE_EDITOR, + STR_EDITOR_STEP_INVENTIONS_LIST_SET_UP, STR_EDITOR_STEP_OPTIONS_SELECTION, + STR_EDITOR_STEP_OBJECTIVE_SELECTION, STR_EDITOR_STEP_SAVE_SCENARIO, + STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER, STR_EDITOR_STEP_TRACK_DESIGNS_MANAGER, + }; - void OnPrepareDraw() override - { - ColourSchemeUpdateByClass( - this, - (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowClass::EditorScenarioBottomToolbar - : WindowClass::EditorTrackBottomToolbar); - - uint16_t screenWidth = ContextGetWidth(); - widgets[WIDX_NEXT_IMAGE].left = screenWidth - 200; - widgets[WIDX_NEXT_IMAGE].right = screenWidth - 1; - widgets[WIDX_NEXT_STEP_BUTTON].left = screenWidth - 198; - widgets[WIDX_NEXT_STEP_BUTTON].right = screenWidth - 3; - - widgets[WIDX_PREVIOUS_STEP_BUTTON].type = WindowWidgetType::FlatBtn; - widgets[WIDX_NEXT_STEP_BUTTON].type = WindowWidgetType::FlatBtn; - widgets[WIDX_PREVIOUS_IMAGE].type = WindowWidgetType::ImgBtn; - widgets[WIDX_NEXT_IMAGE].type = WindowWidgetType::ImgBtn; - - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + public: + void OnOpen() override { - HidePreviousStepButton(); - HideNextStepButton(); + widgets = _editorBottomToolbarWidgets; + + InitScrollWidgets(); + SetAllSceneryItemsInvented(); } - else - { - auto& gameState = GetGameState(); - if (gameState.EditorStep == EditorStep::ObjectSelection) + void OnPrepareDraw() override + { + ColourSchemeUpdateByClass( + this, + (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowClass::EditorScenarioBottomToolbar + : WindowClass::EditorTrackBottomToolbar); + + uint16_t screenWidth = ContextGetWidth(); + widgets[WIDX_NEXT_IMAGE].left = screenWidth - 200; + widgets[WIDX_NEXT_IMAGE].right = screenWidth - 1; + widgets[WIDX_NEXT_STEP_BUTTON].left = screenWidth - 198; + widgets[WIDX_NEXT_STEP_BUTTON].right = screenWidth - 3; + + widgets[WIDX_PREVIOUS_STEP_BUTTON].type = WindowWidgetType::FlatBtn; + widgets[WIDX_NEXT_STEP_BUTTON].type = WindowWidgetType::FlatBtn; + widgets[WIDX_PREVIOUS_IMAGE].type = WindowWidgetType::ImgBtn; + widgets[WIDX_NEXT_IMAGE].type = WindowWidgetType::ImgBtn; + + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { HidePreviousStepButton(); - } - else if (gameState.EditorStep == EditorStep::RollercoasterDesigner) - { HideNextStepButton(); } - else if (!(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)) + else { - if (GetNumFreeEntities() != MAX_ENTITIES || GetGameState().ParkFlags & PARK_FLAGS_SPRITES_INITIALISED) + auto& gameState = GetGameState(); + + if (gameState.EditorStep == EditorStep::ObjectSelection) { HidePreviousStepButton(); } + else if (gameState.EditorStep == EditorStep::RollercoasterDesigner) + { + HideNextStepButton(); + } + else if (!(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)) + { + if (GetNumFreeEntities() != MAX_ENTITIES || GetGameState().ParkFlags & PARK_FLAGS_SPRITES_INITIALISED) + { + HidePreviousStepButton(); + } + } } } - } - void OnDraw(DrawPixelInfo& dpi) override - { - auto drawPreviousButton = widgets[WIDX_PREVIOUS_STEP_BUTTON].type != WindowWidgetType::Empty; - auto drawNextButton = widgets[WIDX_NEXT_STEP_BUTTON].type != WindowWidgetType::Empty; - - if (drawPreviousButton) - DrawLeftButtonBack(dpi); - - if (drawNextButton) - DrawRightButtonBack(dpi); - - DrawWidgets(dpi); - - if (drawPreviousButton) - DrawLeftButton(dpi); - - if (drawNextButton) - DrawRightButton(dpi); - - DrawStepText(dpi); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - auto& gameState = GetGameState(); - if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON) + void OnDraw(DrawPixelInfo& dpi) override { - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) - || (GetNumFreeEntities() == MAX_ENTITIES && !(GetGameState().ParkFlags & PARK_FLAGS_SPRITES_INITIALISED))) + auto drawPreviousButton = widgets[WIDX_PREVIOUS_STEP_BUTTON].type != WindowWidgetType::Empty; + auto drawNextButton = widgets[WIDX_NEXT_STEP_BUTTON].type != WindowWidgetType::Empty; + + if (drawPreviousButton) + DrawLeftButtonBack(dpi); + + if (drawNextButton) + DrawRightButtonBack(dpi); + + DrawWidgets(dpi); + + if (drawPreviousButton) + DrawLeftButton(dpi); + + if (drawNextButton) + DrawRightButton(dpi); + + DrawStepText(dpi); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + auto& gameState = GetGameState(); + if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON) { - ((this)->*(_previousButtonMouseUp[EnumValue(gameState.EditorStep)]))(); + if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + || (GetNumFreeEntities() == MAX_ENTITIES && !(GetGameState().ParkFlags & PARK_FLAGS_SPRITES_INITIALISED))) + { + ((this)->*(_previousButtonMouseUp[EnumValue(gameState.EditorStep)]))(); + } + } + else if (widgetIndex == WIDX_NEXT_STEP_BUTTON) + { + ((this)->*(_nextButtonMouseUp[EnumValue(gameState.EditorStep)]))(); } } - else if (widgetIndex == WIDX_NEXT_STEP_BUTTON) + + private: + void JumpBackToObjectSelection() const { - ((this)->*(_nextButtonMouseUp[EnumValue(gameState.EditorStep)]))(); - } - } - -private: - void JumpBackToObjectSelection() const - { - WindowCloseAll(); - GetGameState().EditorStep = EditorStep::ObjectSelection; - GfxInvalidateScreen(); - } - - void JumpBackToLandscapeEditor() const - { - WindowCloseAll(); - SetAllSceneryItemsInvented(); - ScenerySetDefaultPlacementConfiguration(); - GetGameState().EditorStep = EditorStep::LandscapeEditor; - ContextOpenWindow(WindowClass::Map); - GfxInvalidateScreen(); - } - - void JumpBackToInventionListSetUp() const - { - WindowCloseAll(); - ContextOpenWindow(WindowClass::EditorInventionList); - GetGameState().EditorStep = EditorStep::InventionsListSetUp; - GfxInvalidateScreen(); - } - - void JumpBackToOptionsSelection() const - { - WindowCloseAll(); - ContextOpenWindow(WindowClass::EditorScenarioOptions); - GetGameState().EditorStep = EditorStep::OptionsSelection; - GfxInvalidateScreen(); - } - - bool CheckObjectSelection() const - { - WindowBase* w; - - auto [missingObjectType, errorString] = Editor::CheckObjectSelection(); - if (missingObjectType == ObjectType::None) - { - WindowCloseByClass(WindowClass::EditorObjectSelection); - return true; + WindowCloseAll(); + GetGameState().EditorStep = EditorStep::ObjectSelection; + GfxInvalidateScreen(); } - ContextShowError(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {}); - w = WindowFindByClass(WindowClass::EditorObjectSelection); - if (w != nullptr) - { - // Click tab with missing object - WindowEventMouseUpCall(w, WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 + EnumValue(missingObjectType)); - } - return false; - } - - void JumpForwardFromObjectSelection() const - { - if (!CheckObjectSelection()) - return; - - FinishObjectSelection(); - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) - { - ContextOpenWindow(WindowClass::ConstructRide); - } - else + void JumpBackToLandscapeEditor() const { + WindowCloseAll(); + SetAllSceneryItemsInvented(); + ScenerySetDefaultPlacementConfiguration(); + GetGameState().EditorStep = EditorStep::LandscapeEditor; ContextOpenWindow(WindowClass::Map); + GfxInvalidateScreen(); } - } - void JumpForwardToInventionListSetUp() const - { - auto [checksPassed, errorString] = Editor::CheckPark(); - if (checksPassed) + void JumpBackToInventionListSetUp() const { WindowCloseAll(); ContextOpenWindow(WindowClass::EditorInventionList); GetGameState().EditorStep = EditorStep::InventionsListSetUp; - } - else - { - ContextShowError(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, errorString, {}); - } - - GfxInvalidateScreen(); - } - - void JumpForwardToOptionsSelection() const - { - WindowCloseAll(); - ContextOpenWindow(WindowClass::EditorScenarioOptions); - GetGameState().EditorStep = EditorStep::OptionsSelection; - GfxInvalidateScreen(); - } - - void JumpForwardToObjectiveSelection() const - { - WindowCloseAll(); - ContextOpenWindow(WindowClass::EditorObjectiveOptions); - GetGameState().EditorStep = EditorStep::ObjectiveSelection; - GfxInvalidateScreen(); - } - - void JumpForwardToSaveScenario() const - { - auto& gameState = GetGameState(); - const auto savePrepareResult = ScenarioPrepareForSave(gameState); - if (!savePrepareResult.Successful) - { - ContextShowError(STR_UNABLE_TO_SAVE_SCENARIO_FILE, savePrepareResult.Message, {}); GfxInvalidateScreen(); - return; } - WindowCloseAll(); - auto intent = Intent(WindowClass::Loadsave); - intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO); - intent.PutExtra(INTENT_EXTRA_PATH, gameState.ScenarioName); - ContextOpenIntent(&intent); - } - - void HidePreviousStepButton() - { - widgets[WIDX_PREVIOUS_STEP_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_PREVIOUS_IMAGE].type = WindowWidgetType::Empty; - } - - void HideNextStepButton() - { - widgets[WIDX_NEXT_STEP_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_NEXT_IMAGE].type = WindowWidgetType::Empty; - } - - void DrawLeftButtonBack(DrawPixelInfo& dpi) - { - auto previousWidget = widgets[WIDX_PREVIOUS_IMAGE]; - auto leftTop = windowPos + ScreenCoordsXY{ previousWidget.left, previousWidget.top }; - auto rightBottom = windowPos + ScreenCoordsXY{ previousWidget.right, previousWidget.bottom }; - GfxFilterRect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51); - } - - void DrawLeftButton(DrawPixelInfo& dpi) - { - const auto topLeft = windowPos - + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 1, widgets[WIDX_PREVIOUS_IMAGE].top + 1 }; - const auto bottomRight = windowPos - + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].right - 1, widgets[WIDX_PREVIOUS_IMAGE].bottom - 1 }; - GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_30); - - GfxDrawSprite( - dpi, ImageId(SPR_PREVIOUS), - windowPos + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 6, widgets[WIDX_PREVIOUS_IMAGE].top + 6 }); - - colour_t textColour = NOT_TRANSLUCENT(colours[1]); - if (gHoverWidget.window_classification == WindowClass::BottomToolbar - && gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON) + void JumpBackToOptionsSelection() const { - textColour = COLOUR_WHITE; + WindowCloseAll(); + ContextOpenWindow(WindowClass::EditorScenarioOptions); + GetGameState().EditorStep = EditorStep::OptionsSelection; + GfxInvalidateScreen(); } - int16_t textX = (widgets[WIDX_PREVIOUS_IMAGE].left + 30 + widgets[WIDX_PREVIOUS_IMAGE].right) / 2 + windowPos.x; - int16_t textY = widgets[WIDX_PREVIOUS_IMAGE].top + 6 + windowPos.y; - - StringId stringId = _editorStepNames[EnumValue(GetGameState().EditorStep) - 1]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) - stringId = STR_EDITOR_STEP_OBJECT_SELECTION; - - DrawTextBasic(dpi, { textX, textY }, STR_BACK_TO_PREVIOUS_STEP, {}, { textColour, TextAlignment::CENTRE }); - DrawTextBasic(dpi, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE }); - } - - void DrawRightButtonBack(DrawPixelInfo& dpi) - { - auto nextWidget = widgets[WIDX_NEXT_IMAGE]; - auto leftTop = windowPos + ScreenCoordsXY{ nextWidget.left, nextWidget.top }; - auto rightBottom = windowPos + ScreenCoordsXY{ nextWidget.right, nextWidget.bottom }; - GfxFilterRect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51); - } - - void DrawRightButton(DrawPixelInfo& dpi) - { - const auto topLeft = windowPos + ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].left + 1, widgets[WIDX_NEXT_IMAGE].top + 1 }; - const auto bottomRight = windowPos - + ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].right - 1, widgets[WIDX_NEXT_IMAGE].bottom - 1 }; - GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_30); - - GfxDrawSprite( - dpi, ImageId(SPR_NEXT), - windowPos + ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].right - 29, widgets[WIDX_NEXT_IMAGE].top + 6 }); - - colour_t textColour = NOT_TRANSLUCENT(colours[1]); - - if (gHoverWidget.window_classification == WindowClass::BottomToolbar - && gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON) + void JumpForwardFromObjectSelection() const { - textColour = COLOUR_WHITE; + if (!EditorObjectSelectionWindowCheck()) + return; + + FinishObjectSelection(); + if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + { + ContextOpenWindow(WindowClass::ConstructRide); + } + else + { + ContextOpenWindow(WindowClass::Map); + } } - int16_t textX = (widgets[WIDX_NEXT_IMAGE].left + widgets[WIDX_NEXT_IMAGE].right - 30) / 2 + windowPos.x; - int16_t textY = widgets[WIDX_NEXT_IMAGE].top + 6 + windowPos.y; + void JumpForwardToInventionListSetUp() const + { + auto [checksPassed, errorString] = Editor::CheckPark(); + if (checksPassed) + { + WindowCloseAll(); + ContextOpenWindow(WindowClass::EditorInventionList); + GetGameState().EditorStep = EditorStep::InventionsListSetUp; + } + else + { + ContextShowError(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, errorString, {}); + } - StringId stringId = _editorStepNames[EnumValue(GetGameState().EditorStep) + 1]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) - stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; + GfxInvalidateScreen(); + } - DrawTextBasic(dpi, { textX, textY }, STR_FORWARD_TO_NEXT_STEP, {}, { textColour, TextAlignment::CENTRE }); - DrawTextBasic(dpi, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE }); - } + void JumpForwardToOptionsSelection() const + { + WindowCloseAll(); + ContextOpenWindow(WindowClass::EditorScenarioOptions); + GetGameState().EditorStep = EditorStep::OptionsSelection; + GfxInvalidateScreen(); + } - void DrawStepText(DrawPixelInfo& dpi) - { - int16_t stateX = (widgets[WIDX_PREVIOUS_IMAGE].right + widgets[WIDX_NEXT_IMAGE].left) / 2 + windowPos.x; - int16_t stateY = height - 0x0C + windowPos.y; - DrawTextBasic( - dpi, { stateX, stateY }, _editorStepNames[EnumValue(GetGameState().EditorStep)], {}, - { static_cast(NOT_TRANSLUCENT(colours[2]) | COLOUR_FLAG_OUTLINE), TextAlignment::CENTRE }); - } + void JumpForwardToObjectiveSelection() const + { + WindowCloseAll(); + ContextOpenWindow(WindowClass::EditorObjectiveOptions); + GetGameState().EditorStep = EditorStep::ObjectiveSelection; + GfxInvalidateScreen(); + } - static constexpr FuncPtr _previousButtonMouseUp[] = { - nullptr, - &EditorBottomToolbarWindow::JumpBackToObjectSelection, - &EditorBottomToolbarWindow::JumpBackToLandscapeEditor, - &EditorBottomToolbarWindow::JumpBackToInventionListSetUp, - &EditorBottomToolbarWindow::JumpBackToOptionsSelection, - nullptr, - &EditorBottomToolbarWindow::JumpBackToObjectSelection, - nullptr, + void JumpForwardToSaveScenario() const + { + auto& gameState = GetGameState(); + const auto savePrepareResult = ScenarioPrepareForSave(gameState); + if (!savePrepareResult.Successful) + { + ContextShowError(STR_UNABLE_TO_SAVE_SCENARIO_FILE, savePrepareResult.Message, {}); + GfxInvalidateScreen(); + return; + } + + WindowCloseAll(); + auto intent = Intent(WindowClass::Loadsave); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO); + intent.PutExtra(INTENT_EXTRA_PATH, gameState.ScenarioName); + ContextOpenIntent(&intent); + } + + void HidePreviousStepButton() + { + widgets[WIDX_PREVIOUS_STEP_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_PREVIOUS_IMAGE].type = WindowWidgetType::Empty; + } + + void HideNextStepButton() + { + widgets[WIDX_NEXT_STEP_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_NEXT_IMAGE].type = WindowWidgetType::Empty; + } + + void DrawLeftButtonBack(DrawPixelInfo& dpi) + { + auto previousWidget = widgets[WIDX_PREVIOUS_IMAGE]; + auto leftTop = windowPos + ScreenCoordsXY{ previousWidget.left, previousWidget.top }; + auto rightBottom = windowPos + ScreenCoordsXY{ previousWidget.right, previousWidget.bottom }; + GfxFilterRect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51); + } + + void DrawLeftButton(DrawPixelInfo& dpi) + { + const auto topLeft = windowPos + + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 1, widgets[WIDX_PREVIOUS_IMAGE].top + 1 }; + const auto bottomRight = windowPos + + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].right - 1, widgets[WIDX_PREVIOUS_IMAGE].bottom - 1 }; + GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_30); + + GfxDrawSprite( + dpi, ImageId(SPR_PREVIOUS), + windowPos + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 6, widgets[WIDX_PREVIOUS_IMAGE].top + 6 }); + + colour_t textColour = NOT_TRANSLUCENT(colours[1]); + if (gHoverWidget.window_classification == WindowClass::BottomToolbar + && gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON) + { + textColour = COLOUR_WHITE; + } + + int16_t textX = (widgets[WIDX_PREVIOUS_IMAGE].left + 30 + widgets[WIDX_PREVIOUS_IMAGE].right) / 2 + windowPos.x; + int16_t textY = widgets[WIDX_PREVIOUS_IMAGE].top + 6 + windowPos.y; + + StringId stringId = _editorStepNames[EnumValue(GetGameState().EditorStep) - 1]; + if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + stringId = STR_EDITOR_STEP_OBJECT_SELECTION; + + DrawTextBasic(dpi, { textX, textY }, STR_BACK_TO_PREVIOUS_STEP, {}, { textColour, TextAlignment::CENTRE }); + DrawTextBasic(dpi, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE }); + } + + void DrawRightButtonBack(DrawPixelInfo& dpi) + { + auto nextWidget = widgets[WIDX_NEXT_IMAGE]; + auto leftTop = windowPos + ScreenCoordsXY{ nextWidget.left, nextWidget.top }; + auto rightBottom = windowPos + ScreenCoordsXY{ nextWidget.right, nextWidget.bottom }; + GfxFilterRect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51); + } + + void DrawRightButton(DrawPixelInfo& dpi) + { + const auto topLeft = windowPos + + ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].left + 1, widgets[WIDX_NEXT_IMAGE].top + 1 }; + const auto bottomRight = windowPos + + ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].right - 1, widgets[WIDX_NEXT_IMAGE].bottom - 1 }; + GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_30); + + GfxDrawSprite( + dpi, ImageId(SPR_NEXT), + windowPos + ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].right - 29, widgets[WIDX_NEXT_IMAGE].top + 6 }); + + colour_t textColour = NOT_TRANSLUCENT(colours[1]); + + if (gHoverWidget.window_classification == WindowClass::BottomToolbar + && gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON) + { + textColour = COLOUR_WHITE; + } + + int16_t textX = (widgets[WIDX_NEXT_IMAGE].left + widgets[WIDX_NEXT_IMAGE].right - 30) / 2 + windowPos.x; + int16_t textY = widgets[WIDX_NEXT_IMAGE].top + 6 + windowPos.y; + + StringId stringId = _editorStepNames[EnumValue(GetGameState().EditorStep) + 1]; + if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; + + DrawTextBasic(dpi, { textX, textY }, STR_FORWARD_TO_NEXT_STEP, {}, { textColour, TextAlignment::CENTRE }); + DrawTextBasic(dpi, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE }); + } + + void DrawStepText(DrawPixelInfo& dpi) + { + int16_t stateX = (widgets[WIDX_PREVIOUS_IMAGE].right + widgets[WIDX_NEXT_IMAGE].left) / 2 + windowPos.x; + int16_t stateY = height - 0x0C + windowPos.y; + DrawTextBasic( + dpi, { stateX, stateY }, _editorStepNames[EnumValue(GetGameState().EditorStep)], {}, + { static_cast(NOT_TRANSLUCENT(colours[2]) | COLOUR_FLAG_OUTLINE), TextAlignment::CENTRE }); + } + + static constexpr FuncPtr _previousButtonMouseUp[] = { + nullptr, + &EditorBottomToolbarWindow::JumpBackToObjectSelection, + &EditorBottomToolbarWindow::JumpBackToLandscapeEditor, + &EditorBottomToolbarWindow::JumpBackToInventionListSetUp, + &EditorBottomToolbarWindow::JumpBackToOptionsSelection, + nullptr, + &EditorBottomToolbarWindow::JumpBackToObjectSelection, + nullptr, + }; + + static constexpr FuncPtr _nextButtonMouseUp[] = { + &EditorBottomToolbarWindow::JumpForwardFromObjectSelection, + &EditorBottomToolbarWindow::JumpForwardToInventionListSetUp, + &EditorBottomToolbarWindow::JumpForwardToOptionsSelection, + &EditorBottomToolbarWindow::JumpForwardToObjectiveSelection, + &EditorBottomToolbarWindow::JumpForwardToSaveScenario, + nullptr, + nullptr, + nullptr, + }; }; - static constexpr FuncPtr _nextButtonMouseUp[] = { - &EditorBottomToolbarWindow::JumpForwardFromObjectSelection, - &EditorBottomToolbarWindow::JumpForwardToInventionListSetUp, - &EditorBottomToolbarWindow::JumpForwardToOptionsSelection, - &EditorBottomToolbarWindow::JumpForwardToObjectiveSelection, - &EditorBottomToolbarWindow::JumpForwardToSaveScenario, - nullptr, - nullptr, - nullptr, - }; -}; + /** + * Creates the main editor top toolbar window. + * rct2: 0x0066F052 (part of 0x0066EF38) + */ + WindowBase* EditorBottomToolbarOpen() + { + auto* window = WindowCreate( + WindowClass::BottomToolbar, ScreenCoordsXY(0, ContextGetHeight() - 32), ContextGetWidth(), 32, + WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); -/** - * Creates the main editor top toolbar window. - * rct2: 0x0066F052 (part of 0x0066EF38) - */ -WindowBase* WindowEditorBottomToolbarOpen() -{ - auto* window = WindowCreate( - WindowClass::BottomToolbar, ScreenCoordsXY(0, ContextGetHeight() - 32), ContextGetWidth(), 32, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); - - return window; -} + return window; + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index c8a9b64aa6..bc81650b1b 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -26,15 +26,15 @@ #include #include +namespace OpenRCT2::Ui::Windows +{ #pragma region Widgets -using namespace OpenRCT2; + static constexpr int32_t WW = 600; + static constexpr int32_t WH = 400; + static constexpr StringId WINDOW_TITLE = STR_INVENTION_LIST; -static constexpr int32_t WW = 600; -static constexpr int32_t WH = 400; -static constexpr StringId WINDOW_TITLE = STR_INVENTION_LIST; - -// clang-format off + // clang-format off enum { WIDX_BACKGROUND, WIDX_TITLE, @@ -59,643 +59,647 @@ static Widget _inventionListWidgets[] = { MakeWidget({375, 343}, {220, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_MOVE_ALL_TOP ), MakeWidget({375, 358}, {220, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_MOVE_ALL_BOTTOM ), MakeWidget({375, 373}, {220, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RANDOM_SHUFFLE, STR_RANDOM_SHUFFLE_TIP), - WIDGETS_END, + kWidgetsEnd, }; static Widget _inventionListDragWidgets[] = { MakeWidget({0, 0}, {150, 14}, WindowWidgetType::ImgBtn, WindowColour::Primary), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on #pragma endregion -static void WindowEditorInventionsListDragOpen( - ResearchItem* researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth); -static const ResearchItem* WindowEditorInventionsListDragGetItem(); + static void WindowEditorInventionsListDragOpen( + ResearchItem* researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth); + static const ResearchItem* WindowEditorInventionsListDragGetItem(); -/** - * - * rct2: 0x0068596F - * Sets rides that are in use to be always researched - */ -static void ResearchRidesSetup() -{ - // Reset all objects to not required - for (auto objectType : TransientObjectTypes) + /** + * + * rct2: 0x0068596F + * Sets rides that are in use to be always researched + */ + static void ResearchRidesSetup() { - auto maxObjects = object_entry_group_counts[EnumValue(objectType)]; - for (int32_t i = 0; i < maxObjects; i++) + // Reset all objects to not required + for (auto objectType : TransientObjectTypes) { - Editor::ClearSelectedObject(objectType, i, ObjectSelectionFlags::AllFlags); + auto maxObjects = object_entry_group_counts[EnumValue(objectType)]; + for (int32_t i = 0; i < maxObjects; i++) + { + Editor::ClearSelectedObject(objectType, i, ObjectSelectionFlags::AllFlags); + } + } + + // Set research required for rides in use + for (const auto& ride : GetRideManager()) + { + Editor::SetSelectedObject( + ObjectType::Ride, ride.subtype, ObjectSelectionFlags::Selected | ObjectSelectionFlags::InUse); } } - // Set research required for rides in use - for (const auto& ride : GetRideManager()) + static void DrawResearchItem( + DrawPixelInfo& dpi, const ResearchItem& researchItem, const int16_t& width, const ScreenCoordsXY& screenCoords, + StringId format, TextPaint textPaint) { - Editor::SetSelectedObject(ObjectType::Ride, ride.subtype, ObjectSelectionFlags::Selected | ObjectSelectionFlags::InUse); + const StringId itemNameId = researchItem.GetName(); + int16_t columnSplitOffset = width / 2; + + if (researchItem.type == Research::EntryType::Ride + && !GetRideTypeDescriptor(researchItem.baseRideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) + { + const StringId rideTypeName = GetRideNaming( + researchItem.baseRideType, *GetRideEntryByIndex(researchItem.entryIndex)) + .Name; + + // Draw group name + auto ft = Formatter(); + ft.Add(rideTypeName); + DrawTextEllipsised(dpi, screenCoords, columnSplitOffset - 11, format, ft, textPaint); + + // Draw vehicle name + ft = Formatter(); + ft.Add(itemNameId); + DrawTextEllipsised( + dpi, { screenCoords + ScreenCoordsXY{ columnSplitOffset, 0 } }, columnSplitOffset - 11, format, ft, textPaint); + } + else + { + // Scenery group, flat ride or shopdis + auto ft = Formatter(); + ft.Add(itemNameId); + DrawTextEllipsised(dpi, screenCoords, width, format, ft, textPaint); + } } -} - -static void DrawResearchItem( - DrawPixelInfo& dpi, const ResearchItem& researchItem, const int16_t& width, const ScreenCoordsXY& screenCoords, - StringId format, TextPaint textPaint) -{ - const StringId itemNameId = researchItem.GetName(); - int16_t columnSplitOffset = width / 2; - - if (researchItem.type == Research::EntryType::Ride - && !GetRideTypeDescriptor(researchItem.baseRideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) - { - const StringId rideTypeName = GetRideNaming(researchItem.baseRideType, *GetRideEntryByIndex(researchItem.entryIndex)) - .Name; - - // Draw group name - auto ft = Formatter(); - ft.Add(rideTypeName); - DrawTextEllipsised(dpi, screenCoords, columnSplitOffset - 11, format, ft, textPaint); - - // Draw vehicle name - ft = Formatter(); - ft.Add(itemNameId); - DrawTextEllipsised( - dpi, { screenCoords + ScreenCoordsXY{ columnSplitOffset, 0 } }, columnSplitOffset - 11, format, ft, textPaint); - } - else - { - // Scenery group, flat ride or shopdis - auto ft = Formatter(); - ft.Add(itemNameId); - DrawTextEllipsised(dpi, screenCoords, width, format, ft, textPaint); - } -} #pragma region Invention List Window -struct InventionListItem -{ - ResearchItem* research = nullptr; - bool isInvented = true; -}; - -class InventionListWindow final : public Window -{ - ResearchItem* _selectedResearchItem; - -public: - void OnOpen() override + struct InventionListItem { - ResearchRidesSetup(); + ResearchItem* research = nullptr; + bool isInvented = true; + }; - widgets = _inventionListWidgets; - InitScrollWidgets(); - selected_tab = 0; - _selectedResearchItem = nullptr; - - min_width = WW; - min_height = WH; - max_width = WW * 2; - max_height = WH * 2; - } - - void OnClose() override + class InventionListWindow final : public Window { - ResearchRemoveFlags(); + ResearchItem* _selectedResearchItem; - // When used in-game (as a cheat) - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + public: + void OnOpen() override { - gSilentResearch = true; - ResearchResetCurrentItem(); - gSilentResearch = false; + ResearchRidesSetup(); + + widgets = _inventionListWidgets; + InitScrollWidgets(); + selected_tab = 0; + _selectedResearchItem = nullptr; + + min_width = WW; + min_height = WH; + max_width = WW * 2; + max_height = WH * 2; } - } - void OnMouseUp(WidgetIndex widx) override - { - switch (widx) + void OnClose() override { - case WIDX_CLOSE: - Close(); - break; - case WIDX_RANDOM_SHUFFLE: - ResearchItemsShuffle(); - Invalidate(); - break; - case WIDX_MOVE_ITEMS_TO_TOP: - ResearchItemsMakeAllResearched(); - InitScrollWidgets(); - Invalidate(); - break; - case WIDX_MOVE_ITEMS_TO_BOTTOM: - ResearchItemsMakeAllUnresearched(); - InitScrollWidgets(); - Invalidate(); - break; + ResearchRemoveFlags(); + + // When used in-game (as a cheat) + if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + { + gSilentResearch = true; + ResearchResetCurrentItem(); + gSilentResearch = false; + } } - } - void OnResize() override - { - if (width < min_width) + void OnMouseUp(WidgetIndex widx) override { + switch (widx) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_RANDOM_SHUFFLE: + ResearchItemsShuffle(); + Invalidate(); + break; + case WIDX_MOVE_ITEMS_TO_TOP: + ResearchItemsMakeAllResearched(); + InitScrollWidgets(); + Invalidate(); + break; + case WIDX_MOVE_ITEMS_TO_BOTTOM: + ResearchItemsMakeAllUnresearched(); + InitScrollWidgets(); + Invalidate(); + break; + } + } + + void OnResize() override + { + if (width < min_width) + { + Invalidate(); + width = min_width; + } + if (height < min_height) + { + Invalidate(); + height = min_height; + } + } + + void OnUpdate() override + { + frame_no++; + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_1); + + if (WindowEditorInventionsListDragGetItem() != nullptr) + return; + Invalidate(); - width = min_width; } - if (height < min_height) + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override { - Invalidate(); - height = min_height; + const auto& gameState = GetGameState(); + ScreenSize size{}; + if (scrollIndex == 0) + { + size.height = static_cast(gameState.ResearchItemsInvented.size()) * SCROLLABLE_ROW_HEIGHT; + } + else + { + size.height = static_cast(gameState.ResearchItemsUninvented.size()) * SCROLLABLE_ROW_HEIGHT; + } + return size; } - } - void OnUpdate() override - { - frame_no++; - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_1); - - if (WindowEditorInventionsListDragGetItem() != nullptr) - return; - - Invalidate(); - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - const auto& gameState = GetGameState(); - ScreenSize size{}; - if (scrollIndex == 0) + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { - size.height = static_cast(gameState.ResearchItemsInvented.size()) * SCROLLABLE_ROW_HEIGHT; + auto* researchItem = GetItemFromScrollY(scrollIndex == 0, screenCoords.y); + if (researchItem != _selectedResearchItem) + { + _selectedResearchItem = researchItem; + Invalidate(); + + // Prevent always-researched items from being highlighted when hovered over + if (researchItem != nullptr && researchItem->IsAlwaysResearched()) + { + _selectedResearchItem = nullptr; + } + } } - else - { - size.height = static_cast(gameState.ResearchItemsUninvented.size()) * SCROLLABLE_ROW_HEIGHT; - } - return size; - } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - auto* researchItem = GetItemFromScrollY(scrollIndex == 0, screenCoords.y); - if (researchItem != _selectedResearchItem) + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { - _selectedResearchItem = researchItem; + auto* researchItem = GetItemFromScrollY(scrollIndex == 0, screenCoords.y); + if (researchItem == nullptr) + return; + + // Disallow picking up always-researched items + if (researchItem->IsAlwaysResearched()) + return; + Invalidate(); - // Prevent always-researched items from being highlighted when hovered over - if (researchItem != nullptr && researchItem->IsAlwaysResearched()) - { - _selectedResearchItem = nullptr; - } + WindowEditorInventionsListDragOpen(researchItem, windowPos, widgets[WIDX_PRE_RESEARCHED_SCROLL].right); } - } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - auto* researchItem = GetItemFromScrollY(scrollIndex == 0, screenCoords.y); - if (researchItem == nullptr) - return; - - // Disallow picking up always-researched items - if (researchItem->IsAlwaysResearched()) - return; - - Invalidate(); - - WindowEditorInventionsListDragOpen(researchItem, windowPos, widgets[WIDX_PRE_RESEARCHED_SCROLL].right); - } - - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - const auto& gameState = GetGameState(); - - // Draw background - uint8_t paletteIndex = ColourMapA[colours[1]].mid_light; - GfxClear(&dpi, paletteIndex); - - int16_t boxWidth = widgets[WIDX_RESEARCH_ORDER_SCROLL].width(); - int32_t itemY = -SCROLLABLE_ROW_HEIGHT; - auto* dragItem = WindowEditorInventionsListDragGetItem(); - - const auto& researchList = scrollIndex == 0 ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; - for (const auto& researchItem : researchList) + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override { - itemY += SCROLLABLE_ROW_HEIGHT; - if (itemY + SCROLLABLE_ROW_HEIGHT < dpi.y || itemY >= dpi.y + dpi.height) - continue; + const auto& gameState = GetGameState(); - if (_selectedResearchItem == &researchItem) + // Draw background + uint8_t paletteIndex = ColourMapA[colours[1]].mid_light; + GfxClear(dpi, paletteIndex); + + int16_t boxWidth = widgets[WIDX_RESEARCH_ORDER_SCROLL].width(); + int32_t itemY = -SCROLLABLE_ROW_HEIGHT; + auto* dragItem = WindowEditorInventionsListDragGetItem(); + + const auto& researchList = scrollIndex == 0 ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; + for (const auto& researchItem : researchList) { - int32_t top, bottom; - if (dragItem == nullptr) + itemY += SCROLLABLE_ROW_HEIGHT; + if (itemY + SCROLLABLE_ROW_HEIGHT < dpi.y || itemY >= dpi.y + dpi.height) + continue; + + if (_selectedResearchItem == &researchItem) { - // Highlight - top = itemY; - bottom = itemY + SCROLLABLE_ROW_HEIGHT - 1; - } - else - { - // Drop horizontal rule - top = itemY - 1; - bottom = itemY; + int32_t top, bottom; + if (dragItem == nullptr) + { + // Highlight + top = itemY; + bottom = itemY + SCROLLABLE_ROW_HEIGHT - 1; + } + else + { + // Drop horizontal rule + top = itemY - 1; + bottom = itemY; + } + + GfxFilterRect(dpi, { 0, top, boxWidth, bottom }, FilterPaletteID::PaletteDarken1); } - GfxFilterRect(dpi, { 0, top, boxWidth, bottom }, FilterPaletteID::PaletteDarken1); - } + if (dragItem != nullptr && researchItem == *dragItem) + continue; - if (dragItem != nullptr && researchItem == *dragItem) - continue; + // TODO: this parameter by itself produces very light text. + // It needs a {BLACK} token in the string to work properly. + colour_t colour = COLOUR_BLACK; + FontStyle fontStyle = FontStyle::Medium; + auto darkness = TextDarkness::Regular; - // TODO: this parameter by itself produces very light text. - // It needs a {BLACK} token in the string to work properly. - colour_t colour = COLOUR_BLACK; - FontStyle fontStyle = FontStyle::Medium; - auto darkness = TextDarkness::Regular; - - if (researchItem.IsAlwaysResearched()) - { - if (_selectedResearchItem == &researchItem && dragItem == nullptr) - darkness = TextDarkness::ExtraDark; - else - darkness = TextDarkness::Dark; - colour = colours[1] | COLOUR_FLAG_INSET; - } - - DrawResearchItem(dpi, researchItem, boxWidth, { 1, itemY }, STR_BLACK_STRING, { colour, fontStyle, darkness }); - } - } - - CursorID OnCursor(WidgetIndex widx, const ScreenCoordsXY& screenCoords, CursorID fallback) override - { - bool isInvented = false; - - switch (widx) - { - case WIDX_PRE_RESEARCHED_SCROLL: - isInvented = true; - break; - case WIDX_RESEARCH_ORDER_SCROLL: - isInvented = false; - break; - default: - return fallback; - } - - // Use the open hand as cursor for items that can be picked up - auto* researchItem = GetItemFromScrollY(isInvented, screenCoords.y); - if (researchItem != nullptr && !researchItem->IsAlwaysResearched()) - { - return CursorID::HandOpen; - } - return fallback; - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - // Tab image - auto screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].left, widgets[WIDX_TAB_1].top }; - GfxDrawSprite(dpi, ImageId(SPR_TAB_FINANCES_RESEARCH_0 + (frame_no / 2) % 8), screenPos); - - // Pre-researched items label - screenPos = windowPos - + ScreenCoordsXY{ widgets[WIDX_PRE_RESEARCHED_SCROLL].left, widgets[WIDX_PRE_RESEARCHED_SCROLL].top - 11 }; - DrawTextBasic(dpi, screenPos - ScreenCoordsXY{ 0, 1 }, STR_INVENTION_PREINVENTED_ITEMS); - - // Research order label - screenPos = windowPos - + ScreenCoordsXY{ widgets[WIDX_RESEARCH_ORDER_SCROLL].left, widgets[WIDX_RESEARCH_ORDER_SCROLL].top - 11 }; - DrawTextBasic(dpi, screenPos - ScreenCoordsXY{ 0, 1 }, STR_INVENTION_TO_BE_INVENTED_ITEMS); - - // Preview background - auto& bkWidget = widgets[WIDX_PREVIEW]; - GfxFillRect( - dpi, - { windowPos + ScreenCoordsXY{ bkWidget.left + 1, bkWidget.top + 1 }, - windowPos + ScreenCoordsXY{ bkWidget.right - 1, bkWidget.bottom - 1 } }, - ColourMapA[colours[1]].darkest); - - auto* researchItem = WindowEditorInventionsListDragGetItem(); - if (researchItem == nullptr || researchItem->IsNull()) - researchItem = _selectedResearchItem; - // If the research item is null or a list separator. - if (researchItem == nullptr || researchItem->IsNull()) - return; - - // Preview image - ObjectType objectEntryType = ObjectType::SceneryGroup; - if (researchItem->type == Research::EntryType::Ride) - objectEntryType = ObjectType::Ride; - - auto chunk = ObjectEntryGetChunk(objectEntryType, researchItem->entryIndex); - if (chunk == nullptr) - return; - - // Draw preview - const auto* object = ObjectEntryGetObject(objectEntryType, researchItem->entryIndex); - if (object != nullptr) - { - DrawPixelInfo clipDPI; - screenPos = windowPos + ScreenCoordsXY{ bkWidget.left + 1, bkWidget.top + 1 }; - const auto clipWidth = bkWidget.width() - 1; - const auto clipHeight = bkWidget.height() - 1; - if (ClipDrawPixelInfo(clipDPI, dpi, screenPos, clipWidth, clipHeight)) - { - object->DrawPreview(clipDPI, clipWidth, clipHeight); - } - } - - // Item name - screenPos = windowPos + ScreenCoordsXY{ bkWidget.midX() + 1, bkWidget.bottom + 3 }; - const auto itemWidth = width - widgets[WIDX_RESEARCH_ORDER_SCROLL].right - 6; - - StringId drawString = STR_WINDOW_COLOUR_2_STRINGID; - StringId stringId = researchItem->GetName(); - auto ft = Formatter(); - - if (researchItem->type == Research::EntryType::Ride - && !GetRideTypeDescriptor(researchItem->baseRideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) - { - drawString = STR_WINDOW_COLOUR_2_STRINGID_STRINGID; - StringId rideTypeName = GetRideNaming(researchItem->baseRideType, *GetRideEntryByIndex(researchItem->entryIndex)) - .Name; - ft.Add(rideTypeName); - ft.Add(stringId); - } - else - { - ft.Add(stringId); - } - - DrawTextEllipsised(dpi, screenPos, itemWidth, drawString, ft, { TextAlignment::CENTRE }); - screenPos.y += 15; - - // Item category - screenPos.x = windowPos.x + widgets[WIDX_RESEARCH_ORDER_SCROLL].right + 4; - ft = Formatter(); - ft.Add(researchItem->GetCategoryInventionString()); - DrawTextBasic(dpi, screenPos, STR_INVENTION_RESEARCH_GROUP, ft); - } - - void OnPrepareDraw() override - { - pressed_widgets |= 1uLL << WIDX_PREVIEW; - pressed_widgets |= 1uLL << WIDX_TAB_1; - - widgets[WIDX_CLOSE].type = gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; - - ResizeFrameWithPage(); - - int16_t scrollListHeight = (height - 88) / 2; - - widgets[WIDX_PRE_RESEARCHED_SCROLL].bottom = 60 + scrollListHeight; - widgets[WIDX_PRE_RESEARCHED_SCROLL].right = width - 229; - - widgets[WIDX_RESEARCH_ORDER_SCROLL].top = widgets[WIDX_PRE_RESEARCHED_SCROLL].bottom + 15; - widgets[WIDX_RESEARCH_ORDER_SCROLL].bottom = widgets[WIDX_RESEARCH_ORDER_SCROLL].top + scrollListHeight; - widgets[WIDX_RESEARCH_ORDER_SCROLL].right = width - 229; - - widgets[WIDX_PREVIEW].left = width - 169; - widgets[WIDX_PREVIEW].right = width - 56; - - widgets[WIDX_MOVE_ITEMS_TO_TOP].top = height - 57; - widgets[WIDX_MOVE_ITEMS_TO_TOP].bottom = height - 44; - widgets[WIDX_MOVE_ITEMS_TO_TOP].left = width - 225; - widgets[WIDX_MOVE_ITEMS_TO_TOP].right = width - 6; - - widgets[WIDX_MOVE_ITEMS_TO_BOTTOM].top = height - 42; - widgets[WIDX_MOVE_ITEMS_TO_BOTTOM].bottom = height - 29; - widgets[WIDX_MOVE_ITEMS_TO_BOTTOM].left = width - 225; - widgets[WIDX_MOVE_ITEMS_TO_BOTTOM].right = width - 6; - - widgets[WIDX_RANDOM_SHUFFLE].top = height - 27; - widgets[WIDX_RANDOM_SHUFFLE].bottom = height - 14; - widgets[WIDX_RANDOM_SHUFFLE].left = width - 225; - widgets[WIDX_RANDOM_SHUFFLE].right = width - 6; - } - - // Get Research Item and Scroll Id (scroll id represents invented(0)/not invented(1)/failure(-1) - std::optional GetResearchItemAt(const ScreenCoordsXY& screenCoords) - { - if (windowPos.x <= screenCoords.x && windowPos.y < screenCoords.y && windowPos.x + width > screenCoords.x - && windowPos.y + height > screenCoords.y) - { - WidgetIndex widgetIndex = WindowFindWidgetFromPoint(*this, screenCoords); - auto& widget = widgets[widgetIndex]; - if (widgetIndex == WIDX_PRE_RESEARCHED_SCROLL || widgetIndex == WIDX_RESEARCH_ORDER_SCROLL) - { - gPressedWidget.widget_index = widgetIndex; - int32_t outScrollArea{}; - ScreenCoordsXY outScrollCoords{}; - int32_t outScrollId{}; - WidgetScrollGetPart(*this, &widget, screenCoords, outScrollCoords, &outScrollArea, &outScrollId); - if (outScrollArea == SCROLL_PART_VIEW) + if (researchItem.IsAlwaysResearched()) { - const auto isInvented = outScrollId == 0; - int32_t scrollY = outScrollCoords.y + 6; - return InventionListItem{ GetItemFromScrollYIncludeSeps(isInvented, scrollY), isInvented }; + if (_selectedResearchItem == &researchItem && dragItem == nullptr) + darkness = TextDarkness::ExtraDark; + else + darkness = TextDarkness::Dark; + colour = colours[1] | COLOUR_FLAG_INSET; + } + + DrawResearchItem(dpi, researchItem, boxWidth, { 1, itemY }, STR_BLACK_STRING, { colour, fontStyle, darkness }); + } + } + + CursorID OnCursor(WidgetIndex widx, const ScreenCoordsXY& screenCoords, CursorID fallback) override + { + bool isInvented = false; + + switch (widx) + { + case WIDX_PRE_RESEARCHED_SCROLL: + isInvented = true; + break; + case WIDX_RESEARCH_ORDER_SCROLL: + isInvented = false; + break; + default: + return fallback; + } + + // Use the open hand as cursor for items that can be picked up + auto* researchItem = GetItemFromScrollY(isInvented, screenCoords.y); + if (researchItem != nullptr && !researchItem->IsAlwaysResearched()) + { + return CursorID::HandOpen; + } + return fallback; + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + // Tab image + auto screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].left, widgets[WIDX_TAB_1].top }; + GfxDrawSprite(dpi, ImageId(SPR_TAB_FINANCES_RESEARCH_0 + (frame_no / 2) % 8), screenPos); + + // Pre-researched items label + screenPos = windowPos + + ScreenCoordsXY{ widgets[WIDX_PRE_RESEARCHED_SCROLL].left, widgets[WIDX_PRE_RESEARCHED_SCROLL].top - 11 }; + DrawTextBasic(dpi, screenPos - ScreenCoordsXY{ 0, 1 }, STR_INVENTION_PREINVENTED_ITEMS); + + // Research order label + screenPos = windowPos + + ScreenCoordsXY{ widgets[WIDX_RESEARCH_ORDER_SCROLL].left, widgets[WIDX_RESEARCH_ORDER_SCROLL].top - 11 }; + DrawTextBasic(dpi, screenPos - ScreenCoordsXY{ 0, 1 }, STR_INVENTION_TO_BE_INVENTED_ITEMS); + + // Preview background + auto& bkWidget = widgets[WIDX_PREVIEW]; + GfxFillRect( + dpi, + { windowPos + ScreenCoordsXY{ bkWidget.left + 1, bkWidget.top + 1 }, + windowPos + ScreenCoordsXY{ bkWidget.right - 1, bkWidget.bottom - 1 } }, + ColourMapA[colours[1]].darkest); + + auto* researchItem = WindowEditorInventionsListDragGetItem(); + if (researchItem == nullptr || researchItem->IsNull()) + researchItem = _selectedResearchItem; + // If the research item is null or a list separator. + if (researchItem == nullptr || researchItem->IsNull()) + return; + + // Preview image + ObjectType objectEntryType = ObjectType::SceneryGroup; + if (researchItem->type == Research::EntryType::Ride) + objectEntryType = ObjectType::Ride; + + auto chunk = ObjectEntryGetChunk(objectEntryType, researchItem->entryIndex); + if (chunk == nullptr) + return; + + // Draw preview + const auto* object = ObjectEntryGetObject(objectEntryType, researchItem->entryIndex); + if (object != nullptr) + { + DrawPixelInfo clipDPI; + screenPos = windowPos + ScreenCoordsXY{ bkWidget.left + 1, bkWidget.top + 1 }; + const auto clipWidth = bkWidget.width() - 1; + const auto clipHeight = bkWidget.height() - 1; + if (ClipDrawPixelInfo(clipDPI, dpi, screenPos, clipWidth, clipHeight)) + { + object->DrawPreview(clipDPI, clipWidth, clipHeight); } } + + // Item name + screenPos = windowPos + ScreenCoordsXY{ bkWidget.midX() + 1, bkWidget.bottom + 3 }; + const auto itemWidth = width - widgets[WIDX_RESEARCH_ORDER_SCROLL].right - 6; + + StringId drawString = STR_WINDOW_COLOUR_2_STRINGID; + StringId stringId = researchItem->GetName(); + auto ft = Formatter(); + + if (researchItem->type == Research::EntryType::Ride + && !GetRideTypeDescriptor(researchItem->baseRideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) + { + drawString = STR_WINDOW_COLOUR_2_STRINGID_STRINGID; + StringId rideTypeName = GetRideNaming( + researchItem->baseRideType, *GetRideEntryByIndex(researchItem->entryIndex)) + .Name; + ft.Add(rideTypeName); + ft.Add(stringId); + } + else + { + ft.Add(stringId); + } + + DrawTextEllipsised(dpi, screenPos, itemWidth, drawString, ft, { TextAlignment::CENTRE }); + screenPos.y += 15; + + // Item category + screenPos.x = windowPos.x + widgets[WIDX_RESEARCH_ORDER_SCROLL].right + 4; + ft = Formatter(); + ft.Add(researchItem->GetCategoryInventionString()); + DrawTextBasic(dpi, screenPos, STR_INVENTION_RESEARCH_GROUP, ft); } - return std::nullopt; - } - - bool IsResearchItemSelected(ResearchItem* item) const - { - return item == _selectedResearchItem; - } - - // hack to fix #17544: OnScrollMouseOver never gets called while dragging - void SetSelectedResearchItem(ResearchItem* item) - { - _selectedResearchItem = item; - } - - void MoveResearchItem(const ResearchItem& item, ResearchItem* beforeItem, bool isInvented) - { - auto& gameState = GetGameState(); - _selectedResearchItem = nullptr; - Invalidate(); - - uint32_t beforeItemRawValue = 0; - if (beforeItem != nullptr) - beforeItemRawValue = beforeItem->rawValue; - - if (item.rawValue == beforeItemRawValue) - return; - - ResearchRemove(item); - - auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; - if (beforeItem != nullptr) + void OnPrepareDraw() override { - for (size_t i = 0; i < researchList.size(); i++) + pressed_widgets |= 1uLL << WIDX_PREVIEW; + pressed_widgets |= 1uLL << WIDX_TAB_1; + + widgets[WIDX_CLOSE].type = gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; + + ResizeFrameWithPage(); + + int16_t scrollListHeight = (height - 88) / 2; + + widgets[WIDX_PRE_RESEARCHED_SCROLL].bottom = 60 + scrollListHeight; + widgets[WIDX_PRE_RESEARCHED_SCROLL].right = width - 229; + + widgets[WIDX_RESEARCH_ORDER_SCROLL].top = widgets[WIDX_PRE_RESEARCHED_SCROLL].bottom + 15; + widgets[WIDX_RESEARCH_ORDER_SCROLL].bottom = widgets[WIDX_RESEARCH_ORDER_SCROLL].top + scrollListHeight; + widgets[WIDX_RESEARCH_ORDER_SCROLL].right = width - 229; + + widgets[WIDX_PREVIEW].left = width - 169; + widgets[WIDX_PREVIEW].right = width - 56; + + widgets[WIDX_MOVE_ITEMS_TO_TOP].top = height - 57; + widgets[WIDX_MOVE_ITEMS_TO_TOP].bottom = height - 44; + widgets[WIDX_MOVE_ITEMS_TO_TOP].left = width - 225; + widgets[WIDX_MOVE_ITEMS_TO_TOP].right = width - 6; + + widgets[WIDX_MOVE_ITEMS_TO_BOTTOM].top = height - 42; + widgets[WIDX_MOVE_ITEMS_TO_BOTTOM].bottom = height - 29; + widgets[WIDX_MOVE_ITEMS_TO_BOTTOM].left = width - 225; + widgets[WIDX_MOVE_ITEMS_TO_BOTTOM].right = width - 6; + + widgets[WIDX_RANDOM_SHUFFLE].top = height - 27; + widgets[WIDX_RANDOM_SHUFFLE].bottom = height - 14; + widgets[WIDX_RANDOM_SHUFFLE].left = width - 225; + widgets[WIDX_RANDOM_SHUFFLE].right = width - 6; + } + + // Get Research Item and Scroll Id (scroll id represents invented(0)/not invented(1)/failure(-1) + std::optional GetResearchItemAt(const ScreenCoordsXY& screenCoords) + { + if (windowPos.x <= screenCoords.x && windowPos.y < screenCoords.y && windowPos.x + width > screenCoords.x + && windowPos.y + height > screenCoords.y) { - if (researchList[i].rawValue == beforeItemRawValue) + WidgetIndex widgetIndex = WindowFindWidgetFromPoint(*this, screenCoords); + auto& widget = widgets[widgetIndex]; + if (widgetIndex == WIDX_PRE_RESEARCHED_SCROLL || widgetIndex == WIDX_RESEARCH_ORDER_SCROLL) { - researchList.insert((researchList.begin() + i), item); - return; + gPressedWidget.widget_index = widgetIndex; + int32_t outScrollArea{}; + ScreenCoordsXY outScrollCoords{}; + int32_t outScrollId{}; + WidgetScrollGetPart(*this, &widget, screenCoords, outScrollCoords, &outScrollArea, &outScrollId); + if (outScrollArea == SCROLL_PART_VIEW) + { + const auto isInvented = outScrollId == 0; + int32_t scrollY = outScrollCoords.y + 6; + return InventionListItem{ GetItemFromScrollYIncludeSeps(isInvented, scrollY), isInvented }; + } } } + + return std::nullopt; } - // Still not found? Append to end of list. - researchList.push_back(item); - } - -private: - ResearchItem* GetItemFromScrollY(bool isInvented, int32_t y) const - { - auto& gameState = GetGameState(); - auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; - for (auto& researchItem : researchList) + bool IsResearchItemSelected(ResearchItem* item) const { - y -= SCROLLABLE_ROW_HEIGHT; - if (y < 0) - { - return &researchItem; - } + return item == _selectedResearchItem; } - return nullptr; - } - - ResearchItem* GetItemFromScrollYIncludeSeps(bool isInvented, int32_t y) const - { - auto& gameState = GetGameState(); - auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; - for (auto& researchItem : researchList) + // hack to fix #17544: OnScrollMouseOver never gets called while dragging + void SetSelectedResearchItem(ResearchItem* item) { - y -= SCROLLABLE_ROW_HEIGHT; - if (y < 0) - { - return &researchItem; - } + _selectedResearchItem = item; } - return nullptr; - } -}; -/** - * - * rct2: 0x00684E04 - */ -WindowBase* WindowEditorInventionsListOpen() -{ - return WindowFocusOrCreate( - WindowClass::EditorInventionList, WW, WH, WF_NO_SCROLLING | WF_RESIZABLE | WF_CENTRE_SCREEN); -} + void MoveResearchItem(const ResearchItem& item, ResearchItem* beforeItem, bool isInvented) + { + auto& gameState = GetGameState(); + _selectedResearchItem = nullptr; + Invalidate(); + + uint32_t beforeItemRawValue = 0; + if (beforeItem != nullptr) + beforeItemRawValue = beforeItem->rawValue; + + if (item.rawValue == beforeItemRawValue) + return; + + ResearchRemove(item); + + auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; + if (beforeItem != nullptr) + { + for (size_t i = 0; i < researchList.size(); i++) + { + if (researchList[i].rawValue == beforeItemRawValue) + { + researchList.insert((researchList.begin() + i), item); + return; + } + } + } + + // Still not found? Append to end of list. + researchList.push_back(item); + } + + private: + ResearchItem* GetItemFromScrollY(bool isInvented, int32_t y) const + { + auto& gameState = GetGameState(); + auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; + for (auto& researchItem : researchList) + { + y -= SCROLLABLE_ROW_HEIGHT; + if (y < 0) + { + return &researchItem; + } + } + + return nullptr; + } + + ResearchItem* GetItemFromScrollYIncludeSeps(bool isInvented, int32_t y) const + { + auto& gameState = GetGameState(); + auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; + for (auto& researchItem : researchList) + { + y -= SCROLLABLE_ROW_HEIGHT; + if (y < 0) + { + return &researchItem; + } + } + return nullptr; + } + }; + + /** + * + * rct2: 0x00684E04 + */ + WindowBase* EditorInventionsListOpen() + { + return WindowFocusOrCreate( + WindowClass::EditorInventionList, WW, WH, WF_NO_SCROLLING | WF_RESIZABLE | WF_CENTRE_SCREEN); + } #pragma endregion #pragma region Drag item -class InventionDragWindow final : public Window -{ - ResearchItem _draggedItem; - -public: - void OnOpen() override + class InventionDragWindow final : public Window { - widgets = _inventionListDragWidgets; - colours[1] = COLOUR_WHITE; - } + ResearchItem _draggedItem; - CursorID OnCursor(const WidgetIndex widx, const ScreenCoordsXY& screenCoords, const CursorID defaultCursor) override - { - auto* inventionListWindow = static_cast(WindowFindByClass(WindowClass::EditorInventionList)); - if (inventionListWindow != nullptr) + public: + void OnOpen() override { - auto res = inventionListWindow->GetResearchItemAt(screenCoords); - auto* research = res.has_value() ? res->research : nullptr; - if (!inventionListWindow->IsResearchItemSelected(research)) + widgets = _inventionListDragWidgets; + colours[1] = COLOUR_WHITE; + } + + CursorID OnCursor(const WidgetIndex widx, const ScreenCoordsXY& screenCoords, const CursorID defaultCursor) override + { + auto* inventionListWindow = static_cast(WindowFindByClass(WindowClass::EditorInventionList)); + if (inventionListWindow != nullptr) { - inventionListWindow->SetSelectedResearchItem(research); - inventionListWindow->Invalidate(); + auto res = inventionListWindow->GetResearchItemAt(screenCoords); + auto* research = res.has_value() ? res->research : nullptr; + if (!inventionListWindow->IsResearchItemSelected(research)) + { + inventionListWindow->SetSelectedResearchItem(research); + inventionListWindow->Invalidate(); + } } + + return CursorID::HandClosed; } - return CursorID::HandClosed; - } - - void OnMoved(const ScreenCoordsXY& screenCoords) override - { - auto* inventionListWindow = static_cast(WindowFindByClass(WindowClass::EditorInventionList)); - if (inventionListWindow == nullptr) + void OnMoved(const ScreenCoordsXY& screenCoords) override { + auto* inventionListWindow = static_cast(WindowFindByClass(WindowClass::EditorInventionList)); + if (inventionListWindow == nullptr) + { + Close(); + return; + } + std::optional res; + // Skip always researched items, so that the dragged item gets placed underneath them + auto newScreenCoords = screenCoords; + do + { + res = inventionListWindow->GetResearchItemAt(newScreenCoords); + newScreenCoords.y += LIST_ROW_HEIGHT; + } while (res.has_value() && res->research != nullptr && res->research->IsAlwaysResearched()); + + if (res.has_value()) + { + inventionListWindow->MoveResearchItem(_draggedItem, res->research, res->isInvented); + } + + WindowInvalidateByClass(WindowClass::EditorInventionList); Close(); - return; - } - std::optional res; - // Skip always researched items, so that the dragged item gets placed underneath them - auto newScreenCoords = screenCoords; - do - { - res = inventionListWindow->GetResearchItemAt(newScreenCoords); - newScreenCoords.y += LIST_ROW_HEIGHT; - } while (res.has_value() && res->research != nullptr && res->research->IsAlwaysResearched()); - - if (res.has_value()) - { - inventionListWindow->MoveResearchItem(_draggedItem, res->research, res->isInvented); } - WindowInvalidateByClass(WindowClass::EditorInventionList); - Close(); - } + void OnDraw(DrawPixelInfo& dpi) override + { + auto screenCoords = windowPos + ScreenCoordsXY{ 0, 2 }; - void OnDraw(DrawPixelInfo& dpi) override + DrawResearchItem( + dpi, _draggedItem, width, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, + { COLOUR_BLACK | static_cast(COLOUR_FLAG_OUTLINE) }); + } + + void Init(ResearchItem& researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth) + { + _draggedItem = researchItem; + + widgets[0].right = objectSelectionScrollWidth; + Invalidate(); + windowPos = ScreenCoordsXY{ editorPos.x, gTooltipCursor.y - 7 }; + width = objectSelectionScrollWidth; + Invalidate(); + + InputWindowPositionBegin(*this, 0, gTooltipCursor); + } + + const ResearchItem& GetItem() const + { + return _draggedItem; + } + }; + + static void WindowEditorInventionsListDragOpen( + ResearchItem* researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth) { - auto screenCoords = windowPos + ScreenCoordsXY{ 0, 2 }; - - DrawResearchItem( - dpi, _draggedItem, width, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, - { COLOUR_BLACK | static_cast(COLOUR_FLAG_OUTLINE) }); + WindowCloseByClass(WindowClass::EditorInventionListDrag); + auto* wnd = WindowCreate( + WindowClass::EditorInventionListDrag, 10, 14, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING); + if (wnd != nullptr) + { + wnd->Init(*researchItem, editorPos, objectSelectionScrollWidth); + } } - void Init(ResearchItem& researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth) + static const ResearchItem* WindowEditorInventionsListDragGetItem() { - _draggedItem = researchItem; - - widgets[0].right = objectSelectionScrollWidth; - Invalidate(); - windowPos = ScreenCoordsXY{ editorPos.x, gTooltipCursor.y - 7 }; - width = objectSelectionScrollWidth; - Invalidate(); - - InputWindowPositionBegin(*this, 0, gTooltipCursor); + auto* wnd = static_cast(WindowFindByClass(WindowClass::EditorInventionListDrag)); + if (wnd == nullptr) + { + return nullptr; + } + return &wnd->GetItem(); } - const ResearchItem& GetItem() const - { - return _draggedItem; - } -}; - -static void WindowEditorInventionsListDragOpen( - ResearchItem* researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth) -{ - WindowCloseByClass(WindowClass::EditorInventionListDrag); - auto* wnd = WindowCreate( - WindowClass::EditorInventionListDrag, 10, 14, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING); - if (wnd != nullptr) - { - wnd->Init(*researchItem, editorPos, objectSelectionScrollWidth); - } -} - -static const ResearchItem* WindowEditorInventionsListDragGetItem() -{ - auto* wnd = static_cast(WindowFindByClass(WindowClass::EditorInventionListDrag)); - if (wnd == nullptr) - { - return nullptr; - } - return &wnd->GetItem(); -} - #pragma endregion +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 8f0cf44c86..32a2b797d2 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -42,69 +42,69 @@ #include #include -using namespace OpenRCT2; - -enum +namespace OpenRCT2::Ui::Windows { - FILTER_RCT1 = (1 << 0), - FILTER_AA = (1 << 1), - FILTER_LL = (1 << 2), - FILTER_RCT2 = (1 << 3), - FILTER_WW = (1 << 4), - FILTER_TT = (1 << 5), - FILTER_OO = (1 << 6), - FILTER_CUSTOM = (1 << 7), + enum + { + FILTER_RCT1 = (1 << 0), + FILTER_AA = (1 << 1), + FILTER_LL = (1 << 2), + FILTER_RCT2 = (1 << 3), + FILTER_WW = (1 << 4), + FILTER_TT = (1 << 5), + FILTER_OO = (1 << 6), + FILTER_CUSTOM = (1 << 7), - FILTER_RIDE_TRANSPORT = (1 << 8), - FILTER_RIDE_GENTLE = (1 << 9), - FILTER_RIDE_COASTER = (1 << 10), - FILTER_RIDE_THRILL = (1 << 11), - FILTER_RIDE_WATER = (1 << 12), - FILTER_RIDE_STALL = (1 << 13), + FILTER_RIDE_TRANSPORT = (1 << 8), + FILTER_RIDE_GENTLE = (1 << 9), + FILTER_RIDE_COASTER = (1 << 10), + FILTER_RIDE_THRILL = (1 << 11), + FILTER_RIDE_WATER = (1 << 12), + FILTER_RIDE_STALL = (1 << 13), - FILTER_SELECTED = (1 << 14), - FILTER_NONSELECTED = (1 << 15), + FILTER_SELECTED = (1 << 14), + FILTER_NONSELECTED = (1 << 15), - FILTER_RIDES = FILTER_RIDE_TRANSPORT | FILTER_RIDE_GENTLE | FILTER_RIDE_COASTER | FILTER_RIDE_THRILL | FILTER_RIDE_WATER - | FILTER_RIDE_STALL, - FILTER_ALL = FILTER_RIDES | FILTER_RCT1 | FILTER_AA | FILTER_LL | FILTER_RCT2 | FILTER_WW | FILTER_TT | FILTER_OO - | FILTER_CUSTOM | FILTER_SELECTED | FILTER_NONSELECTED, -}; + FILTER_RIDES = FILTER_RIDE_TRANSPORT | FILTER_RIDE_GENTLE | FILTER_RIDE_COASTER | FILTER_RIDE_THRILL | FILTER_RIDE_WATER + | FILTER_RIDE_STALL, + FILTER_ALL = FILTER_RIDES | FILTER_RCT1 | FILTER_AA | FILTER_LL | FILTER_RCT2 | FILTER_WW | FILTER_TT | FILTER_OO + | FILTER_CUSTOM | FILTER_SELECTED | FILTER_NONSELECTED, + }; -enum -{ - RIDE_SORT_TYPE, - RIDE_SORT_RIDE -}; + enum + { + RIDE_SORT_TYPE, + RIDE_SORT_RIDE + }; -enum -{ - DDIX_FILTER_RCT1, - DDIX_FILTER_AA, - DDIX_FILTER_LL, - DDIX_FILTER_RCT2, - DDIX_FILTER_WW, - DDIX_FILTER_TT, - DDIX_FILTER_OO, - DDIX_FILTER_CUSTOM, - DDIX_FILTER_SEPARATOR, - DDIX_FILTER_SELECTED, - DDIX_FILTER_NONSELECTED, -}; + enum + { + DDIX_FILTER_RCT1, + DDIX_FILTER_AA, + DDIX_FILTER_LL, + DDIX_FILTER_RCT2, + DDIX_FILTER_WW, + DDIX_FILTER_TT, + DDIX_FILTER_OO, + DDIX_FILTER_CUSTOM, + DDIX_FILTER_SEPARATOR, + DDIX_FILTER_SELECTED, + DDIX_FILTER_NONSELECTED, + }; -struct ObjectListItem -{ - const ObjectRepositoryItem* repositoryItem; - std::unique_ptr filter; - uint8_t* flags; -}; + struct ObjectListItem + { + const ObjectRepositoryItem* repositoryItem; + std::unique_ptr filter; + uint8_t* flags; + }; -static constexpr uint8_t _numSourceGameItems = 8; + static constexpr uint8_t _numSourceGameItems = 8; -static uint32_t _filter_flags; -static uint16_t _filter_object_counts[EnumValue(ObjectType::Count)]; + static uint32_t _filter_flags; + static uint16_t _filter_object_counts[EnumValue(ObjectType::Count)]; -static char _filter_string[MAX_PATH]; + static char _filter_string[MAX_PATH]; #define _FILTER_ALL ((_filter_flags & FILTER_ALL) == FILTER_ALL) #define _FILTER_RCT1 (_filter_flags & FILTER_RCT1) @@ -118,18 +118,18 @@ static char _filter_string[MAX_PATH]; #define _FILTER_SELECTED (_filter_flags & FILTER_SELECTED) #define _FILTER_NONSELECTED (_filter_flags & FILTER_NONSELECTED) -static constexpr StringId WINDOW_TITLE = STR_OBJECT_SELECTION; -static constexpr int32_t WH = 400; -static constexpr int32_t WW = 755; + static constexpr StringId WINDOW_TITLE = STR_OBJECT_SELECTION; + static constexpr int32_t WH = 400; + static constexpr int32_t WW = 755; -struct ObjectPageDesc -{ - StringId Caption; - uint32_t Image; - bool IsAdvanced; -}; + struct ObjectPageDesc + { + StringId Caption; + uint32_t Image; + bool IsAdvanced; + }; -// clang-format off + // clang-format off // Order of which the object tabs are displayed. static constexpr ObjectPageDesc ObjectSelectionPages[] = { { STR_OBJECT_SELECTION_RIDE_VEHICLES_ATTRACTIONS, SPR_TAB_RIDE_16, false }, @@ -149,52 +149,52 @@ static constexpr ObjectPageDesc ObjectSelectionPages[] = { { STR_OBJECT_SELECTION_TERRAIN_EDGES, SPR_G2_TERRAIN_EDGE_TAB, true }, { STR_OBJECT_SELECTION_WATER, SPR_TAB_WATER, false }, }; -// clang-format on + // clang-format on -// Order of which the contents of each tab is displayed. -ObjectType static TabOrder[] = { - ObjectType::Ride, ObjectType::Station, ObjectType::Music, - ObjectType::SceneryGroup, ObjectType::SmallScenery, ObjectType::LargeScenery, - ObjectType::Walls, ObjectType::FootpathSurface, ObjectType::FootpathRailings, - ObjectType::Paths, ObjectType::PathAdditions, ObjectType::Banners, - ObjectType::ParkEntrance, ObjectType::TerrainSurface, ObjectType::TerrainEdge, - ObjectType::Water, -}; + // Order of which the contents of each tab is displayed. + ObjectType static TabOrder[] = { + ObjectType::Ride, ObjectType::Station, ObjectType::Music, + ObjectType::SceneryGroup, ObjectType::SmallScenery, ObjectType::LargeScenery, + ObjectType::Walls, ObjectType::FootpathSurface, ObjectType::FootpathRailings, + ObjectType::Paths, ObjectType::PathAdditions, ObjectType::Banners, + ObjectType::ParkEntrance, ObjectType::TerrainSurface, ObjectType::TerrainEdge, + ObjectType::Water, + }; #pragma region Widgets -enum WINDOW_EDITOR_OBJECT_SELECTION_WIDGET_IDX -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_TAB_CONTENT_PANEL, - WIDX_ADVANCED, - WIDX_LIST, - WIDX_PREVIEW, - WIDX_INSTALL_TRACK, - WIDX_FILTER_DROPDOWN, - WIDX_FILTER_TEXT_BOX, - WIDX_FILTER_CLEAR_BUTTON, - WIDX_FILTER_RIDE_TAB_FRAME, - WIDX_FILTER_RIDE_TAB_ALL, - WIDX_FILTER_RIDE_TAB_TRANSPORT, - WIDX_FILTER_RIDE_TAB_GENTLE, - WIDX_FILTER_RIDE_TAB_COASTER, - WIDX_FILTER_RIDE_TAB_THRILL, - WIDX_FILTER_RIDE_TAB_WATER, - WIDX_FILTER_RIDE_TAB_STALL, - WIDX_LIST_SORT_TYPE, - WIDX_LIST_SORT_RIDE, - WIDX_RELOAD_OBJECT, - WIDX_TAB_1, -}; + enum WINDOW_EDITOR_OBJECT_SELECTION_WIDGET_IDX + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_TAB_CONTENT_PANEL, + WIDX_ADVANCED, + WIDX_LIST, + WIDX_PREVIEW, + WIDX_INSTALL_TRACK, + WIDX_FILTER_DROPDOWN, + WIDX_FILTER_TEXT_BOX, + WIDX_FILTER_CLEAR_BUTTON, + WIDX_FILTER_RIDE_TAB_FRAME, + WIDX_FILTER_RIDE_TAB_ALL, + WIDX_FILTER_RIDE_TAB_TRANSPORT, + WIDX_FILTER_RIDE_TAB_GENTLE, + WIDX_FILTER_RIDE_TAB_COASTER, + WIDX_FILTER_RIDE_TAB_THRILL, + WIDX_FILTER_RIDE_TAB_WATER, + WIDX_FILTER_RIDE_TAB_STALL, + WIDX_LIST_SORT_TYPE, + WIDX_LIST_SORT_RIDE, + WIDX_RELOAD_OBJECT, + WIDX_TAB_1, + }; -validate_global_widx(WC_EDITOR_OBJECT_SELECTION, WIDX_TAB_1); + validate_global_widx(WC_EDITOR_OBJECT_SELECTION, WIDX_TAB_1); -static bool _window_editor_object_selection_widgets_initialised; + static bool _window_editor_object_selection_widgets_initialised; -// clang-format off + // clang-format off static std::vector _window_editor_object_selection_widgets = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, {WW, 357}, WindowWidgetType::Resize, WindowColour::Secondary ), @@ -219,1208 +219,1223 @@ static std::vector _window_editor_object_selection_widgets = { MakeTab ({ 3, 17}, STR_STRING_DEFINED_TOOLTIP ), // Copied object type times... - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on #pragma endregion -static constexpr int32_t window_editor_object_selection_animation_loops[] = { - 20, // All - 32, // Transport - 10, // Gentle - 72, // Coaster - 24, // Thrill - 28, // Water - 16, // Stall -}; -static constexpr int32_t window_editor_object_selection_animation_divisor[] = { - 4, // All - 8, // Transport - 2, // Gentle - 4, // Coaster - 4, // Thrill - 4, // Water - 2, // Stall -}; + static constexpr int32_t window_editor_object_selection_animation_loops[] = { + 20, // All + 32, // Transport + 10, // Gentle + 72, // Coaster + 24, // Thrill + 28, // Water + 16, // Stall + }; + static constexpr int32_t window_editor_object_selection_animation_divisor[] = { + 4, // All + 8, // Transport + 2, // Gentle + 4, // Coaster + 4, // Thrill + 4, // Water + 2, // Stall + }; -static StringId GetRideTypeStringId(const ObjectRepositoryItem* item); -static bool VisibleListSortRideType(const ObjectListItem& a, const ObjectListItem& b); -static bool VisibleListSortRideName(const ObjectListItem& a, const ObjectListItem& b); -void EditorLoadSelectedObjects(); + static StringId GetRideTypeStringId(const ObjectRepositoryItem* item); + static bool VisibleListSortRideType(const ObjectListItem& a, const ObjectListItem& b); + static bool VisibleListSortRideName(const ObjectListItem& a, const ObjectListItem& b); + void EditorLoadSelectedObjects(); -class EditorObjectSelectionWindow final : public Window -{ - using sortFunc_t = bool (*)(const ObjectListItem&, const ObjectListItem&); - -private: - std::vector _listItems; - int32_t _listSortType = RIDE_SORT_TYPE; - bool _listSortDescending = false; - std::unique_ptr _loadedObject; - -public: - /** - * - * rct2: 0x006AA64E - */ - void OnOpen() override + class EditorObjectSelectionWindow final : public Window { - InitWidgets(); + using sortFunc_t = bool (*)(const ObjectListItem&, const ObjectListItem&); - Sub6AB211(); - ResetSelectedObjectCountAndSize(); + private: + std::vector _listItems; + int32_t _listSortType = RIDE_SORT_TYPE; + bool _listSortDescending = false; + std::unique_ptr _loadedObject; - widgets[WIDX_FILTER_TEXT_BOX].string = _filter_string; - - _filter_flags = gConfigInterface.ObjectSelectionFilterFlags; - std::fill_n(_filter_string, sizeof(_filter_string), 0x00); - - WindowInitScrollWidgets(*this); - - selected_tab = 0; - selected_list_item = -1; - min_width = WW; - min_height = WH; - max_width = 1200; - max_height = 1000; - - _listSortType = RIDE_SORT_TYPE; - _listSortDescending = false; - - VisibleListRefresh(); - } - - /** - * - * rct2: 0x006AB199 - */ - void OnClose() override - { - UnloadUnselectedObjects(); - EditorLoadSelectedObjects(); - EditorObjectFlagsFree(); - - if (_loadedObject != nullptr) - _loadedObject->Unload(); - - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + public: + /** + * + * rct2: 0x006AA64E + */ + void OnOpen() override { - ResearchPopulateListRandom(); - } - else - { - // Used for in-game object selection cheat - // This resets the ride selection list and resets research to 0 on current item - gSilentResearch = true; - ResearchResetCurrentItem(); - gSilentResearch = false; + InitWidgets(); + + Sub6AB211(); + ResetSelectedObjectCountAndSize(); + + widgets[WIDX_FILTER_TEXT_BOX].string = _filter_string; + + _filter_flags = gConfigInterface.ObjectSelectionFilterFlags; + std::fill_n(_filter_string, sizeof(_filter_string), 0x00); + + WindowInitScrollWidgets(*this); + + selected_tab = 0; + selected_list_item = -1; + min_width = WW; + min_height = WH; + max_width = 1200; + max_height = 1000; + + _listSortType = RIDE_SORT_TYPE; + _listSortDescending = false; + + VisibleListRefresh(); } - auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES); - ContextBroadcastIntent(&intent); - - VisibleListDispose(); - - intent = Intent(INTENT_ACTION_REFRESH_SCENERY); - ContextBroadcastIntent(&intent); - } - - void OnUpdate() override - { - if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) + /** + * + * rct2: 0x006AB199 + */ + void OnClose() override { - WindowUpdateTextboxCaret(); - WidgetInvalidate(*this, WIDX_FILTER_TEXT_BOX); - } - - for (WidgetIndex i = WIDX_FILTER_RIDE_TAB_TRANSPORT; i <= WIDX_FILTER_RIDE_TAB_STALL; i++) - { - if (!IsWidgetPressed(i)) - continue; - - frame_no++; - if (frame_no >= window_editor_object_selection_animation_loops[i - WIDX_FILTER_RIDE_TAB_TRANSPORT]) - frame_no = 0; - - WidgetInvalidate(*this, i); - break; - } - } - - /** - * - * rct2: 0x006AAFAB - */ - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - WindowClose(*this); - if (gScreenFlags & SCREEN_FLAGS_EDITOR) - { - FinishObjectSelection(); - } - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - GameNotifyMapChange(); - GameUnloadScripts(); - TitleLoad(); - } - break; - case WIDX_FILTER_RIDE_TAB_ALL: - _filter_flags |= FILTER_RIDES; - gConfigInterface.ObjectSelectionFilterFlags = _filter_flags; - ConfigSaveDefault(); - - FilterUpdateCounts(); - VisibleListRefresh(); - - selected_list_item = -1; - scrolls[0].v_top = 0; - Invalidate(); - break; - case WIDX_FILTER_RIDE_TAB_TRANSPORT: - case WIDX_FILTER_RIDE_TAB_GENTLE: - case WIDX_FILTER_RIDE_TAB_COASTER: - case WIDX_FILTER_RIDE_TAB_THRILL: - case WIDX_FILTER_RIDE_TAB_WATER: - case WIDX_FILTER_RIDE_TAB_STALL: - _filter_flags &= ~FILTER_RIDES; - _filter_flags |= (1 << (widgetIndex - WIDX_FILTER_RIDE_TAB_TRANSPORT + _numSourceGameItems)); - gConfigInterface.ObjectSelectionFilterFlags = _filter_flags; - ConfigSaveDefault(); - - FilterUpdateCounts(); - VisibleListRefresh(); - - selected_list_item = -1; - scrolls[0].v_top = 0; - frame_no = 0; - Invalidate(); - break; - - case WIDX_ADVANCED: - list_information_type ^= 1; - Invalidate(); - break; - - case WIDX_INSTALL_TRACK: - { - if (selected_list_item != -1) - { - selected_list_item = -1; - } - Invalidate(); - - auto intent = Intent(WindowClass::Loadsave); - intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK); - ContextOpenIntent(&intent); - break; - } - case WIDX_FILTER_TEXT_BOX: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _filter_string, sizeof(_filter_string)); - break; - case WIDX_FILTER_CLEAR_BUTTON: - std::fill_n(_filter_string, sizeof(_filter_string), 0x00); - FilterUpdateCounts(); - scrolls->v_top = 0; - VisibleListRefresh(); - Invalidate(); - break; - case WIDX_LIST_SORT_TYPE: - if (_listSortType == RIDE_SORT_TYPE) - { - _listSortDescending = !_listSortDescending; - } - else - { - _listSortType = RIDE_SORT_TYPE; - _listSortDescending = false; - } - VisibleListRefresh(); - break; - case WIDX_LIST_SORT_RIDE: - if (_listSortType == RIDE_SORT_RIDE) - { - _listSortDescending = !_listSortDescending; - } - else - { - _listSortType = RIDE_SORT_RIDE; - _listSortDescending = false; - } - VisibleListRefresh(); - break; - case WIDX_RELOAD_OBJECT: - if (_loadedObject != nullptr) - { - auto descriptor = _loadedObject->GetDescriptor(); - auto& objectManager = GetContext()->GetObjectManager(); - auto entryIndex = objectManager.GetLoadedObjectEntryIndex(descriptor); - if (entryIndex != OBJECT_ENTRY_INDEX_NULL) - { - objectManager.UnloadObjects({ descriptor }); - objectManager.LoadObject(descriptor, entryIndex); - } - } - break; - default: - if (widgetIndex >= WIDX_TAB_1 - && static_cast(widgetIndex) < WIDX_TAB_1 + std::size(ObjectSelectionPages)) - { - SetPage(widgetIndex - WIDX_TAB_1); - } - break; - } - } - - void OnResize() override - { - WindowSetResize(*this, WW, WH, 1200, 1000); - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - int32_t numSelectionItems = 0; - - switch (widgetIndex) - { - case WIDX_FILTER_DROPDOWN: - - gDropdownItems[DDIX_FILTER_RCT1].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIX_FILTER_AA].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIX_FILTER_LL].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIX_FILTER_RCT2].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIX_FILTER_WW].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIX_FILTER_TT].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIX_FILTER_OO].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIX_FILTER_CUSTOM].Format = STR_TOGGLE_OPTION; - - gDropdownItems[DDIX_FILTER_RCT1].Args = STR_SCENARIO_CATEGORY_RCT1; - gDropdownItems[DDIX_FILTER_AA].Args = STR_SCENARIO_CATEGORY_RCT1_AA; - gDropdownItems[DDIX_FILTER_LL].Args = STR_SCENARIO_CATEGORY_RCT1_LL; - gDropdownItems[DDIX_FILTER_RCT2].Args = STR_ROLLERCOASTER_TYCOON_2_DROPDOWN; - gDropdownItems[DDIX_FILTER_WW].Args = STR_OBJECT_FILTER_WW; - gDropdownItems[DDIX_FILTER_TT].Args = STR_OBJECT_FILTER_TT; - gDropdownItems[DDIX_FILTER_OO].Args = STR_OBJECT_FILTER_OPENRCT2_OFFICIAL; - gDropdownItems[DDIX_FILTER_CUSTOM].Args = STR_OBJECT_FILTER_CUSTOM; - - // Track manager cannot select multiple, so only show selection filters if not in track manager - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) - { - numSelectionItems = 3; - gDropdownItems[DDIX_FILTER_SEPARATOR].Format = 0; - gDropdownItems[DDIX_FILTER_SELECTED].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIX_FILTER_NONSELECTED].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIX_FILTER_SEPARATOR].Args = STR_NONE; - gDropdownItems[DDIX_FILTER_SELECTED].Args = STR_SELECTED_ONLY; - gDropdownItems[DDIX_FILTER_NONSELECTED].Args = STR_NON_SELECTED_ONLY; - } - - WindowDropdownShowText( - { windowPos.x + widgets[widgetIndex].left, windowPos.y + widgets[widgetIndex].top }, - widgets[widgetIndex].height() + 1, colours[widgets[widgetIndex].colour], Dropdown::Flag::StayOpen, - _numSourceGameItems + numSelectionItems); - - for (int32_t i = 0; i < _numSourceGameItems; i++) - { - if (_filter_flags & (1 << i)) - { - Dropdown::SetChecked(i, true); - } - } - - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) - { - Dropdown::SetChecked(DDIX_FILTER_SELECTED, _FILTER_SELECTED != 0); - Dropdown::SetChecked(DDIX_FILTER_NONSELECTED, _FILTER_NONSELECTED != 0); - } - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - if (dropdownIndex == -1) - return; - - switch (widgetIndex) - { - case WIDX_FILTER_DROPDOWN: - if (dropdownIndex == DDIX_FILTER_SELECTED) - { - _filter_flags ^= FILTER_SELECTED; - _filter_flags &= ~FILTER_NONSELECTED; - } - else if (dropdownIndex == DDIX_FILTER_NONSELECTED) - { - _filter_flags ^= FILTER_NONSELECTED; - _filter_flags &= ~FILTER_SELECTED; - } - else - { - _filter_flags ^= (1 << dropdownIndex); - } - gConfigInterface.ObjectSelectionFilterFlags = _filter_flags; - ConfigSaveDefault(); - - FilterUpdateCounts(); - scrolls->v_top = 0; - - VisibleListRefresh(); - Invalidate(); - break; - } - } - - /** - * - * rct2: 0x006AB031 - */ - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - const auto newHeight = static_cast(_listItems.size() * SCROLLABLE_ROW_HEIGHT); - return { 0, newHeight }; - } - - /** - * - * rct2: 0x006AB0B6 - */ - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - // Used for in-game object selection cheat to prevent crashing the game - // when windows attempt to draw objects that don't exist any more - WindowCloseAllExceptClass(WindowClass::EditorObjectSelection); - - int32_t selected_object = GetObjectFromObjectSelection(GetSelectedObjectType(), screenCoords.y); - if (selected_object == -1) - return; - - ObjectListItem* listItem = &_listItems[selected_object]; - uint8_t object_selection_flags = *listItem->flags; - if (object_selection_flags & ObjectSelectionFlags::Flag6) - return; - - Invalidate(); - - const CursorState* state = ContextGetCursorState(); - Audio::Play(Audio::SoundId::Click1, 0, state->position.x); - - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - const auto objectSelectResult = WindowEditorObjectSelectionSelectObject( - 0, INPUT_FLAG_EDITOR_OBJECT_SELECT, listItem->repositoryItem); - if (!objectSelectResult.Successful) - return; + UnloadUnselectedObjects(); + EditorLoadSelectedObjects(); + EditorObjectFlagsFree(); if (_loadedObject != nullptr) - { _loadedObject->Unload(); - _loadedObject = nullptr; + + if (gScreenFlags & SCREEN_FLAGS_EDITOR) + { + ResearchPopulateListRandom(); + } + else + { + // Used for in-game object selection cheat + // This resets the ride selection list and resets research to 0 on current item + gSilentResearch = true; + ResearchResetCurrentItem(); + gSilentResearch = false; } - auto& objRepository = GetContext()->GetObjectRepository(); - _loadedObject = objRepository.LoadObject(listItem->repositoryItem); - auto& objManager = GetContext()->GetObjectManager(); - objManager.LoadObject(_loadedObject.get()->GetIdentifier()); + auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES); + ContextBroadcastIntent(&intent); - // This function calls window_track_list_open - ManageTracks(); - Close(); - return; + VisibleListDispose(); + + intent = Intent(INTENT_ACTION_REFRESH_SCENERY); + ContextBroadcastIntent(&intent); } - uint32_t inputFlags = INPUT_FLAG_EDITOR_OBJECT_1 | INPUT_FLAG_EDITOR_OBJECT_SELECT_OBJECTS_IN_SCENERY_GROUP; - // If already selected - if (!(object_selection_flags & ObjectSelectionFlags::Selected)) - inputFlags |= INPUT_FLAG_EDITOR_OBJECT_SELECT; - - _gSceneryGroupPartialSelectError = std::nullopt; - const auto objectSelectResult = WindowEditorObjectSelectionSelectObject(0, inputFlags, listItem->repositoryItem); - if (!objectSelectResult.Successful) + void OnUpdate() override { - StringId error_title = (inputFlags & INPUT_FLAG_EDITOR_OBJECT_SELECT) ? STR_UNABLE_TO_SELECT_THIS_OBJECT - : STR_UNABLE_TO_DE_SELECT_THIS_OBJECT; + if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) + { + WindowUpdateTextboxCaret(); + WidgetInvalidate(*this, WIDX_FILTER_TEXT_BOX); + } - ContextShowError(error_title, objectSelectResult.Message, {}); - return; + for (WidgetIndex i = WIDX_FILTER_RIDE_TAB_TRANSPORT; i <= WIDX_FILTER_RIDE_TAB_STALL; i++) + { + if (!IsWidgetPressed(i)) + continue; + + frame_no++; + if (frame_no >= window_editor_object_selection_animation_loops[i - WIDX_FILTER_RIDE_TAB_TRANSPORT]) + frame_no = 0; + + WidgetInvalidate(*this, i); + break; + } } - if (_FILTER_SELECTED || _FILTER_NONSELECTED) + /** + * + * rct2: 0x006AAFAB + */ + void OnMouseUp(WidgetIndex widgetIndex) override { + switch (widgetIndex) + { + case WIDX_CLOSE: + if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && !EditorObjectSelectionWindowCheck()) + return; + + if (gScreenFlags & SCREEN_FLAGS_EDITOR) + { + FinishObjectSelection(); + } + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + { + GameNotifyMapChange(); + GameUnloadScripts(); + TitleLoad(); + } + break; + case WIDX_FILTER_RIDE_TAB_ALL: + _filter_flags |= FILTER_RIDES; + gConfigInterface.ObjectSelectionFilterFlags = _filter_flags; + ConfigSaveDefault(); + + FilterUpdateCounts(); + VisibleListRefresh(); + + selected_list_item = -1; + scrolls[0].v_top = 0; + Invalidate(); + break; + case WIDX_FILTER_RIDE_TAB_TRANSPORT: + case WIDX_FILTER_RIDE_TAB_GENTLE: + case WIDX_FILTER_RIDE_TAB_COASTER: + case WIDX_FILTER_RIDE_TAB_THRILL: + case WIDX_FILTER_RIDE_TAB_WATER: + case WIDX_FILTER_RIDE_TAB_STALL: + _filter_flags &= ~FILTER_RIDES; + _filter_flags |= (1 << (widgetIndex - WIDX_FILTER_RIDE_TAB_TRANSPORT + _numSourceGameItems)); + gConfigInterface.ObjectSelectionFilterFlags = _filter_flags; + ConfigSaveDefault(); + + FilterUpdateCounts(); + VisibleListRefresh(); + + selected_list_item = -1; + scrolls[0].v_top = 0; + frame_no = 0; + Invalidate(); + break; + + case WIDX_ADVANCED: + list_information_type ^= 1; + Invalidate(); + break; + + case WIDX_INSTALL_TRACK: + { + if (selected_list_item != -1) + { + selected_list_item = -1; + } + Invalidate(); + + auto intent = Intent(WindowClass::Loadsave); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK); + ContextOpenIntent(&intent); + break; + } + case WIDX_FILTER_TEXT_BOX: + WindowStartTextbox(*this, widgetIndex, STR_STRING, _filter_string, sizeof(_filter_string)); + break; + case WIDX_FILTER_CLEAR_BUTTON: + std::fill_n(_filter_string, sizeof(_filter_string), 0x00); + FilterUpdateCounts(); + scrolls->v_top = 0; + VisibleListRefresh(); + Invalidate(); + break; + case WIDX_LIST_SORT_TYPE: + if (_listSortType == RIDE_SORT_TYPE) + { + _listSortDescending = !_listSortDescending; + } + else + { + _listSortType = RIDE_SORT_TYPE; + _listSortDescending = false; + } + VisibleListRefresh(); + break; + case WIDX_LIST_SORT_RIDE: + if (_listSortType == RIDE_SORT_RIDE) + { + _listSortDescending = !_listSortDescending; + } + else + { + _listSortType = RIDE_SORT_RIDE; + _listSortDescending = false; + } + VisibleListRefresh(); + break; + case WIDX_RELOAD_OBJECT: + if (_loadedObject != nullptr) + { + auto descriptor = _loadedObject->GetDescriptor(); + auto& objectManager = GetContext()->GetObjectManager(); + auto entryIndex = objectManager.GetLoadedObjectEntryIndex(descriptor); + if (entryIndex != OBJECT_ENTRY_INDEX_NULL) + { + objectManager.UnloadObjects({ descriptor }); + objectManager.LoadObject(descriptor, entryIndex); + } + } + break; + default: + if (widgetIndex >= WIDX_TAB_1 + && static_cast(widgetIndex) < WIDX_TAB_1 + std::size(ObjectSelectionPages)) + { + SetPage(widgetIndex - WIDX_TAB_1); + } + break; + } + } + + void OnResize() override + { + WindowSetResize(*this, WW, WH, 1200, 1000); + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + int32_t numSelectionItems = 0; + + switch (widgetIndex) + { + case WIDX_FILTER_DROPDOWN: + + gDropdownItems[DDIX_FILTER_RCT1].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIX_FILTER_AA].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIX_FILTER_LL].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIX_FILTER_RCT2].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIX_FILTER_WW].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIX_FILTER_TT].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIX_FILTER_OO].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIX_FILTER_CUSTOM].Format = STR_TOGGLE_OPTION; + + gDropdownItems[DDIX_FILTER_RCT1].Args = STR_SCENARIO_CATEGORY_RCT1; + gDropdownItems[DDIX_FILTER_AA].Args = STR_SCENARIO_CATEGORY_RCT1_AA; + gDropdownItems[DDIX_FILTER_LL].Args = STR_SCENARIO_CATEGORY_RCT1_LL; + gDropdownItems[DDIX_FILTER_RCT2].Args = STR_ROLLERCOASTER_TYCOON_2_DROPDOWN; + gDropdownItems[DDIX_FILTER_WW].Args = STR_OBJECT_FILTER_WW; + gDropdownItems[DDIX_FILTER_TT].Args = STR_OBJECT_FILTER_TT; + gDropdownItems[DDIX_FILTER_OO].Args = STR_OBJECT_FILTER_OPENRCT2_OFFICIAL; + gDropdownItems[DDIX_FILTER_CUSTOM].Args = STR_OBJECT_FILTER_CUSTOM; + + // Track manager cannot select multiple, so only show selection filters if not in track manager + if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + { + numSelectionItems = 3; + gDropdownItems[DDIX_FILTER_SEPARATOR].Format = 0; + gDropdownItems[DDIX_FILTER_SELECTED].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIX_FILTER_NONSELECTED].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIX_FILTER_SEPARATOR].Args = STR_NONE; + gDropdownItems[DDIX_FILTER_SELECTED].Args = STR_SELECTED_ONLY; + gDropdownItems[DDIX_FILTER_NONSELECTED].Args = STR_NON_SELECTED_ONLY; + } + + WindowDropdownShowText( + { windowPos.x + widgets[widgetIndex].left, windowPos.y + widgets[widgetIndex].top }, + widgets[widgetIndex].height() + 1, colours[widgets[widgetIndex].colour], Dropdown::Flag::StayOpen, + _numSourceGameItems + numSelectionItems); + + for (int32_t i = 0; i < _numSourceGameItems; i++) + { + if (_filter_flags & (1 << i)) + { + Dropdown::SetChecked(i, true); + } + } + + if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + { + Dropdown::SetChecked(DDIX_FILTER_SELECTED, _FILTER_SELECTED != 0); + Dropdown::SetChecked(DDIX_FILTER_NONSELECTED, _FILTER_NONSELECTED != 0); + } + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + { + if (dropdownIndex == -1) + return; + + switch (widgetIndex) + { + case WIDX_FILTER_DROPDOWN: + if (dropdownIndex == DDIX_FILTER_SELECTED) + { + _filter_flags ^= FILTER_SELECTED; + _filter_flags &= ~FILTER_NONSELECTED; + } + else if (dropdownIndex == DDIX_FILTER_NONSELECTED) + { + _filter_flags ^= FILTER_NONSELECTED; + _filter_flags &= ~FILTER_SELECTED; + } + else + { + _filter_flags ^= (1 << dropdownIndex); + } + gConfigInterface.ObjectSelectionFilterFlags = _filter_flags; + ConfigSaveDefault(); + + FilterUpdateCounts(); + scrolls->v_top = 0; + + VisibleListRefresh(); + Invalidate(); + break; + } + } + + /** + * + * rct2: 0x006AB031 + */ + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + const auto newHeight = static_cast(_listItems.size() * SCROLLABLE_ROW_HEIGHT); + return { 0, newHeight }; + } + + /** + * + * rct2: 0x006AB0B6 + */ + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + // Used for in-game object selection cheat to prevent crashing the game + // when windows attempt to draw objects that don't exist any more + WindowCloseAllExceptClass(WindowClass::EditorObjectSelection); + + int32_t selected_object = GetObjectFromObjectSelection(GetSelectedObjectType(), screenCoords.y); + if (selected_object == -1) + return; + + ObjectListItem* listItem = &_listItems[selected_object]; + uint8_t object_selection_flags = *listItem->flags; + if (object_selection_flags & ObjectSelectionFlags::Flag6) + return; + + Invalidate(); + + const CursorState* state = ContextGetCursorState(); + Audio::Play(Audio::SoundId::Click1, 0, state->position.x); + + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + { + const auto objectSelectResult = WindowEditorObjectSelectionSelectObject( + 0, INPUT_FLAG_EDITOR_OBJECT_SELECT, listItem->repositoryItem); + if (!objectSelectResult.Successful) + return; + + if (_loadedObject != nullptr) + { + _loadedObject->Unload(); + _loadedObject = nullptr; + } + + auto& objRepository = GetContext()->GetObjectRepository(); + _loadedObject = objRepository.LoadObject(listItem->repositoryItem); + auto& objManager = GetContext()->GetObjectManager(); + objManager.LoadObject(_loadedObject.get()->GetIdentifier()); + + // This function calls window_track_list_open + ManageTracks(); + Close(); + return; + } + + uint32_t inputFlags = INPUT_FLAG_EDITOR_OBJECT_1 | INPUT_FLAG_EDITOR_OBJECT_SELECT_OBJECTS_IN_SCENERY_GROUP; + // If already selected + if (!(object_selection_flags & ObjectSelectionFlags::Selected)) + inputFlags |= INPUT_FLAG_EDITOR_OBJECT_SELECT; + + _gSceneryGroupPartialSelectError = std::nullopt; + const auto objectSelectResult = WindowEditorObjectSelectionSelectObject(0, inputFlags, listItem->repositoryItem); + if (!objectSelectResult.Successful) + { + StringId error_title = (inputFlags & INPUT_FLAG_EDITOR_OBJECT_SELECT) ? STR_UNABLE_TO_SELECT_THIS_OBJECT + : STR_UNABLE_TO_DE_SELECT_THIS_OBJECT; + + ContextShowError(error_title, objectSelectResult.Message, {}); + return; + } + + if (_FILTER_SELECTED || _FILTER_NONSELECTED) + { + FilterUpdateCounts(); + VisibleListRefresh(); + Invalidate(); + } + + if (_gSceneryGroupPartialSelectError.has_value()) + { + const auto errorMessage = _gSceneryGroupPartialSelectError.value(); + if (errorMessage == STR_OBJECT_SELECTION_ERR_TOO_MANY_OF_TYPE_SELECTED) + { + ContextShowError( + STR_WARNING_TOO_MANY_OBJECTS_SELECTED, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, {}); + } + else + { + ContextShowError( + errorMessage, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, Formatter::Common()); + } + } + } + + /** + * + * rct2: 0x006AB079 + */ + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + int32_t selectedObject = GetObjectFromObjectSelection(GetSelectedObjectType(), screenCoords.y); + if (selectedObject != -1) + { + ObjectListItem* listItem = &_listItems[selectedObject]; + uint8_t objectSelectionFlags = *listItem->flags; + if (objectSelectionFlags & ObjectSelectionFlags::Flag6) + { + selectedObject = -1; + } + } + if (selectedObject != selected_list_item) + { + selected_list_item = selectedObject; + + if (_loadedObject != nullptr) + { + _loadedObject->Unload(); + _loadedObject = nullptr; + } + + if (selectedObject != -1) + { + auto listItem = &_listItems[selectedObject]; + auto& objRepository = GetContext()->GetObjectRepository(); + _loadedObject = objRepository.LoadObject(listItem->repositoryItem); + if (_loadedObject != nullptr) + { + _loadedObject->Load(); + } + } + + Invalidate(); + } + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + // ScrollPaint + ScreenCoordsXY screenCoords; + bool ridePage = (GetSelectedObjectType() == ObjectType::Ride); + + uint8_t paletteIndex = ColourMapA[colours[1]].mid_light; + GfxClear(dpi, paletteIndex); + + screenCoords.y = 0; + for (size_t i = 0; i < _listItems.size(); i++) + { + const auto& listItem = _listItems[i]; + if (screenCoords.y + SCROLLABLE_ROW_HEIGHT >= dpi.y && screenCoords.y <= dpi.y + dpi.height) + { + // Draw checkbox + if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && !(*listItem.flags & 0x20)) + GfxFillRectInset( + dpi, { { 2, screenCoords.y }, { 11, screenCoords.y + 10 } }, colours[1], INSET_RECT_F_E0); + + // Highlight background + auto highlighted = i == static_cast(selected_list_item) + && !(*listItem.flags & ObjectSelectionFlags::Flag6); + if (highlighted) + { + auto bottom = screenCoords.y + (SCROLLABLE_ROW_HEIGHT - 1); + GfxFilterRect(dpi, { 0, screenCoords.y, width, bottom }, FilterPaletteID::PaletteDarken1); + } + + // Draw checkmark + if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && (*listItem.flags & ObjectSelectionFlags::Selected)) + { + screenCoords.x = 2; + auto darkness = highlighted ? TextDarkness::ExtraDark : TextDarkness::Dark; + colour_t colour2 = NOT_TRANSLUCENT(colours[1]); + if (*listItem.flags & (ObjectSelectionFlags::InUse | ObjectSelectionFlags::AlwaysRequired)) + colour2 |= COLOUR_FLAG_INSET; + + GfxDrawString( + dpi, screenCoords, static_cast(CheckBoxMarkString), + { static_cast(colour2), FontStyle::Medium, darkness }); + } + + screenCoords.x = gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 15; + + auto bufferWithColour = strcpy(gCommonStringFormatBuffer, highlighted ? "{WINDOW_COLOUR_2}" : "{BLACK}"); + auto buffer = strchr(bufferWithColour, '\0'); + + colour_t colour = COLOUR_BLACK; + auto darkness = TextDarkness::Regular; + if (*listItem.flags & ObjectSelectionFlags::Flag6) + { + colour = colours[1] & 0x7F; + darkness = TextDarkness::Dark; + } + + int32_t width_limit = widgets[WIDX_LIST].width() - screenCoords.x; + + if (ridePage) + { + width_limit /= 2; + // Draw ride type + StringId rideTypeStringId = GetRideTypeStringId(listItem.repositoryItem); + SafeStrCpy(buffer, LanguageGetString(rideTypeStringId), 256 - (buffer - bufferWithColour)); + auto ft = Formatter(); + ft.Add(gCommonStringFormatBuffer); + DrawTextEllipsised( + dpi, screenCoords, width_limit - 15, STR_STRING, ft, { colour, FontStyle::Medium, darkness }); + screenCoords.x = widgets[WIDX_LIST_SORT_RIDE].left - widgets[WIDX_LIST].left; + } + + // Draw text + SafeStrCpy(buffer, listItem.repositoryItem->Name.c_str(), 256 - (buffer - bufferWithColour)); + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + { + while (*buffer != 0 && *buffer != 9) + buffer++; + + *buffer = 0; + } + auto ft = Formatter(); + ft.Add(gCommonStringFormatBuffer); + DrawTextEllipsised(dpi, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::Medium, darkness }); + } + screenCoords.y += SCROLLABLE_ROW_HEIGHT; + } + } + + /** + * + * rct2: 0x006AB058 + */ + OpenRCT2String OnTooltip(const WidgetIndex widgetIndex, const StringId fallback) override + { + if (widgetIndex >= WIDX_TAB_1 && static_cast(widgetIndex) < WIDX_TAB_1 + std::size(ObjectSelectionPages)) + { + auto ft = Formatter(); + ft.Add(ObjectSelectionPages[(widgetIndex - WIDX_TAB_1)].Caption); + return { fallback, ft }; + } + return { fallback, {} }; + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (widgetIndex != WIDX_FILTER_TEXT_BOX) + return; + + std::string tempText = text.data(); + const char* c = tempText.c_str(); + + if (strcmp(_filter_string, c) == 0) + return; + + SafeStrCpy(_filter_string, c, sizeof(_filter_string)); + FilterUpdateCounts(); + + scrolls->v_top = 0; + VisibleListRefresh(); Invalidate(); } - if (_gSceneryGroupPartialSelectError.has_value()) + void OnPrepareDraw() override { - const auto errorMessage = _gSceneryGroupPartialSelectError.value(); - if (errorMessage == STR_OBJECT_SELECTION_ERR_TOO_MANY_OF_TYPE_SELECTED) + // Resize widgets + ResizeFrameWithPage(); + widgets[WIDX_ADVANCED].left = width - 130; + widgets[WIDX_ADVANCED].right = width - 9; + widgets[WIDX_LIST].right = width - 309; + widgets[WIDX_LIST].bottom = height - 14; + widgets[WIDX_PREVIEW].left = width - 209; + widgets[WIDX_PREVIEW].right = width - 96; + widgets[WIDX_INSTALL_TRACK].left = width - 130; + widgets[WIDX_INSTALL_TRACK].right = width - 9; + widgets[WIDX_FILTER_DROPDOWN].left = width - 250; + widgets[WIDX_FILTER_DROPDOWN].right = width - 137; + widgets[WIDX_RELOAD_OBJECT].left = width - 9 - 24; + widgets[WIDX_RELOAD_OBJECT].right = width - 9; + + // Set pressed widgets + pressed_widgets |= 1uLL << WIDX_PREVIEW; + SetPressedTab(); + if (list_information_type & 1) + pressed_widgets |= (1uLL << WIDX_ADVANCED); + else + pressed_widgets &= ~(1uLL << WIDX_ADVANCED); + + // Set window title and buttons + auto ft = Formatter::Common(); + ft.Add(ObjectSelectionPages[selected_tab].Caption); + auto& titleWidget = widgets[WIDX_TITLE]; + auto& installTrackWidget = widgets[WIDX_INSTALL_TRACK]; + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { - ContextShowError( - STR_WARNING_TOO_MANY_OBJECTS_SELECTED, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, {}); + titleWidget.text = STR_TRACK_DESIGNS_MANAGER_SELECT_RIDE_TYPE; + installTrackWidget.type = WindowWidgetType::Button; + } + else if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + { + titleWidget.text = STR_ROLLER_COASTER_DESIGNER_SELECT_RIDE_TYPES_VEHICLES; + installTrackWidget.type = WindowWidgetType::Empty; } else { - ContextShowError( - errorMessage, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, Formatter::Common()); - } - } - } - - /** - * - * rct2: 0x006AB079 - */ - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - int32_t selectedObject = GetObjectFromObjectSelection(GetSelectedObjectType(), screenCoords.y); - if (selectedObject != -1) - { - ObjectListItem* listItem = &_listItems[selectedObject]; - uint8_t objectSelectionFlags = *listItem->flags; - if (objectSelectionFlags & ObjectSelectionFlags::Flag6) - { - selectedObject = -1; - } - } - if (selectedObject != selected_list_item) - { - selected_list_item = selectedObject; - - if (_loadedObject != nullptr) - { - _loadedObject->Unload(); - _loadedObject = nullptr; + titleWidget.text = STR_OBJECT_SELECTION; + installTrackWidget.type = WindowWidgetType::Empty; } - if (selectedObject != -1) + // Align tabs, hide advanced ones + bool advancedMode = (list_information_type & 1) != 0; + int32_t x = 3; + for (size_t i = 0; i < std::size(ObjectSelectionPages); i++) { - auto listItem = &_listItems[selectedObject]; - auto& objRepository = GetContext()->GetObjectRepository(); - _loadedObject = objRepository.LoadObject(listItem->repositoryItem); - if (_loadedObject != nullptr) + auto& widget = widgets[WIDX_TAB_1 + i]; + if ((!advancedMode && ObjectSelectionPages[i].IsAdvanced) + || ObjectSelectionPages[i].Image == static_cast(SPR_NONE)) { - _loadedObject->Load(); + widget.type = WindowWidgetType::Empty; + } + else + { + widget.type = WindowWidgetType::Tab; + widget.left = x; + widget.right = x + 30; + x += 31; } } - Invalidate(); - } - } + if (gConfigGeneral.DebuggingTools) + widgets[WIDX_RELOAD_OBJECT].type = WindowWidgetType::ImgBtn; + else + widgets[WIDX_RELOAD_OBJECT].type = WindowWidgetType::Empty; - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - // ScrollPaint - ScreenCoordsXY screenCoords; - bool ridePage = (GetSelectedObjectType() == ObjectType::Ride); - - uint8_t paletteIndex = ColourMapA[colours[1]].mid_light; - GfxClear(&dpi, paletteIndex); - - screenCoords.y = 0; - for (size_t i = 0; i < _listItems.size(); i++) - { - const auto& listItem = _listItems[i]; - if (screenCoords.y + SCROLLABLE_ROW_HEIGHT >= dpi.y && screenCoords.y <= dpi.y + dpi.height) + if (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TRACK_DESIGNER)) { - // Draw checkbox - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && !(*listItem.flags & 0x20)) - GfxFillRectInset(dpi, { { 2, screenCoords.y }, { 11, screenCoords.y + 10 } }, colours[1], INSET_RECT_F_E0); - - // Highlight background - auto highlighted = i == static_cast(selected_list_item) - && !(*listItem.flags & ObjectSelectionFlags::Flag6); - if (highlighted) + widgets[WIDX_ADVANCED].type = WindowWidgetType::Empty; + for (size_t i = 1; i < std::size(ObjectSelectionPages); i++) { - auto bottom = screenCoords.y + (SCROLLABLE_ROW_HEIGHT - 1); - GfxFilterRect(dpi, { 0, screenCoords.y, width, bottom }, FilterPaletteID::PaletteDarken1); + widgets[WIDX_TAB_1 + i].type = WindowWidgetType::Empty; } - - // Draw checkmark - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && (*listItem.flags & ObjectSelectionFlags::Selected)) - { - screenCoords.x = 2; - auto darkness = highlighted ? TextDarkness::ExtraDark : TextDarkness::Dark; - colour_t colour2 = NOT_TRANSLUCENT(colours[1]); - if (*listItem.flags & (ObjectSelectionFlags::InUse | ObjectSelectionFlags::AlwaysRequired)) - colour2 |= COLOUR_FLAG_INSET; - - GfxDrawString( - dpi, screenCoords, static_cast(CheckBoxMarkString), - { static_cast(colour2), FontStyle::Medium, darkness }); - } - - screenCoords.x = gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 15; - - auto bufferWithColour = strcpy(gCommonStringFormatBuffer, highlighted ? "{WINDOW_COLOUR_2}" : "{BLACK}"); - auto buffer = strchr(bufferWithColour, '\0'); - - colour_t colour = COLOUR_BLACK; - auto darkness = TextDarkness::Regular; - if (*listItem.flags & ObjectSelectionFlags::Flag6) - { - colour = colours[1] & 0x7F; - darkness = TextDarkness::Dark; - } - - int32_t width_limit = widgets[WIDX_LIST].width() - screenCoords.x; - - if (ridePage) - { - width_limit /= 2; - // Draw ride type - StringId rideTypeStringId = GetRideTypeStringId(listItem.repositoryItem); - SafeStrCpy(buffer, LanguageGetString(rideTypeStringId), 256 - (buffer - bufferWithColour)); - auto ft = Formatter(); - ft.Add(gCommonStringFormatBuffer); - DrawTextEllipsised( - dpi, screenCoords, width_limit - 15, STR_STRING, ft, { colour, FontStyle::Medium, darkness }); - screenCoords.x = widgets[WIDX_LIST_SORT_RIDE].left - widgets[WIDX_LIST].left; - } - - // Draw text - SafeStrCpy(buffer, listItem.repositoryItem->Name.c_str(), 256 - (buffer - bufferWithColour)); - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - while (*buffer != 0 && *buffer != 9) - buffer++; - - *buffer = 0; - } - auto ft = Formatter(); - ft.Add(gCommonStringFormatBuffer); - DrawTextEllipsised(dpi, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::Medium, darkness }); - } - screenCoords.y += SCROLLABLE_ROW_HEIGHT; - } - } - - /** - * - * rct2: 0x006AB058 - */ - OpenRCT2String OnTooltip(const WidgetIndex widgetIndex, const StringId fallback) override - { - if (widgetIndex >= WIDX_TAB_1 && static_cast(widgetIndex) < WIDX_TAB_1 + std::size(ObjectSelectionPages)) - { - auto ft = Formatter(); - ft.Add(ObjectSelectionPages[(widgetIndex - WIDX_TAB_1)].Caption); - return { fallback, ft }; - } - return { fallback, {} }; - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (widgetIndex != WIDX_FILTER_TEXT_BOX) - return; - - std::string tempText = text.data(); - const char* c = tempText.c_str(); - - if (strcmp(_filter_string, c) == 0) - return; - - SafeStrCpy(_filter_string, c, sizeof(_filter_string)); - - FilterUpdateCounts(); - - scrolls->v_top = 0; - - VisibleListRefresh(); - Invalidate(); - } - - void OnPrepareDraw() override - { - // Resize widgets - ResizeFrameWithPage(); - widgets[WIDX_ADVANCED].left = width - 130; - widgets[WIDX_ADVANCED].right = width - 9; - widgets[WIDX_LIST].right = width - 309; - widgets[WIDX_LIST].bottom = height - 14; - widgets[WIDX_PREVIEW].left = width - 209; - widgets[WIDX_PREVIEW].right = width - 96; - widgets[WIDX_INSTALL_TRACK].left = width - 130; - widgets[WIDX_INSTALL_TRACK].right = width - 9; - widgets[WIDX_FILTER_DROPDOWN].left = width - 250; - widgets[WIDX_FILTER_DROPDOWN].right = width - 137; - widgets[WIDX_RELOAD_OBJECT].left = width - 9 - 24; - widgets[WIDX_RELOAD_OBJECT].right = width - 9; - - // Set pressed widgets - pressed_widgets |= 1uLL << WIDX_PREVIEW; - SetPressedTab(); - if (list_information_type & 1) - pressed_widgets |= (1uLL << WIDX_ADVANCED); - else - pressed_widgets &= ~(1uLL << WIDX_ADVANCED); - - // Set window title and buttons - auto ft = Formatter::Common(); - ft.Add(ObjectSelectionPages[selected_tab].Caption); - auto& titleWidget = widgets[WIDX_TITLE]; - auto& installTrackWidget = widgets[WIDX_INSTALL_TRACK]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - titleWidget.text = STR_TRACK_DESIGNS_MANAGER_SELECT_RIDE_TYPE; - installTrackWidget.type = WindowWidgetType::Button; - } - else if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) - { - titleWidget.text = STR_ROLLER_COASTER_DESIGNER_SELECT_RIDE_TYPES_VEHICLES; - installTrackWidget.type = WindowWidgetType::Empty; - } - else - { - titleWidget.text = STR_OBJECT_SELECTION; - installTrackWidget.type = WindowWidgetType::Empty; - } - - // Align tabs, hide advanced ones - bool advancedMode = (list_information_type & 1) != 0; - int32_t x = 3; - for (size_t i = 0; i < std::size(ObjectSelectionPages); i++) - { - auto& widget = widgets[WIDX_TAB_1 + i]; - if ((!advancedMode && ObjectSelectionPages[i].IsAdvanced) - || ObjectSelectionPages[i].Image == static_cast(SPR_NONE)) - { - widget.type = WindowWidgetType::Empty; + x = 150; } else { - widget.type = WindowWidgetType::Tab; - widget.left = x; - widget.right = x + 30; - x += 31; + widgets[WIDX_ADVANCED].type = WindowWidgetType::Button; + x = 300; } - } - if (gConfigGeneral.DebuggingTools) - widgets[WIDX_RELOAD_OBJECT].type = WindowWidgetType::ImgBtn; - else - widgets[WIDX_RELOAD_OBJECT].type = WindowWidgetType::Empty; + widgets[WIDX_FILTER_DROPDOWN].type = WindowWidgetType::Button; + widgets[WIDX_LIST].right = width - (WW - 587) - x; + widgets[WIDX_PREVIEW].left = width - (WW - 537) - (x / 2); + widgets[WIDX_PREVIEW].right = widgets[WIDX_PREVIEW].left + 113; + widgets[WIDX_FILTER_RIDE_TAB_FRAME].right = widgets[WIDX_LIST].right; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TRACK_DESIGNER)) - { - widgets[WIDX_ADVANCED].type = WindowWidgetType::Empty; - for (size_t i = 1; i < std::size(ObjectSelectionPages); i++) + bool ridePage = (GetSelectedObjectType() == ObjectType::Ride); + widgets[WIDX_LIST].top = (ridePage ? 118 : 60); + widgets[WIDX_FILTER_TEXT_BOX].right = widgets[WIDX_LIST].right - 77; + widgets[WIDX_FILTER_TEXT_BOX].top = (ridePage ? 79 : 45); + widgets[WIDX_FILTER_TEXT_BOX].bottom = (ridePage ? 92 : 58); + widgets[WIDX_FILTER_CLEAR_BUTTON].left = widgets[WIDX_LIST].right - 73; + widgets[WIDX_FILTER_CLEAR_BUTTON].right = widgets[WIDX_LIST].right; + widgets[WIDX_FILTER_CLEAR_BUTTON].top = (ridePage ? 79 : 45); + widgets[WIDX_FILTER_CLEAR_BUTTON].bottom = (ridePage ? 92 : 58); + + if (ridePage) { - widgets[WIDX_TAB_1 + i].type = WindowWidgetType::Empty; + for (int32_t i = WIDX_FILTER_RIDE_TAB_ALL; i <= WIDX_FILTER_RIDE_TAB_STALL; i++) + pressed_widgets &= ~(1 << i); + + if ((_filter_flags & FILTER_RIDES) == FILTER_RIDES) + pressed_widgets |= (1uLL << WIDX_FILTER_RIDE_TAB_ALL); + else + { + for (int32_t i = 0; i < 6; i++) + { + if (_filter_flags & (1 << (_numSourceGameItems + i))) + pressed_widgets |= 1uLL << (WIDX_FILTER_RIDE_TAB_TRANSPORT + i); + } + } + + widgets[WIDX_FILTER_RIDE_TAB_FRAME].type = WindowWidgetType::ImgBtn; + for (int32_t i = WIDX_FILTER_RIDE_TAB_ALL; i <= WIDX_FILTER_RIDE_TAB_STALL; i++) + widgets[i].type = WindowWidgetType::Tab; + + int32_t width_limit = (widgets[WIDX_LIST].width() - 15) / 2; + + widgets[WIDX_LIST_SORT_TYPE].type = WindowWidgetType::TableHeader; + widgets[WIDX_LIST_SORT_TYPE].top = widgets[WIDX_FILTER_TEXT_BOX].bottom + 3; + widgets[WIDX_LIST_SORT_TYPE].bottom = widgets[WIDX_LIST_SORT_TYPE].top + 13; + widgets[WIDX_LIST_SORT_TYPE].left = 4; + widgets[WIDX_LIST_SORT_TYPE].right = widgets[WIDX_LIST_SORT_TYPE].left + width_limit; + + widgets[WIDX_LIST_SORT_RIDE].type = WindowWidgetType::TableHeader; + widgets[WIDX_LIST_SORT_RIDE].top = widgets[WIDX_LIST_SORT_TYPE].top; + widgets[WIDX_LIST_SORT_RIDE].bottom = widgets[WIDX_LIST_SORT_TYPE].bottom; + widgets[WIDX_LIST_SORT_RIDE].left = widgets[WIDX_LIST_SORT_TYPE].right + 1; + widgets[WIDX_LIST_SORT_RIDE].right = widgets[WIDX_LIST].right; + + widgets[WIDX_LIST].top = widgets[WIDX_LIST_SORT_TYPE].bottom + 2; } - x = 150; - } - else - { - widgets[WIDX_ADVANCED].type = WindowWidgetType::Button; - x = 300; - } - - widgets[WIDX_FILTER_DROPDOWN].type = WindowWidgetType::Button; - widgets[WIDX_LIST].right = width - (WW - 587) - x; - widgets[WIDX_PREVIEW].left = width - (WW - 537) - (x / 2); - widgets[WIDX_PREVIEW].right = widgets[WIDX_PREVIEW].left + 113; - widgets[WIDX_FILTER_RIDE_TAB_FRAME].right = widgets[WIDX_LIST].right; - - bool ridePage = (GetSelectedObjectType() == ObjectType::Ride); - widgets[WIDX_LIST].top = (ridePage ? 118 : 60); - widgets[WIDX_FILTER_TEXT_BOX].right = widgets[WIDX_LIST].right - 77; - widgets[WIDX_FILTER_TEXT_BOX].top = (ridePage ? 79 : 45); - widgets[WIDX_FILTER_TEXT_BOX].bottom = (ridePage ? 92 : 58); - widgets[WIDX_FILTER_CLEAR_BUTTON].left = widgets[WIDX_LIST].right - 73; - widgets[WIDX_FILTER_CLEAR_BUTTON].right = widgets[WIDX_LIST].right; - widgets[WIDX_FILTER_CLEAR_BUTTON].top = (ridePage ? 79 : 45); - widgets[WIDX_FILTER_CLEAR_BUTTON].bottom = (ridePage ? 92 : 58); - - if (ridePage) - { - for (int32_t i = WIDX_FILTER_RIDE_TAB_ALL; i <= WIDX_FILTER_RIDE_TAB_STALL; i++) - pressed_widgets &= ~(1 << i); - - if ((_filter_flags & FILTER_RIDES) == FILTER_RIDES) - pressed_widgets |= (1uLL << WIDX_FILTER_RIDE_TAB_ALL); else { - for (int32_t i = 0; i < 6; i++) + for (int32_t i = WIDX_FILTER_RIDE_TAB_FRAME; i <= WIDX_FILTER_RIDE_TAB_STALL; i++) + widgets[i].type = WindowWidgetType::Empty; + + widgets[WIDX_LIST_SORT_TYPE].type = WindowWidgetType::Empty; + widgets[WIDX_LIST_SORT_RIDE].type = WindowWidgetType::Empty; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + int32_t _width; + + DrawWidgets(dpi); + + // Draw tabs + for (size_t i = 0; i < std::size(ObjectSelectionPages); i++) + { + const auto& widget = widgets[WIDX_TAB_1 + i]; + if (widget.type != WindowWidgetType::Empty) { - if (_filter_flags & (1 << (_numSourceGameItems + i))) - pressed_widgets |= 1uLL << (WIDX_FILTER_RIDE_TAB_TRANSPORT + i); + auto image = ImageId(ObjectSelectionPages[i].Image); + auto screenPos = windowPos + ScreenCoordsXY{ widget.left, widget.top }; + GfxDrawSprite(dpi, image, screenPos); } } - widgets[WIDX_FILTER_RIDE_TAB_FRAME].type = WindowWidgetType::ImgBtn; - for (int32_t i = WIDX_FILTER_RIDE_TAB_ALL; i <= WIDX_FILTER_RIDE_TAB_STALL; i++) - widgets[i].type = WindowWidgetType::Tab; + const int32_t ride_tabs[] = { + SPR_TAB_RIDE_16, SPR_TAB_RIDES_TRANSPORT_0, SPR_TAB_RIDES_GENTLE_0, SPR_TAB_RIDES_ROLLER_COASTERS_0, + SPR_TAB_RIDES_THRILL_0, SPR_TAB_RIDES_WATER_0, SPR_TAB_RIDES_SHOP_0, SPR_TAB_FINANCES_RESEARCH_0, + }; + const int32_t ThrillRidesTabAnimationSequence[] = { + 5, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, + }; - int32_t width_limit = (widgets[WIDX_LIST].width() - 15) / 2; - - widgets[WIDX_LIST_SORT_TYPE].type = WindowWidgetType::TableHeader; - widgets[WIDX_LIST_SORT_TYPE].top = widgets[WIDX_FILTER_TEXT_BOX].bottom + 3; - widgets[WIDX_LIST_SORT_TYPE].bottom = widgets[WIDX_LIST_SORT_TYPE].top + 13; - widgets[WIDX_LIST_SORT_TYPE].left = 4; - widgets[WIDX_LIST_SORT_TYPE].right = widgets[WIDX_LIST_SORT_TYPE].left + width_limit; - - widgets[WIDX_LIST_SORT_RIDE].type = WindowWidgetType::TableHeader; - widgets[WIDX_LIST_SORT_RIDE].top = widgets[WIDX_LIST_SORT_TYPE].top; - widgets[WIDX_LIST_SORT_RIDE].bottom = widgets[WIDX_LIST_SORT_TYPE].bottom; - widgets[WIDX_LIST_SORT_RIDE].left = widgets[WIDX_LIST_SORT_TYPE].right + 1; - widgets[WIDX_LIST_SORT_RIDE].right = widgets[WIDX_LIST].right; - - widgets[WIDX_LIST].top = widgets[WIDX_LIST_SORT_TYPE].bottom + 2; - } - else - { - for (int32_t i = WIDX_FILTER_RIDE_TAB_FRAME; i <= WIDX_FILTER_RIDE_TAB_STALL; i++) - widgets[i].type = WindowWidgetType::Empty; - - widgets[WIDX_LIST_SORT_TYPE].type = WindowWidgetType::Empty; - widgets[WIDX_LIST_SORT_RIDE].type = WindowWidgetType::Empty; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - int32_t _width; - - DrawWidgets(dpi); - - // Draw tabs - for (size_t i = 0; i < std::size(ObjectSelectionPages); i++) - { - const auto& widget = widgets[WIDX_TAB_1 + i]; - if (widget.type != WindowWidgetType::Empty) + // Draw ride tabs + if (GetSelectedObjectType() == ObjectType::Ride) { - auto image = ImageId(ObjectSelectionPages[i].Image); - auto screenPos = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - GfxDrawSprite(dpi, image, screenPos); - } - } - - const int32_t ride_tabs[] = { - SPR_TAB_RIDE_16, SPR_TAB_RIDES_TRANSPORT_0, SPR_TAB_RIDES_GENTLE_0, SPR_TAB_RIDES_ROLLER_COASTERS_0, - SPR_TAB_RIDES_THRILL_0, SPR_TAB_RIDES_WATER_0, SPR_TAB_RIDES_SHOP_0, SPR_TAB_FINANCES_RESEARCH_0, - }; - const int32_t ThrillRidesTabAnimationSequence[] = { - 5, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, - }; - - // Draw ride tabs - if (GetSelectedObjectType() == ObjectType::Ride) - { - for (int32_t i = 0; i < 7; i++) - { - const auto& widget = widgets[WIDX_FILTER_RIDE_TAB_ALL + i]; - if (widget.type == WindowWidgetType::Empty) - continue; - - int32_t spriteIndex = ride_tabs[i]; - int32_t frame = 0; - if (i != 0 && IsWidgetPressed(WIDX_FILTER_RIDE_TAB_ALL + i)) + for (int32_t i = 0; i < 7; i++) { - frame = frame_no / window_editor_object_selection_animation_divisor[i - 1]; - } - spriteIndex += (i == 4 ? ThrillRidesTabAnimationSequence[frame] : frame); - - auto screenPos = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - GfxDrawSprite(dpi, ImageId(spriteIndex, colours[1]), screenPos); - } - } - - // Preview background - const auto& previewWidget = widgets[WIDX_PREVIEW]; - GfxFillRect( - dpi, - { windowPos + ScreenCoordsXY{ previewWidget.left + 1, previewWidget.top + 1 }, - windowPos + ScreenCoordsXY{ previewWidget.right - 1, previewWidget.bottom - 1 } }, - ColourMapA[colours[1]].darkest); - - // Draw number of selected items - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) - { - auto screenPos = windowPos + ScreenCoordsXY{ 3, height - 13 }; - - int32_t numSelected = _numSelectedObjectsForType[EnumValue(GetSelectedObjectType())]; - int32_t totalSelectable = object_entry_group_counts[EnumValue(GetSelectedObjectType())]; - - auto ft = Formatter(); - ft.Add(numSelected); - ft.Add(totalSelectable); - DrawTextBasic(dpi, screenPos, STR_OBJECT_SELECTION_SELECTION_SIZE, ft); - } - - // Draw sort button text - const auto& listSortTypeWidget = widgets[WIDX_LIST_SORT_TYPE]; - if (listSortTypeWidget.type != WindowWidgetType::Empty) - { - auto ft = Formatter(); - auto stringId = _listSortType == RIDE_SORT_TYPE ? static_cast(_listSortDescending ? STR_DOWN : STR_UP) - : STR_NONE; - ft.Add(stringId); - auto screenPos = windowPos + ScreenCoordsXY{ listSortTypeWidget.left + 1, listSortTypeWidget.top + 1 }; - DrawTextEllipsised(dpi, screenPos, listSortTypeWidget.width(), STR_OBJECTS_SORT_TYPE, ft, { colours[1] }); - } - const auto& listSortRideWidget = widgets[WIDX_LIST_SORT_RIDE]; - if (listSortRideWidget.type != WindowWidgetType::Empty) - { - auto ft = Formatter(); - auto stringId = _listSortType == RIDE_SORT_RIDE ? static_cast(_listSortDescending ? STR_DOWN : STR_UP) - : STR_NONE; - ft.Add(stringId); - auto screenPos = windowPos + ScreenCoordsXY{ listSortRideWidget.left + 1, listSortRideWidget.top + 1 }; - DrawTextEllipsised(dpi, screenPos, listSortRideWidget.width(), STR_OBJECTS_SORT_RIDE, ft, { colours[1] }); - } - - if (selected_list_item == -1 || _loadedObject == nullptr) - return; - - ObjectListItem* listItem = &_listItems[selected_list_item]; - - // Draw preview - { - DrawPixelInfo clipDPI; - auto screenPos = windowPos + ScreenCoordsXY{ previewWidget.left + 1, previewWidget.top + 1 }; - _width = previewWidget.width() - 1; - int32_t _height = previewWidget.height() - 1; - if (ClipDrawPixelInfo(clipDPI, dpi, screenPos, _width, _height)) - { - _loadedObject->DrawPreview(clipDPI, _width, _height); - } - } - - // Draw name of object - { - auto screenPos = windowPos + ScreenCoordsXY{ previewWidget.midX() + 1, previewWidget.bottom + 3 }; - _width = this->width - widgets[WIDX_LIST].right - 6; - auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(listItem->repositoryItem->Name.c_str()); - DrawTextEllipsised(dpi, screenPos, _width, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); - } - - DrawDescriptions(dpi); - DrawDebugData(dpi); - } - -private: - void InitWidgets() - { - auto& targetWidgets = _window_editor_object_selection_widgets; - if (!_window_editor_object_selection_widgets_initialised) - { - _window_editor_object_selection_widgets_initialised = true; - auto tabWidget = targetWidgets[targetWidgets.size() - 2]; - for (size_t i = 1; i < std::size(ObjectSelectionPages); i++) - { - targetWidgets.insert(targetWidgets.end() - 1, tabWidget); - } - } - - widgets = targetWidgets.data(); - } - - void SetPage(int32_t _page) - { - if (selected_tab == _page) - return; - - selected_tab = _page; - selected_list_item = -1; - scrolls[0].v_top = 0; - frame_no = 0; - - if (_page == EnumValue(ObjectType::Ride)) - { - _listSortType = RIDE_SORT_TYPE; - _listSortDescending = false; - } - else - { - _listSortType = RIDE_SORT_RIDE; - _listSortDescending = false; - } - - VisibleListRefresh(); - Invalidate(); - } - - void VisibleListRefresh() - { - int32_t numObjects = static_cast(ObjectRepositoryGetItemsCount()); - - VisibleListDispose(); - selected_list_item = -1; - - const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); - for (int32_t i = 0; i < numObjects; i++) - { - uint8_t selectionFlags = _objectSelectionFlags[i]; - const ObjectRepositoryItem* item = &items[i]; - if (item->Type == GetSelectedObjectType() && !(selectionFlags & ObjectSelectionFlags::Flag6) && FilterSource(item) - && FilterString(*item) && FilterChunks(item) && FilterSelected(selectionFlags) - && FilterCompatibilityObject(*item, selectionFlags)) - { - auto filter = std::make_unique(); - filter->category[0] = 0; - filter->category[1] = 0; - filter->ride_type = 0; - - ObjectListItem currentListItem; - currentListItem.repositoryItem = item; - currentListItem.filter = std::move(filter); - currentListItem.flags = &_objectSelectionFlags[i]; - _listItems.push_back(std::move(currentListItem)); - } - } - - if (_listItems.empty()) - { - VisibleListDispose(); - } - else - { - sortFunc_t sortFunc = nullptr; - switch (_listSortType) - { - case RIDE_SORT_TYPE: - sortFunc = VisibleListSortRideType; - break; - case RIDE_SORT_RIDE: - sortFunc = VisibleListSortRideName; - break; - default: - LOG_WARNING("Wrong sort type %d, leaving list as-is.", _listSortType); - break; - } - if (sortFunc != nullptr) - { - std::sort(_listItems.begin(), _listItems.end(), sortFunc); - if (_listSortDescending) - { - std::reverse(_listItems.begin(), _listItems.end()); - } - } - } - Invalidate(); - } - - void VisibleListDispose() - { - _listItems.clear(); - _listItems.shrink_to_fit(); - } - - void DrawDescriptions(DrawPixelInfo& dpi) - { - const auto& widget = widgets[WIDX_PREVIEW]; - auto screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_LIST].right + 4, widget.bottom + 23 }; - auto _width2 = windowPos.x + this->width - screenPos.x - 4; - - if (_loadedObject->IsCompatibilityObject()) - { - screenPos.y += DrawTextWrapped( - dpi, screenPos, _width2, STR_OBJECT_SELECTION_COMPAT_OBJECT_DESCRIPTION, {}, - { COLOUR_BRIGHT_RED }) - + LIST_ROW_HEIGHT; - } - - auto description = ObjectGetDescription(_loadedObject.get()); - if (!description.empty()) - { - auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(description.c_str()); - - screenPos.y += DrawTextWrapped(dpi, screenPos, _width2, STR_WINDOW_COLOUR_2_STRINGID, ft) + LIST_ROW_HEIGHT; - } - if (GetSelectedObjectType() == ObjectType::Ride) - { - auto* rideObject = reinterpret_cast(_loadedObject.get()); - const auto* rideEntry = reinterpret_cast(rideObject->GetLegacyData()); - if (rideEntry->shop_item[0] != ShopItem::None) - { - std::string sells = ""; - for (size_t i = 0; i < std::size(rideEntry->shop_item); i++) - { - if (rideEntry->shop_item[i] == ShopItem::None) + const auto& widget = widgets[WIDX_FILTER_RIDE_TAB_ALL + i]; + if (widget.type == WindowWidgetType::Empty) continue; - if (!sells.empty()) - sells += ", "; + int32_t spriteIndex = ride_tabs[i]; + int32_t frame = 0; + if (i != 0 && IsWidgetPressed(WIDX_FILTER_RIDE_TAB_ALL + i)) + { + frame = frame_no / window_editor_object_selection_animation_divisor[i - 1]; + } + spriteIndex += (i == 4 ? ThrillRidesTabAnimationSequence[frame] : frame); - sells += LanguageGetString(GetShopItemDescriptor(rideEntry->shop_item[i]).Naming.Plural); + auto screenPos = windowPos + ScreenCoordsXY{ widget.left, widget.top }; + GfxDrawSprite(dpi, ImageId(spriteIndex, colours[1]), screenPos); } - auto ft = Formatter(); - ft.Add(sells.c_str()); - screenPos.y += DrawTextWrapped(dpi, screenPos, _width2, STR_RIDE_OBJECT_SHOP_SELLS, ft) + 2; } - } - else if (GetSelectedObjectType() == ObjectType::SceneryGroup) - { - const auto* sceneryGroupObject = reinterpret_cast(_loadedObject.get()); - auto ft = Formatter(); - ft.Add(sceneryGroupObject->GetNumIncludedObjects()); - screenPos.y += DrawTextWrapped(dpi, screenPos, _width2, STR_INCLUDES_X_OBJECTS, ft) + 2; - } - else if (GetSelectedObjectType() == ObjectType::Music) - { - screenPos.y += DrawTextWrapped(dpi, screenPos, _width2, STR_MUSIC_OBJECT_TRACK_HEADER) + 2; - const auto* musicObject = reinterpret_cast(_loadedObject.get()); - for (size_t i = 0; i < musicObject->GetTrackCount(); i++) - { - const auto* track = musicObject->GetTrack(i); - if (track->Name.empty()) - continue; - auto stringId = track->Composer.empty() ? STR_MUSIC_OBJECT_TRACK_LIST_ITEM - : STR_MUSIC_OBJECT_TRACK_LIST_ITEM_WITH_COMPOSER; + // Preview background + const auto& previewWidget = widgets[WIDX_PREVIEW]; + GfxFillRect( + dpi, + { windowPos + ScreenCoordsXY{ previewWidget.left + 1, previewWidget.top + 1 }, + windowPos + ScreenCoordsXY{ previewWidget.right - 1, previewWidget.bottom - 1 } }, + ColourMapA[colours[1]].darkest); + + // Draw number of selected items + if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + { + auto screenPos = windowPos + ScreenCoordsXY{ 3, height - 13 }; + + int32_t numSelected = _numSelectedObjectsForType[EnumValue(GetSelectedObjectType())]; + int32_t totalSelectable = object_entry_group_counts[EnumValue(GetSelectedObjectType())]; + auto ft = Formatter(); - ft.Add(track->Name.c_str()); - ft.Add(track->Composer.c_str()); - screenPos.y += DrawTextWrapped(dpi, screenPos + ScreenCoordsXY{ 10, 0 }, _width2, stringId, ft); + ft.Add(numSelected); + ft.Add(totalSelectable); + DrawTextBasic(dpi, screenPos, STR_OBJECT_SELECTION_SELECTION_SIZE, ft); } - } - } - void DrawDebugData(DrawPixelInfo& dpi) - { - ObjectListItem* listItem = &_listItems[selected_list_item]; - auto screenPos = windowPos + ScreenCoordsXY{ width - 5, height - (LIST_ROW_HEIGHT * 6) }; - - // Draw fallback image warning - if (_loadedObject && _loadedObject->UsesFallbackImages()) - { - DrawTextBasic(dpi, screenPos, STR_OBJECT_USES_FALLBACK_IMAGES, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); - } - screenPos.y += LIST_ROW_HEIGHT; - - // Draw ride type. - if (GetSelectedObjectType() == ObjectType::Ride) - { - auto stringId = GetRideTypeStringId(listItem->repositoryItem); - DrawTextBasic(dpi, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); - } - - screenPos.y += LIST_ROW_HEIGHT; - - // Draw object source - auto stringId = ObjectManagerGetSourceGameString(listItem->repositoryItem->GetFirstSourceGame()); - DrawTextBasic(dpi, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); - screenPos.y += LIST_ROW_HEIGHT; - - // Draw object filename - { - auto path = Path::GetFileName(listItem->repositoryItem->Path); - auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(path.c_str()); - DrawTextBasic( - dpi, { windowPos.x + this->width - 5, screenPos.y }, STR_WINDOW_COLOUR_2_STRINGID, ft, - { COLOUR_BLACK, TextAlignment::RIGHT }); - screenPos.y += LIST_ROW_HEIGHT; - } - - // Draw object author (will be blank space if no author in file or a non JSON object) - { - auto ft = Formatter(); - std::string authorsString; - for (size_t i = 0; i < listItem->repositoryItem->Authors.size(); i++) + // Draw sort button text + const auto& listSortTypeWidget = widgets[WIDX_LIST_SORT_TYPE]; + if (listSortTypeWidget.type != WindowWidgetType::Empty) { - if (i > 0) + auto ft = Formatter(); + auto stringId = _listSortType == RIDE_SORT_TYPE ? static_cast(_listSortDescending ? STR_DOWN : STR_UP) + : STR_NONE; + ft.Add(stringId); + auto screenPos = windowPos + ScreenCoordsXY{ listSortTypeWidget.left + 1, listSortTypeWidget.top + 1 }; + DrawTextEllipsised(dpi, screenPos, listSortTypeWidget.width(), STR_OBJECTS_SORT_TYPE, ft, { colours[1] }); + } + const auto& listSortRideWidget = widgets[WIDX_LIST_SORT_RIDE]; + if (listSortRideWidget.type != WindowWidgetType::Empty) + { + auto ft = Formatter(); + auto stringId = _listSortType == RIDE_SORT_RIDE ? static_cast(_listSortDescending ? STR_DOWN : STR_UP) + : STR_NONE; + ft.Add(stringId); + auto screenPos = windowPos + ScreenCoordsXY{ listSortRideWidget.left + 1, listSortRideWidget.top + 1 }; + DrawTextEllipsised(dpi, screenPos, listSortRideWidget.width(), STR_OBJECTS_SORT_RIDE, ft, { colours[1] }); + } + + if (selected_list_item == -1 || _loadedObject == nullptr) + return; + + ObjectListItem* listItem = &_listItems[selected_list_item]; + + // Draw preview + { + DrawPixelInfo clipDPI; + auto screenPos = windowPos + ScreenCoordsXY{ previewWidget.left + 1, previewWidget.top + 1 }; + _width = previewWidget.width() - 1; + int32_t _height = previewWidget.height() - 1; + if (ClipDrawPixelInfo(clipDPI, dpi, screenPos, _width, _height)) { - authorsString.append(", "); + _loadedObject->DrawPreview(clipDPI, _width, _height); } - authorsString.append(listItem->repositoryItem->Authors[i]); } - ft.Add(STR_STRING); - ft.Add(authorsString.c_str()); - DrawTextEllipsised( - dpi, { windowPos.x + width - 5, screenPos.y }, width - widgets[WIDX_LIST].right - 4, - STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::RIGHT }); - } - } - bool FilterSelected(uint8_t objectFlag) - { - // Track Manager has no concept of selection filtering, so always return true - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - return true; - } - if (_FILTER_SELECTED == _FILTER_NONSELECTED) - { - return true; - } - if (_FILTER_SELECTED && objectFlag & ObjectSelectionFlags::Selected) - { - return true; - } - if (_FILTER_NONSELECTED && !(objectFlag & ObjectSelectionFlags::Selected)) - { - return true; + // Draw name of object + { + auto screenPos = windowPos + ScreenCoordsXY{ previewWidget.midX() + 1, previewWidget.bottom + 3 }; + _width = this->width - widgets[WIDX_LIST].right - 6; + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(listItem->repositoryItem->Name.c_str()); + DrawTextEllipsised(dpi, screenPos, _width, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); + } + + DrawDescriptions(dpi); + DrawDebugData(dpi); } - return false; - } - - bool FilterCompatibilityObject(const ObjectRepositoryItem& item, uint8_t objectFlag) - { - // Only show compat objects if they are not selected already. - return !(item.Flags & ObjectItemFlags::IsCompatibilityObject) || (objectFlag & ObjectSelectionFlags::Selected); - } - - static bool IsFilterInName(const ObjectRepositoryItem& item, std::string_view filter) - { - return String::Contains(item.Name, filter, true); - } - - static bool IsFilterInRideType(const ObjectRepositoryItem& item, std::string_view filter) - { - if (item.Type == ObjectType::Ride) + void GoToTab(ObjectType objectType) { - auto rideTypeName = LanguageGetString(GetRideTypeStringId(&item)); - if (String::Contains(rideTypeName, filter, true)) - return true; + for (size_t offset = 0; offset < std::size(TabOrder); offset++) + { + if (TabOrder[offset] == objectType) + { + SetPage(static_cast(offset)); + return; + } + } } - return false; - } - static bool IsFilterInFilename(const ObjectRepositoryItem& item, std::string_view filter) - { - return String::Contains(item.Path, filter, true); - } - - static bool IsFilterInAuthor(const ObjectRepositoryItem& item, std::string_view filter) - { - for (auto& author : item.Authors) + private: + void InitWidgets() { - if (String::Contains(author, filter, true)) + auto& targetWidgets = _window_editor_object_selection_widgets; + if (!_window_editor_object_selection_widgets_initialised) + { + _window_editor_object_selection_widgets_initialised = true; + auto tabWidget = targetWidgets[targetWidgets.size() - 2]; + for (size_t i = 1; i < std::size(ObjectSelectionPages); i++) + { + targetWidgets.insert(targetWidgets.end() - 1, tabWidget); + } + } + + widgets = targetWidgets.data(); + } + + void SetPage(int32_t _page) + { + if (selected_tab == _page) + return; + + selected_tab = _page; + selected_list_item = -1; + scrolls[0].v_top = 0; + frame_no = 0; + + if (_page == EnumValue(ObjectType::Ride)) + { + _listSortType = RIDE_SORT_TYPE; + _listSortDescending = false; + } + else + { + _listSortType = RIDE_SORT_RIDE; + _listSortDescending = false; + } + + VisibleListRefresh(); + Invalidate(); + } + + void VisibleListRefresh() + { + int32_t numObjects = static_cast(ObjectRepositoryGetItemsCount()); + + VisibleListDispose(); + selected_list_item = -1; + + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); + for (int32_t i = 0; i < numObjects; i++) + { + uint8_t selectionFlags = _objectSelectionFlags[i]; + const ObjectRepositoryItem* item = &items[i]; + if (item->Type == GetSelectedObjectType() && !(selectionFlags & ObjectSelectionFlags::Flag6) + && FilterSource(item) && FilterString(*item) && FilterChunks(item) && FilterSelected(selectionFlags) + && FilterCompatibilityObject(*item, selectionFlags)) + { + auto filter = std::make_unique(); + filter->category[0] = 0; + filter->category[1] = 0; + filter->ride_type = 0; + + ObjectListItem currentListItem; + currentListItem.repositoryItem = item; + currentListItem.filter = std::move(filter); + currentListItem.flags = &_objectSelectionFlags[i]; + _listItems.push_back(std::move(currentListItem)); + } + } + + if (_listItems.empty()) + { + VisibleListDispose(); + } + else + { + sortFunc_t sortFunc = nullptr; + switch (_listSortType) + { + case RIDE_SORT_TYPE: + sortFunc = VisibleListSortRideType; + break; + case RIDE_SORT_RIDE: + sortFunc = VisibleListSortRideName; + break; + default: + LOG_WARNING("Wrong sort type %d, leaving list as-is.", _listSortType); + break; + } + if (sortFunc != nullptr) + { + std::sort(_listItems.begin(), _listItems.end(), sortFunc); + if (_listSortDescending) + { + std::reverse(_listItems.begin(), _listItems.end()); + } + } + } + Invalidate(); + } + + void VisibleListDispose() + { + _listItems.clear(); + _listItems.shrink_to_fit(); + } + + void DrawDescriptions(DrawPixelInfo& dpi) + { + const auto& widget = widgets[WIDX_PREVIEW]; + auto screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_LIST].right + 4, widget.bottom + 23 }; + auto _width2 = windowPos.x + this->width - screenPos.x - 4; + + if (_loadedObject->IsCompatibilityObject()) + { + screenPos.y += DrawTextWrapped( + dpi, screenPos, _width2, STR_OBJECT_SELECTION_COMPAT_OBJECT_DESCRIPTION, {}, + { COLOUR_BRIGHT_RED }) + + LIST_ROW_HEIGHT; + } + + auto description = ObjectGetDescription(_loadedObject.get()); + if (!description.empty()) + { + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(description.c_str()); + + screenPos.y += DrawTextWrapped(dpi, screenPos, _width2, STR_WINDOW_COLOUR_2_STRINGID, ft) + LIST_ROW_HEIGHT; + } + if (GetSelectedObjectType() == ObjectType::Ride) + { + auto* rideObject = reinterpret_cast(_loadedObject.get()); + const auto* rideEntry = reinterpret_cast(rideObject->GetLegacyData()); + if (rideEntry->shop_item[0] != ShopItem::None) + { + std::string sells = ""; + for (size_t i = 0; i < std::size(rideEntry->shop_item); i++) + { + if (rideEntry->shop_item[i] == ShopItem::None) + continue; + + if (!sells.empty()) + sells += ", "; + + sells += LanguageGetString(GetShopItemDescriptor(rideEntry->shop_item[i]).Naming.Plural); + } + auto ft = Formatter(); + ft.Add(sells.c_str()); + screenPos.y += DrawTextWrapped(dpi, screenPos, _width2, STR_RIDE_OBJECT_SHOP_SELLS, ft) + 2; + } + } + else if (GetSelectedObjectType() == ObjectType::SceneryGroup) + { + const auto* sceneryGroupObject = reinterpret_cast(_loadedObject.get()); + auto ft = Formatter(); + ft.Add(sceneryGroupObject->GetNumIncludedObjects()); + screenPos.y += DrawTextWrapped(dpi, screenPos, _width2, STR_INCLUDES_X_OBJECTS, ft) + 2; + } + else if (GetSelectedObjectType() == ObjectType::Music) + { + screenPos.y += DrawTextWrapped(dpi, screenPos, _width2, STR_MUSIC_OBJECT_TRACK_HEADER) + 2; + const auto* musicObject = reinterpret_cast(_loadedObject.get()); + for (size_t i = 0; i < musicObject->GetTrackCount(); i++) + { + const auto* track = musicObject->GetTrack(i); + if (track->Name.empty()) + continue; + + auto stringId = track->Composer.empty() ? STR_MUSIC_OBJECT_TRACK_LIST_ITEM + : STR_MUSIC_OBJECT_TRACK_LIST_ITEM_WITH_COMPOSER; + auto ft = Formatter(); + ft.Add(track->Name.c_str()); + ft.Add(track->Composer.c_str()); + screenPos.y += DrawTextWrapped(dpi, screenPos + ScreenCoordsXY{ 10, 0 }, _width2, stringId, ft); + } + } + } + + void DrawDebugData(DrawPixelInfo& dpi) + { + ObjectListItem* listItem = &_listItems[selected_list_item]; + auto screenPos = windowPos + ScreenCoordsXY{ width - 5, height - (LIST_ROW_HEIGHT * 6) }; + + // Draw fallback image warning + if (_loadedObject && _loadedObject->UsesFallbackImages()) + { + DrawTextBasic(dpi, screenPos, STR_OBJECT_USES_FALLBACK_IMAGES, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + } + screenPos.y += LIST_ROW_HEIGHT; + + // Draw ride type. + if (GetSelectedObjectType() == ObjectType::Ride) + { + auto stringId = GetRideTypeStringId(listItem->repositoryItem); + DrawTextBasic(dpi, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + } + + screenPos.y += LIST_ROW_HEIGHT; + + // Draw object source + auto stringId = ObjectManagerGetSourceGameString(listItem->repositoryItem->GetFirstSourceGame()); + DrawTextBasic(dpi, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + screenPos.y += LIST_ROW_HEIGHT; + + // Draw object filename + { + auto path = Path::GetFileName(listItem->repositoryItem->Path); + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(path.c_str()); + DrawTextBasic( + dpi, { windowPos.x + this->width - 5, screenPos.y }, STR_WINDOW_COLOUR_2_STRINGID, ft, + { COLOUR_BLACK, TextAlignment::RIGHT }); + screenPos.y += LIST_ROW_HEIGHT; + } + + // Draw object author (will be blank space if no author in file or a non JSON object) + { + auto ft = Formatter(); + std::string authorsString; + for (size_t i = 0; i < listItem->repositoryItem->Authors.size(); i++) + { + if (i > 0) + { + authorsString.append(", "); + } + authorsString.append(listItem->repositoryItem->Authors[i]); + } + ft.Add(STR_STRING); + ft.Add(authorsString.c_str()); + DrawTextEllipsised( + dpi, { windowPos.x + width - 5, screenPos.y }, width - widgets[WIDX_LIST].right - 4, + STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::RIGHT }); + } + } + + bool FilterSelected(uint8_t objectFlag) + { + // Track Manager has no concept of selection filtering, so always return true + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { return true; } + if (_FILTER_SELECTED == _FILTER_NONSELECTED) + { + return true; + } + if (_FILTER_SELECTED && objectFlag & ObjectSelectionFlags::Selected) + { + return true; + } + if (_FILTER_NONSELECTED && !(objectFlag & ObjectSelectionFlags::Selected)) + { + return true; + } + + return false; } - return false; - } - bool FilterString(const ObjectRepositoryItem& item) - { - // Nothing to search for - std::string_view filter = _filter_string; - if (filter.empty()) - return true; + bool FilterCompatibilityObject(const ObjectRepositoryItem& item, uint8_t objectFlag) + { + // Only show compat objects if they are not selected already. + return !(item.Flags & ObjectItemFlags::IsCompatibilityObject) || (objectFlag & ObjectSelectionFlags::Selected); + } - return IsFilterInName(item, filter) || IsFilterInRideType(item, filter) || IsFilterInFilename(item, filter) - || IsFilterInAuthor(item, filter); - } + static bool IsFilterInName(const ObjectRepositoryItem& item, std::string_view filter) + { + return String::Contains(item.Name, filter, true); + } - bool SourcesMatch(ObjectSourceGame source) - { - // clang-format off + static bool IsFilterInRideType(const ObjectRepositoryItem& item, std::string_view filter) + { + if (item.Type == ObjectType::Ride) + { + auto rideTypeName = LanguageGetString(GetRideTypeStringId(&item)); + if (String::Contains(rideTypeName, filter, true)) + return true; + } + return false; + } + + static bool IsFilterInFilename(const ObjectRepositoryItem& item, std::string_view filter) + { + return String::Contains(item.Path, filter, true); + } + + static bool IsFilterInAuthor(const ObjectRepositoryItem& item, std::string_view filter) + { + for (auto& author : item.Authors) + { + if (String::Contains(author, filter, true)) + { + return true; + } + } + return false; + } + + bool FilterString(const ObjectRepositoryItem& item) + { + // Nothing to search for + std::string_view filter = _filter_string; + if (filter.empty()) + return true; + + return IsFilterInName(item, filter) || IsFilterInRideType(item, filter) || IsFilterInFilename(item, filter) + || IsFilterInAuthor(item, filter); + } + + bool SourcesMatch(ObjectSourceGame source) + { + // clang-format off return (_FILTER_RCT1 && source == ObjectSourceGame::RCT1) || (_FILTER_AA && source == ObjectSourceGame::AddedAttractions) || (_FILTER_LL && source == ObjectSourceGame::LoopyLandscapes) || @@ -1436,226 +1451,248 @@ private: source != ObjectSourceGame::WackyWorlds && source != ObjectSourceGame::TimeTwister && source != ObjectSourceGame::OpenRCT2Official); - // clang-format on - } + // clang-format on + } - bool FilterSource(const ObjectRepositoryItem* item) - { - if (_FILTER_ALL) - return true; - - for (auto source : item->Sources) + bool FilterSource(const ObjectRepositoryItem* item) { - if (SourcesMatch(source)) + if (_FILTER_ALL) return true; - } - return false; - } - - bool FilterChunks(const ObjectRepositoryItem* item) - { - if (item->Type == ObjectType::Ride) - { - ride_type_t rideType = 0; - for (int32_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++) + for (auto source : item->Sources) { - if (item->RideInfo.RideType[i] != RIDE_TYPE_NULL) - { - rideType = item->RideInfo.RideType[i]; - break; - } + if (SourcesMatch(source)) + return true; } - return (_filter_flags & (1 << (GetRideTypeDescriptor(rideType).Category + _numSourceGameItems))) != 0; + + return false; } - return true; - } - void FilterUpdateCounts() - { - if (!_FILTER_ALL || _filter_string[0] != '\0') + bool FilterChunks(const ObjectRepositoryItem* item) { - const auto& selectionFlags = _objectSelectionFlags; - std::fill(std::begin(_filter_object_counts), std::end(_filter_object_counts), 0); - - size_t numObjects = ObjectRepositoryGetItemsCount(); - const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); - for (size_t i = 0; i < numObjects; i++) + if (item->Type == ObjectType::Ride) { - const ObjectRepositoryItem* item = &items[i]; - if (FilterSource(item) && FilterString(*item) && FilterChunks(item) && FilterSelected(selectionFlags[i]) - && FilterCompatibilityObject(*item, selectionFlags[i])) + ride_type_t rideType = 0; + for (int32_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++) { - _filter_object_counts[EnumValue(item->Type)]++; + if (item->RideInfo.RideType[i] != RIDE_TYPE_NULL) + { + rideType = item->RideInfo.RideType[i]; + break; + } + } + return (_filter_flags & (1 << (GetRideTypeDescriptor(rideType).Category + _numSourceGameItems))) != 0; + } + return true; + } + + void FilterUpdateCounts() + { + if (!_FILTER_ALL || _filter_string[0] != '\0') + { + const auto& selectionFlags = _objectSelectionFlags; + std::fill(std::begin(_filter_object_counts), std::end(_filter_object_counts), 0); + + size_t numObjects = ObjectRepositoryGetItemsCount(); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); + for (size_t i = 0; i < numObjects; i++) + { + const ObjectRepositoryItem* item = &items[i]; + if (FilterSource(item) && FilterString(*item) && FilterChunks(item) && FilterSelected(selectionFlags[i]) + && FilterCompatibilityObject(*item, selectionFlags[i])) + { + _filter_object_counts[EnumValue(item->Type)]++; + } } } } - } - std::string ObjectGetDescription(const Object* object) - { - switch (object->GetObjectType()) + std::string ObjectGetDescription(const Object* object) { - case ObjectType::Ride: + switch (object->GetObjectType()) { - const RideObject* rideObject = static_cast(object); - return rideObject->GetDescription(); + case ObjectType::Ride: + { + const RideObject* rideObject = static_cast(object); + return rideObject->GetDescription(); + } + default: + return ""; } - default: - return ""; } - } - ObjectType GetSelectedObjectType() - { - const bool inBounds = selected_tab >= 0 && selected_tab < static_cast(std::size(TabOrder)); - return inBounds ? TabOrder[selected_tab] : ObjectType::Ride; - } + ObjectType GetSelectedObjectType() + { + const bool inBounds = selected_tab >= 0 && selected_tab < static_cast(std::size(TabOrder)); + return inBounds ? TabOrder[selected_tab] : ObjectType::Ride; + } + + /** + * Takes the y coordinate of the clicked on scroll list + * and converts this into an object selection. + * Returns the position in the list. + * Object_selection_flags, installed_entry also populated + * + * rct2: 0x006AA703 + */ + int32_t GetObjectFromObjectSelection(ObjectType object_type, int32_t y) + { + int32_t listItemIndex = y / SCROLLABLE_ROW_HEIGHT; + if (listItemIndex < 0 || static_cast(listItemIndex) >= _listItems.size()) + return -1; + + return listItemIndex; + } + + void SetPressedTab() + { + for (size_t i = 0; i < std::size(ObjectSelectionPages); i++) + { + pressed_widgets &= ~(1ull << (WIDX_TAB_1 + i)); + } + pressed_widgets |= 1LL << (WIDX_TAB_1 + selected_tab); + } + + /** + * + * rct2: 0x006D33E2 + */ + void ManageTracks() + { + SetEveryRideTypeInvented(); + SetEveryRideEntryInvented(); + + GetGameState().EditorStep = EditorStep::DesignsManager; + + int32_t entry_index = 0; + for (; ObjectEntryGetChunk(ObjectType::Ride, entry_index) == nullptr; entry_index++) + ; + + const auto* rideEntry = GetRideEntryByIndex(entry_index); + auto rideType = rideEntry->GetFirstNonNullRideType(); + + auto intent = Intent(WindowClass::TrackDesignList); + intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, rideType); + intent.PutExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, entry_index); + ContextOpenIntent(&intent); + } + }; /** - * Takes the y coordinate of the clicked on scroll list - * and converts this into an object selection. - * Returns the position in the list. - * Object_selection_flags, installed_entry also populated * - * rct2: 0x006AA703 + * rct2: 0x006AA64E */ - int32_t GetObjectFromObjectSelection(ObjectType object_type, int32_t y) + WindowBase* EditorObjectSelectionOpen() { - int32_t listItemIndex = y / SCROLLABLE_ROW_HEIGHT; - if (listItemIndex < 0 || static_cast(listItemIndex) >= _listItems.size()) - return -1; - - return listItemIndex; + return WindowFocusOrCreate( + WindowClass::EditorObjectSelection, 755, 400, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN); } - void SetPressedTab() + static bool VisibleListSortRideName(const ObjectListItem& a, const ObjectListItem& b) { - for (size_t i = 0; i < std::size(ObjectSelectionPages); i++) + auto nameA = a.repositoryItem->Name.c_str(); + auto nameB = b.repositoryItem->Name.c_str(); + return strcmp(nameA, nameB) < 0; + } + + static bool VisibleListSortRideType(const ObjectListItem& a, const ObjectListItem& b) + { + auto rideTypeA = LanguageGetString(GetRideTypeStringId(a.repositoryItem)); + auto rideTypeB = LanguageGetString(GetRideTypeStringId(b.repositoryItem)); + int32_t result = String::Compare(rideTypeA, rideTypeB); + return result != 0 ? result < 0 : VisibleListSortRideName(a, b); + } + + static StringId GetRideTypeStringId(const ObjectRepositoryItem* item) + { + StringId result = STR_NONE; + for (int32_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++) { - pressed_widgets &= ~(1ull << (WIDX_TAB_1 + i)); + auto rideType = item->RideInfo.RideType[i]; + if (rideType != RIDE_TYPE_NULL) + { + result = GetRideTypeDescriptor(rideType).Naming.Name; + break; + } } - pressed_widgets |= 1LL << (WIDX_TAB_1 + selected_tab); + return result; } /** * - * rct2: 0x006D33E2 + * rct2: 0x006ABBBE */ - void ManageTracks() + void EditorLoadSelectedObjects() { - SetEveryRideTypeInvented(); - SetEveryRideEntryInvented(); - - GetGameState().EditorStep = EditorStep::DesignsManager; - - int32_t entry_index = 0; - for (; ObjectEntryGetChunk(ObjectType::Ride, entry_index) == nullptr; entry_index++) - ; - - const auto* rideEntry = GetRideEntryByIndex(entry_index); - auto rideType = rideEntry->GetFirstNonNullRideType(); - - auto intent = Intent(WindowClass::TrackDesignList); - intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, rideType); - intent.PutExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, entry_index); - ContextOpenIntent(&intent); - } -}; - -/** - * - * rct2: 0x006AA64E - */ -WindowBase* WindowEditorObjectSelectionOpen() -{ - return WindowFocusOrCreate( - WindowClass::EditorObjectSelection, 755, 400, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN); -} - -static bool VisibleListSortRideName(const ObjectListItem& a, const ObjectListItem& b) -{ - auto nameA = a.repositoryItem->Name.c_str(); - auto nameB = b.repositoryItem->Name.c_str(); - return strcmp(nameA, nameB) < 0; -} - -static bool VisibleListSortRideType(const ObjectListItem& a, const ObjectListItem& b) -{ - auto rideTypeA = LanguageGetString(GetRideTypeStringId(a.repositoryItem)); - auto rideTypeB = LanguageGetString(GetRideTypeStringId(b.repositoryItem)); - int32_t result = String::Compare(rideTypeA, rideTypeB); - return result != 0 ? result < 0 : VisibleListSortRideName(a, b); -} - -static StringId GetRideTypeStringId(const ObjectRepositoryItem* item) -{ - StringId result = STR_NONE; - for (int32_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++) - { - auto rideType = item->RideInfo.RideType[i]; - if (rideType != RIDE_TYPE_NULL) + auto& objManager = GetContext()->GetObjectManager(); + int32_t numItems = static_cast(ObjectRepositoryGetItemsCount()); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); + bool showFallbackWarning = false; + for (int32_t i = 0; i < numItems; i++) { - result = GetRideTypeDescriptor(rideType).Naming.Name; - break; - } - } - return result; -} - -/** - * - * rct2: 0x006ABBBE - */ -void EditorLoadSelectedObjects() -{ - auto& objManager = GetContext()->GetObjectManager(); - int32_t numItems = static_cast(ObjectRepositoryGetItemsCount()); - const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); - bool showFallbackWarning = false; - for (int32_t i = 0; i < numItems; i++) - { - if (_objectSelectionFlags[i] & ObjectSelectionFlags::Selected) - { - const auto* item = &items[i]; - auto descriptor = ObjectEntryDescriptor(*item); - const auto* loadedObject = objManager.GetLoadedObject(descriptor); - if (loadedObject == nullptr) + if (_objectSelectionFlags[i] & ObjectSelectionFlags::Selected) { - loadedObject = objManager.LoadObject(descriptor); + const auto* item = &items[i]; + auto descriptor = ObjectEntryDescriptor(*item); + const auto* loadedObject = objManager.GetLoadedObject(descriptor); if (loadedObject == nullptr) { - LOG_ERROR("Failed to load entry %s", std::string(descriptor.GetName()).c_str()); - } - else if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) - { - // Defaults selected items to researched (if in-game) - auto objectType = loadedObject->GetObjectType(); - auto entryIndex = ObjectManagerGetLoadedObjectEntryIndex(loadedObject); - if (objectType == ObjectType::Ride) + loadedObject = objManager.LoadObject(descriptor); + if (loadedObject == nullptr) { - const auto* rideEntry = GetRideEntryByIndex(entryIndex); - auto rideType = rideEntry->GetFirstNonNullRideType(); - ResearchCategory category = static_cast(GetRideTypeDescriptor(rideType).Category); - ResearchInsertRideEntry(rideType, entryIndex, category, true); + LOG_ERROR("Failed to load entry %s", std::string(descriptor.GetName()).c_str()); } - else if (objectType == ObjectType::SceneryGroup) + else if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { - ResearchInsertSceneryGroupEntry(entryIndex, true); - } - if (loadedObject->UsesFallbackImages()) - { - showFallbackWarning = true; + // Defaults selected items to researched (if in-game) + auto objectType = loadedObject->GetObjectType(); + auto entryIndex = ObjectManagerGetLoadedObjectEntryIndex(loadedObject); + if (objectType == ObjectType::Ride) + { + const auto* rideEntry = GetRideEntryByIndex(entryIndex); + auto rideType = rideEntry->GetFirstNonNullRideType(); + ResearchCategory category = static_cast(GetRideTypeDescriptor(rideType).Category); + ResearchInsertRideEntry(rideType, entryIndex, category, true); + } + else if (objectType == ObjectType::SceneryGroup) + { + ResearchInsertSceneryGroupEntry(entryIndex, true); + } + if (loadedObject->UsesFallbackImages()) + { + showFallbackWarning = true; + } } } } } + if (_numSelectedObjectsForType[EnumValue(ObjectType::Water)] == 0) + { + // Reloads the default cyan water palette if no palette was selected. + LoadPalette(); + } + if (showFallbackWarning) + ContextShowError(STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING, STR_EMPTY, Formatter::Common()); } - if (_numSelectedObjectsForType[EnumValue(ObjectType::Water)] == 0) + + bool EditorObjectSelectionWindowCheck() { - // Reloads the default cyan water palette if no palette was selected. - LoadPalette(); + WindowBase* w; + + auto [missingObjectType, errorString] = Editor::CheckObjectSelection(); + if (missingObjectType == ObjectType::None) + { + WindowCloseByClass(WindowClass::EditorObjectSelection); + return true; + } + + ContextShowError(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {}); + w = WindowFindByClass(WindowClass::EditorObjectSelection); + if (w != nullptr) + { + // Click tab with missing object + static_cast(w)->GoToTab(missingObjectType); + } + return false; } - if (showFallbackWarning) - ContextShowError(STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING, STR_EMPTY, Formatter::Common()); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp index 740ac35864..3cea51f898 100644 --- a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp +++ b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp @@ -29,40 +29,40 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_OBJECTIVE_SELECTION; + static constexpr int32_t WH = 229; + static constexpr int32_t WW = 450; -static constexpr StringId WINDOW_TITLE = STR_OBJECTIVE_SELECTION; -static constexpr int32_t WH = 229; -static constexpr int32_t WW = 450; + static constexpr money64 ObjectiveCurrencyLoanAndValueMax = 2000000.00_GBP; + static constexpr money64 ObjectiveCurrencyLoanAndValueMin = 1000.00_GBP; + static constexpr money64 ObjectiveCurrencyLoanAndValueAdjustment = 1000.00_GBP; -static constexpr money64 ObjectiveCurrencyLoanAndValueMax = 2000000.00_GBP; -static constexpr money64 ObjectiveCurrencyLoanAndValueMin = 1000.00_GBP; -static constexpr money64 ObjectiveCurrencyLoanAndValueAdjustment = 1000.00_GBP; + static constexpr money64 ObjectiveCurrencyFoodMax = 2000000.00_GBP; + static constexpr money64 ObjectiveCurrencyFoodMin = 1000.00_GBP; + static constexpr money64 ObjectiveCurrencyFoodAdjustment = 100.00_GBP; -static constexpr money64 ObjectiveCurrencyFoodMax = 2000000.00_GBP; -static constexpr money64 ObjectiveCurrencyFoodMin = 1000.00_GBP; -static constexpr money64 ObjectiveCurrencyFoodAdjustment = 100.00_GBP; + static constexpr uint16_t ObjectiveLengthMax = 5000; + static constexpr uint16_t ObjectiveLengthMin = 1000; + static constexpr uint16_t ObjectiveLengthAdjustment = 100; -static constexpr uint16_t ObjectiveLengthMax = 5000; -static constexpr uint16_t ObjectiveLengthMin = 1000; -static constexpr uint16_t ObjectiveLengthAdjustment = 100; + static constexpr uint16_t ObjectiveExcitementMax = FIXED_2DP(9, 90); + static constexpr uint16_t ObjectiveExcitementMin = FIXED_2DP(4, 00); + static constexpr uint16_t ObjectiveExcitementAdjustment = FIXED_2DP(0, 10); -static constexpr uint16_t ObjectiveExcitementMax = FIXED_2DP(9, 90); -static constexpr uint16_t ObjectiveExcitementMin = FIXED_2DP(4, 00); -static constexpr uint16_t ObjectiveExcitementAdjustment = FIXED_2DP(0, 10); + // The number has to leave a bit of room for other entities like vehicles, litter and balloons. + static constexpr uint16_t ObjectiveGuestsMax = 50000; + static constexpr uint16_t ObjectiveGuestsMin = 250; + static constexpr uint16_t ObjectiveGuestsAdjustment = 50; -// The number has to leave a bit of room for other entities like vehicles, litter and balloons. -static constexpr uint16_t ObjectiveGuestsMax = 50000; -static constexpr uint16_t ObjectiveGuestsMin = 250; -static constexpr uint16_t ObjectiveGuestsAdjustment = 50; - -static constexpr uint8_t ObjectiveYearMax = 25; -static constexpr uint8_t ObjectiveYearMin = 1; -static constexpr uint8_t ObjectiveYearAdjustment = 1; + static constexpr uint8_t ObjectiveYearMax = 25; + static constexpr uint8_t ObjectiveYearMin = 1; + static constexpr uint8_t ObjectiveYearAdjustment = 1; #pragma region Widgets -// clang-format off + // clang-format off enum { WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN, WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES, @@ -126,13 +126,13 @@ static Widget window_editor_objective_options_main_widgets[] = { MakeWidget ({ 98, 133}, {180, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_NONE, STR_SELECT_WHICH_GROUP_THIS_SCENARIO_APPEARS_IN), MakeWidget ({266, 134}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_WHICH_GROUP_THIS_SCENARIO_APPEARS_IN), MakeWidget ({370, 150}, { 75, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGE, STR_CHANGE_DETAIL_NOTES_ABOUT_PARK_SCENARIO_TIP), - WIDGETS_END, + kWidgetsEnd, }; static Widget window_editor_objective_options_rides_widgets[] = { MAIN_OBJECTIVE_OPTIONS_WIDGETS, MakeWidget({ 3, 60}, {374, 161}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), - WIDGETS_END, + kWidgetsEnd, }; static Widget *window_editor_objective_options_widgets[] = { @@ -152,1053 +152,1056 @@ static uint64_t window_editor_objective_options_page_hold_down_widgets[] = { 0, }; -// clang-format on + // clang-format on #pragma endregion -class EditorObjectiveOptionsWindow final : public Window -{ -private: - // Not shops or facilities - std::vector _rideableRides; - -public: - void OnOpen() override + class EditorObjectiveOptionsWindow final : public Window { - widgets = window_editor_objective_options_main_widgets; - pressed_widgets = 0; - hold_down_widgets = window_editor_objective_options_page_hold_down_widgets[WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN]; - InitScrollWidgets(); - selected_tab = WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN; - selected_list_item = -1; - UpdateDisabledWidgets(); - } + private: + // Not shops or facilities + std::vector _rideableRides; - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - SetPage(widgetIndex - WIDX_TAB_1); - return; + widgets = window_editor_objective_options_main_widgets; + pressed_widgets = 0; + hold_down_widgets = window_editor_objective_options_page_hold_down_widgets + [WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN]; + InitScrollWidgets(); + selected_tab = WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN; + selected_list_item = -1; + UpdateDisabledWidgets(); } - if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN) + void OnMouseUp(WidgetIndex widgetIndex) override { - OnMouseUpMain(widgetIndex); - } - } + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + SetPage(widgetIndex - WIDX_TAB_1); + return; + } - void OnResize() override - { - switch (page) - { - case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN: - OnResizeMain(); - break; - case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES: - OnResizeRides(); - break; - } - } - - void OnPrepareDraw() override - { - switch (page) - { - case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN: - OnPrepareDrawMain(); - break; - case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES: - OnPrepareDrawRides(); - break; - } - } - - void OnUpdate() override - { - switch (page) - { - case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN: - OnUpdateMain(); - break; - case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES: - OnUpdateRides(); - break; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - switch (page) - { - case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN: - OnDrawMain(dpi); - break; - case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES: - OnDrawRides(dpi); - break; - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN) - { - OnMouseDownMain(widgetIndex); - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN) - { - OnDropdownMain(widgetIndex, selectedIndex); - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN) - { - OnTextInputMain(widgetIndex, text); - } - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES) - { - OnScrollMouseDownRides(scrollIndex, screenCoords); - } - } - - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES) - { - OnScrollMouseOverRides(scrollIndex, screenCoords); - } - } - - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES) - { - OnScrollDrawRides(dpi, scrollIndex); - } - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES) - { - return OnScrollGetSizeRides(scrollIndex); + if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN) + { + OnMouseUpMain(widgetIndex); + } } - return {}; - } - -private: - /** - * - * rct2: 0x00668496 - */ - void SetPage(int32_t newPage) - { - if (page == newPage) - return; - - page = newPage; - frame_no = 0; - _rideableRides.clear(); - selected_list_item = -1; - hold_down_widgets = window_editor_objective_options_page_hold_down_widgets[newPage]; - widgets = window_editor_objective_options_widgets[newPage]; - Invalidate(); - UpdateDisabledWidgets(); - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); - } - - /** - * - * rct2: 0x00672609 - */ - void UpdateDisabledWidgets() - { - // Check if there are any rides (not shops or facilities) - const auto& rideManager = GetRideManager(); - if (std::any_of(rideManager.begin(), rideManager.end(), [](const Ride& rideToCheck) { return rideToCheck.IsRide(); })) + void OnResize() override { - disabled_widgets &= ~(1uLL << WIDX_TAB_2); + switch (page) + { + case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN: + OnResizeMain(); + break; + case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES: + OnResizeRides(); + break; + } } - else + + void OnPrepareDraw() override { - disabled_widgets |= (1uLL << WIDX_TAB_2); + switch (page) + { + case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN: + OnPrepareDrawMain(); + break; + case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES: + OnPrepareDrawRides(); + break; + } } - } - void SetPressedTab() - { - int32_t i; - for (i = WIDX_TAB_1; i <= WIDX_TAB_2; i++) - pressed_widgets &= ~(1 << i); - pressed_widgets |= 1LL << (WIDX_TAB_1 + page); - } + void OnUpdate() override + { + switch (page) + { + case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN: + OnUpdateMain(); + break; + case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES: + OnUpdateRides(); + break; + } + } - void AnchorBorderWidgets() - { - ResizeFrameWithPage(); - } + void OnDraw(DrawPixelInfo& dpi) override + { + switch (page) + { + case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN: + OnDrawMain(dpi); + break; + case WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES: + OnDrawRides(dpi); + break; + } + } - void DrawTabImages(DrawPixelInfo& dpi) - { - Widget* widget; - int32_t spriteIndex; + void OnMouseDown(WidgetIndex widgetIndex) override + { + if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN) + { + OnMouseDownMain(widgetIndex); + } + } - // Tab 1 - widget = &widgets[WIDX_TAB_1]; + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN) + { + OnDropdownMain(widgetIndex, selectedIndex); + } + } - spriteIndex = SPR_TAB_OBJECTIVE_0; - if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN) - spriteIndex += (frame_no / 4) % 16; + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN) + { + OnTextInputMain(widgetIndex, text); + } + } - GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget->left, widget->top }); - - // Tab 2 - if (!IsWidgetDisabled(WIDX_TAB_2)) + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { - widget = &widgets[WIDX_TAB_2]; - spriteIndex = SPR_TAB_RIDE_0; if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES) + { + OnScrollMouseDownRides(scrollIndex, screenCoords); + } + } + + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES) + { + OnScrollMouseOverRides(scrollIndex, screenCoords); + } + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES) + { + OnScrollDrawRides(dpi, scrollIndex); + } + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES) + { + return OnScrollGetSizeRides(scrollIndex); + } + + return {}; + } + + private: + /** + * + * rct2: 0x00668496 + */ + void SetPage(int32_t newPage) + { + if (page == newPage) + return; + + page = newPage; + frame_no = 0; + _rideableRides.clear(); + selected_list_item = -1; + hold_down_widgets = window_editor_objective_options_page_hold_down_widgets[newPage]; + widgets = window_editor_objective_options_widgets[newPage]; + Invalidate(); + UpdateDisabledWidgets(); + OnResize(); + OnPrepareDraw(); + InitScrollWidgets(); + Invalidate(); + } + + /** + * + * rct2: 0x00672609 + */ + void UpdateDisabledWidgets() + { + // Check if there are any rides (not shops or facilities) + const auto& rideManager = GetRideManager(); + if (std::any_of( + rideManager.begin(), rideManager.end(), [](const Ride& rideToCheck) { return rideToCheck.IsRide(); })) + { + disabled_widgets &= ~(1uLL << WIDX_TAB_2); + } + else + { + disabled_widgets |= (1uLL << WIDX_TAB_2); + } + } + + void SetPressedTab() + { + int32_t i; + for (i = WIDX_TAB_1; i <= WIDX_TAB_2; i++) + pressed_widgets &= ~(1 << i); + pressed_widgets |= 1LL << (WIDX_TAB_1 + page); + } + + void AnchorBorderWidgets() + { + ResizeFrameWithPage(); + } + + void DrawTabImages(DrawPixelInfo& dpi) + { + Widget* widget; + int32_t spriteIndex; + + // Tab 1 + widget = &widgets[WIDX_TAB_1]; + + spriteIndex = SPR_TAB_OBJECTIVE_0; + if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN) spriteIndex += (frame_no / 4) % 16; GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget->left, widget->top }); - } - } - /** - * - * rct2: 0x0067201D - */ - void SetObjective(int32_t objective) - { - auto& gameState = GetGameState(); - gameState.ScenarioObjective.Type = objective; - Invalidate(); - - // Set default objective arguments - switch (objective) - { - case OBJECTIVE_NONE: - case OBJECTIVE_HAVE_FUN: - case OBJECTIVE_BUILD_THE_BEST: - case OBJECTIVE_10_ROLLERCOASTERS: - break; - case OBJECTIVE_GUESTS_BY: - gameState.ScenarioObjective.Year = 3; - gameState.ScenarioObjective.NumGuests = 1500; - break; - case OBJECTIVE_PARK_VALUE_BY: - gameState.ScenarioObjective.Year = 3; - gameState.ScenarioObjective.Currency = 50000.00_GBP; - break; - case OBJECTIVE_GUESTS_AND_RATING: - gameState.ScenarioObjective.NumGuests = 2000; - break; - case OBJECTIVE_MONTHLY_RIDE_INCOME: - gameState.ScenarioObjective.Currency = 10000.00_GBP; - break; - case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: - gameState.ScenarioObjective.MinimumLength = 1200; - break; - case OBJECTIVE_FINISH_5_ROLLERCOASTERS: - gameState.ScenarioObjective.MinimumExcitement = FIXED_2DP(6, 70); - break; - case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: - gameState.ScenarioObjective.Currency = 50000.00_GBP; - break; - case OBJECTIVE_MONTHLY_FOOD_INCOME: - gameState.ScenarioObjective.Currency = 1000.00_GBP; - break; - } - } - - void ShowObjectiveDropdown() - { - const auto& gameState = GetGameState(); - int32_t numItems = 0, objectiveType; - Widget* dropdownWidget; - - dropdownWidget = &widgets[WIDX_OBJECTIVE]; - - for (auto i = 0; i < OBJECTIVE_COUNT; i++) - { - if (i == OBJECTIVE_NONE || i == OBJECTIVE_BUILD_THE_BEST) - continue; - - const bool objectiveAllowedByMoneyUsage = !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) - || !ObjectiveNeedsMoney(i); - // This objective can only work if the player can ask money for rides. - const bool objectiveAllowedByPaymentSettings = (i != OBJECTIVE_MONTHLY_RIDE_INCOME) || ParkRidePricesUnlocked(); - if (objectiveAllowedByMoneyUsage && objectiveAllowedByPaymentSettings) + // Tab 2 + if (!IsWidgetDisabled(WIDX_TAB_2)) { - gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[numItems].Args = ObjectiveDropdownOptionNames[i]; - numItems++; + widget = &widgets[WIDX_TAB_2]; + spriteIndex = SPR_TAB_RIDE_0; + if (page == WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_RIDES) + spriteIndex += (frame_no / 4) % 16; + + GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget->left, widget->top }); } } - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], - 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 3); - - objectiveType = gameState.ScenarioObjective.Type; - for (int32_t j = 0; j < numItems; j++) + /** + * + * rct2: 0x0067201D + */ + void SetObjective(int32_t objective) { - if (gDropdownItems[j].Args - STR_OBJECTIVE_DROPDOWN_NONE == objectiveType) + auto& gameState = GetGameState(); + gameState.ScenarioObjective.Type = objective; + Invalidate(); + + // Set default objective arguments + switch (objective) { - Dropdown::SetChecked(j, true); - break; + case OBJECTIVE_NONE: + case OBJECTIVE_HAVE_FUN: + case OBJECTIVE_BUILD_THE_BEST: + case OBJECTIVE_10_ROLLERCOASTERS: + break; + case OBJECTIVE_GUESTS_BY: + gameState.ScenarioObjective.Year = 3; + gameState.ScenarioObjective.NumGuests = 1500; + break; + case OBJECTIVE_PARK_VALUE_BY: + gameState.ScenarioObjective.Year = 3; + gameState.ScenarioObjective.Currency = 50000.00_GBP; + break; + case OBJECTIVE_GUESTS_AND_RATING: + gameState.ScenarioObjective.NumGuests = 2000; + break; + case OBJECTIVE_MONTHLY_RIDE_INCOME: + gameState.ScenarioObjective.Currency = 10000.00_GBP; + break; + case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: + gameState.ScenarioObjective.MinimumLength = 1200; + break; + case OBJECTIVE_FINISH_5_ROLLERCOASTERS: + gameState.ScenarioObjective.MinimumExcitement = FIXED_2DP(6, 70); + break; + case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: + gameState.ScenarioObjective.Currency = 50000.00_GBP; + break; + case OBJECTIVE_MONTHLY_FOOD_INCOME: + gameState.ScenarioObjective.Currency = 1000.00_GBP; + break; } } - } - void ShowCategoryDropdown() - { - int32_t i; - Widget* dropdownWidget; + void ShowObjectiveDropdown() + { + const auto& gameState = GetGameState(); + int32_t numItems = 0, objectiveType; + Widget* dropdownWidget; - dropdownWidget = &widgets[WIDX_CATEGORY]; + dropdownWidget = &widgets[WIDX_OBJECTIVE]; - for (i = SCENARIO_CATEGORY_BEGINNER; i <= SCENARIO_CATEGORY_OTHER; i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = ScenarioCategoryStringIds[i]; - } - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], - 0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 3); - Dropdown::SetChecked(GetGameState().ScenarioCategory, true); - } + for (auto i = 0; i < OBJECTIVE_COUNT; i++) + { + if (i == OBJECTIVE_NONE || i == OBJECTIVE_BUILD_THE_BEST) + continue; - void Arg1Increase() - { - auto& gameState = GetGameState(); - switch (gameState.ScenarioObjective.Type) - { - case OBJECTIVE_PARK_VALUE_BY: - case OBJECTIVE_MONTHLY_RIDE_INCOME: - case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: - if (gameState.ScenarioObjective.Currency >= ObjectiveCurrencyLoanAndValueMax) + const bool objectiveAllowedByMoneyUsage = !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) + || !ObjectiveNeedsMoney(i); + // This objective can only work if the player can ask money for rides. + const bool objectiveAllowedByPaymentSettings = (i != OBJECTIVE_MONTHLY_RIDE_INCOME) || ParkRidePricesUnlocked(); + if (objectiveAllowedByMoneyUsage && objectiveAllowedByPaymentSettings) { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[numItems].Args = ObjectiveDropdownOptionNames[i]; + numItems++; } - else - { - gameState.ScenarioObjective.Currency += ObjectiveCurrencyLoanAndValueAdjustment; - Invalidate(); - } - break; - case OBJECTIVE_MONTHLY_FOOD_INCOME: - if (gameState.ScenarioObjective.Currency >= ObjectiveCurrencyFoodMax) - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - else - { - gameState.ScenarioObjective.Currency += ObjectiveCurrencyFoodAdjustment; - Invalidate(); - } - break; - case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: - if (gameState.ScenarioObjective.MinimumLength >= ObjectiveLengthMax) - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - else - { - gameState.ScenarioObjective.MinimumLength += ObjectiveLengthAdjustment; - Invalidate(); - } - break; - case OBJECTIVE_FINISH_5_ROLLERCOASTERS: - if (gameState.ScenarioObjective.MinimumExcitement >= ObjectiveExcitementMax) - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - else - { - gameState.ScenarioObjective.MinimumExcitement += ObjectiveExcitementAdjustment; - Invalidate(); - } - break; - default: - if (gameState.ScenarioObjective.NumGuests >= ObjectiveGuestsMax) - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - else - { - gameState.ScenarioObjective.NumGuests += ObjectiveGuestsAdjustment; - Invalidate(); - } - break; - } - } + } - void Arg1Decrease() - { - auto& gameState = GetGameState(); - switch (gameState.ScenarioObjective.Type) - { - case OBJECTIVE_PARK_VALUE_BY: - case OBJECTIVE_MONTHLY_RIDE_INCOME: - case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: - if (gameState.ScenarioObjective.Currency <= ObjectiveCurrencyLoanAndValueMin) - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - else - { - gameState.ScenarioObjective.Currency -= ObjectiveCurrencyLoanAndValueAdjustment; - Invalidate(); - } - break; - case OBJECTIVE_MONTHLY_FOOD_INCOME: - if (gameState.ScenarioObjective.Currency <= ObjectiveCurrencyFoodMin) - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - else - { - gameState.ScenarioObjective.Currency -= ObjectiveCurrencyFoodAdjustment; - Invalidate(); - } - break; - case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: - if (gameState.ScenarioObjective.MinimumLength <= ObjectiveLengthMin) - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - else - { - gameState.ScenarioObjective.MinimumLength -= ObjectiveLengthAdjustment; - Invalidate(); - } - break; - case OBJECTIVE_FINISH_5_ROLLERCOASTERS: - if (gameState.ScenarioObjective.MinimumExcitement <= ObjectiveExcitementMin) - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - else - { - gameState.ScenarioObjective.MinimumExcitement -= ObjectiveExcitementAdjustment; - Invalidate(); - } - break; - default: - if (gameState.ScenarioObjective.NumGuests <= ObjectiveGuestsMin) - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - else - { - gameState.ScenarioObjective.NumGuests -= ObjectiveGuestsAdjustment; - Invalidate(); - } - break; - } - } + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 3); - void Arg2Increase() - { - auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Year >= ObjectiveYearMax) - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + objectiveType = gameState.ScenarioObjective.Type; + for (int32_t j = 0; j < numItems; j++) + { + if (gDropdownItems[j].Args - STR_OBJECTIVE_DROPDOWN_NONE == objectiveType) + { + Dropdown::SetChecked(j, true); + break; + } + } } - else - { - gameState.ScenarioObjective.Year += ObjectiveYearAdjustment; - Invalidate(); - } - } - void Arg2Decrease() - { - auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Year <= ObjectiveYearMin) + void ShowCategoryDropdown() { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + int32_t i; + Widget* dropdownWidget; + + dropdownWidget = &widgets[WIDX_CATEGORY]; + + for (i = SCENARIO_CATEGORY_BEGINNER; i <= SCENARIO_CATEGORY_OTHER; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = ScenarioCategoryStringIds[i]; + } + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 3); + Dropdown::SetChecked(GetGameState().ScenarioCategory, true); } - else + + void Arg1Increase() { - gameState.ScenarioObjective.Year -= ObjectiveYearAdjustment; - Invalidate(); + auto& gameState = GetGameState(); + switch (gameState.ScenarioObjective.Type) + { + case OBJECTIVE_PARK_VALUE_BY: + case OBJECTIVE_MONTHLY_RIDE_INCOME: + case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: + if (gameState.ScenarioObjective.Currency >= ObjectiveCurrencyLoanAndValueMax) + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.Currency += ObjectiveCurrencyLoanAndValueAdjustment; + Invalidate(); + } + break; + case OBJECTIVE_MONTHLY_FOOD_INCOME: + if (gameState.ScenarioObjective.Currency >= ObjectiveCurrencyFoodMax) + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.Currency += ObjectiveCurrencyFoodAdjustment; + Invalidate(); + } + break; + case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: + if (gameState.ScenarioObjective.MinimumLength >= ObjectiveLengthMax) + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.MinimumLength += ObjectiveLengthAdjustment; + Invalidate(); + } + break; + case OBJECTIVE_FINISH_5_ROLLERCOASTERS: + if (gameState.ScenarioObjective.MinimumExcitement >= ObjectiveExcitementMax) + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.MinimumExcitement += ObjectiveExcitementAdjustment; + Invalidate(); + } + break; + default: + if (gameState.ScenarioObjective.NumGuests >= ObjectiveGuestsMax) + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.NumGuests += ObjectiveGuestsAdjustment; + Invalidate(); + } + break; + } + } + + void Arg1Decrease() + { + auto& gameState = GetGameState(); + switch (gameState.ScenarioObjective.Type) + { + case OBJECTIVE_PARK_VALUE_BY: + case OBJECTIVE_MONTHLY_RIDE_INCOME: + case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: + if (gameState.ScenarioObjective.Currency <= ObjectiveCurrencyLoanAndValueMin) + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.Currency -= ObjectiveCurrencyLoanAndValueAdjustment; + Invalidate(); + } + break; + case OBJECTIVE_MONTHLY_FOOD_INCOME: + if (gameState.ScenarioObjective.Currency <= ObjectiveCurrencyFoodMin) + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.Currency -= ObjectiveCurrencyFoodAdjustment; + Invalidate(); + } + break; + case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: + if (gameState.ScenarioObjective.MinimumLength <= ObjectiveLengthMin) + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.MinimumLength -= ObjectiveLengthAdjustment; + Invalidate(); + } + break; + case OBJECTIVE_FINISH_5_ROLLERCOASTERS: + if (gameState.ScenarioObjective.MinimumExcitement <= ObjectiveExcitementMin) + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.MinimumExcitement -= ObjectiveExcitementAdjustment; + Invalidate(); + } + break; + default: + if (gameState.ScenarioObjective.NumGuests <= ObjectiveGuestsMin) + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.NumGuests -= ObjectiveGuestsAdjustment; + Invalidate(); + } + break; + } + } + + void Arg2Increase() + { + auto& gameState = GetGameState(); + if (gameState.ScenarioObjective.Year >= ObjectiveYearMax) + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.Year += ObjectiveYearAdjustment; + Invalidate(); + } + } + + void Arg2Decrease() + { + auto& gameState = GetGameState(); + if (gameState.ScenarioObjective.Year <= ObjectiveYearMin) + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + else + { + gameState.ScenarioObjective.Year -= ObjectiveYearAdjustment; + Invalidate(); + } } - } #pragma region Main - /** - * - * rct2: 0x006719CA - */ - void OnMouseUpMain(WidgetIndex widgetIndex) - { - const auto& gameState = GetGameState(); - switch (widgetIndex) + /** + * + * rct2: 0x006719CA + */ + void OnMouseUpMain(WidgetIndex widgetIndex) { - case WIDX_PARK_NAME: + const auto& gameState = GetGameState(); + switch (widgetIndex) { - auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); - WindowTextInputRawOpen( - this, WIDX_PARK_NAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, {}, park.Name.c_str(), ParkNameMaxLength); - break; - } - case WIDX_SCENARIO_NAME: - WindowTextInputRawOpen( - this, WIDX_SCENARIO_NAME, STR_SCENARIO_NAME, STR_ENTER_SCENARIO_NAME, {}, gameState.ScenarioName.c_str(), - ScenarioNameMaxLength); - break; - case WIDX_DETAILS: - WindowTextInputRawOpen( - this, WIDX_DETAILS, STR_PARK_SCENARIO_DETAILS, STR_ENTER_SCENARIO_DESCRIPTION, {}, - gameState.ScenarioDetails.c_str(), ScenarioDetailsNameMaxLength); - break; - } - } - - /** - * - * rct2: 0x00672254 - */ - void OnResizeMain() - { - WindowSetResize(*this, 450, 229, 450, 229); - } - - /** - * - * rct2: 0x00671A0D - */ - void OnMouseDownMain(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_OBJECTIVE_DROPDOWN: - ShowObjectiveDropdown(); - break; - case WIDX_OBJECTIVE_ARG_1_INCREASE: - Arg1Increase(); - break; - case WIDX_OBJECTIVE_ARG_1_DECREASE: - Arg1Decrease(); - break; - case WIDX_OBJECTIVE_ARG_2_INCREASE: - Arg2Increase(); - break; - case WIDX_OBJECTIVE_ARG_2_DECREASE: - Arg2Decrease(); - break; - case WIDX_CATEGORY_DROPDOWN: - ShowCategoryDropdown(); - break; - } - } - - /** - * - * rct2: 0x00671A54 - */ - void OnDropdownMain(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - auto& gameState = GetGameState(); - uint8_t newObjectiveType; - - if (dropdownIndex == -1) - return; - - switch (widgetIndex) - { - case WIDX_OBJECTIVE_DROPDOWN: - // TODO: Don't rely on string ID order - newObjectiveType = static_cast(gDropdownItems[dropdownIndex].Args - STR_OBJECTIVE_DROPDOWN_NONE); - if (gameState.ScenarioObjective.Type != newObjectiveType) - SetObjective(newObjectiveType); - break; - case WIDX_CATEGORY_DROPDOWN: - if (gameState.ScenarioCategory != static_cast(dropdownIndex)) - { - gameState.ScenarioCategory = static_cast(dropdownIndex); - Invalidate(); - } - break; - } - } - - /** - * - * rct2: 0x006721E7 - */ - void OnUpdateMain() - { - uint8_t objectiveType; - - frame_no++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_1); - - objectiveType = GetGameState().ScenarioObjective.Type; - - // Check if objective is allowed by money and pay-per-ride settings. - const bool objectiveAllowedByMoneyUsage = !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) - || !ObjectiveNeedsMoney(objectiveType); - // This objective can only work if the player can ask money for rides. - const bool objectiveAllowedByPaymentSettings = (objectiveType != OBJECTIVE_MONTHLY_RIDE_INCOME) - || ParkRidePricesUnlocked(); - if (!objectiveAllowedByMoneyUsage || !objectiveAllowedByPaymentSettings) - { - // Reset objective - SetObjective(OBJECTIVE_GUESTS_AND_RATING); - } - } - - /** - * - * rct2: 0x00671A73 - */ - void OnTextInputMain(WidgetIndex widgetIndex, std::string_view text) - { - if (text.empty()) - return; - - auto& gameState = GetGameState(); - switch (widgetIndex) - { - case WIDX_PARK_NAME: - { - auto action = ParkSetNameAction(std::string(text)); - GameActions::Execute(&action); - - if (gameState.ScenarioName.empty()) + case WIDX_PARK_NAME: { auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); - gameState.ScenarioName = park.Name; + WindowTextInputRawOpen( + this, WIDX_PARK_NAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, {}, park.Name.c_str(), ParkNameMaxLength); + break; } - break; + case WIDX_SCENARIO_NAME: + WindowTextInputRawOpen( + this, WIDX_SCENARIO_NAME, STR_SCENARIO_NAME, STR_ENTER_SCENARIO_NAME, {}, + gameState.ScenarioName.c_str(), ScenarioNameMaxLength); + break; + case WIDX_DETAILS: + WindowTextInputRawOpen( + this, WIDX_DETAILS, STR_PARK_SCENARIO_DETAILS, STR_ENTER_SCENARIO_DESCRIPTION, {}, + gameState.ScenarioDetails.c_str(), ScenarioDetailsNameMaxLength); + break; } - case WIDX_SCENARIO_NAME: - gameState.ScenarioName = text; - Invalidate(); - break; - case WIDX_DETAILS: - gameState.ScenarioDetails = text; - Invalidate(); - break; - } - } - - /** - * - * rct2: 0x0067161C - */ - void OnPrepareDrawMain() - { - auto& gameState = GetGameState(); - auto widgetsToSet = window_editor_objective_options_widgets[page]; - if (widgets != widgetsToSet) - { - widgets = widgetsToSet; - InitScrollWidgets(); } - SetPressedTab(); - - switch (gameState.ScenarioObjective.Type) + /** + * + * rct2: 0x00672254 + */ + void OnResizeMain() { - case OBJECTIVE_GUESTS_BY: - case OBJECTIVE_PARK_VALUE_BY: - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Spinner; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Button; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Button; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Spinner; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Button; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Button; - break; - case OBJECTIVE_GUESTS_AND_RATING: - case OBJECTIVE_MONTHLY_RIDE_INCOME: - case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: - case OBJECTIVE_FINISH_5_ROLLERCOASTERS: - case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: - case OBJECTIVE_MONTHLY_FOOD_INCOME: - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Spinner; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Button; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Button; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Empty; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Empty; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Empty; - break; - default: - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Empty; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Empty; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Empty; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Empty; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Empty; - window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Empty; - break; + WindowSetResize(*this, 450, 229, 450, 229); } - window_editor_objective_options_main_widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) - ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; - - AnchorBorderWidgets(); - } - - /** - * - * rct2: 0x0067161C - */ - void OnDrawMain(DrawPixelInfo& dpi) - { - const auto& gameState = GetGameState(); - int32_t widthToSet; - StringId stringId; - - DrawWidgets(dpi); - DrawTabImages(dpi); - - // Objective label - auto screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_OBJECTIVE].top }; - DrawTextBasic(dpi, screenCoords, STR_OBJECTIVE_WINDOW); - - // Objective value - screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_OBJECTIVE].left + 1, widgets[WIDX_OBJECTIVE].top }; - auto ft = Formatter(); - ft.Add(ObjectiveDropdownOptionNames[gameState.ScenarioObjective.Type]); - DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); - - if (widgets[WIDX_OBJECTIVE_ARG_1].type != WindowWidgetType::Empty) + /** + * + * rct2: 0x00671A0D + */ + void OnMouseDownMain(WidgetIndex widgetIndex) { - // Objective argument 1 label - screenCoords = windowPos + ScreenCoordsXY{ 28, widgets[WIDX_OBJECTIVE_ARG_1].top }; + switch (widgetIndex) + { + case WIDX_OBJECTIVE_DROPDOWN: + ShowObjectiveDropdown(); + break; + case WIDX_OBJECTIVE_ARG_1_INCREASE: + Arg1Increase(); + break; + case WIDX_OBJECTIVE_ARG_1_DECREASE: + Arg1Decrease(); + break; + case WIDX_OBJECTIVE_ARG_2_INCREASE: + Arg2Increase(); + break; + case WIDX_OBJECTIVE_ARG_2_DECREASE: + Arg2Decrease(); + break; + case WIDX_CATEGORY_DROPDOWN: + ShowCategoryDropdown(); + break; + } + } + + /** + * + * rct2: 0x00671A54 + */ + void OnDropdownMain(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + auto& gameState = GetGameState(); + uint8_t newObjectiveType; + + if (dropdownIndex == -1) + return; + + switch (widgetIndex) + { + case WIDX_OBJECTIVE_DROPDOWN: + // TODO: Don't rely on string ID order + newObjectiveType = static_cast(gDropdownItems[dropdownIndex].Args - STR_OBJECTIVE_DROPDOWN_NONE); + if (gameState.ScenarioObjective.Type != newObjectiveType) + SetObjective(newObjectiveType); + break; + case WIDX_CATEGORY_DROPDOWN: + if (gameState.ScenarioCategory != static_cast(dropdownIndex)) + { + gameState.ScenarioCategory = static_cast(dropdownIndex); + Invalidate(); + } + break; + } + } + + /** + * + * rct2: 0x006721E7 + */ + void OnUpdateMain() + { + uint8_t objectiveType; + + frame_no++; + OnPrepareDraw(); + InvalidateWidget(WIDX_TAB_1); + + objectiveType = GetGameState().ScenarioObjective.Type; + + // Check if objective is allowed by money and pay-per-ride settings. + const bool objectiveAllowedByMoneyUsage = !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) + || !ObjectiveNeedsMoney(objectiveType); + // This objective can only work if the player can ask money for rides. + const bool objectiveAllowedByPaymentSettings = (objectiveType != OBJECTIVE_MONTHLY_RIDE_INCOME) + || ParkRidePricesUnlocked(); + if (!objectiveAllowedByMoneyUsage || !objectiveAllowedByPaymentSettings) + { + // Reset objective + SetObjective(OBJECTIVE_GUESTS_AND_RATING); + } + } + + /** + * + * rct2: 0x00671A73 + */ + void OnTextInputMain(WidgetIndex widgetIndex, std::string_view text) + { + if (text.empty()) + return; + + auto& gameState = GetGameState(); + switch (widgetIndex) + { + case WIDX_PARK_NAME: + { + auto action = ParkSetNameAction(std::string(text)); + GameActions::Execute(&action); + + if (gameState.ScenarioName.empty()) + { + auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); + gameState.ScenarioName = park.Name; + } + break; + } + case WIDX_SCENARIO_NAME: + gameState.ScenarioName = text; + Invalidate(); + break; + case WIDX_DETAILS: + gameState.ScenarioDetails = text; + Invalidate(); + break; + } + } + + /** + * + * rct2: 0x0067161C + */ + void OnPrepareDrawMain() + { + auto& gameState = GetGameState(); + auto widgetsToSet = window_editor_objective_options_widgets[page]; + if (widgets != widgetsToSet) + { + widgets = widgetsToSet; + InitScrollWidgets(); + } + + SetPressedTab(); + switch (gameState.ScenarioObjective.Type) { case OBJECTIVE_GUESTS_BY: - case OBJECTIVE_GUESTS_AND_RATING: - stringId = STR_WINDOW_OBJECTIVE_GUEST_COUNT; - break; case OBJECTIVE_PARK_VALUE_BY: - case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: - stringId = STR_WINDOW_OBJECTIVE_PARK_VALUE; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Spinner; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Button; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Button; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Spinner; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Button; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Button; break; - case OBJECTIVE_MONTHLY_RIDE_INCOME: - stringId = STR_WINDOW_OBJECTIVE_MONTHLY_INCOME; - break; - case OBJECTIVE_MONTHLY_FOOD_INCOME: - stringId = STR_WINDOW_OBJECTIVE_MONTHLY_PROFIT; - break; - case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: - stringId = STR_WINDOW_OBJECTIVE_MINIMUM_LENGTH; - break; - default: - stringId = STR_WINDOW_OBJECTIVE_EXCITEMENT_RATING; - break; - } - DrawTextBasic(dpi, screenCoords, stringId); - - // Objective argument 1 value - screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_OBJECTIVE_ARG_1].left + 1, widgets[WIDX_OBJECTIVE_ARG_1].top }; - ft = Formatter(); - switch (gameState.ScenarioObjective.Type) - { - case OBJECTIVE_GUESTS_BY: case OBJECTIVE_GUESTS_AND_RATING: - stringId = STR_WINDOW_COLOUR_2_COMMA16; - ft.Add(gameState.ScenarioObjective.NumGuests); - break; - case OBJECTIVE_PARK_VALUE_BY: - case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: case OBJECTIVE_MONTHLY_RIDE_INCOME: - case OBJECTIVE_MONTHLY_FOOD_INCOME: - stringId = STR_CURRENCY_FORMAT_LABEL; - ft.Add(gameState.ScenarioObjective.Currency); - break; case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: - stringId = STR_WINDOW_COLOUR_2_LENGTH; - ft.Add(gameState.ScenarioObjective.MinimumLength); - break; case OBJECTIVE_FINISH_5_ROLLERCOASTERS: - stringId = STR_WINDOW_COLOUR_2_COMMA2DP32; - ft.Add(gameState.ScenarioObjective.MinimumExcitement); + case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: + case OBJECTIVE_MONTHLY_FOOD_INCOME: + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Spinner; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Button; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Button; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Empty; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Empty; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Empty; break; default: - stringId = STR_WINDOW_COLOUR_2_COMMA2DP32; - ft.Add(gameState.ScenarioObjective.Currency); + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Empty; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Empty; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Empty; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Empty; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Empty; + window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Empty; break; } - DrawTextBasic(dpi, screenCoords, stringId, ft, COLOUR_BLACK); + + window_editor_objective_options_main_widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; + + AnchorBorderWidgets(); } - if (widgets[WIDX_OBJECTIVE_ARG_2].type != WindowWidgetType::Empty) + /** + * + * rct2: 0x0067161C + */ + void OnDrawMain(DrawPixelInfo& dpi) { - // Objective argument 2 label - screenCoords = windowPos + ScreenCoordsXY{ 28, widgets[WIDX_OBJECTIVE_ARG_2].top }; - DrawTextBasic(dpi, screenCoords, STR_WINDOW_OBJECTIVE_DATE); + const auto& gameState = GetGameState(); + int32_t widthToSet; + StringId stringId; - // Objective argument 2 value - screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_OBJECTIVE_ARG_2].left + 1, widgets[WIDX_OBJECTIVE_ARG_2].top }; - ft = Formatter(); - ft.Add((gameState.ScenarioObjective.Year * MONTH_COUNT) - 1); - DrawTextBasic(dpi, screenCoords, STR_WINDOW_OBJECTIVE_VALUE_DATE, ft); - } + DrawWidgets(dpi); + DrawTabImages(dpi); - // Park name - screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_PARK_NAME].top }; - widthToSet = widgets[WIDX_PARK_NAME].left - 16; + // Objective label + auto screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_OBJECTIVE].top }; + DrawTextBasic(dpi, screenCoords, STR_OBJECTIVE_WINDOW); - { - auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); - auto parkName = park.Name.c_str(); + // Objective value + screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_OBJECTIVE].left + 1, widgets[WIDX_OBJECTIVE].top }; + auto ft = Formatter(); + ft.Add(ObjectiveDropdownOptionNames[gameState.ScenarioObjective.Type]); + DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); + + if (widgets[WIDX_OBJECTIVE_ARG_1].type != WindowWidgetType::Empty) + { + // Objective argument 1 label + screenCoords = windowPos + ScreenCoordsXY{ 28, widgets[WIDX_OBJECTIVE_ARG_1].top }; + switch (gameState.ScenarioObjective.Type) + { + case OBJECTIVE_GUESTS_BY: + case OBJECTIVE_GUESTS_AND_RATING: + stringId = STR_WINDOW_OBJECTIVE_GUEST_COUNT; + break; + case OBJECTIVE_PARK_VALUE_BY: + case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: + stringId = STR_WINDOW_OBJECTIVE_PARK_VALUE; + break; + case OBJECTIVE_MONTHLY_RIDE_INCOME: + stringId = STR_WINDOW_OBJECTIVE_MONTHLY_INCOME; + break; + case OBJECTIVE_MONTHLY_FOOD_INCOME: + stringId = STR_WINDOW_OBJECTIVE_MONTHLY_PROFIT; + break; + case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: + stringId = STR_WINDOW_OBJECTIVE_MINIMUM_LENGTH; + break; + default: + stringId = STR_WINDOW_OBJECTIVE_EXCITEMENT_RATING; + break; + } + DrawTextBasic(dpi, screenCoords, stringId); + + // Objective argument 1 value + screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_OBJECTIVE_ARG_1].left + 1, widgets[WIDX_OBJECTIVE_ARG_1].top }; + ft = Formatter(); + switch (gameState.ScenarioObjective.Type) + { + case OBJECTIVE_GUESTS_BY: + case OBJECTIVE_GUESTS_AND_RATING: + stringId = STR_WINDOW_COLOUR_2_COMMA32; + ft.Add(gameState.ScenarioObjective.NumGuests); + break; + case OBJECTIVE_PARK_VALUE_BY: + case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: + case OBJECTIVE_MONTHLY_RIDE_INCOME: + case OBJECTIVE_MONTHLY_FOOD_INCOME: + stringId = STR_CURRENCY_FORMAT_LABEL; + ft.Add(gameState.ScenarioObjective.Currency); + break; + case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: + stringId = STR_WINDOW_COLOUR_2_LENGTH; + ft.Add(gameState.ScenarioObjective.MinimumLength); + break; + case OBJECTIVE_FINISH_5_ROLLERCOASTERS: + stringId = STR_WINDOW_COLOUR_2_COMMA2DP32; + ft.Add(gameState.ScenarioObjective.MinimumExcitement); + break; + default: + stringId = STR_WINDOW_COLOUR_2_COMMA2DP32; + ft.Add(gameState.ScenarioObjective.Currency); + break; + } + DrawTextBasic(dpi, screenCoords, stringId, ft, COLOUR_BLACK); + } + + if (widgets[WIDX_OBJECTIVE_ARG_2].type != WindowWidgetType::Empty) + { + // Objective argument 2 label + screenCoords = windowPos + ScreenCoordsXY{ 28, widgets[WIDX_OBJECTIVE_ARG_2].top }; + DrawTextBasic(dpi, screenCoords, STR_WINDOW_OBJECTIVE_DATE); + + // Objective argument 2 value + screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_OBJECTIVE_ARG_2].left + 1, widgets[WIDX_OBJECTIVE_ARG_2].top }; + ft = Formatter(); + ft.Add((gameState.ScenarioObjective.Year * MONTH_COUNT) - 1); + DrawTextBasic(dpi, screenCoords, STR_WINDOW_OBJECTIVE_VALUE_DATE, ft); + } + + // Park name + screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_PARK_NAME].top }; + widthToSet = widgets[WIDX_PARK_NAME].left - 16; + + { + auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); + auto parkName = park.Name.c_str(); + + ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(parkName); + DrawTextEllipsised(dpi, screenCoords, widthToSet, STR_WINDOW_PARK_NAME, ft); + } + + // Scenario name + screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_SCENARIO_NAME].top }; + widthToSet = widgets[WIDX_SCENARIO_NAME].left - 16; ft = Formatter(); ft.Add(STR_STRING); - ft.Add(parkName); - DrawTextEllipsised(dpi, screenCoords, widthToSet, STR_WINDOW_PARK_NAME, ft); + ft.Add(gameState.ScenarioName.c_str()); + DrawTextEllipsised(dpi, screenCoords, widthToSet, STR_WINDOW_SCENARIO_NAME, ft); + + // Scenario details label + screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_DETAILS].top }; + DrawTextBasic(dpi, screenCoords, STR_WINDOW_PARK_DETAILS); + + // Scenario details value + screenCoords = windowPos + ScreenCoordsXY{ 16, widgets[WIDX_DETAILS].top + 10 }; + widthToSet = widgets[WIDX_DETAILS].left - 4; + + ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(gameState.ScenarioDetails.c_str()); + DrawTextWrapped(dpi, screenCoords, widthToSet, STR_BLACK_STRING, ft); + + // Scenario category label + screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_CATEGORY].top }; + DrawTextBasic(dpi, screenCoords, STR_WINDOW_SCENARIO_GROUP); + + // Scenario category value + screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_CATEGORY].left + 1, widgets[WIDX_CATEGORY].top }; + ft = Formatter(); + ft.Add(ScenarioCategoryStringIds[gameState.ScenarioCategory]); + DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); } - // Scenario name - screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_SCENARIO_NAME].top }; - widthToSet = widgets[WIDX_SCENARIO_NAME].left - 16; - - ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(gameState.ScenarioName.c_str()); - DrawTextEllipsised(dpi, screenCoords, widthToSet, STR_WINDOW_SCENARIO_NAME, ft); - - // Scenario details label - screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_DETAILS].top }; - DrawTextBasic(dpi, screenCoords, STR_WINDOW_PARK_DETAILS); - - // Scenario details value - screenCoords = windowPos + ScreenCoordsXY{ 16, widgets[WIDX_DETAILS].top + 10 }; - widthToSet = widgets[WIDX_DETAILS].left - 4; - - ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(gameState.ScenarioDetails.c_str()); - DrawTextWrapped(dpi, screenCoords, widthToSet, STR_BLACK_STRING, ft); - - // Scenario category label - screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_CATEGORY].top }; - DrawTextBasic(dpi, screenCoords, STR_WINDOW_SCENARIO_GROUP); - - // Scenario category value - screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_CATEGORY].left + 1, widgets[WIDX_CATEGORY].top }; - ft = Formatter(); - ft.Add(ScenarioCategoryStringIds[gameState.ScenarioCategory]); - DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); - } - #pragma endregion #pragma region Rides - /** - * - * rct2: 0x006725A8 - */ - void OnResizeRides() - { - WindowSetResize(*this, 380, 224, 380, 224); - } - - /** - * - * rct2: 0x00672544 - */ - void OnUpdateRides() - { - frame_no++; - OnPrepareDraw(); - OnResize(); - InvalidateWidget(WIDX_TAB_2); - - const auto oldSize = _rideableRides.size(); - _rideableRides.clear(); - for (auto& currentRide : GetRideManager()) + /** + * + * rct2: 0x006725A8 + */ + void OnResizeRides() { - if (currentRide.IsRide()) + WindowSetResize(*this, 380, 224, 380, 224); + } + + /** + * + * rct2: 0x00672544 + */ + void OnUpdateRides() + { + frame_no++; + OnPrepareDraw(); + OnResize(); + InvalidateWidget(WIDX_TAB_2); + + const auto oldSize = _rideableRides.size(); + _rideableRides.clear(); + for (auto& currentRide : GetRideManager()) { - _rideableRides.push_back(currentRide.id); + if (currentRide.IsRide()) + { + _rideableRides.push_back(currentRide.id); + } + } + + if (oldSize != _rideableRides.size()) + { + Invalidate(); } } - if (oldSize != _rideableRides.size()) + /** + * + * rct2: 0x006724BF + */ + ScreenSize OnScrollGetSizeRides(int32_t scrollIndex) { - Invalidate(); - } - } + ScreenSize newSize; + newSize.height = static_cast(_rideableRides.size()) * 10; - /** - * - * rct2: 0x006724BF - */ - ScreenSize OnScrollGetSizeRides(int32_t scrollIndex) - { - ScreenSize newSize; - newSize.height = static_cast(_rideableRides.size()) * 10; - - return newSize; - } - - /** - * - * rct2: 0x006724FC - */ - void OnScrollMouseDownRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) - { - auto i = screenCoords.y / 12; - if (i < 0 || i >= static_cast(_rideableRides.size())) - return; - - auto* currentRide = GetRide(_rideableRides[i]); - if (currentRide != nullptr) - { - currentRide->lifecycle_flags ^= RIDE_LIFECYCLE_INDESTRUCTIBLE; - } - Invalidate(); - } - - /** - * - * rct2: 0x006724CC - */ - void OnScrollMouseOverRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) - { - int32_t i; - - i = screenCoords.y / 12; - if (i < 0 || i >= static_cast(_rideableRides.size())) - return; - - if (selected_list_item != i) - { - selected_list_item = i; - Invalidate(); - } - } - - /** - * - * rct2: 0x006722B5 - */ - void OnPrepareDrawRides() - { - Widget* widgetsToSet = window_editor_objective_options_widgets[page]; - if (widgets != widgetsToSet) - { - widgets = widgetsToSet; - InitScrollWidgets(); + return newSize; } - SetPressedTab(); - - window_editor_objective_options_main_widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) - ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; - - AnchorBorderWidgets(); - } - - /** - * - * rct2: 0x00672340 - */ - void OnDrawRides(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PAGE_BACKGROUND].top + 3 }, STR_WINDOW_PRESERVATION_ORDER); - } - - /** - * - * rct2: 0x0067236F - */ - void OnScrollDrawRides(DrawPixelInfo& dpi, int32_t scrollIndex) - { - int32_t colour = ColourMapA[colours[1]].mid_light; - GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, colour); - - for (int32_t i = 0; i < static_cast(_rideableRides.size()); i++) + /** + * + * rct2: 0x006724FC + */ + void OnScrollMouseDownRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) { - int32_t y = i * 12; + auto i = screenCoords.y / 12; + if (i < 0 || i >= static_cast(_rideableRides.size())) + return; - if (y + 12 < dpi.y || y >= dpi.y + dpi.height) - continue; - - // Checkbox - GfxFillRectInset(dpi, { { 2, y }, { 11, y + 10 } }, colours[1], INSET_RECT_F_E0); - - // Highlighted - auto stringId = STR_BLACK_STRING; - if (i == selected_list_item) - { - stringId = STR_WINDOW_COLOUR_2_STRINGID; - GfxFilterRect(dpi, { 0, y, width, y + 11 }, FilterPaletteID::PaletteDarken1); - } - - // Checkbox mark auto* currentRide = GetRide(_rideableRides[i]); if (currentRide != nullptr) { - if (currentRide->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE) - { - auto darkness = stringId == STR_WINDOW_COLOUR_2_STRINGID ? TextDarkness::ExtraDark : TextDarkness::Dark; - GfxDrawString( - dpi, { 2, y }, static_cast(CheckBoxMarkString), - { static_cast(colours[1] & 0x7F), FontStyle::Medium, darkness }); - } + currentRide->lifecycle_flags ^= RIDE_LIFECYCLE_INDESTRUCTIBLE; + } + Invalidate(); + } - // Ride name + /** + * + * rct2: 0x006724CC + */ + void OnScrollMouseOverRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) + { + int32_t i; - Formatter ft; - currentRide->FormatNameTo(ft); - DrawTextBasic(dpi, { 15, y }, stringId, ft); + i = screenCoords.y / 12; + if (i < 0 || i >= static_cast(_rideableRides.size())) + return; + + if (selected_list_item != i) + { + selected_list_item = i; + Invalidate(); + } + } + + /** + * + * rct2: 0x006722B5 + */ + void OnPrepareDrawRides() + { + Widget* widgetsToSet = window_editor_objective_options_widgets[page]; + if (widgets != widgetsToSet) + { + widgets = widgetsToSet; + InitScrollWidgets(); + } + + SetPressedTab(); + + window_editor_objective_options_main_widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; + + AnchorBorderWidgets(); + } + + /** + * + * rct2: 0x00672340 + */ + void OnDrawRides(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PAGE_BACKGROUND].top + 3 }, STR_WINDOW_PRESERVATION_ORDER); + } + + /** + * + * rct2: 0x0067236F + */ + void OnScrollDrawRides(DrawPixelInfo& dpi, int32_t scrollIndex) + { + int32_t colour = ColourMapA[colours[1]].mid_light; + GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, colour); + + for (int32_t i = 0; i < static_cast(_rideableRides.size()); i++) + { + int32_t y = i * 12; + + if (y + 12 < dpi.y || y >= dpi.y + dpi.height) + continue; + + // Checkbox + GfxFillRectInset(dpi, { { 2, y }, { 11, y + 10 } }, colours[1], INSET_RECT_F_E0); + + // Highlighted + auto stringId = STR_BLACK_STRING; + if (i == selected_list_item) + { + stringId = STR_WINDOW_COLOUR_2_STRINGID; + GfxFilterRect(dpi, { 0, y, width, y + 11 }, FilterPaletteID::PaletteDarken1); + } + + // Checkbox mark + auto* currentRide = GetRide(_rideableRides[i]); + if (currentRide != nullptr) + { + if (currentRide->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE) + { + auto darkness = stringId == STR_WINDOW_COLOUR_2_STRINGID ? TextDarkness::ExtraDark : TextDarkness::Dark; + GfxDrawString( + dpi, { 2, y }, static_cast(CheckBoxMarkString), + { static_cast(colours[1] & 0x7F), FontStyle::Medium, darkness }); + } + + // Ride name + + Formatter ft; + currentRide->FormatNameTo(ft); + DrawTextBasic(dpi, { 15, y }, stringId, ft); + } } } - } #pragma endregion -}; + }; + + /** + * + * rct2: 0x0067137D + */ + WindowBase* EditorObjectiveOptionsOpen() + { + auto window = WindowBringToFrontByClass(WindowClass::EditorObjectiveOptions); + if (window != nullptr) + return window; + + window = WindowCreate( + WindowClass::EditorObjectiveOptions, 450, 225, WF_10 | WF_CENTRE_SCREEN); -/** - * - * rct2: 0x0067137D - */ -WindowBase* WindowEditorObjectiveOptionsOpen() -{ - auto window = WindowBringToFrontByClass(WindowClass::EditorObjectiveOptions); - if (window != nullptr) return window; - - window = WindowCreate( - WindowClass::EditorObjectiveOptions, 450, 225, WF_10 | WF_CENTRE_SCREEN); - - return window; -} + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index 47cd8b969d..bd98594969 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -30,20 +30,20 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr int32_t WW_FINANCIAL = 280; + static constexpr int32_t WH_FINANCIAL = 149; -static constexpr int32_t WW_FINANCIAL = 280; -static constexpr int32_t WH_FINANCIAL = 149; + static constexpr int32_t WW_GUESTS = 380; + static constexpr int32_t WH_GUESTS = 149; -static constexpr int32_t WW_GUESTS = 380; -static constexpr int32_t WH_GUESTS = 149; - -static constexpr int32_t WW_PARK = 400; -static constexpr int32_t WH_PARK = 200; + static constexpr int32_t WW_PARK = 400; + static constexpr int32_t WH_PARK = 200; #pragma region Widgets -// clang-format off + // clang-format off enum { WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL, WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS, @@ -135,7 +135,7 @@ static Widget window_editor_scenario_options_financial_widgets[] = { MakeSpinnerWidgets({168, 116}, { 70, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets MakeWidget ({ 8, 133}, {WW_FINANCIAL - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_MARKETING, STR_FORBID_MARKETING_TIP ), MakeWidget ({ 8, 116}, {WW_FINANCIAL - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_RCT1_INTEREST, STR_RCT1_INTEREST_TIP ), - WIDGETS_END, + kWidgetsEnd, }; static Widget window_editor_scenario_options_guests_widgets[] = { @@ -150,7 +150,7 @@ static Widget window_editor_scenario_options_guests_widgets[] = { MakeSpinnerWidgets({268, 99}, { 70, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets MakeWidget ({ 8, 116}, {WW_GUESTS - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_GUESTS_PREFER_LESS_INTENSE_RIDES, STR_GUESTS_PREFER_LESS_INTENSE_RIDES_TIP), MakeWidget ({ 8, 133}, {WW_GUESTS - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_GUESTS_PREFER_MORE_INTENSE_RIDES, STR_GUESTS_PREFER_MORE_INTENSE_RIDES_TIP), - WIDGETS_END, + kWidgetsEnd, }; static Widget window_editor_scenario_options_park_widgets[] = { @@ -171,7 +171,7 @@ static Widget window_editor_scenario_options_park_widgets[] = { MakeWidget ({ 8, 150}, {WW_PARK - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_HIGH_CONSTRUCTION, STR_FORBID_HIGH_CONSTRUCTION_TIP ), MakeWidget ({ 8, 167}, {WW_PARK - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_HARD_PARK_RATING, STR_HARD_PARK_RATING_TIP ), MakeWidget ({ 8, 184}, {WW_PARK - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_HARD_GUEST_GENERATION, STR_HARD_GUEST_GENERATION_TIP ), - WIDGETS_END, + kWidgetsEnd, }; static Widget *window_editor_scenario_options_widgets[] = { @@ -208,1080 +208,1082 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = { (1uLL << WIDX_ENTRY_PRICE_INCREASE) | (1uLL << WIDX_ENTRY_PRICE_DECREASE), }; -// clang-format on + // clang-format on #pragma endregion -class EditorScenarioOptionsWindow final : public Window -{ -public: - void OnOpen() override + class EditorScenarioOptionsWindow final : public Window { - widgets = window_editor_scenario_options_widgets[WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL]; - hold_down_widgets = window_editor_scenario_options_page_hold_down_widgets - [WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL]; - WindowInitScrollWidgets(*this); - page = 0; - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (page) + public: + void OnOpen() override { - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: - return FinancialMouseUp(widgetIndex); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: - return GuestsMouseUp(widgetIndex); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: - return ParkMouseUp(widgetIndex); + widgets = window_editor_scenario_options_widgets[WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL]; + hold_down_widgets = window_editor_scenario_options_page_hold_down_widgets + [WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL]; + WindowInitScrollWidgets(*this); + page = 0; } - } - void OnResize() override - { - switch (page) + void OnMouseUp(WidgetIndex widgetIndex) override { - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: - return FinancialResize(); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: - return GuestsResize(); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: - return ParkResize(); + switch (page) + { + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: + return FinancialMouseUp(widgetIndex); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: + return GuestsMouseUp(widgetIndex); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: + return ParkMouseUp(widgetIndex); + } } - } - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (page) + void OnResize() override { - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: - return FinancialMouseDown(widgetIndex); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: - return GuestsMouseDown(widgetIndex); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: - return ParkMouseDown(widgetIndex); + switch (page) + { + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: + return FinancialResize(); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: + return GuestsResize(); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: + return ParkResize(); + } } - } - void OnUpdate() override - { - switch (page) + void OnMouseDown(WidgetIndex widgetIndex) override { - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: - return FinancialUpdate(); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: - return GuestsUpdate(); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: - return ParkUpdate(); + switch (page) + { + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: + return FinancialMouseDown(widgetIndex); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: + return GuestsMouseDown(widgetIndex); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: + return ParkMouseDown(widgetIndex); + } } - } - void OnPrepareDraw() override - { - switch (page) + void OnUpdate() override { - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: - return FinancialPrepareDraw(); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: - return GuestsPrepareDraw(); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: - return ParkPrepareDraw(); + switch (page) + { + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: + return FinancialUpdate(); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: + return GuestsUpdate(); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: + return ParkUpdate(); + } } - } - void OnDraw(DrawPixelInfo& dpi) override - { - switch (page) + void OnPrepareDraw() override { - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: - return FinancialDraw(dpi); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: - return GuestsDraw(dpi); - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: - return ParkDraw(dpi); + switch (page) + { + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: + return FinancialPrepareDraw(); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: + return GuestsPrepareDraw(); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: + return ParkPrepareDraw(); + } } - } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - switch (page) + void OnDraw(DrawPixelInfo& dpi) override { - case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: - return ParkDropdown(widgetIndex, selectedIndex); + switch (page) + { + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL: + return FinancialDraw(dpi); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS: + return GuestsDraw(dpi); + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: + return ParkDraw(dpi); + } } - } -private: - void SetPressedTab() - { - int32_t i; - for (i = 0; i < WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_COUNT; i++) - SetWidgetPressed(WIDX_TAB_1 + i, false); - SetWidgetPressed(WIDX_TAB_1 + page, true); - } + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + switch (page) + { + case WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_PARK: + return ParkDropdown(widgetIndex, selectedIndex); + } + } - void AnchorBorderWidgets() - { - ResizeFrameWithPage(); - } + private: + void SetPressedTab() + { + int32_t i; + for (i = 0; i < WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_COUNT; i++) + SetWidgetPressed(WIDX_TAB_1 + i, false); + SetWidgetPressed(WIDX_TAB_1 + page, true); + } - void DrawTabImages(DrawPixelInfo& dpi) - { - Widget* widget; - int32_t spriteIndex; + void AnchorBorderWidgets() + { + ResizeFrameWithPage(); + } - // Tab 1 - widget = &widgets[WIDX_TAB_1]; - spriteIndex = SPR_TAB_FINANCES_SUMMARY_0; - if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL) - spriteIndex += (frame_no / 2) % 8; + void DrawTabImages(DrawPixelInfo& dpi) + { + Widget* widget; + int32_t spriteIndex; - GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget->left, widget->top }); + // Tab 1 + widget = &widgets[WIDX_TAB_1]; + spriteIndex = SPR_TAB_FINANCES_SUMMARY_0; + if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL) + spriteIndex += (frame_no / 2) % 8; - // Tab 2 - widget = &widgets[WIDX_TAB_2]; - spriteIndex = SPR_TAB_GUESTS_0; - if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS) - spriteIndex += (frame_no / 4) % 8; + GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget->left, widget->top }); - GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget->left, widget->top }); + // Tab 2 + widget = &widgets[WIDX_TAB_2]; + spriteIndex = SPR_TAB_GUESTS_0; + if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_GUESTS) + spriteIndex += (frame_no / 4) % 8; - // Tab 3 - widget = &widgets[WIDX_TAB_3]; - spriteIndex = SPR_TAB_PARK; - GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget->left, widget->top }); - } + GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget->left, widget->top }); - void SetPage(int32_t newPage) - { - if (page == newPage) - return; + // Tab 3 + widget = &widgets[WIDX_TAB_3]; + spriteIndex = SPR_TAB_PARK; + GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget->left, widget->top }); + } - page = newPage; - frame_no = 0; - hold_down_widgets = window_editor_scenario_options_page_hold_down_widgets[page]; - widgets = window_editor_scenario_options_widgets[page]; - Invalidate(); - OnResize(); - OnPrepareDraw(); - WindowInitScrollWidgets(*this); - Invalidate(); - } + void SetPage(int32_t newPage) + { + if (page == newPage) + return; + + page = newPage; + frame_no = 0; + hold_down_widgets = window_editor_scenario_options_page_hold_down_widgets[page]; + widgets = window_editor_scenario_options_widgets[page]; + Invalidate(); + OnResize(); + OnPrepareDraw(); + WindowInitScrollWidgets(*this); + Invalidate(); + } #pragma region Financial - void FinancialMouseUp(WidgetIndex widgetIndex) - { - auto& gameState = GetGameState(); - switch (widgetIndex) + void FinancialMouseUp(WidgetIndex widgetIndex) { - case WIDX_CLOSE: - WindowClose(*this); - break; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_NO_MONEY: + auto& gameState = GetGameState(); + switch (widgetIndex) { - auto newMoneySetting = (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) ? 0 : 1; - auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::NoMoney, newMoneySetting); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; - } - case WIDX_FORBID_MARKETING: - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::ForbidMarketingCampaigns, - gameState.ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN ? 0 : 1); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; - } - case WIDX_RCT1_INTEREST: - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::UseRCT1Interest, gameState.ParkFlags & PARK_FLAGS_RCT1_INTEREST ? 0 : 1); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; + case WIDX_CLOSE: + WindowClose(*this); + break; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + SetPage(widgetIndex - WIDX_TAB_1); + break; + case WIDX_NO_MONEY: + { + auto newMoneySetting = (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) ? 0 : 1; + auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::NoMoney, newMoneySetting); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } + case WIDX_FORBID_MARKETING: + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::ForbidMarketingCampaigns, + gameState.ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN ? 0 : 1); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } + case WIDX_RCT1_INTEREST: + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::UseRCT1Interest, gameState.ParkFlags & PARK_FLAGS_RCT1_INTEREST ? 0 : 1); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } } } - } - void FinancialResize() - { - WindowSetResize(*this, 280, 149, 280, 149); - } - - void ShowClimateDropdown() - { - int32_t i; - - const auto& dropdownWidget = widgets[WIDX_CLIMATE]; - - for (i = 0; i < static_cast(ClimateType::Count); i++) + void FinancialResize() { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = ClimateNames[i]; - } - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget.left, windowPos.y + dropdownWidget.top }, dropdownWidget.height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, static_cast(ClimateType::Count), dropdownWidget.width() - 3); - Dropdown::SetChecked(static_cast(GetGameState().Climate), true); - } - - void FinancialMouseDown(WidgetIndex widgetIndex) - { - auto& gameState = GetGameState(); - switch (widgetIndex) - { - case WIDX_INITIAL_CASH_INCREASE: - if (gameState.InitialCash < 1000000.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::InitialCash, gameState.InitialCash + 500.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_CASH, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_INITIAL_CASH_DECREASE: - if (gameState.InitialCash > 0.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::InitialCash, gameState.InitialCash - 500.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_CASH, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_INITIAL_LOAN_INCREASE: - if (gameState.BankLoan < 5000000.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::InitialLoan, gameState.BankLoan + 1000.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_INIT_LOAN, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_INITIAL_LOAN_DECREASE: - if (gameState.BankLoan > 0.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::InitialLoan, gameState.BankLoan - 1000.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_INIT_LOAN, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_MAXIMUM_LOAN_INCREASE: - if (gameState.MaxBankLoan < 5000000.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::MaximumLoanSize, gameState.MaxBankLoan + 1000.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_MAX_LOAN, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_MAXIMUM_LOAN_DECREASE: - if (gameState.MaxBankLoan > 0.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::MaximumLoanSize, gameState.MaxBankLoan - 1000.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_MAX_LOAN, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_INTEREST_RATE_INCREASE: - if (gameState.BankLoanInterestRate < MaxBankLoanInterestRate) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::AnnualInterestRate, gameState.BankLoanInterestRate + 1); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_INTEREST_RATE, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_INTEREST_RATE_DECREASE: - if (gameState.BankLoanInterestRate > 0) - { - auto interest = std::min(MaxBankLoanInterestRate, gameState.BankLoanInterestRate - 1); - auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::AnnualInterestRate, interest); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_INTEREST_RATE, STR_NONE, {}); - } - Invalidate(); - break; + WindowSetResize(*this, 280, 149, 280, 149); } - if (gScreenFlags == SCREEN_FLAGS_PLAYING) + void ShowClimateDropdown() { - WindowInvalidateByClass(WindowClass::Finances); - WindowInvalidateByClass(WindowClass::BottomToolbar); - } - } + int32_t i; - void FinancialUpdate() - { - frame_no++; - FinancialPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_1); - } + const auto& dropdownWidget = widgets[WIDX_CLIMATE]; - void FinancialPrepareDraw() - { - Widget* newWidgets = window_editor_scenario_options_widgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - WindowInitScrollWidgets(*this); - } - - SetPressedTab(); - - auto& gameState = GetGameState(); - if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) - { - SetWidgetPressed(WIDX_NO_MONEY, true); - for (int32_t i = WIDX_INITIAL_CASH; i <= WIDX_RCT1_INTEREST; i++) - widgets[i].type = WindowWidgetType::Empty; - } - else - { - SetWidgetPressed(WIDX_NO_MONEY, false); - widgets[WIDX_INITIAL_CASH].type = WindowWidgetType::Spinner; - widgets[WIDX_INITIAL_CASH_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_INITIAL_CASH_DECREASE].type = WindowWidgetType::Button; - widgets[WIDX_INITIAL_LOAN].type = WindowWidgetType::Spinner; - widgets[WIDX_INITIAL_LOAN_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_INITIAL_LOAN_DECREASE].type = WindowWidgetType::Button; - widgets[WIDX_MAXIMUM_LOAN].type = WindowWidgetType::Spinner; - widgets[WIDX_MAXIMUM_LOAN_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_MAXIMUM_LOAN_DECREASE].type = WindowWidgetType::Button; - widgets[WIDX_FORBID_MARKETING].type = WindowWidgetType::Checkbox; - - if (gameState.ParkFlags & PARK_FLAGS_RCT1_INTEREST) + for (i = 0; i < static_cast(ClimateType::Count); i++) { - widgets[WIDX_INTEREST_RATE].type = WindowWidgetType::Empty; - widgets[WIDX_INTEREST_RATE_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_INTEREST_RATE_DECREASE].type = WindowWidgetType::Empty; - widgets[WIDX_RCT1_INTEREST].type = WindowWidgetType::Checkbox; - SetWidgetPressed(WIDX_RCT1_INTEREST, true); + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = ClimateNames[i]; + } + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget.left, windowPos.y + dropdownWidget.top }, dropdownWidget.height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, static_cast(ClimateType::Count), dropdownWidget.width() - 3); + Dropdown::SetChecked(static_cast(GetGameState().Climate), true); + } + + void FinancialMouseDown(WidgetIndex widgetIndex) + { + auto& gameState = GetGameState(); + switch (widgetIndex) + { + case WIDX_INITIAL_CASH_INCREASE: + if (gameState.InitialCash < 1000000.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::InitialCash, gameState.InitialCash + 500.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_CASH, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_INITIAL_CASH_DECREASE: + if (gameState.InitialCash > 0.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::InitialCash, gameState.InitialCash - 500.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_CASH, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_INITIAL_LOAN_INCREASE: + if (gameState.BankLoan < 5000000.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::InitialLoan, gameState.BankLoan + 1000.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_INIT_LOAN, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_INITIAL_LOAN_DECREASE: + if (gameState.BankLoan > 0.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::InitialLoan, gameState.BankLoan - 1000.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_INIT_LOAN, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_MAXIMUM_LOAN_INCREASE: + if (gameState.MaxBankLoan < 5000000.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::MaximumLoanSize, gameState.MaxBankLoan + 1000.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_MAX_LOAN, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_MAXIMUM_LOAN_DECREASE: + if (gameState.MaxBankLoan > 0.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::MaximumLoanSize, gameState.MaxBankLoan - 1000.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_MAX_LOAN, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_INTEREST_RATE_INCREASE: + if (gameState.BankLoanInterestRate < MaxBankLoanInterestRate) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::AnnualInterestRate, gameState.BankLoanInterestRate + 1); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_INTEREST_RATE, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_INTEREST_RATE_DECREASE: + if (gameState.BankLoanInterestRate > 0) + { + auto interest = std::min(MaxBankLoanInterestRate, gameState.BankLoanInterestRate - 1); + auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::AnnualInterestRate, interest); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_INTEREST_RATE, STR_NONE, {}); + } + Invalidate(); + break; + } + + if (gScreenFlags == SCREEN_FLAGS_PLAYING) + { + WindowInvalidateByClass(WindowClass::Finances); + WindowInvalidateByClass(WindowClass::BottomToolbar); + } + } + + void FinancialUpdate() + { + frame_no++; + FinancialPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_1); + } + + void FinancialPrepareDraw() + { + Widget* newWidgets = window_editor_scenario_options_widgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + WindowInitScrollWidgets(*this); + } + + SetPressedTab(); + + auto& gameState = GetGameState(); + if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) + { + SetWidgetPressed(WIDX_NO_MONEY, true); + for (int32_t i = WIDX_INITIAL_CASH; i <= WIDX_RCT1_INTEREST; i++) + widgets[i].type = WindowWidgetType::Empty; } else { - widgets[WIDX_INTEREST_RATE].type = WindowWidgetType::Spinner; - widgets[WIDX_INTEREST_RATE_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_INTEREST_RATE_DECREASE].type = WindowWidgetType::Button; - widgets[WIDX_RCT1_INTEREST].type = WindowWidgetType::Empty; + SetWidgetPressed(WIDX_NO_MONEY, false); + widgets[WIDX_INITIAL_CASH].type = WindowWidgetType::Spinner; + widgets[WIDX_INITIAL_CASH_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_INITIAL_CASH_DECREASE].type = WindowWidgetType::Button; + widgets[WIDX_INITIAL_LOAN].type = WindowWidgetType::Spinner; + widgets[WIDX_INITIAL_LOAN_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_INITIAL_LOAN_DECREASE].type = WindowWidgetType::Button; + widgets[WIDX_MAXIMUM_LOAN].type = WindowWidgetType::Spinner; + widgets[WIDX_MAXIMUM_LOAN_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_MAXIMUM_LOAN_DECREASE].type = WindowWidgetType::Button; + widgets[WIDX_FORBID_MARKETING].type = WindowWidgetType::Checkbox; + + if (gameState.ParkFlags & PARK_FLAGS_RCT1_INTEREST) + { + widgets[WIDX_INTEREST_RATE].type = WindowWidgetType::Empty; + widgets[WIDX_INTEREST_RATE_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_INTEREST_RATE_DECREASE].type = WindowWidgetType::Empty; + widgets[WIDX_RCT1_INTEREST].type = WindowWidgetType::Checkbox; + SetWidgetPressed(WIDX_RCT1_INTEREST, true); + } + else + { + widgets[WIDX_INTEREST_RATE].type = WindowWidgetType::Spinner; + widgets[WIDX_INTEREST_RATE_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_INTEREST_RATE_DECREASE].type = WindowWidgetType::Button; + widgets[WIDX_RCT1_INTEREST].type = WindowWidgetType::Empty; + } + } + + SetWidgetPressed(WIDX_FORBID_MARKETING, gameState.ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN); + + widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; + + AnchorBorderWidgets(); + } + + void FinancialDraw(DrawPixelInfo& dpi) + { + ScreenCoordsXY screenCoords{}; + + WindowDrawWidgets(*this, dpi); + DrawTabImages(dpi); + + auto& gameState = GetGameState(); + + const auto& initialCashWidget = widgets[WIDX_INITIAL_CASH]; + if (initialCashWidget.type != WindowWidgetType::Empty) + { + screenCoords = windowPos + ScreenCoordsXY{ 8, initialCashWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_INIT_CASH_LABEL); + + screenCoords = windowPos + ScreenCoordsXY{ initialCashWidget.left + 1, initialCashWidget.top }; + auto ft = Formatter(); + ft.Add(GetGameState().InitialCash); + DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); + } + + const auto& initialLoanWidget = widgets[WIDX_INITIAL_LOAN]; + if (initialLoanWidget.type != WindowWidgetType::Empty) + { + screenCoords = windowPos + ScreenCoordsXY{ 8, initialLoanWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_INIT_LOAN_LABEL); + + screenCoords = windowPos + ScreenCoordsXY{ initialLoanWidget.left + 1, initialLoanWidget.top }; + auto ft = Formatter(); + ft.Add(gameState.BankLoan); + DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); + } + + const auto& maximumLoanWidget = widgets[WIDX_MAXIMUM_LOAN]; + if (maximumLoanWidget.type != WindowWidgetType::Empty) + { + screenCoords = windowPos + ScreenCoordsXY{ 8, maximumLoanWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_MAX_LOAN_LABEL); + + screenCoords = windowPos + ScreenCoordsXY{ maximumLoanWidget.left + 1, maximumLoanWidget.top }; + auto ft = Formatter(); + ft.Add(GetGameState().MaxBankLoan); + DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); + } + + const auto& interestRateWidget = widgets[WIDX_INTEREST_RATE]; + if (interestRateWidget.type != WindowWidgetType::Empty) + { + screenCoords = windowPos + ScreenCoordsXY{ 8, interestRateWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_INTEREST_RATE_LABEL); + + screenCoords = windowPos + ScreenCoordsXY{ interestRateWidget.left + 1, interestRateWidget.top }; + + auto ft = Formatter(); + ft.Add( + std::clamp(static_cast(gameState.BankLoanInterestRate), INT16_MIN, INT16_MAX)); + DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); } } - SetWidgetPressed(WIDX_FORBID_MARKETING, gameState.ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN); - - widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; - - AnchorBorderWidgets(); - } - - void FinancialDraw(DrawPixelInfo& dpi) - { - ScreenCoordsXY screenCoords{}; - - WindowDrawWidgets(*this, dpi); - DrawTabImages(dpi); - - auto& gameState = GetGameState(); - - const auto& initialCashWidget = widgets[WIDX_INITIAL_CASH]; - if (initialCashWidget.type != WindowWidgetType::Empty) - { - screenCoords = windowPos + ScreenCoordsXY{ 8, initialCashWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_INIT_CASH_LABEL); - - screenCoords = windowPos + ScreenCoordsXY{ initialCashWidget.left + 1, initialCashWidget.top }; - auto ft = Formatter(); - ft.Add(GetGameState().InitialCash); - DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); - } - - const auto& initialLoanWidget = widgets[WIDX_INITIAL_LOAN]; - if (initialLoanWidget.type != WindowWidgetType::Empty) - { - screenCoords = windowPos + ScreenCoordsXY{ 8, initialLoanWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_INIT_LOAN_LABEL); - - screenCoords = windowPos + ScreenCoordsXY{ initialLoanWidget.left + 1, initialLoanWidget.top }; - auto ft = Formatter(); - ft.Add(gameState.BankLoan); - DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); - } - - const auto& maximumLoanWidget = widgets[WIDX_MAXIMUM_LOAN]; - if (maximumLoanWidget.type != WindowWidgetType::Empty) - { - screenCoords = windowPos + ScreenCoordsXY{ 8, maximumLoanWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_MAX_LOAN_LABEL); - - screenCoords = windowPos + ScreenCoordsXY{ maximumLoanWidget.left + 1, maximumLoanWidget.top }; - auto ft = Formatter(); - ft.Add(GetGameState().MaxBankLoan); - DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); - } - - const auto& interestRateWidget = widgets[WIDX_INTEREST_RATE]; - if (interestRateWidget.type != WindowWidgetType::Empty) - { - screenCoords = windowPos + ScreenCoordsXY{ 8, interestRateWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_INTEREST_RATE_LABEL); - - screenCoords = windowPos + ScreenCoordsXY{ interestRateWidget.left + 1, interestRateWidget.top }; - - auto ft = Formatter(); - ft.Add(std::clamp(static_cast(gameState.BankLoanInterestRate), INT16_MIN, INT16_MAX)); - DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); - } - } - #pragma endregion #pragma region Guests - void GuestsMouseUp(WidgetIndex widgetIndex) - { - auto& gameState = GetGameState(); - switch (widgetIndex) + void GuestsMouseUp(WidgetIndex widgetIndex) { - case WIDX_CLOSE: - WindowClose(*this); - break; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_GUEST_PREFER_LESS_INTENSE_RIDES: + auto& gameState = GetGameState(); + switch (widgetIndex) { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestsPreferLessIntenseRides, - gameState.ParkFlags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES ? 0 : 1); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; - } - case WIDX_GUEST_PREFER_MORE_INTENSE_RIDES: - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestsPreferMoreIntenseRides, - gameState.ParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES ? 0 : 1); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; + case WIDX_CLOSE: + WindowClose(*this); + break; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + SetPage(widgetIndex - WIDX_TAB_1); + break; + case WIDX_GUEST_PREFER_LESS_INTENSE_RIDES: + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::GuestsPreferLessIntenseRides, + gameState.ParkFlags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES ? 0 : 1); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } + case WIDX_GUEST_PREFER_MORE_INTENSE_RIDES: + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::GuestsPreferMoreIntenseRides, + gameState.ParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES ? 0 : 1); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } } } - } - void GuestsResize() - { - WindowSetResize(*this, 380, 149, 380, 149); - } - - void GuestsMouseDown(WidgetIndex widgetIndex) - { - auto& gameState = GetGameState(); - - switch (widgetIndex) + void GuestsResize() { - case WIDX_CASH_PER_GUEST_INCREASE: - if (gameState.GuestInitialCash < 1000.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::AverageCashPerGuest, gameState.GuestInitialCash + 1.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_CASH_PER_GUEST_DECREASE: - if (gameState.GuestInitialCash > 0.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::AverageCashPerGuest, gameState.GuestInitialCash - 1.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_GUEST_INITIAL_HAPPINESS_INCREASE: - if (gameState.GuestInitialHappiness < 250) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialHappiness, gameState.GuestInitialHappiness + 4); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_GUEST_INITIAL_HAPPINESS_DECREASE: - if (gameState.GuestInitialHappiness > 40) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialHappiness, gameState.GuestInitialHappiness - 4); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_GUEST_INITIAL_HUNGER_INCREASE: - if (gameState.GuestInitialHunger > 40) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialHunger, gameState.GuestInitialHunger - 4); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_GUEST_INITIAL_HUNGER_DECREASE: - if (gameState.GuestInitialHunger < 250) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialHunger, gameState.GuestInitialHunger + 4); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_GUEST_INITIAL_THIRST_INCREASE: - if (gameState.GuestInitialThirst > 40) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialThirst, gameState.GuestInitialThirst - 4); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_GUEST_INITIAL_THIRST_DECREASE: - if (gameState.GuestInitialThirst < 250) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialThirst, gameState.GuestInitialThirst + 4); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - } - } - - void GuestsUpdate() - { - frame_no++; - GuestsPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_2); - } - - void GuestsPrepareDraw() - { - Widget* newWidgets = window_editor_scenario_options_widgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - WindowInitScrollWidgets(*this); + WindowSetResize(*this, 380, 149, 380, 149); } - SetPressedTab(); + void GuestsMouseDown(WidgetIndex widgetIndex) + { + auto& gameState = GetGameState(); - auto& gameState = GetGameState(); - if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) - { - widgets[WIDX_CASH_PER_GUEST].type = WindowWidgetType::Empty; - widgets[WIDX_CASH_PER_GUEST_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_CASH_PER_GUEST_DECREASE].type = WindowWidgetType::Empty; - } - else - { - widgets[WIDX_CASH_PER_GUEST].type = WindowWidgetType::Spinner; - widgets[WIDX_CASH_PER_GUEST_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_CASH_PER_GUEST_DECREASE].type = WindowWidgetType::Button; + switch (widgetIndex) + { + case WIDX_CASH_PER_GUEST_INCREASE: + if (gameState.GuestInitialCash < 1000.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::AverageCashPerGuest, gameState.GuestInitialCash + 1.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_CASH_PER_GUEST_DECREASE: + if (gameState.GuestInitialCash > 0.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::AverageCashPerGuest, gameState.GuestInitialCash - 1.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_GUEST_INITIAL_HAPPINESS_INCREASE: + if (gameState.GuestInitialHappiness < 250) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::GuestInitialHappiness, gameState.GuestInitialHappiness + 4); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_GUEST_INITIAL_HAPPINESS_DECREASE: + if (gameState.GuestInitialHappiness > 40) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::GuestInitialHappiness, gameState.GuestInitialHappiness - 4); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_GUEST_INITIAL_HUNGER_INCREASE: + if (gameState.GuestInitialHunger > 40) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::GuestInitialHunger, gameState.GuestInitialHunger - 4); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_GUEST_INITIAL_HUNGER_DECREASE: + if (gameState.GuestInitialHunger < 250) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::GuestInitialHunger, gameState.GuestInitialHunger + 4); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_GUEST_INITIAL_THIRST_INCREASE: + if (gameState.GuestInitialThirst > 40) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::GuestInitialThirst, gameState.GuestInitialThirst - 4); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_GUEST_INITIAL_THIRST_DECREASE: + if (gameState.GuestInitialThirst < 250) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::GuestInitialThirst, gameState.GuestInitialThirst + 4); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + } } - SetWidgetPressed(WIDX_GUEST_PREFER_LESS_INTENSE_RIDES, gameState.ParkFlags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES); - SetWidgetPressed(WIDX_GUEST_PREFER_MORE_INTENSE_RIDES, gameState.ParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES); - - widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; - - AnchorBorderWidgets(); - } - - void GuestsDraw(DrawPixelInfo& dpi) - { - ScreenCoordsXY screenCoords{}; - - WindowDrawWidgets(*this, dpi); - DrawTabImages(dpi); - auto& gameState = GetGameState(); - - const auto& cashPerGuestWidget = widgets[WIDX_CASH_PER_GUEST]; - if (cashPerGuestWidget.type != WindowWidgetType::Empty) + void GuestsUpdate() { - // Cash per guest label - screenCoords = windowPos + ScreenCoordsXY{ 8, cashPerGuestWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_CASH_PER_GUEST_LABEL); + frame_no++; + GuestsPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_2); + } - // Cash per guest value - screenCoords = windowPos + ScreenCoordsXY{ cashPerGuestWidget.left + 1, cashPerGuestWidget.top }; + void GuestsPrepareDraw() + { + Widget* newWidgets = window_editor_scenario_options_widgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + WindowInitScrollWidgets(*this); + } + + SetPressedTab(); + + auto& gameState = GetGameState(); + if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) + { + widgets[WIDX_CASH_PER_GUEST].type = WindowWidgetType::Empty; + widgets[WIDX_CASH_PER_GUEST_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_CASH_PER_GUEST_DECREASE].type = WindowWidgetType::Empty; + } + else + { + widgets[WIDX_CASH_PER_GUEST].type = WindowWidgetType::Spinner; + widgets[WIDX_CASH_PER_GUEST_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_CASH_PER_GUEST_DECREASE].type = WindowWidgetType::Button; + } + + SetWidgetPressed(WIDX_GUEST_PREFER_LESS_INTENSE_RIDES, gameState.ParkFlags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES); + SetWidgetPressed(WIDX_GUEST_PREFER_MORE_INTENSE_RIDES, gameState.ParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES); + + widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; + + AnchorBorderWidgets(); + } + + void GuestsDraw(DrawPixelInfo& dpi) + { + ScreenCoordsXY screenCoords{}; + + WindowDrawWidgets(*this, dpi); + DrawTabImages(dpi); + auto& gameState = GetGameState(); + + const auto& cashPerGuestWidget = widgets[WIDX_CASH_PER_GUEST]; + if (cashPerGuestWidget.type != WindowWidgetType::Empty) + { + // Cash per guest label + screenCoords = windowPos + ScreenCoordsXY{ 8, cashPerGuestWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_CASH_PER_GUEST_LABEL); + + // Cash per guest value + screenCoords = windowPos + ScreenCoordsXY{ cashPerGuestWidget.left + 1, cashPerGuestWidget.top }; + auto ft = Formatter(); + ft.Add(gameState.GuestInitialCash); + DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); + } + + // Guest initial happiness label + const auto& initialHappinessWidget = widgets[WIDX_GUEST_INITIAL_HAPPINESS]; + screenCoords = windowPos + ScreenCoordsXY{ 8, initialHappinessWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_GUEST_INIT_HAPPINESS); + + // Guest initial happiness value + screenCoords = windowPos + ScreenCoordsXY{ initialHappinessWidget.left + 1, initialHappinessWidget.top }; auto ft = Formatter(); - ft.Add(gameState.GuestInitialCash); - DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); + ft.Add((gameState.GuestInitialHappiness * 100) / 255); + DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); + + // Guest initial hunger label + const auto& initialHungerWidget = widgets[WIDX_GUEST_INITIAL_HUNGER]; + screenCoords = windowPos + ScreenCoordsXY{ 8, initialHungerWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_GUEST_INIT_HUNGER); + + // Guest initial hunger value + screenCoords = windowPos + ScreenCoordsXY{ initialHungerWidget.left + 1, initialHungerWidget.top }; + ft = Formatter(); + ft.Add(((255 - gameState.GuestInitialHunger) * 100) / 255); + DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); + + // Guest initial thirst label + const auto& initialThirstWidget = widgets[WIDX_GUEST_INITIAL_THIRST]; + screenCoords = windowPos + ScreenCoordsXY{ 8, initialThirstWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_GUEST_INIT_THIRST); + + // Guest initial thirst value + screenCoords = windowPos + ScreenCoordsXY{ initialThirstWidget.left + 1, initialThirstWidget.top }; + ft = Formatter(); + ft.Add(((255 - gameState.GuestInitialThirst) * 100) / 255); + DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); } - // Guest initial happiness label - const auto& initialHappinessWidget = widgets[WIDX_GUEST_INITIAL_HAPPINESS]; - screenCoords = windowPos + ScreenCoordsXY{ 8, initialHappinessWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_GUEST_INIT_HAPPINESS); - - // Guest initial happiness value - screenCoords = windowPos + ScreenCoordsXY{ initialHappinessWidget.left + 1, initialHappinessWidget.top }; - auto ft = Formatter(); - ft.Add((gameState.GuestInitialHappiness * 100) / 255); - DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); - - // Guest initial hunger label - const auto& initialHungerWidget = widgets[WIDX_GUEST_INITIAL_HUNGER]; - screenCoords = windowPos + ScreenCoordsXY{ 8, initialHungerWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_GUEST_INIT_HUNGER); - - // Guest initial hunger value - screenCoords = windowPos + ScreenCoordsXY{ initialHungerWidget.left + 1, initialHungerWidget.top }; - ft = Formatter(); - ft.Add(((255 - gameState.GuestInitialHunger) * 100) / 255); - DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); - - // Guest initial thirst label - const auto& initialThirstWidget = widgets[WIDX_GUEST_INITIAL_THIRST]; - screenCoords = windowPos + ScreenCoordsXY{ 8, initialThirstWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_GUEST_INIT_THIRST); - - // Guest initial thirst value - screenCoords = windowPos + ScreenCoordsXY{ initialThirstWidget.left + 1, initialThirstWidget.top }; - ft = Formatter(); - ft.Add(((255 - gameState.GuestInitialThirst) * 100) / 255); - DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); - } - #pragma endregion #pragma region Park - void ParkMouseUp(WidgetIndex widgetIndex) - { - auto& gameState = GetGameState(); - switch (widgetIndex) + void ParkMouseUp(WidgetIndex widgetIndex) { - case WIDX_CLOSE: - WindowClose(*this); - break; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_FORBID_TREE_REMOVAL: + auto& gameState = GetGameState(); + switch (widgetIndex) { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::ForbidTreeRemoval, gameState.ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL ? 0 : 1); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; - } - case WIDX_FORBID_LANDSCAPE_CHANGES: - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::ForbidLandscapeChanges, - gameState.ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES ? 0 : 1); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; - } - case WIDX_FORBID_HIGH_CONSTRUCTION: - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::ForbidHighConstruction, - gameState.ParkFlags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION ? 0 : 1); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; - } - case WIDX_HARD_PARK_RATING: - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::ParkRatingHigherDifficultyLevel, - gameState.ParkFlags & PARK_FLAGS_DIFFICULT_PARK_RATING ? 0 : 1); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; - } - case WIDX_HARD_GUEST_GENERATION: - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestGenerationHigherDifficultyLevel, - gameState.ParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION ? 0 : 1); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; + case WIDX_CLOSE: + WindowClose(*this); + break; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + SetPage(widgetIndex - WIDX_TAB_1); + break; + case WIDX_FORBID_TREE_REMOVAL: + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::ForbidTreeRemoval, gameState.ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL ? 0 : 1); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } + case WIDX_FORBID_LANDSCAPE_CHANGES: + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::ForbidLandscapeChanges, + gameState.ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES ? 0 : 1); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } + case WIDX_FORBID_HIGH_CONSTRUCTION: + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::ForbidHighConstruction, + gameState.ParkFlags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION ? 0 : 1); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } + case WIDX_HARD_PARK_RATING: + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::ParkRatingHigherDifficultyLevel, + gameState.ParkFlags & PARK_FLAGS_DIFFICULT_PARK_RATING ? 0 : 1); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } + case WIDX_HARD_GUEST_GENERATION: + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::GuestGenerationHigherDifficultyLevel, + gameState.ParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION ? 0 : 1); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } } } - } - void ParkResize() - { - WindowSetResize(*this, 400, 200, 400, 200); - } - - void ParkMouseDown(WidgetIndex widgetIndex) - { - Widget* dropdownWidget; - Widget* widget = &widgets[widgetIndex]; - - auto& gameState = GetGameState(); - switch (widgetIndex) + void ParkResize() { - case WIDX_LAND_COST_INCREASE: - if (gLandPrice < 200.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::CostToBuyLand, gLandPrice + 1.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_LAND_COST_DECREASE: - if (gLandPrice > 5.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::CostToBuyLand, gLandPrice - 1.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE: - if (gameState.ConstructionRightsPrice < 200.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::CostToBuyConstructionRights, gameState.ConstructionRightsPrice + 1.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE: - if (gameState.ConstructionRightsPrice > 5.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::CostToBuyConstructionRights, gameState.ConstructionRightsPrice - 1.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_ENTRY_PRICE_INCREASE: - if (gameState.ParkEntranceFee < MAX_ENTRANCE_FEE) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::ParkChargeEntryFee, gameState.ParkEntranceFee + 1.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_ENTRY_PRICE_DECREASE: - if (gameState.ParkEntranceFee > 0.00_GBP) - { - auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::ParkChargeEntryFee, gameState.ParkEntranceFee - 1.00_GBP); - GameActions::Execute(&scenarioSetSetting); - } - else - { - ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); - } - Invalidate(); - break; - case WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN: - dropdownWidget = widget - 1; + WindowSetResize(*this, 400, 200, 400, 200); + } - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_FREE_PARK_ENTER; - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Args = STR_PAY_PARK_ENTER; - gDropdownItems[2].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[2].Args = STR_PAID_ENTRY_PAID_RIDES; + void ParkMouseDown(WidgetIndex widgetIndex) + { + Widget* dropdownWidget; + Widget* widget = &widgets[widgetIndex]; - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 1, - colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3); + auto& gameState = GetGameState(); + switch (widgetIndex) + { + case WIDX_LAND_COST_INCREASE: + if (gameState.LandPrice < 200.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::CostToBuyLand, gameState.LandPrice + 1.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_LAND_COST_DECREASE: + if (gameState.LandPrice > 5.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::CostToBuyLand, gameState.LandPrice - 1.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE: + if (gameState.ConstructionRightsPrice < 200.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::CostToBuyConstructionRights, gameState.ConstructionRightsPrice + 1.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE: + if (gameState.ConstructionRightsPrice > 5.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::CostToBuyConstructionRights, gameState.ConstructionRightsPrice - 1.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_ENTRY_PRICE_INCREASE: + if (gameState.ParkEntranceFee < MAX_ENTRANCE_FEE) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::ParkChargeEntryFee, gameState.ParkEntranceFee + 1.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_ENTRY_PRICE_DECREASE: + if (gameState.ParkEntranceFee > 0.00_GBP) + { + auto scenarioSetSetting = ScenarioSetSettingAction( + ScenarioSetSetting::ParkChargeEntryFee, gameState.ParkEntranceFee - 1.00_GBP); + GameActions::Execute(&scenarioSetSetting); + } + else + { + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + } + Invalidate(); + break; + case WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN: + dropdownWidget = widget - 1; + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_FREE_PARK_ENTER; + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Args = STR_PAY_PARK_ENTER; + gDropdownItems[2].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[2].Args = STR_PAID_ENTRY_PAID_RIDES; + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 1, + colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3); + + if (gameState.ParkFlags & PARK_FLAGS_UNLOCK_ALL_PRICES) + Dropdown::SetChecked(2, true); + else if (gameState.ParkFlags & PARK_FLAGS_PARK_FREE_ENTRY) + Dropdown::SetChecked(0, true); + else + Dropdown::SetChecked(1, true); + + break; + case WIDX_CLIMATE_DROPDOWN: + ShowClimateDropdown(); + break; + } + } + + void ParkDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + if (dropdownIndex == -1) + { + return; + } + + switch (widgetIndex) + { + case WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN: + { + auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ParkChargeMethod, dropdownIndex); + GameActions::Execute(&scenarioSetSetting); + Invalidate(); + break; + } + case WIDX_CLIMATE_DROPDOWN: + if (static_cast(GetGameState().Climate) != static_cast(dropdownIndex)) + { + auto gameAction = ClimateSetAction(ClimateType{ static_cast(dropdownIndex) }); + GameActions::Execute(&gameAction); + } + break; + } + } + + void ParkUpdate() + { + frame_no++; + ParkPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_3); + } + + void ParkPrepareDraw() + { + Widget* newWidgets = window_editor_scenario_options_widgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + WindowInitScrollWidgets(*this); + } + + SetPressedTab(); + + auto& gameState = GetGameState(); + if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) + { + for (int32_t i = WIDX_LAND_COST; i <= WIDX_ENTRY_PRICE_DECREASE; i++) + widgets[i].type = WindowWidgetType::Empty; + } + else + { + widgets[WIDX_LAND_COST].type = WindowWidgetType::Spinner; + widgets[WIDX_LAND_COST_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_LAND_COST_DECREASE].type = WindowWidgetType::Button; + widgets[WIDX_CONSTRUCTION_RIGHTS_COST].type = WindowWidgetType::Spinner; + widgets[WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE].type = WindowWidgetType::Button; + widgets[WIDX_PAY_FOR_PARK_OR_RIDES].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN].type = WindowWidgetType::Button; + + if (!ParkEntranceFeeUnlocked()) + { + widgets[WIDX_ENTRY_PRICE].type = WindowWidgetType::Empty; + widgets[WIDX_ENTRY_PRICE_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_ENTRY_PRICE_DECREASE].type = WindowWidgetType::Empty; + } + else + { + widgets[WIDX_ENTRY_PRICE].type = WindowWidgetType::Spinner; + widgets[WIDX_ENTRY_PRICE_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_ENTRY_PRICE_DECREASE].type = WindowWidgetType::Button; + } + } + + SetWidgetPressed(WIDX_FORBID_TREE_REMOVAL, gameState.ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL); + SetWidgetPressed(WIDX_FORBID_LANDSCAPE_CHANGES, gameState.ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES); + SetWidgetPressed(WIDX_FORBID_HIGH_CONSTRUCTION, gameState.ParkFlags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION); + SetWidgetPressed(WIDX_HARD_PARK_RATING, gameState.ParkFlags & PARK_FLAGS_DIFFICULT_PARK_RATING); + SetWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.ParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION); + + widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; + + AnchorBorderWidgets(); + } + + void ParkDraw(DrawPixelInfo& dpi) + { + ScreenCoordsXY screenCoords{}; + + WindowDrawWidgets(*this, dpi); + DrawTabImages(dpi); + + const auto& gameState = GetGameState(); + const auto& landCostWidget = widgets[WIDX_LAND_COST]; + if (landCostWidget.type != WindowWidgetType::Empty) + { + // Cost to buy land label + screenCoords = windowPos + ScreenCoordsXY{ 8, landCostWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_LAND_COST_LABEL); + + // Cost to buy land value + screenCoords = windowPos + ScreenCoordsXY{ landCostWidget.left + 1, landCostWidget.top }; + auto ft = Formatter(); + ft.Add(gameState.LandPrice); + DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); + } + + const auto& constructionRightsCostWidget = widgets[WIDX_CONSTRUCTION_RIGHTS_COST]; + if (constructionRightsCostWidget.type != WindowWidgetType::Empty) + { + // Cost to buy construction rights label + screenCoords = windowPos + ScreenCoordsXY{ 8, constructionRightsCostWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_RIGHTS_COST_LABEL); + + // Cost to buy construction rights value + screenCoords = windowPos + + ScreenCoordsXY{ constructionRightsCostWidget.left + 1, constructionRightsCostWidget.top }; + auto ft = Formatter(); + ft.Add(gameState.ConstructionRightsPrice); + DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); + } + + const auto& payForParkOrRidesWidget = widgets[WIDX_PAY_FOR_PARK_OR_RIDES]; + if (payForParkOrRidesWidget.type != WindowWidgetType::Empty) + { + // Pay for park or rides label + screenCoords = windowPos + ScreenCoordsXY{ payForParkOrRidesWidget.left + 1, payForParkOrRidesWidget.top }; + + auto ft = Formatter(); + // Pay for park and/or rides value if (gameState.ParkFlags & PARK_FLAGS_UNLOCK_ALL_PRICES) - Dropdown::SetChecked(2, true); + ft.Add(STR_PAID_ENTRY_PAID_RIDES); else if (gameState.ParkFlags & PARK_FLAGS_PARK_FREE_ENTRY) - Dropdown::SetChecked(0, true); + ft.Add(STR_FREE_PARK_ENTER); else - Dropdown::SetChecked(1, true); + ft.Add(STR_PAY_PARK_ENTER); - break; - case WIDX_CLIMATE_DROPDOWN: - ShowClimateDropdown(); - break; - } - } - - void ParkDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - if (dropdownIndex == -1) - { - return; - } - - switch (widgetIndex) - { - case WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN: - { - auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ParkChargeMethod, dropdownIndex); - GameActions::Execute(&scenarioSetSetting); - Invalidate(); - break; + DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); } - case WIDX_CLIMATE_DROPDOWN: - if (static_cast(GetGameState().Climate) != static_cast(dropdownIndex)) - { - auto gameAction = ClimateSetAction(ClimateType{ static_cast(dropdownIndex) }); - GameActions::Execute(&gameAction); - } - break; - } - } - void ParkUpdate() - { - frame_no++; - ParkPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_3); - } - - void ParkPrepareDraw() - { - Widget* newWidgets = window_editor_scenario_options_widgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - WindowInitScrollWidgets(*this); - } - - SetPressedTab(); - - auto& gameState = GetGameState(); - if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) - { - for (int32_t i = WIDX_LAND_COST; i <= WIDX_ENTRY_PRICE_DECREASE; i++) - widgets[i].type = WindowWidgetType::Empty; - } - else - { - widgets[WIDX_LAND_COST].type = WindowWidgetType::Spinner; - widgets[WIDX_LAND_COST_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_LAND_COST_DECREASE].type = WindowWidgetType::Button; - widgets[WIDX_CONSTRUCTION_RIGHTS_COST].type = WindowWidgetType::Spinner; - widgets[WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE].type = WindowWidgetType::Button; - widgets[WIDX_PAY_FOR_PARK_OR_RIDES].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN].type = WindowWidgetType::Button; - - if (!ParkEntranceFeeUnlocked()) + const auto& entryPriceWidget = widgets[WIDX_ENTRY_PRICE]; + if (entryPriceWidget.type != WindowWidgetType::Empty) { - widgets[WIDX_ENTRY_PRICE].type = WindowWidgetType::Empty; - widgets[WIDX_ENTRY_PRICE_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_ENTRY_PRICE_DECREASE].type = WindowWidgetType::Empty; + // Entry price label + screenCoords = windowPos + ScreenCoordsXY{ payForParkOrRidesWidget.right + 8, entryPriceWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_ENTRY_PRICE_LABEL); + + // Entry price value + screenCoords = windowPos + ScreenCoordsXY{ entryPriceWidget.left + 1, entryPriceWidget.top }; + auto ft = Formatter(); + ft.Add(gameState.ParkEntranceFee); + DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); } - else - { - widgets[WIDX_ENTRY_PRICE].type = WindowWidgetType::Spinner; - widgets[WIDX_ENTRY_PRICE_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_ENTRY_PRICE_DECREASE].type = WindowWidgetType::Button; - } - } - SetWidgetPressed(WIDX_FORBID_TREE_REMOVAL, gameState.ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL); - SetWidgetPressed(WIDX_FORBID_LANDSCAPE_CHANGES, gameState.ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES); - SetWidgetPressed(WIDX_FORBID_HIGH_CONSTRUCTION, gameState.ParkFlags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION); - SetWidgetPressed(WIDX_HARD_PARK_RATING, gameState.ParkFlags & PARK_FLAGS_DIFFICULT_PARK_RATING); - SetWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.ParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION); + // Climate label + const auto& climateWidget = widgets[WIDX_CLIMATE]; + screenCoords = windowPos + ScreenCoordsXY{ 8, climateWidget.top }; + DrawTextBasic(dpi, screenCoords, STR_CLIMATE_LABEL); - widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; - - AnchorBorderWidgets(); - } - - void ParkDraw(DrawPixelInfo& dpi) - { - ScreenCoordsXY screenCoords{}; - - WindowDrawWidgets(*this, dpi); - DrawTabImages(dpi); - - const auto& gameState = GetGameState(); - const auto& landCostWidget = widgets[WIDX_LAND_COST]; - if (landCostWidget.type != WindowWidgetType::Empty) - { - // Cost to buy land label - screenCoords = windowPos + ScreenCoordsXY{ 8, landCostWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_LAND_COST_LABEL); - - // Cost to buy land value - screenCoords = windowPos + ScreenCoordsXY{ landCostWidget.left + 1, landCostWidget.top }; + // Climate value + screenCoords = windowPos + ScreenCoordsXY{ climateWidget.left + 1, climateWidget.top }; auto ft = Formatter(); - ft.Add(gLandPrice); - DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); - } - - const auto& constructionRightsCostWidget = widgets[WIDX_CONSTRUCTION_RIGHTS_COST]; - if (constructionRightsCostWidget.type != WindowWidgetType::Empty) - { - // Cost to buy construction rights label - screenCoords = windowPos + ScreenCoordsXY{ 8, constructionRightsCostWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_RIGHTS_COST_LABEL); - - // Cost to buy construction rights value - screenCoords = windowPos - + ScreenCoordsXY{ constructionRightsCostWidget.left + 1, constructionRightsCostWidget.top }; - auto ft = Formatter(); - ft.Add(gameState.ConstructionRightsPrice); - DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); - } - - const auto& payForParkOrRidesWidget = widgets[WIDX_PAY_FOR_PARK_OR_RIDES]; - if (payForParkOrRidesWidget.type != WindowWidgetType::Empty) - { - // Pay for park or rides label - screenCoords = windowPos + ScreenCoordsXY{ payForParkOrRidesWidget.left + 1, payForParkOrRidesWidget.top }; - - auto ft = Formatter(); - // Pay for park and/or rides value - if (gameState.ParkFlags & PARK_FLAGS_UNLOCK_ALL_PRICES) - ft.Add(STR_PAID_ENTRY_PAID_RIDES); - else if (gameState.ParkFlags & PARK_FLAGS_PARK_FREE_ENTRY) - ft.Add(STR_FREE_PARK_ENTER); - else - ft.Add(STR_PAY_PARK_ENTER); - + ft.Add(ClimateNames[EnumValue(gameState.Climate)]); DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); } - const auto& entryPriceWidget = widgets[WIDX_ENTRY_PRICE]; - if (entryPriceWidget.type != WindowWidgetType::Empty) - { - // Entry price label - screenCoords = windowPos + ScreenCoordsXY{ payForParkOrRidesWidget.right + 8, entryPriceWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_ENTRY_PRICE_LABEL); - - // Entry price value - screenCoords = windowPos + ScreenCoordsXY{ entryPriceWidget.left + 1, entryPriceWidget.top }; - auto ft = Formatter(); - ft.Add(gameState.ParkEntranceFee); - DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); - } - - // Climate label - const auto& climateWidget = widgets[WIDX_CLIMATE]; - screenCoords = windowPos + ScreenCoordsXY{ 8, climateWidget.top }; - DrawTextBasic(dpi, screenCoords, STR_CLIMATE_LABEL); - - // Climate value - screenCoords = windowPos + ScreenCoordsXY{ climateWidget.left + 1, climateWidget.top }; - auto ft = Formatter(); - ft.Add(ClimateNames[static_cast(gameState.Climate)]); - DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); - } - #pragma endregion -}; + }; -WindowBase* WindowEditorScenarioOptionsOpen() -{ - return WindowFocusOrCreate(WindowClass::EditorScenarioOptions, 280, 148, WF_NO_SCROLLING); -} + WindowBase* EditorScenarioOptionsOpen() + { + return WindowFocusOrCreate(WindowClass::EditorScenarioOptions, 280, 148, WF_NO_SCROLLING); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index bd772f24ed..192492711f 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -18,155 +18,158 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum { WIDX_BACKGROUND }; static Widget window_error_widgets[] = { MakeWidget({0, 0}, {200, 42}, WindowWidgetType::ImgBtn, WindowColour::Primary), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class ErrorWindow final : public Window -{ -private: - std::string _text; - uint16_t _numLines; - uint8_t _staleCount; - -public: - ErrorWindow(std::string text, uint16_t numLines) - : _text(std::move(text)) - , _numLines(numLines) + class ErrorWindow final : public Window { - } + private: + std::string _text; + uint16_t _numLines; + uint8_t _staleCount; - void OnOpen() override - { - window_error_widgets[WIDX_BACKGROUND].right = width; - window_error_widgets[WIDX_BACKGROUND].bottom = height; - - widgets = window_error_widgets; - _staleCount = 0; - if (!gDisableErrorWindowSound) + public: + ErrorWindow(std::string text, uint16_t numLines) + : _text(std::move(text)) + , _numLines(numLines) { - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Error, 0, windowPos.x + (width / 2)); } - } - void OnDraw(DrawPixelInfo& dpi) override - { - ScreenCoordsXY leftTop{ windowPos }; - ScreenCoordsXY rightBottom{ windowPos + ScreenCoordsXY{ width - 1, height - 1 } }; - ScreenCoordsXY leftBottom{ leftTop.x, rightBottom.y }; - ScreenCoordsXY rightTop{ rightBottom.x, leftTop.y }; - - GfxFilterRect( - dpi, ScreenRect{ leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, - FilterPaletteID::Palette45); - GfxFilterRect(dpi, ScreenRect{ leftTop, rightBottom }, FilterPaletteID::PaletteGlassSaturatedRed); - - GfxFilterRect( - dpi, ScreenRect{ leftTop + ScreenCoordsXY{ 0, 2 }, leftBottom - ScreenCoordsXY{ 0, 2 } }, - FilterPaletteID::PaletteDarken3); - GfxFilterRect( - dpi, ScreenRect{ rightTop + ScreenCoordsXY{ 0, 2 }, rightBottom - ScreenCoordsXY{ 0, 2 } }, - FilterPaletteID::PaletteDarken3); - GfxFilterRect( - dpi, ScreenRect{ leftBottom + ScreenCoordsXY{ 2, 0 }, rightBottom - ScreenCoordsXY{ 2, 0 } }, - FilterPaletteID::PaletteDarken3); - GfxFilterRect( - dpi, ScreenRect{ leftTop + ScreenCoordsXY{ 2, 0 }, rightTop - ScreenCoordsXY{ 2, 0 } }, - FilterPaletteID::PaletteDarken3); - - GfxFilterRect( - dpi, ScreenRect{ rightTop + ScreenCoordsXY{ 1, 1 }, rightTop + ScreenCoordsXY{ 1, 1 } }, - FilterPaletteID::PaletteDarken3); - GfxFilterRect( - dpi, ScreenRect{ rightTop + ScreenCoordsXY{ -1, 1 }, rightTop + ScreenCoordsXY{ -1, 1 } }, - FilterPaletteID::PaletteDarken3); - GfxFilterRect( - dpi, ScreenRect{ leftBottom + ScreenCoordsXY{ 1, -1 }, leftBottom + ScreenCoordsXY{ 1, -1 } }, - FilterPaletteID::PaletteDarken3); - GfxFilterRect( - dpi, ScreenRect{ rightBottom - ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, - FilterPaletteID::PaletteDarken3); - - DrawStringCentredRaw( - dpi, { leftTop + ScreenCoordsXY{ (width + 1) / 2 - 1, 1 } }, _numLines, _text.data(), FontStyle::Medium); - } - - void OnPeriodicUpdate() override - { - // Close the window after 8 seconds of showing - _staleCount++; - if (_staleCount >= 8) + void OnOpen() override { - Close(); + window_error_widgets[WIDX_BACKGROUND].right = width; + window_error_widgets[WIDX_BACKGROUND].bottom = height; + + widgets = window_error_widgets; + _staleCount = 0; + if (!gDisableErrorWindowSound) + { + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Error, 0, windowPos.x + (width / 2)); + } } - } -}; -WindowBase* WindowErrorOpen(std::string_view title, std::string_view message) -{ - std::string buffer = "{BLACK}"; - buffer.append(title); + void OnDraw(DrawPixelInfo& dpi) override + { + ScreenCoordsXY leftTop{ windowPos }; + ScreenCoordsXY rightBottom{ windowPos + ScreenCoordsXY{ width - 1, height - 1 } }; + ScreenCoordsXY leftBottom{ leftTop.x, rightBottom.y }; + ScreenCoordsXY rightTop{ rightBottom.x, leftTop.y }; - // Format the message - if (!message.empty()) + GfxFilterRect( + dpi, ScreenRect{ leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, + FilterPaletteID::Palette45); + GfxFilterRect(dpi, ScreenRect{ leftTop, rightBottom }, FilterPaletteID::PaletteGlassSaturatedRed); + + GfxFilterRect( + dpi, ScreenRect{ leftTop + ScreenCoordsXY{ 0, 2 }, leftBottom - ScreenCoordsXY{ 0, 2 } }, + FilterPaletteID::PaletteDarken3); + GfxFilterRect( + dpi, ScreenRect{ rightTop + ScreenCoordsXY{ 0, 2 }, rightBottom - ScreenCoordsXY{ 0, 2 } }, + FilterPaletteID::PaletteDarken3); + GfxFilterRect( + dpi, ScreenRect{ leftBottom + ScreenCoordsXY{ 2, 0 }, rightBottom - ScreenCoordsXY{ 2, 0 } }, + FilterPaletteID::PaletteDarken3); + GfxFilterRect( + dpi, ScreenRect{ leftTop + ScreenCoordsXY{ 2, 0 }, rightTop - ScreenCoordsXY{ 2, 0 } }, + FilterPaletteID::PaletteDarken3); + + GfxFilterRect( + dpi, ScreenRect{ rightTop + ScreenCoordsXY{ 1, 1 }, rightTop + ScreenCoordsXY{ 1, 1 } }, + FilterPaletteID::PaletteDarken3); + GfxFilterRect( + dpi, ScreenRect{ rightTop + ScreenCoordsXY{ -1, 1 }, rightTop + ScreenCoordsXY{ -1, 1 } }, + FilterPaletteID::PaletteDarken3); + GfxFilterRect( + dpi, ScreenRect{ leftBottom + ScreenCoordsXY{ 1, -1 }, leftBottom + ScreenCoordsXY{ 1, -1 } }, + FilterPaletteID::PaletteDarken3); + GfxFilterRect( + dpi, ScreenRect{ rightBottom - ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, + FilterPaletteID::PaletteDarken3); + + DrawStringCentredRaw( + dpi, { leftTop + ScreenCoordsXY{ (width + 1) / 2 - 1, 1 } }, _numLines, _text.data(), FontStyle::Medium); + } + + void OnPeriodicUpdate() override + { + // Close the window after 8 seconds of showing + _staleCount++; + if (_staleCount >= 8) + { + Close(); + } + } + }; + + WindowBase* ErrorOpen(std::string_view title, std::string_view message) { - buffer.push_back('\n'); - buffer.append(message); + std::string buffer = "{BLACK}"; + buffer.append(title); + + // Format the message + if (!message.empty()) + { + buffer.push_back('\n'); + buffer.append(message); + } + + LOG_VERBOSE("show error, %s", buffer.c_str() + 1); + + // Don't do unnecessary work in headless. Also saves checking if cursor state is null. + if (gOpenRCT2Headless) + { + return nullptr; + } + + // Check if there is any text to display + if (buffer.size() <= 1) + { + return nullptr; + } + + // Close any existing error windows if they exist. + WindowCloseByClass(WindowClass::Error); + + int32_t width = GfxGetStringWidthNewLined(buffer.data(), FontStyle::Medium); + width = std::clamp(width, 64, 196); + + int32_t numLines{}; + GfxWrapString(buffer, width + 1, FontStyle::Medium, &buffer, &numLines); + + width = width + 3; + int32_t height = (numLines + 1) * FontGetLineHeight(FontStyle::Medium) + 4; + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + const CursorState* state = ContextGetCursorState(); + ScreenCoordsXY windowPosition = state->position - ScreenCoordsXY(width / 2, -26); + windowPosition.x = std::clamp(windowPosition.x, 0, screenWidth); + windowPosition.y = std::max(22, windowPosition.y); + int32_t maxY = screenHeight - height; + if (windowPosition.y > maxY) + { + windowPosition.y = std::min(windowPosition.y - height - 40, maxY); + } + + auto errorWindow = std::make_unique(std::move(buffer), numLines); + return WindowCreate( + std::move(errorWindow), WindowClass::Error, windowPosition, width, height, + WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_RESIZABLE); } - LOG_VERBOSE("show error, %s", buffer.c_str() + 1); - - // Don't do unnecessary work in headless. Also saves checking if cursor state is null. - if (gOpenRCT2Headless) + WindowBase* ErrorOpen(StringId title, StringId message, const Formatter& args) { - return nullptr; + auto titlez = FormatStringIDLegacy(title, args.Data()); + auto messagez = FormatStringIDLegacy(message, args.Data()); + return ErrorOpen(titlez, messagez); } - - // Check if there is any text to display - if (buffer.size() <= 1) - { - return nullptr; - } - - // Close any existing error windows if they exist. - WindowCloseByClass(WindowClass::Error); - - int32_t width = GfxGetStringWidthNewLined(buffer.data(), FontStyle::Medium); - width = std::clamp(width, 64, 196); - - int32_t numLines{}; - GfxWrapString(buffer, width + 1, FontStyle::Medium, &buffer, &numLines); - - width = width + 3; - int32_t height = (numLines + 1) * FontGetLineHeight(FontStyle::Medium) + 4; - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - const CursorState* state = ContextGetCursorState(); - ScreenCoordsXY windowPosition = state->position - ScreenCoordsXY(width / 2, -26); - windowPosition.x = std::clamp(windowPosition.x, 0, screenWidth); - windowPosition.y = std::max(22, windowPosition.y); - int32_t maxY = screenHeight - height; - if (windowPosition.y > maxY) - { - windowPosition.y = std::min(windowPosition.y - height - 40, maxY); - } - - auto errorWindow = std::make_unique(std::move(buffer), numLines); - return WindowCreate( - std::move(errorWindow), WindowClass::Error, windowPosition, width, height, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_RESIZABLE); -} - -WindowBase* WindowErrorOpen(StringId title, StringId message, const Formatter& args) -{ - auto titlez = FormatStringID(title, args.Data()); - auto messagez = FormatStringID(message, args.Data()); - return WindowErrorOpen(titlez, messagez); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index b94f1fed68..f1fa47c280 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -28,79 +28,79 @@ #include #include -using namespace OpenRCT2; - -enum +namespace OpenRCT2::Ui::Windows { - WINDOW_FINANCES_PAGE_SUMMARY, - WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH, - WINDOW_FINANCES_PAGE_VALUE_GRAPH, - WINDOW_FINANCES_PAGE_PROFIT_GRAPH, - WINDOW_FINANCES_PAGE_MARKETING, - WINDOW_FINANCES_PAGE_RESEARCH, - WINDOW_FINANCES_PAGE_COUNT -}; + enum + { + WINDOW_FINANCES_PAGE_SUMMARY, + WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH, + WINDOW_FINANCES_PAGE_VALUE_GRAPH, + WINDOW_FINANCES_PAGE_PROFIT_GRAPH, + WINDOW_FINANCES_PAGE_MARKETING, + WINDOW_FINANCES_PAGE_RESEARCH, + WINDOW_FINANCES_PAGE_COUNT + }; -enum -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_PAGE_BACKGROUND, - WIDX_TAB_1, - WIDX_TAB_2, - WIDX_TAB_3, - WIDX_TAB_4, - WIDX_TAB_5, - WIDX_TAB_6, + enum + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_PAGE_BACKGROUND, + WIDX_TAB_1, + WIDX_TAB_2, + WIDX_TAB_3, + WIDX_TAB_4, + WIDX_TAB_5, + WIDX_TAB_6, - WIDX_TAB_CONTENT, + WIDX_TAB_CONTENT, - WIDX_SUMMARY_SCROLL = WIDX_TAB_CONTENT, - WIDX_LOAN, - WIDX_LOAN_INCREASE, - WIDX_LOAN_DECREASE, + WIDX_SUMMARY_SCROLL = WIDX_TAB_CONTENT, + WIDX_LOAN, + WIDX_LOAN_INCREASE, + WIDX_LOAN_DECREASE, - WIDX_ACTIVE_CAMPAIGNS_GROUP = WIDX_TAB_CONTENT, - WIDX_CAMPAIGNS_AVAILABLE_GROUP, - WIDX_CAMPAIGN_1, - WIDX_CAMPAIGN_2, - WIDX_CAMPAIGN_3, - WIDX_CAMPAIGN_4, - WIDX_CAMPAIGN_5, - WIDX_CAMPAIGN_6, + WIDX_ACTIVE_CAMPAIGNS_GROUP = WIDX_TAB_CONTENT, + WIDX_CAMPAIGNS_AVAILABLE_GROUP, + WIDX_CAMPAIGN_1, + WIDX_CAMPAIGN_2, + WIDX_CAMPAIGN_3, + WIDX_CAMPAIGN_4, + WIDX_CAMPAIGN_5, + WIDX_CAMPAIGN_6, - WIDX_RESEARCH_FUNDING_GROUP = WIDX_TAB_CONTENT, - WIDX_RESEARCH_FUNDING, - WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON, - WIDX_RESEARCH_PRIORITIES_GROUP, - WIDX_TRANSPORT_RIDES, - WIDX_GENTLE_RIDES, - WIDX_ROLLER_COASTERS, - WIDX_THRILL_RIDES, - WIDX_WATER_RIDES, - WIDX_SHOPS_AND_STALLS, - WIDX_SCENERY_AND_THEMING, -}; + WIDX_RESEARCH_FUNDING_GROUP = WIDX_TAB_CONTENT, + WIDX_RESEARCH_FUNDING, + WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON, + WIDX_RESEARCH_PRIORITIES_GROUP, + WIDX_TRANSPORT_RIDES, + WIDX_GENTLE_RIDES, + WIDX_ROLLER_COASTERS, + WIDX_THRILL_RIDES, + WIDX_WATER_RIDES, + WIDX_SHOPS_AND_STALLS, + WIDX_SCENERY_AND_THEMING, + }; #pragma region Measurements -static constexpr int32_t WH_SUMMARY = 309; -static constexpr int32_t WH_RESEARCH = 207; -static constexpr int32_t WH_OTHER_TABS = 257; -static constexpr int32_t WW_RESEARCH = 320; -static constexpr int32_t WW_OTHER_TABS = 530; -static constexpr int32_t RSH_SUMMARY = 266; -static constexpr int32_t RSH_RESEARCH = 164; -static constexpr int32_t RSH_OTHER_TABS = 214; -static constexpr int32_t RSW_RESEARCH = WW_RESEARCH; -static constexpr int32_t RSW_OTHER_TABS = WW_OTHER_TABS; + static constexpr int32_t WH_SUMMARY = 309; + static constexpr int32_t WH_RESEARCH = 207; + static constexpr int32_t WH_OTHER_TABS = 257; + static constexpr int32_t WW_RESEARCH = 320; + static constexpr int32_t WW_OTHER_TABS = 530; + static constexpr int32_t RSH_SUMMARY = 266; + static constexpr int32_t RSH_RESEARCH = 164; + static constexpr int32_t RSH_OTHER_TABS = 214; + static constexpr int32_t RSW_RESEARCH = WW_RESEARCH; + static constexpr int32_t RSW_OTHER_TABS = WW_OTHER_TABS; #pragma endregion #pragma region Widgets -// clang-format off + // clang-format off #define MAIN_FINANCES_WIDGETS(TITLE, RSW, RSH, WW, WH) \ WINDOW_SHIM(TITLE, WW, WH), \ MakeWidget({0, 43}, {RSW, RSH}, WindowWidgetType::Resize, WindowColour::Secondary), \ @@ -116,25 +116,25 @@ static Widget _windowFinancesSummaryWidgets[] = MAIN_FINANCES_WIDGETS(STR_FINANCIAL_SUMMARY, RSW_OTHER_TABS, RSH_SUMMARY, WW_OTHER_TABS, WH_SUMMARY), MakeWidget ({130, 50}, {391, 211}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), MakeSpinnerWidgets({ 64, 279}, { 97, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_FINANCES_SUMMARY_LOAN_VALUE), // NB: 3 widgets. - WIDGETS_END, + kWidgetsEnd, }; static Widget _windowFinancesCashWidgets[] = { MAIN_FINANCES_WIDGETS(STR_FINANCIAL_GRAPH, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, WH_OTHER_TABS), - WIDGETS_END, + kWidgetsEnd, }; static Widget _windowFinancesParkValueWidgets[] = { MAIN_FINANCES_WIDGETS(STR_PARK_VALUE_GRAPH, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, WH_OTHER_TABS), - WIDGETS_END, + kWidgetsEnd, }; static Widget _windowFinancesProfitWidgets[] = { MAIN_FINANCES_WIDGETS(STR_PROFIT_GRAPH, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, WH_OTHER_TABS), - WIDGETS_END, + kWidgetsEnd, }; static Widget _windowFinancesMarketingWidgets[] = @@ -148,7 +148,7 @@ static Widget _windowFinancesMarketingWidgets[] = MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN), MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN), MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN), - WIDGETS_END, + kWidgetsEnd, }; static Widget _windowFinancesResearchWidgets[] = @@ -165,815 +165,821 @@ static Widget _windowFinancesResearchWidgets[] = MakeWidget({ 8, 160}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_WATER_RIDES, STR_RESEARCH_NEW_WATER_RIDES_TIP ), MakeWidget({ 8, 173}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_SHOPS_AND_STALLS, STR_RESEARCH_NEW_SHOPS_AND_STALLS_TIP ), MakeWidget({ 8, 186}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_SCENERY_AND_THEMING, STR_RESEARCH_NEW_SCENERY_AND_THEMING_TIP ), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -static Widget* _windowFinancesPageWidgets[] = { - _windowFinancesSummaryWidgets, // WINDOW_FINANCES_PAGE_SUMMARY - _windowFinancesCashWidgets, // WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH - _windowFinancesParkValueWidgets, // WINDOW_FINANCES_PAGE_VALUE_GRAPH - _windowFinancesProfitWidgets, // WINDOW_FINANCES_PAGE_PROFIT_GRAPH - _windowFinancesMarketingWidgets, // WINDOW_FINANCES_PAGE_MARKETING - _windowFinancesResearchWidgets, // WINDOW_FINANCES_PAGE_RESEARCH -}; -static_assert(std::size(_windowFinancesPageWidgets) == WINDOW_FINANCES_PAGE_COUNT); + static Widget* _windowFinancesPageWidgets[] = { + _windowFinancesSummaryWidgets, // WINDOW_FINANCES_PAGE_SUMMARY + _windowFinancesCashWidgets, // WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH + _windowFinancesParkValueWidgets, // WINDOW_FINANCES_PAGE_VALUE_GRAPH + _windowFinancesProfitWidgets, // WINDOW_FINANCES_PAGE_PROFIT_GRAPH + _windowFinancesMarketingWidgets, // WINDOW_FINANCES_PAGE_MARKETING + _windowFinancesResearchWidgets, // WINDOW_FINANCES_PAGE_RESEARCH + }; + static_assert(std::size(_windowFinancesPageWidgets) == WINDOW_FINANCES_PAGE_COUNT); #pragma endregion -static constexpr StringId _windowFinancesSummaryRowLabels[static_cast(ExpenditureType::Count)] = { - STR_FINANCES_SUMMARY_RIDE_CONSTRUCTION, - STR_FINANCES_SUMMARY_RIDE_RUNNING_COSTS, - STR_FINANCES_SUMMARY_LAND_PURCHASE, - STR_FINANCES_SUMMARY_LANDSCAPING, - STR_FINANCES_SUMMARY_PARK_ENTRANCE_TICKETS, - STR_FINANCES_SUMMARY_RIDE_TICKETS, - STR_FINANCES_SUMMARY_SHOP_SALES, - STR_FINANCES_SUMMARY_SHOP_STOCK, - STR_FINANCES_SUMMARY_FOOD_DRINK_SALES, - STR_FINANCES_SUMMARY_FOOD_DRINK_STOCK, - STR_FINANCES_SUMMARY_STAFF_WAGES, - STR_FINANCES_SUMMARY_MARKETING, - STR_FINANCES_SUMMARY_RESEARCH, - STR_FINANCES_SUMMARY_LOAN_INTEREST, -}; + static constexpr StringId _windowFinancesSummaryRowLabels[EnumValue(ExpenditureType::Count)] = { + STR_FINANCES_SUMMARY_RIDE_CONSTRUCTION, + STR_FINANCES_SUMMARY_RIDE_RUNNING_COSTS, + STR_FINANCES_SUMMARY_LAND_PURCHASE, + STR_FINANCES_SUMMARY_LANDSCAPING, + STR_FINANCES_SUMMARY_PARK_ENTRANCE_TICKETS, + STR_FINANCES_SUMMARY_RIDE_TICKETS, + STR_FINANCES_SUMMARY_SHOP_SALES, + STR_FINANCES_SUMMARY_SHOP_STOCK, + STR_FINANCES_SUMMARY_FOOD_DRINK_SALES, + STR_FINANCES_SUMMARY_FOOD_DRINK_STOCK, + STR_FINANCES_SUMMARY_STAFF_WAGES, + STR_FINANCES_SUMMARY_MARKETING, + STR_FINANCES_SUMMARY_RESEARCH, + STR_FINANCES_SUMMARY_LOAN_INTEREST, + }; -static constexpr int32_t _windowFinancesTabAnimationFrames[] = { - 8, // WINDOW_FINANCES_PAGE_SUMMARY - 16, // WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH - 16, // WINDOW_FINANCES_PAGE_VALUE_GRAPH - 16, // WINDOW_FINANCES_PAGE_PROFIT_GRAPH - 19, // WINDOW_FINANCES_PAGE_MARKETING - 8, // WINDOW_FINANCES_PAGE_RESEARCH -}; -static_assert(std::size(_windowFinancesTabAnimationFrames) == WINDOW_FINANCES_PAGE_COUNT); + static constexpr int32_t _windowFinancesTabAnimationFrames[] = { + 8, // WINDOW_FINANCES_PAGE_SUMMARY + 16, // WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH + 16, // WINDOW_FINANCES_PAGE_VALUE_GRAPH + 16, // WINDOW_FINANCES_PAGE_PROFIT_GRAPH + 19, // WINDOW_FINANCES_PAGE_MARKETING + 8, // WINDOW_FINANCES_PAGE_RESEARCH + }; + static_assert(std::size(_windowFinancesTabAnimationFrames) == WINDOW_FINANCES_PAGE_COUNT); -static constexpr int32_t EXPENDITURE_COLUMN_WIDTH = 80; + static constexpr int32_t EXPENDITURE_COLUMN_WIDTH = 80; -static constexpr uint32_t _windowFinancesPageHoldDownWidgets[] = { - (1uLL << WIDX_LOAN_INCREASE) | (1uLL << WIDX_LOAN_DECREASE), // WINDOW_FINANCES_PAGE_SUMMARY + static constexpr uint32_t _windowFinancesPageHoldDownWidgets[] = { + (1uLL << WIDX_LOAN_INCREASE) | (1uLL << WIDX_LOAN_DECREASE), // WINDOW_FINANCES_PAGE_SUMMARY - 0, // WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH - 0, // WINDOW_FINANCES_PAGE_VALUE_GRAPH - 0, // WINDOW_FINANCES_PAGE_PROFIT_GRAPH - 0, // WINDOW_FINANCES_PAGE_MARKETING - 0, // WINDOW_FINANCES_PAGE_RESEARCH -}; -static_assert(std::size(_windowFinancesPageHoldDownWidgets) == WINDOW_FINANCES_PAGE_COUNT); + 0, // WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH + 0, // WINDOW_FINANCES_PAGE_VALUE_GRAPH + 0, // WINDOW_FINANCES_PAGE_PROFIT_GRAPH + 0, // WINDOW_FINANCES_PAGE_MARKETING + 0, // WINDOW_FINANCES_PAGE_RESEARCH + }; + static_assert(std::size(_windowFinancesPageHoldDownWidgets) == WINDOW_FINANCES_PAGE_COUNT); #pragma endregion -class FinancesWindow final : public Window -{ -private: - uint32_t _lastPaintedMonth; - - void SetDisabledTabs() + class FinancesWindow final : public Window { - disabled_widgets = (GetGameState().ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) ? (1uLL << WIDX_TAB_5) : 0; - } + private: + uint32_t _lastPaintedMonth; -public: - void OnOpen() override - { - SetPage(WINDOW_FINANCES_PAGE_SUMMARY); - _lastPaintedMonth = std::numeric_limits::max(); - ResearchUpdateUncompletedTypes(); - } - - void OnUpdate() override - { - frame_no++; - InvalidateWidget(WIDX_TAB_1 + page); - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (page) + void SetDisabledTabs() { - case WINDOW_FINANCES_PAGE_SUMMARY: - OnMouseDownSummary(widgetIndex); - break; - case WINDOW_FINANCES_PAGE_RESEARCH: - WindowResearchFundingMouseDown(this, widgetIndex, WIDX_RESEARCH_FUNDING); - break; - } - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - SetPage(widgetIndex - WIDX_TAB_1); - break; - default: - switch (page) - { - case WINDOW_FINANCES_PAGE_MARKETING: - OnMouseUpMarketing(widgetIndex); - break; - case WINDOW_FINANCES_PAGE_RESEARCH: - WindowResearchFundingMouseUp(widgetIndex, WIDX_RESEARCH_FUNDING); - } - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - if (page == WINDOW_FINANCES_PAGE_RESEARCH) - { - WindowResearchFundingDropdown(widgetIndex, selectedIndex, WIDX_RESEARCH_FUNDING); - } - } - - void OnPrepareDraw() override - { - auto* targetWidgets = _windowFinancesPageWidgets[page]; - - if (widgets != targetWidgets) - { - widgets = targetWidgets; - WindowInitScrollWidgets(*this); + disabled_widgets = (GetGameState().ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) ? (1uLL << WIDX_TAB_5) : 0; } - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_6); - - for (auto i = 0; i < WINDOW_FINANCES_PAGE_COUNT; i++) - SetWidgetPressed(WIDX_TAB_1 + i, false); - SetWidgetPressed(WIDX_TAB_1 + page, true); - switch (page) + public: + void OnOpen() override { - case WINDOW_FINANCES_PAGE_SUMMARY: - OnPrepareDrawSummary(); - break; - case WINDOW_FINANCES_PAGE_MARKETING: - OnPrepareDrawMarketing(); - break; - case WINDOW_FINANCES_PAGE_RESEARCH: - WindowResearchFundingPrepareDraw(this, WIDX_RESEARCH_FUNDING); - break; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - switch (page) - { - case WINDOW_FINANCES_PAGE_SUMMARY: - OnDrawSummary(dpi); - break; - case WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH: - OnDrawFinancialGraph(dpi); - break; - case WINDOW_FINANCES_PAGE_VALUE_GRAPH: - OnDrawParkValueGraph(dpi); - break; - case WINDOW_FINANCES_PAGE_PROFIT_GRAPH: - OnDrawProfitGraph(dpi); - break; - case WINDOW_FINANCES_PAGE_MARKETING: - OnDrawMarketing(dpi); - break; - case WINDOW_FINANCES_PAGE_RESEARCH: - WindowResearchFundingDraw(this, dpi); - break; - } - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - if (page == WINDOW_FINANCES_PAGE_SUMMARY) - { - return { EXPENDITURE_COLUMN_WIDTH * (SummaryMaxAvailableMonth() + 1), 0 }; + SetPage(WINDOW_FINANCES_PAGE_SUMMARY); + _lastPaintedMonth = std::numeric_limits::max(); + ResearchUpdateUncompletedTypes(); } - return {}; - } - - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - if (page != WINDOW_FINANCES_PAGE_SUMMARY) - return; - - auto screenCoords = ScreenCoordsXY{ 0, TABLE_CELL_HEIGHT + 2 }; - - Widget self = widgets[WIDX_SUMMARY_SCROLL]; - int32_t row_width = std::max(scrolls[0].h_right, self.width()); - - // Expenditure / Income row labels - for (int32_t i = 0; i < static_cast(ExpenditureType::Count); i++) + void OnUpdate() override { - // Darken every even row - if (i % 2 == 0) - GfxFillRect( - dpi, - { screenCoords - ScreenCoordsXY{ 0, 1 }, - screenCoords + ScreenCoordsXY{ row_width, (TABLE_CELL_HEIGHT - 2) } }, - ColourMapA[colours[1]].lighter | 0x1000000); - - screenCoords.y += TABLE_CELL_HEIGHT; + frame_no++; + InvalidateWidget(WIDX_TAB_1 + page); } - // Expenditure / Income values for each month - auto currentMonthYear = GetDate().GetMonthsElapsed(); - for (int32_t i = SummaryMaxAvailableMonth(); i >= 0; i--) + void OnMouseDown(WidgetIndex widgetIndex) override { - screenCoords.y = 0; - - uint16_t monthyear = currentMonthYear - i; - - // Month heading - auto ft = Formatter(); - ft.Add(STR_FINANCES_SUMMARY_MONTH_HEADING); - ft.Add(monthyear); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, - monthyear == currentMonthYear ? STR_WINDOW_COLOUR_2_STRINGID : STR_BLACK_STRING, ft, - { TextUnderline::On, TextAlignment::RIGHT }); - screenCoords.y += 14; - - // Month expenditures - money64 profit = 0; - for (int32_t j = 0; j < static_cast(ExpenditureType::Count); j++) + switch (page) { - auto expenditure = gExpenditureTable[i][j]; - if (expenditure != 0) - { - profit += expenditure; - const StringId format = expenditure >= 0 ? STR_FINANCES_SUMMARY_INCOME_VALUE - : STR_FINANCES_SUMMARY_EXPENDITURE_VALUE; - ft = Formatter(); - ft.Add(expenditure); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, format, ft, - { TextAlignment::RIGHT }); - } + case WINDOW_FINANCES_PAGE_SUMMARY: + OnMouseDownSummary(widgetIndex); + break; + case WINDOW_FINANCES_PAGE_RESEARCH: + WindowResearchFundingMouseDown(this, widgetIndex, WIDX_RESEARCH_FUNDING); + break; + } + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + SetPage(widgetIndex - WIDX_TAB_1); + break; + default: + switch (page) + { + case WINDOW_FINANCES_PAGE_MARKETING: + OnMouseUpMarketing(widgetIndex); + break; + case WINDOW_FINANCES_PAGE_RESEARCH: + WindowResearchFundingMouseUp(widgetIndex, WIDX_RESEARCH_FUNDING); + } + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + if (page == WINDOW_FINANCES_PAGE_RESEARCH) + { + WindowResearchFundingDropdown(widgetIndex, selectedIndex, WIDX_RESEARCH_FUNDING); + } + } + + void OnPrepareDraw() override + { + auto* targetWidgets = _windowFinancesPageWidgets[page]; + + if (widgets != targetWidgets) + { + widgets = targetWidgets; + WindowInitScrollWidgets(*this); + } + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_6); + + for (auto i = 0; i < WINDOW_FINANCES_PAGE_COUNT; i++) + SetWidgetPressed(WIDX_TAB_1 + i, false); + SetWidgetPressed(WIDX_TAB_1 + page, true); + switch (page) + { + case WINDOW_FINANCES_PAGE_SUMMARY: + OnPrepareDrawSummary(); + break; + case WINDOW_FINANCES_PAGE_MARKETING: + OnPrepareDrawMarketing(); + break; + case WINDOW_FINANCES_PAGE_RESEARCH: + WindowResearchFundingPrepareDraw(this, WIDX_RESEARCH_FUNDING); + break; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + switch (page) + { + case WINDOW_FINANCES_PAGE_SUMMARY: + OnDrawSummary(dpi); + break; + case WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH: + OnDrawFinancialGraph(dpi); + break; + case WINDOW_FINANCES_PAGE_VALUE_GRAPH: + OnDrawParkValueGraph(dpi); + break; + case WINDOW_FINANCES_PAGE_PROFIT_GRAPH: + OnDrawProfitGraph(dpi); + break; + case WINDOW_FINANCES_PAGE_MARKETING: + OnDrawMarketing(dpi); + break; + case WINDOW_FINANCES_PAGE_RESEARCH: + WindowResearchFundingDraw(this, dpi); + break; + } + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + if (page == WINDOW_FINANCES_PAGE_SUMMARY) + { + return { EXPENDITURE_COLUMN_WIDTH * (SummaryMaxAvailableMonth() + 1), 0 }; + } + + return {}; + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + if (page != WINDOW_FINANCES_PAGE_SUMMARY) + return; + + auto screenCoords = ScreenCoordsXY{ 0, TABLE_CELL_HEIGHT + 2 }; + + Widget self = widgets[WIDX_SUMMARY_SCROLL]; + int32_t row_width = std::max(scrolls[0].h_right, self.width()); + + // Expenditure / Income row labels + for (int32_t i = 0; i < static_cast(ExpenditureType::Count); i++) + { + // Darken every even row + if (i % 2 == 0) + GfxFillRect( + dpi, + { screenCoords - ScreenCoordsXY{ 0, 1 }, + screenCoords + ScreenCoordsXY{ row_width, (TABLE_CELL_HEIGHT - 2) } }, + ColourMapA[colours[1]].lighter | 0x1000000); + screenCoords.y += TABLE_CELL_HEIGHT; } - screenCoords.y += 4; - // Month profit - const StringId format = profit >= 0 ? STR_FINANCES_SUMMARY_INCOME_VALUE : STR_FINANCES_SUMMARY_LOSS_VALUE; - ft = Formatter(); - ft.Add(profit); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, format, ft, { TextAlignment::RIGHT }); + auto& gameState = GetGameState(); + // Expenditure / Income values for each month + auto currentMonthYear = GetDate().GetMonthsElapsed(); + for (int32_t i = SummaryMaxAvailableMonth(); i >= 0; i--) + { + screenCoords.y = 0; - GfxFillRect( - dpi, { screenCoords + ScreenCoordsXY{ 10, -2 }, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, -2 } }, - PALETTE_INDEX_10); + uint16_t monthyear = currentMonthYear - i; - screenCoords.x += EXPENDITURE_COLUMN_WIDTH; + // Month heading + auto ft = Formatter(); + ft.Add(STR_FINANCES_SUMMARY_MONTH_HEADING); + ft.Add(monthyear); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, + monthyear == currentMonthYear ? STR_WINDOW_COLOUR_2_STRINGID : STR_BLACK_STRING, ft, + { TextUnderline::On, TextAlignment::RIGHT }); + screenCoords.y += 14; + + // Month expenditures + money64 profit = 0; + for (int32_t j = 0; j < static_cast(ExpenditureType::Count); j++) + { + auto expenditure = gameState.ExpenditureTable[i][j]; + if (expenditure != 0) + { + profit += expenditure; + const StringId format = expenditure >= 0 ? STR_FINANCES_SUMMARY_INCOME_VALUE + : STR_FINANCES_SUMMARY_EXPENDITURE_VALUE; + ft = Formatter(); + ft.Add(expenditure); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, format, ft, + { TextAlignment::RIGHT }); + } + screenCoords.y += TABLE_CELL_HEIGHT; + } + screenCoords.y += 4; + + // Month profit + const StringId format = profit >= 0 ? STR_FINANCES_SUMMARY_INCOME_VALUE : STR_FINANCES_SUMMARY_LOSS_VALUE; + ft = Formatter(); + ft.Add(profit); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, format, ft, { TextAlignment::RIGHT }); + + GfxFillRect( + dpi, + { screenCoords + ScreenCoordsXY{ 10, -2 }, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, -2 } }, + PALETTE_INDEX_10); + + screenCoords.x += EXPENDITURE_COLUMN_WIDTH; + } + + _lastPaintedMonth = currentMonthYear; } - _lastPaintedMonth = currentMonthYear; - } - - void SetPage(int32_t p) - { - page = p; - frame_no = 0; - - hold_down_widgets = _windowFinancesPageHoldDownWidgets[p]; - pressed_widgets = 0; - widgets = _windowFinancesPageWidgets[p]; - SetDisabledTabs(); - Invalidate(); - - if (p == WINDOW_FINANCES_PAGE_RESEARCH) + void SetPage(int32_t p) { - width = WW_RESEARCH; - height = WH_RESEARCH; - } - else if (p == WINDOW_FINANCES_PAGE_SUMMARY) - { - width = WW_OTHER_TABS; - height = WH_SUMMARY; - } - else - { - width = WW_OTHER_TABS; - height = WH_OTHER_TABS; - } - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); + page = p; + frame_no = 0; - WindowInitScrollWidgets(*this); + hold_down_widgets = _windowFinancesPageHoldDownWidgets[p]; + pressed_widgets = 0; + widgets = _windowFinancesPageWidgets[p]; + SetDisabledTabs(); + Invalidate(); - // Scroll summary all the way to the right, initially. - if (p == WINDOW_FINANCES_PAGE_SUMMARY) - InitialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0); + if (p == WINDOW_FINANCES_PAGE_RESEARCH) + { + width = WW_RESEARCH; + height = WH_RESEARCH; + } + else if (p == WINDOW_FINANCES_PAGE_SUMMARY) + { + width = WW_OTHER_TABS; + height = WH_SUMMARY; + } + else + { + width = WW_OTHER_TABS; + height = WH_OTHER_TABS; + } + OnResize(); + OnPrepareDraw(); - Invalidate(); - } + WindowInitScrollWidgets(*this); + + // Scroll summary all the way to the right, initially. + if (p == WINDOW_FINANCES_PAGE_SUMMARY) + InitialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0); + + Invalidate(); + } #pragma region Summary Events - void OnMouseDownSummary(WidgetIndex widgetIndex) - { - auto& gameState = GetGameState(); - switch (widgetIndex) + void OnMouseDownSummary(WidgetIndex widgetIndex) { - case WIDX_LOAN_INCREASE: + auto& gameState = GetGameState(); + switch (widgetIndex) { - // If loan can be increased, do so. - // If not, action shows error message. - auto newLoan = gameState.BankLoan + 1000.00_GBP; - if (gameState.BankLoan < gameState.MaxBankLoan) + case WIDX_LOAN_INCREASE: { - newLoan = std::min(gameState.MaxBankLoan, newLoan); - } - auto gameAction = ParkSetLoanAction(newLoan); - GameActions::Execute(&gameAction); - break; - } - case WIDX_LOAN_DECREASE: - { - // If loan is positive, decrease it. - // If loan is negative, action shows error message. - // If loan is exactly 0, prevent error message. - if (gameState.BankLoan != 0) - { - auto newLoan = gameState.BankLoan - 1000.00_GBP; - if (gameState.BankLoan > 0) + // If loan can be increased, do so. + // If not, action shows error message. + auto newLoan = gameState.BankLoan + 1000.00_GBP; + if (gameState.BankLoan < gameState.MaxBankLoan) { - newLoan = std::max(static_cast(0LL), newLoan); + newLoan = std::min(gameState.MaxBankLoan, newLoan); } auto gameAction = ParkSetLoanAction(newLoan); GameActions::Execute(&gameAction); + break; + } + case WIDX_LOAN_DECREASE: + { + // If loan is positive, decrease it. + // If loan is negative, action shows error message. + // If loan is exactly 0, prevent error message. + if (gameState.BankLoan != 0) + { + auto newLoan = gameState.BankLoan - 1000.00_GBP; + if (gameState.BankLoan > 0) + { + newLoan = std::max(static_cast(0LL), newLoan); + } + auto gameAction = ParkSetLoanAction(newLoan); + GameActions::Execute(&gameAction); + } + break; } - break; } } - } - void OnPrepareDrawSummary() - { - // Setting loan widget's format arguments here. - // Nothing else should use the global formatter until - // drawing has completed. - auto ft = Formatter::Common(); - ft.Increment(6); - ft.Add(GetGameState().BankLoan); - - // Keep up with new months being added in the first two years. - if (GetDate().GetMonthsElapsed() != _lastPaintedMonth) - InitialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0); - } - - void OnDrawSummary(DrawPixelInfo& dpi) - { - auto screenCoords = windowPos + ScreenCoordsXY{ 8, 51 }; - auto& gameState = GetGameState(); - - // Expenditure / Income heading - DrawTextBasic( - dpi, screenCoords, STR_FINANCES_SUMMARY_EXPENDITURE_INCOME, {}, - { COLOUR_BLACK, TextUnderline::On, TextAlignment::LEFT }); - screenCoords.y += 14; - - // Expenditure / Income row labels - for (int32_t i = 0; i < static_cast(ExpenditureType::Count); i++) + void OnPrepareDrawSummary() { - // Darken every even row - if (i % 2 == 0) - GfxFillRect( - dpi, - { screenCoords - ScreenCoordsXY{ 0, 1 }, screenCoords + ScreenCoordsXY{ 121, (TABLE_CELL_HEIGHT - 2) } }, - ColourMapA[colours[1]].lighter | 0x1000000); + // Setting loan widget's format arguments here. + // Nothing else should use the global formatter until + // drawing has completed. + auto ft = Formatter::Common(); + ft.Increment(6); + ft.Add(GetGameState().BankLoan); - DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, _windowFinancesSummaryRowLabels[i]); - screenCoords.y += TABLE_CELL_HEIGHT; + // Keep up with new months being added in the first two years. + if (GetDate().GetMonthsElapsed() != _lastPaintedMonth) + InitialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0); } - // Horizontal rule below expenditure / income table - GfxFillRectInset( - dpi, { windowPos + ScreenCoordsXY{ 8, 272 }, windowPos + ScreenCoordsXY{ 8 + 513, 272 + 1 } }, colours[1], - INSET_RECT_FLAG_BORDER_INSET); - - // Loan and interest rate - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, 279 }, STR_FINANCES_SUMMARY_LOAN); - if (!(gameState.ParkFlags & PARK_FLAGS_RCT1_INTEREST)) + void OnDrawSummary(DrawPixelInfo& dpi) { - auto ft = Formatter(); - ft.Add(gameState.BankLoanInterestRate); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 167, 279 }, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft); - } + auto screenCoords = windowPos + ScreenCoordsXY{ 8, 51 }; + auto& gameState = GetGameState(); - // Current cash - auto ft = Formatter(); - ft.Add(gameState.Cash); - StringId stringId = gameState.Cash >= 0 ? STR_CASH_LABEL : STR_CASH_NEGATIVE_LABEL; - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, 294 }, stringId, ft); - - // Objective related financial information - if (gameState.ScenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME) - { - auto lastMonthProfit = FinanceGetLastMonthShopProfit(); - ft = Formatter(); - ft.Add(lastMonthProfit); + // Expenditure / Income heading DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, ft); - } - else - { - // Park value and company value - ft = Formatter(); - ft.Add(gameState.ParkValue); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_PARK_VALUE_LABEL, ft); - ft = Formatter(); - ft.Add(gameState.CompanyValue); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 294 }, STR_COMPANY_VALUE_LABEL, ft); - } - } + dpi, screenCoords, STR_FINANCES_SUMMARY_EXPENDITURE_INCOME, {}, + { COLOUR_BLACK, TextUnderline::On, TextAlignment::LEFT }); + screenCoords.y += 14; - uint16_t SummaryMaxAvailableMonth() - { - return std::min(GetDate().GetMonthsElapsed(), EXPENDITURE_TABLE_MONTH_COUNT - 1); - } + // Expenditure / Income row labels + for (int32_t i = 0; i < static_cast(ExpenditureType::Count); i++) + { + // Darken every even row + if (i % 2 == 0) + GfxFillRect( + dpi, + { screenCoords - ScreenCoordsXY{ 0, 1 }, + screenCoords + ScreenCoordsXY{ 121, (TABLE_CELL_HEIGHT - 2) } }, + ColourMapA[colours[1]].lighter | 0x1000000); + + DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, _windowFinancesSummaryRowLabels[i]); + screenCoords.y += TABLE_CELL_HEIGHT; + } + + // Horizontal rule below expenditure / income table + GfxFillRectInset( + dpi, { windowPos + ScreenCoordsXY{ 8, 272 }, windowPos + ScreenCoordsXY{ 8 + 513, 272 + 1 } }, colours[1], + INSET_RECT_FLAG_BORDER_INSET); + + // Loan and interest rate + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, 279 }, STR_FINANCES_SUMMARY_LOAN); + if (!(gameState.ParkFlags & PARK_FLAGS_RCT1_INTEREST)) + { + auto ft = Formatter(); + ft.Add(gameState.BankLoanInterestRate); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 167, 279 }, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft); + } + + // Current cash + auto ft = Formatter(); + ft.Add(gameState.Cash); + StringId stringId = gameState.Cash >= 0 ? STR_CASH_LABEL : STR_CASH_NEGATIVE_LABEL; + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, 294 }, stringId, ft); + + // Objective related financial information + if (gameState.ScenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME) + { + auto lastMonthProfit = FinanceGetLastMonthShopProfit(); + ft = Formatter(); + ft.Add(lastMonthProfit); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, + ft); + } + else + { + // Park value and company value + ft = Formatter(); + ft.Add(gameState.ParkValue); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_PARK_VALUE_LABEL, ft); + ft = Formatter(); + ft.Add(gameState.CompanyValue); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 294 }, STR_COMPANY_VALUE_LABEL, ft); + } + } + + uint16_t SummaryMaxAvailableMonth() + { + return std::min(GetDate().GetMonthsElapsed(), EXPENDITURE_TABLE_MONTH_COUNT - 1); + } #pragma endregion #pragma region Financial Graph Events - void OnDrawFinancialGraph(DrawPixelInfo& dpi) - { - Widget* pageWidget = &_windowFinancesCashWidgets[WIDX_PAGE_BACKGROUND]; - auto graphTopLeft = windowPos + ScreenCoordsXY{ pageWidget->left + 4, pageWidget->top + 15 }; - auto graphBottomRight = windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 }; - - const auto& gameState = GetGameState(); - - // Cash (less loan) - auto cashLessLoan = gameState.Cash - gameState.BankLoan; - auto ft = Formatter(); - ft.Add(cashLessLoan); - - DrawTextBasic( - dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, - cashLessLoan >= 0 ? STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_POSITIVE - : STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_NEGATIVE, - ft); - - // Graph - GfxFillRectInset(dpi, { graphTopLeft, graphBottomRight }, colours[1], INSET_RECT_F_30); - - // Calculate the Y axis scale (log2 of highest [+/-]balance) - int32_t yAxisScale = 0; - for (int32_t i = 0; i < 64; i++) + void OnDrawFinancialGraph(DrawPixelInfo& dpi) { - auto balance = gCashHistory[i]; - if (balance == kMoney64Undefined) - continue; + Widget* pageWidget = &_windowFinancesCashWidgets[WIDX_PAGE_BACKGROUND]; + auto graphTopLeft = windowPos + ScreenCoordsXY{ pageWidget->left + 4, pageWidget->top + 15 }; + auto graphBottomRight = windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 }; - // Modifier balance then keep halving until less than 127 pixels - balance = std::abs(balance) >> yAxisScale; - while (balance > 127) - { - balance /= 2; - yAxisScale++; - } - } + const auto& gameState = GetGameState(); + + // Cash (less loan) + auto cashLessLoan = gameState.Cash - gameState.BankLoan; + auto ft = Formatter(); + ft.Add(cashLessLoan); - // Y axis labels - auto coords = graphTopLeft + ScreenCoordsXY{ 18, 14 }; - money64 axisBase; - for (axisBase = 12.00_GBP; axisBase >= -12.00_GBP; axisBase -= 6.00_GBP) - { - auto axisValue = axisBase << yAxisScale; - ft = Formatter(); - ft.Add(axisValue); DrawTextBasic( - dpi, coords + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, - { FontStyle::Small, TextAlignment::RIGHT }); - GfxFillRectInset( - dpi, { coords + ScreenCoordsXY{ 70, 5 }, { graphTopLeft.x + 482, coords.y + 5 } }, colours[2], - INSET_RECT_FLAG_BORDER_INSET); - coords.y += 39; - } + dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, + cashLessLoan >= 0 ? STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_POSITIVE + : STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_NEGATIVE, + ft); - // X axis labels and values - coords = graphTopLeft + ScreenCoordsXY{ 98, 17 }; - Graph::Draw(dpi, gCashHistory, 64, coords, yAxisScale, 128); - } + // Graph + GfxFillRectInset(dpi, { graphTopLeft, graphBottomRight }, colours[1], INSET_RECT_F_30); + + // Calculate the Y axis scale (log2 of highest [+/-]balance) + int32_t yAxisScale = 0; + for (int32_t i = 0; i < 64; i++) + { + auto balance = gameState.CashHistory[i]; + if (balance == kMoney64Undefined) + continue; + + // Modifier balance then keep halving until less than 127 pixels + balance = std::abs(balance) >> yAxisScale; + while (balance > 127) + { + balance /= 2; + yAxisScale++; + } + } + + // Y axis labels + auto coords = graphTopLeft + ScreenCoordsXY{ 18, 14 }; + money64 axisBase; + for (axisBase = 12.00_GBP; axisBase >= -12.00_GBP; axisBase -= 6.00_GBP) + { + auto axisValue = axisBase << yAxisScale; + ft = Formatter(); + ft.Add(axisValue); + DrawTextBasic( + dpi, coords + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, + { FontStyle::Small, TextAlignment::RIGHT }); + GfxFillRectInset( + dpi, { coords + ScreenCoordsXY{ 70, 5 }, { graphTopLeft.x + 482, coords.y + 5 } }, colours[2], + INSET_RECT_FLAG_BORDER_INSET); + coords.y += 39; + } + + // X axis labels and values + coords = graphTopLeft + ScreenCoordsXY{ 98, 17 }; + Graph::Draw(dpi, gameState.CashHistory, 64, coords, yAxisScale, 128); + } #pragma endregion #pragma region Park Value Graph Events - void OnDrawParkValueGraph(DrawPixelInfo& dpi) - { - Widget* pageWidget = &_windowFinancesCashWidgets[WIDX_PAGE_BACKGROUND]; - auto graphTopLeft = windowPos + ScreenCoordsXY{ pageWidget->left + 4, pageWidget->top + 15 }; - auto graphBottomRight = windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 }; - - const auto& gameState = GetGameState(); - - // Park value - auto ft = Formatter(); - ft.Add(gameState.ParkValue); - DrawTextBasic(dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, STR_FINANCES_PARK_VALUE, ft); - - // Graph - GfxFillRectInset(dpi, { graphTopLeft, graphBottomRight }, colours[1], INSET_RECT_F_30); - - // Calculate the Y axis scale (log2 of highest [+/-]balance) - int32_t yAxisScale = 0; - for (int32_t i = 0; i < 64; i++) + void OnDrawParkValueGraph(DrawPixelInfo& dpi) { - auto balance = gameState.ParkValueHistory[i]; - if (balance == kMoney64Undefined) - continue; + Widget* pageWidget = &_windowFinancesCashWidgets[WIDX_PAGE_BACKGROUND]; + auto graphTopLeft = windowPos + ScreenCoordsXY{ pageWidget->left + 4, pageWidget->top + 15 }; + auto graphBottomRight = windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 }; - // Modifier balance then keep halving until less than 255 pixels - balance = std::abs(balance) >> yAxisScale; - while (balance > 255) + const auto& gameState = GetGameState(); + + // Park value + auto ft = Formatter(); + ft.Add(gameState.ParkValue); + DrawTextBasic(dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, STR_FINANCES_PARK_VALUE, ft); + + // Graph + GfxFillRectInset(dpi, { graphTopLeft, graphBottomRight }, colours[1], INSET_RECT_F_30); + + // Calculate the Y axis scale (log2 of highest [+/-]balance) + int32_t yAxisScale = 0; + for (int32_t i = 0; i < 64; i++) { - balance /= 2; - yAxisScale++; + auto balance = gameState.ParkValueHistory[i]; + if (balance == kMoney64Undefined) + continue; + + // Modifier balance then keep halving until less than 255 pixels + balance = std::abs(balance) >> yAxisScale; + while (balance > 255) + { + balance /= 2; + yAxisScale++; + } } - } - // Y axis labels - auto coords = graphTopLeft + ScreenCoordsXY{ 18, 14 }; - money64 axisBase; - for (axisBase = 24.00_GBP; axisBase >= 0.00_GBP; axisBase -= 6.00_GBP) - { - auto axisValue = axisBase << yAxisScale; - ft = Formatter(); - ft.Add(axisValue); - DrawTextBasic( - dpi, coords + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, - { FontStyle::Small, TextAlignment::RIGHT }); - GfxFillRectInset( - dpi, { coords + ScreenCoordsXY{ 70, 5 }, { graphTopLeft.x + 482, coords.y + 5 } }, colours[2], - INSET_RECT_FLAG_BORDER_INSET); - coords.y += 39; - } + // Y axis labels + auto coords = graphTopLeft + ScreenCoordsXY{ 18, 14 }; + money64 axisBase; + for (axisBase = 24.00_GBP; axisBase >= 0.00_GBP; axisBase -= 6.00_GBP) + { + auto axisValue = axisBase << yAxisScale; + ft = Formatter(); + ft.Add(axisValue); + DrawTextBasic( + dpi, coords + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, + { FontStyle::Small, TextAlignment::RIGHT }); + GfxFillRectInset( + dpi, { coords + ScreenCoordsXY{ 70, 5 }, { graphTopLeft.x + 482, coords.y + 5 } }, colours[2], + INSET_RECT_FLAG_BORDER_INSET); + coords.y += 39; + } - // X axis labels and values - coords = graphTopLeft + ScreenCoordsXY{ 98, 17 }; - Graph::Draw(dpi, gameState.ParkValueHistory, 64, coords, yAxisScale, 0); - } + // X axis labels and values + coords = graphTopLeft + ScreenCoordsXY{ 98, 17 }; + Graph::Draw(dpi, gameState.ParkValueHistory, 64, coords, yAxisScale, 0); + } #pragma endregion #pragma region Profit Graph Events - void OnDrawProfitGraph(DrawPixelInfo& dpi) - { - auto& gameState = GetGameState(); - Widget* pageWidget = &_windowFinancesCashWidgets[WIDX_PAGE_BACKGROUND]; - auto graphTopLeft = windowPos + ScreenCoordsXY{ pageWidget->left + 4, pageWidget->top + 15 }; - auto graphBottomRight = windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 }; - - // Weekly profit - auto ft = Formatter(); - ft.Add(gameState.CurrentProfit); - DrawTextBasic( - dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, - gameState.CurrentProfit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE : STR_FINANCES_WEEKLY_PROFIT_LOSS, ft); - - // Graph - GfxFillRectInset(dpi, { graphTopLeft, graphBottomRight }, colours[1], INSET_RECT_F_30); - - // Calculate the Y axis scale (log2 of highest [+/-]balance) - int32_t yAxisScale = 0; - for (int32_t i = 0; i < 64; i++) + void OnDrawProfitGraph(DrawPixelInfo& dpi) { - auto balance = gameState.WeeklyProfitHistory[i]; - if (balance == kMoney64Undefined) - continue; + auto& gameState = GetGameState(); + Widget* pageWidget = &_windowFinancesCashWidgets[WIDX_PAGE_BACKGROUND]; + auto graphTopLeft = windowPos + ScreenCoordsXY{ pageWidget->left + 4, pageWidget->top + 15 }; + auto graphBottomRight = windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 }; - // Modifier balance then keep halving until less than 127 pixels - balance = std::abs(balance) >> yAxisScale; - while (balance > 127) - { - balance /= 2; - yAxisScale++; - } - } - - // Y axis labels - auto screenPos = graphTopLeft + ScreenCoordsXY{ 18, 14 }; - money64 axisBase; - for (axisBase = 12.00_GBP; axisBase >= -12.00_GBP; axisBase -= 6.00_GBP) - { - money64 axisValue = axisBase << yAxisScale; - ft = Formatter(); - ft.Add(axisValue); + // Weekly profit + auto ft = Formatter(); + ft.Add(gameState.CurrentProfit); DrawTextBasic( - dpi, screenPos + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, - { FontStyle::Small, TextAlignment::RIGHT }); - GfxFillRectInset( - dpi, { screenPos + ScreenCoordsXY{ 70, 5 }, { graphTopLeft.x + 482, screenPos.y + 5 } }, colours[2], - INSET_RECT_FLAG_BORDER_INSET); - screenPos.y += 39; - } + dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, + gameState.CurrentProfit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE : STR_FINANCES_WEEKLY_PROFIT_LOSS, ft); - // X axis labels and values - screenPos = graphTopLeft + ScreenCoordsXY{ 98, 17 }; - Graph::Draw(dpi, gameState.WeeklyProfitHistory, 64, screenPos, yAxisScale, 128); - } + // Graph + GfxFillRectInset(dpi, { graphTopLeft, graphBottomRight }, colours[1], INSET_RECT_F_30); + + // Calculate the Y axis scale (log2 of highest [+/-]balance) + int32_t yAxisScale = 0; + for (int32_t i = 0; i < 64; i++) + { + auto balance = gameState.WeeklyProfitHistory[i]; + if (balance == kMoney64Undefined) + continue; + + // Modifier balance then keep halving until less than 127 pixels + balance = std::abs(balance) >> yAxisScale; + while (balance > 127) + { + balance /= 2; + yAxisScale++; + } + } + + // Y axis labels + auto screenPos = graphTopLeft + ScreenCoordsXY{ 18, 14 }; + money64 axisBase; + for (axisBase = 12.00_GBP; axisBase >= -12.00_GBP; axisBase -= 6.00_GBP) + { + money64 axisValue = axisBase << yAxisScale; + ft = Formatter(); + ft.Add(axisValue); + DrawTextBasic( + dpi, screenPos + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, + { FontStyle::Small, TextAlignment::RIGHT }); + GfxFillRectInset( + dpi, { screenPos + ScreenCoordsXY{ 70, 5 }, { graphTopLeft.x + 482, screenPos.y + 5 } }, colours[2], + INSET_RECT_FLAG_BORDER_INSET); + screenPos.y += 39; + } + + // X axis labels and values + screenPos = graphTopLeft + ScreenCoordsXY{ 98, 17 }; + Graph::Draw(dpi, gameState.WeeklyProfitHistory, 64, screenPos, yAxisScale, 128); + } #pragma endregion #pragma region Marketing Events - void OnMouseUpMarketing(WidgetIndex widgetIndex) - { - if (widgetIndex >= WIDX_CAMPAIGN_1 && widgetIndex <= WIDX_CAMPAIGN_6) + void OnMouseUpMarketing(WidgetIndex widgetIndex) { - ContextOpenDetailWindow(WD_NEW_CAMPAIGN, widgetIndex - WIDX_CAMPAIGN_1); - } - } - - void OnPrepareDrawMarketing() - { - // Count number of active campaigns - int32_t numActiveCampaigns = static_cast(gMarketingCampaigns.size()); - int32_t y = std::max(1, numActiveCampaigns) * LIST_ROW_HEIGHT + 92; - - // Update group box positions - _windowFinancesMarketingWidgets[WIDX_ACTIVE_CAMPAIGNS_GROUP].bottom = y - 22; - _windowFinancesMarketingWidgets[WIDX_CAMPAIGNS_AVAILABLE_GROUP].top = y - 13; - - // Update new campaign button visibility - y += 3; - for (int32_t i = 0; i < ADVERTISING_CAMPAIGN_COUNT; i++) - { - auto campaignButton = &_windowFinancesMarketingWidgets[WIDX_CAMPAIGN_1 + i]; - auto marketingCampaign = MarketingGetCampaign(i); - if (marketingCampaign == nullptr && MarketingIsCampaignTypeApplicable(i)) + if (widgetIndex >= WIDX_CAMPAIGN_1 && widgetIndex <= WIDX_CAMPAIGN_6) { - campaignButton->type = WindowWidgetType::Button; - campaignButton->top = y; - campaignButton->bottom = y + BUTTON_FACE_HEIGHT + 1; - y += BUTTON_FACE_HEIGHT + 2; - } - else - { - campaignButton->type = WindowWidgetType::Empty; + ContextOpenDetailWindow(WD_NEW_CAMPAIGN, widgetIndex - WIDX_CAMPAIGN_1); } } - } - void OnDrawMarketing(DrawPixelInfo& dpi) - { - auto screenCoords = windowPos + ScreenCoordsXY{ 8, 62 }; - int32_t noCampaignsActive = 1; - for (int32_t i = 0; i < ADVERTISING_CAMPAIGN_COUNT; i++) + void OnPrepareDrawMarketing() { - auto marketingCampaign = MarketingGetCampaign(i); - if (marketingCampaign == nullptr) - continue; + // Count number of active campaigns + int32_t numActiveCampaigns = static_cast(gMarketingCampaigns.size()); + int32_t y = std::max(1, numActiveCampaigns) * LIST_ROW_HEIGHT + 92; - noCampaignsActive = 0; - auto ft = Formatter(); + // Update group box positions + _windowFinancesMarketingWidgets[WIDX_ACTIVE_CAMPAIGNS_GROUP].bottom = y - 22; + _windowFinancesMarketingWidgets[WIDX_CAMPAIGNS_AVAILABLE_GROUP].top = y - 13; - // Set special parameters - switch (i) + // Update new campaign button visibility + y += 3; + for (int32_t i = 0; i < ADVERTISING_CAMPAIGN_COUNT; i++) { - case ADVERTISING_CAMPAIGN_RIDE_FREE: - case ADVERTISING_CAMPAIGN_RIDE: + auto campaignButton = &_windowFinancesMarketingWidgets[WIDX_CAMPAIGN_1 + i]; + auto marketingCampaign = MarketingGetCampaign(i); + if (marketingCampaign == nullptr && MarketingIsCampaignTypeApplicable(i)) { - auto campaignRide = GetRide(marketingCampaign->RideId); - if (campaignRide != nullptr) - { - campaignRide->FormatNameTo(ft); - } - else - { - ft.Add(STR_NONE); - } - break; + campaignButton->type = WindowWidgetType::Button; + campaignButton->top = y; + campaignButton->bottom = y + BUTTON_FACE_HEIGHT + 1; + y += BUTTON_FACE_HEIGHT + 2; } - case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE: - ft.Add(GetShopItemDescriptor(marketingCampaign->ShopItemType).Naming.Plural); - break; - default: + else { - auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); - auto parkName = park.Name.c_str(); - ft.Add(STR_STRING); - ft.Add(parkName); + campaignButton->type = WindowWidgetType::Empty; } } - // Advertisement - DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, 296, MarketingCampaignNames[i][1], ft); - - // Duration - uint16_t weeksRemaining = marketingCampaign->WeeksLeft; - ft = Formatter(); - ft.Add(weeksRemaining); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 304, 0 }, - weeksRemaining == 1 ? STR_1_WEEK_REMAINING : STR_X_WEEKS_REMAINING, ft); - - screenCoords.y += LIST_ROW_HEIGHT; } - if (noCampaignsActive) + void OnDrawMarketing(DrawPixelInfo& dpi) { - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, STR_MARKETING_CAMPAIGNS_NONE); - screenCoords.y += LIST_ROW_HEIGHT; - } - screenCoords.y += 34; - - // Draw campaign button text - for (int32_t i = 0; i < ADVERTISING_CAMPAIGN_COUNT; i++) - { - auto campaignButton = &_windowFinancesMarketingWidgets[WIDX_CAMPAIGN_1 + i]; - if (campaignButton->type != WindowWidgetType::Empty) + auto screenCoords = windowPos + ScreenCoordsXY{ 8, 62 }; + int32_t noCampaignsActive = 1; + for (int32_t i = 0; i < ADVERTISING_CAMPAIGN_COUNT; i++) { - // Draw button text - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, MarketingCampaignNames[i][0]); + auto marketingCampaign = MarketingGetCampaign(i); + if (marketingCampaign == nullptr) + continue; + + noCampaignsActive = 0; auto ft = Formatter(); - ft.Add(AdvertisingCampaignPricePerWeek[i]); - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ WH_SUMMARY, 0 }, STR_MARKETING_PER_WEEK, ft); - screenCoords.y += BUTTON_FACE_HEIGHT + 2; + // Set special parameters + switch (i) + { + case ADVERTISING_CAMPAIGN_RIDE_FREE: + case ADVERTISING_CAMPAIGN_RIDE: + { + auto campaignRide = GetRide(marketingCampaign->RideId); + if (campaignRide != nullptr) + { + campaignRide->FormatNameTo(ft); + } + else + { + ft.Add(STR_NONE); + } + break; + } + case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE: + ft.Add(GetShopItemDescriptor(marketingCampaign->ShopItemType).Naming.Plural); + break; + default: + { + auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); + auto parkName = park.Name.c_str(); + ft.Add(STR_STRING); + ft.Add(parkName); + } + } + // Advertisement + DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, 296, MarketingCampaignNames[i][1], ft); + + // Duration + uint16_t weeksRemaining = marketingCampaign->WeeksLeft; + ft = Formatter(); + ft.Add(weeksRemaining); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 304, 0 }, + weeksRemaining == 1 ? STR_1_WEEK_REMAINING : STR_X_WEEKS_REMAINING, ft); + + screenCoords.y += LIST_ROW_HEIGHT; + } + + if (noCampaignsActive) + { + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, STR_MARKETING_CAMPAIGNS_NONE); + screenCoords.y += LIST_ROW_HEIGHT; + } + screenCoords.y += 34; + + // Draw campaign button text + for (int32_t i = 0; i < ADVERTISING_CAMPAIGN_COUNT; i++) + { + auto campaignButton = &_windowFinancesMarketingWidgets[WIDX_CAMPAIGN_1 + i]; + if (campaignButton->type != WindowWidgetType::Empty) + { + // Draw button text + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, MarketingCampaignNames[i][0]); + auto ft = Formatter(); + ft.Add(AdvertisingCampaignPricePerWeek[i]); + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ WH_SUMMARY, 0 }, STR_MARKETING_PER_WEEK, ft); + + screenCoords.y += BUTTON_FACE_HEIGHT + 2; + } } } - } #pragma endregion - void InitialiseScrollPosition(WidgetIndex widgetIndex, int32_t scrollId) - { - const auto& widget = this->widgets[widgetIndex]; - scrolls[scrollId].h_left = std::max(0, scrolls[scrollId].h_right - (widget.width() - 2)); - - WidgetScrollUpdateThumbs(*this, widgetIndex); - } - - void DrawTabImage(DrawPixelInfo& dpi, int32_t tabPage, int32_t spriteIndex) - { - WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage; - - if (!IsWidgetDisabled(widgetIndex)) + void InitialiseScrollPosition(WidgetIndex widgetIndex, int32_t scrollId) { - if (this->page == tabPage) - { - int32_t frame = frame_no / 2; - spriteIndex += (frame % _windowFinancesTabAnimationFrames[this->page]); - } + const auto& widget = this->widgets[widgetIndex]; + scrolls[scrollId].h_left = std::max(0, scrolls[scrollId].h_right - (widget.width() - 2)); - GfxDrawSprite( - dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); + WidgetScrollUpdateThumbs(*this, widgetIndex); } - } - void DrawTabImages(DrawPixelInfo& dpi) + void DrawTabImage(DrawPixelInfo& dpi, int32_t tabPage, int32_t spriteIndex) + { + WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage; + + if (!IsWidgetDisabled(widgetIndex)) + { + if (this->page == tabPage) + { + int32_t frame = frame_no / 2; + spriteIndex += (frame % _windowFinancesTabAnimationFrames[this->page]); + } + + GfxDrawSprite( + dpi, ImageId(spriteIndex), + windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); + } + } + + void DrawTabImages(DrawPixelInfo& dpi) + { + DrawTabImage(dpi, WINDOW_FINANCES_PAGE_SUMMARY, SPR_TAB_FINANCES_SUMMARY_0); + DrawTabImage(dpi, WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH, SPR_TAB_FINANCES_FINANCIAL_GRAPH_0); + DrawTabImage(dpi, WINDOW_FINANCES_PAGE_VALUE_GRAPH, SPR_TAB_FINANCES_VALUE_GRAPH_0); + DrawTabImage(dpi, WINDOW_FINANCES_PAGE_PROFIT_GRAPH, SPR_TAB_FINANCES_PROFIT_GRAPH_0); + DrawTabImage(dpi, WINDOW_FINANCES_PAGE_MARKETING, SPR_TAB_FINANCES_MARKETING_0); + DrawTabImage(dpi, WINDOW_FINANCES_PAGE_RESEARCH, SPR_TAB_FINANCES_RESEARCH_0); + } + + void OnResize() override + { + ResizeFrameWithPage(); + } + }; + + static FinancesWindow* FinancesWindowOpen(uint8_t page) { - DrawTabImage(dpi, WINDOW_FINANCES_PAGE_SUMMARY, SPR_TAB_FINANCES_SUMMARY_0); - DrawTabImage(dpi, WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH, SPR_TAB_FINANCES_FINANCIAL_GRAPH_0); - DrawTabImage(dpi, WINDOW_FINANCES_PAGE_VALUE_GRAPH, SPR_TAB_FINANCES_VALUE_GRAPH_0); - DrawTabImage(dpi, WINDOW_FINANCES_PAGE_PROFIT_GRAPH, SPR_TAB_FINANCES_PROFIT_GRAPH_0); - DrawTabImage(dpi, WINDOW_FINANCES_PAGE_MARKETING, SPR_TAB_FINANCES_MARKETING_0); - DrawTabImage(dpi, WINDOW_FINANCES_PAGE_RESEARCH, SPR_TAB_FINANCES_RESEARCH_0); + auto* window = WindowFocusOrCreate(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10); + + if (window != nullptr && page != WINDOW_FINANCES_PAGE_SUMMARY) + window->SetPage(page); + + return window; } - void OnResize() override + WindowBase* FinancesOpen() { - ResizeFrameWithPage(); + return WindowFocusOrCreate(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10); } -}; -static FinancesWindow* FinancesWindowOpen(uint8_t page) -{ - auto* window = WindowFocusOrCreate(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10); + WindowBase* FinancesResearchOpen() + { + return FinancesWindowOpen(WINDOW_FINANCES_PAGE_RESEARCH); + } - if (window != nullptr && page != WINDOW_FINANCES_PAGE_SUMMARY) - window->SetPage(page); - - return window; -} - -WindowBase* WindowFinancesOpen() -{ - return WindowFocusOrCreate(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10); -} - -WindowBase* WindowFinancesResearchOpen() -{ - return FinancesWindowOpen(WINDOW_FINANCES_PAGE_RESEARCH); -} - -WindowBase* WindowFinancesMarketingOpen() -{ - return FinancesWindowOpen(WINDOW_FINANCES_PAGE_MARKETING); -} + WindowBase* FinancesMarketingOpen() + { + return FinancesWindowOpen(WINDOW_FINANCES_PAGE_MARKETING); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index d24ffce194..31b63b6115 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -34,10 +34,9 @@ #include #include -using namespace OpenRCT2; -using namespace OpenRCT2::Ui; - -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum { PATH_CONSTRUCTION_MODE_LAND, @@ -112,7 +111,7 @@ static Widget window_footpath_widgets[] = { MakeWidget({ 3, 361}, {100, 54}, WindowWidgetType::Groupbox, WindowColour::Primary ), MakeWidget({13, 372}, { 36, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_CONSTRUCTION_FOOTPATH_LAND), STR_CONSTRUCT_FOOTPATH_ON_LAND_TIP ), MakeWidget({57, 372}, { 36, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_CONSTRUCTION_FOOTPATH_BRIDGE), STR_CONSTRUCT_BRIDGE_OR_TUNNEL_FOOTPATH_TIP ), - WIDGETS_END, + kWidgetsEnd, }; #pragma endregion @@ -143,692 +142,793 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = { { 16, 17, 18, 19 }, // Upwards { 18, 19, 16, 17 }, // Downwards }; -// clang-format on + // clang-format on -class FootpathWindow final : public Window -{ -private: - const uint16_t ARROW_PULSE_DURATION = 200; + class FootpathWindow final : public Window + { + private: + const uint16_t ARROW_PULSE_DURATION = 200; - uint8_t _footpathConstructDirection; - uint8_t _footpathConstructValidDirections; - uint8_t _footpathConstructionMode; + uint8_t _footpathConstructDirection; + uint8_t _footpathConstructValidDirections; + uint8_t _footpathConstructionMode; - std::vector> _dropdownEntries; + std::vector> _dropdownEntries; - money64 _windowFootpathCost; - uint32_t _footpathConstructionNextArrowPulse = 0; - uint8_t _lastUpdatedCameraRotation = UINT8_MAX; - bool _footpathErrorOccured = false; + money64 _windowFootpathCost; + uint32_t _footpathConstructionNextArrowPulse = 0; + uint8_t _lastUpdatedCameraRotation = UINT8_MAX; + bool _footpathErrorOccured = false; -public: + public: #pragma region Window Override Events - void OnOpen() override - { - widgets = window_footpath_widgets; - - WindowInitScrollWidgets(*this); - WindowPushOthersRight(*this); - ShowGridlines(); - - ToolCancel(); - _footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND; - ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::PathDown); - InputSetFlag(INPUT_FLAG_6, true); - _footpathErrorOccured = false; - WindowFootpathSetEnabledAndPressedWidgets(); - } - - void OnClose() override - { - FootpathProvisionalUpdate(); - ViewportSetVisibility(ViewportVisibility::Default); - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - WindowInvalidateByClass(WindowClass::TopToolbar); - HideGridlines(); - } - - void OnUpdate() override - { - WidgetInvalidate(*this, WIDX_CONSTRUCT); - WindowFootpathUpdateProvisionalPathForBridgeMode(); - - // #2502: The camera might have changed rotation, so we need to update which directional buttons are pressed - uint8_t currentRotation = GetCurrentRotation(); - if (_lastUpdatedCameraRotation != currentRotation) + void OnOpen() override { - _lastUpdatedCameraRotation = currentRotation; + widgets = window_footpath_widgets; + + WindowInitScrollWidgets(*this); + WindowPushOthersRight(*this); + ShowGridlines(); + + ToolCancel(); + _footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND; + ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::PathDown); + InputSetFlag(INPUT_FLAG_6, true); + _footpathErrorOccured = false; WindowFootpathSetEnabledAndPressedWidgets(); } - // Check tool - if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_LAND) + void OnClose() override { - if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) - { - Close(); - } - else if (gCurrentToolWidget.window_classification != WindowClass::Footpath) - { - Close(); - } - else if (gCurrentToolWidget.widget_index != WIDX_CONSTRUCT_ON_LAND) - { - Close(); - } - } - else if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL_TOOL) - { - if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) - { - Close(); - } - else if (gCurrentToolWidget.window_classification != WindowClass::Footpath) - { - Close(); - } - else if (gCurrentToolWidget.widget_index != WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL) - { - Close(); - } - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_FOOTPATH_TYPE: - WindowFootpathShowFootpathTypesDialog(&window_footpath_widgets[widgetIndex], false); - break; - case WIDX_QUEUELINE_TYPE: - WindowFootpathShowFootpathTypesDialog(&window_footpath_widgets[widgetIndex], true); - break; - case WIDX_RAILINGS_TYPE: - WindowFootpathShowRailingsTypesDialog(&window_footpath_widgets[widgetIndex]); - break; - case WIDX_DIRECTION_NW: - WindowFootpathMousedownDirection(0); - break; - case WIDX_DIRECTION_NE: - WindowFootpathMousedownDirection(1); - break; - case WIDX_DIRECTION_SW: - WindowFootpathMousedownDirection(2); - break; - case WIDX_DIRECTION_SE: - WindowFootpathMousedownDirection(3); - break; - case WIDX_SLOPEDOWN: - WindowFootpathMousedownSlope(6); - break; - case WIDX_LEVEL: - WindowFootpathMousedownSlope(0); - break; - case WIDX_SLOPEUP: - WindowFootpathMousedownSlope(2); - break; - } - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_CONSTRUCT: - WindowFootpathConstruct(); - break; - case WIDX_REMOVE: - WindowFootpathRemove(); - break; - case WIDX_CONSTRUCT_ON_LAND: - if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_LAND) - { - break; - } - - _windowFootpathCost = kMoney64Undefined; - ToolCancel(); - FootpathProvisionalUpdate(); - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - _footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND; - ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::PathDown); - InputSetFlag(INPUT_FLAG_6, true); - _footpathErrorOccured = false; - WindowFootpathSetEnabledAndPressedWidgets(); - break; - case WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL: - if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL_TOOL) - { - break; - } - - _windowFootpathCost = kMoney64Undefined; - ToolCancel(); - FootpathProvisionalUpdate(); - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - _footpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL_TOOL; - ToolSet(*this, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, Tool::Crosshair); - InputSetFlag(INPUT_FLAG_6, true); - _footpathErrorOccured = false; - WindowFootpathSetEnabledAndPressedWidgets(); - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - if (selectedIndex < 0 || static_cast(selectedIndex) >= _dropdownEntries.size()) - return; - - auto entryIndex = _dropdownEntries[selectedIndex]; - if (widgetIndex == WIDX_FOOTPATH_TYPE) - { - gFootpathSelection.IsQueueSelected = false; - if (entryIndex.first == ObjectType::Paths) - { - gFootpathSelection.LegacyPath = entryIndex.second; - } - else - { - gFootpathSelection.LegacyPath = OBJECT_ENTRY_INDEX_NULL; - gFootpathSelection.NormalSurface = entryIndex.second; - } - } - else if (widgetIndex == WIDX_QUEUELINE_TYPE) - { - gFootpathSelection.IsQueueSelected = true; - if (entryIndex.first == ObjectType::Paths) - { - gFootpathSelection.LegacyPath = entryIndex.second; - } - else - { - gFootpathSelection.LegacyPath = OBJECT_ENTRY_INDEX_NULL; - gFootpathSelection.QueueSurface = entryIndex.second; - } - } - else if (widgetIndex == WIDX_RAILINGS_TYPE) - { - gFootpathSelection.Railings = entryIndex.second; - } - else - { - return; - } - - FootpathProvisionalUpdate(); - _windowFootpathCost = kMoney64Undefined; - Invalidate(); - } - - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) - { - WindowFootpathSetProvisionalPathAtPoint(screenCoords); - } - else if (widgetIndex == WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL) - { - WindowFootpathSetSelectionStartBridgeAtPoint(screenCoords); - } - } - - void OnToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY&) override - { - if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) - { - _footpathErrorOccured = false; - } - } - - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) - { - WindowFootpathPlacePathAtPoint(screenCoords); - } - else if (widgetIndex == WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL) - { - WindowFootpathStartBridgeAtPoint(screenCoords); - } - } - - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) - { - WindowFootpathPlacePathAtPoint(screenCoords); - } - } - - void OnPrepareDraw() override - { - // Press / unpress footpath and queue type buttons - pressed_widgets &= ~(1uLL << WIDX_FOOTPATH_TYPE); - pressed_widgets &= ~(1uLL << WIDX_QUEUELINE_TYPE); - pressed_widgets |= gFootpathSelection.IsQueueSelected ? (1uLL << WIDX_QUEUELINE_TYPE) : (1uLL << WIDX_FOOTPATH_TYPE); - - // Enable / disable construct button - window_footpath_widgets[WIDX_CONSTRUCT].type = _footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL - ? WindowWidgetType::ImgBtn - : WindowWidgetType::Empty; - - if (gFootpathSelection.LegacyPath == OBJECT_ENTRY_INDEX_NULL) - { - window_footpath_widgets[WIDX_RAILINGS_TYPE].type = WindowWidgetType::FlatBtn; - } - else - { - window_footpath_widgets[WIDX_RAILINGS_TYPE].type = WindowWidgetType::Empty; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - ScreenCoordsXY screenCoords; - WindowDrawWidgets(*this, dpi); - WindowFootpathDrawDropdownButtons(dpi); - - if (!IsWidgetDisabled(WIDX_CONSTRUCT)) - { - // Get construction image - uint8_t direction = (_footpathConstructDirection + GetCurrentRotation()) % 4; - uint8_t slope = 0; - if (gFootpathConstructSlope == 2) - { - slope = TILE_ELEMENT_SLOPE_N_CORNER_UP; - } - else if (gFootpathConstructSlope == 6) - { - slope = TILE_ELEMENT_SLOPE_E_CORNER_UP; - } - - std::optional baseImage; - if (gFootpathSelection.LegacyPath == OBJECT_ENTRY_INDEX_NULL) - { - auto selectedPath = gFootpathSelection.GetSelectedSurface(); - const auto* pathType = GetPathSurfaceEntry(selectedPath); - if (pathType != nullptr) - { - baseImage = pathType->BaseImageId; - } - } - else - { - auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); - auto* pathObj = static_cast( - objManager.GetLoadedObject(ObjectType::Paths, gFootpathSelection.LegacyPath)); - if (pathObj != nullptr) - { - auto pathEntry = reinterpret_cast(pathObj->GetLegacyData()); - if (gFootpathSelection.IsQueueSelected) - baseImage = pathEntry->GetQueueImage(); - else - baseImage = pathEntry->image; - } - } - - if (baseImage) - { - auto image = *baseImage + ConstructionPreviewImages[slope][direction]; - - // Draw construction image - screenCoords = this->windowPos - + ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(), - window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60 }; - GfxDrawSprite(dpi, ImageId(image), screenCoords); - } - - // Draw build this... label - screenCoords = this->windowPos - + ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(), - window_footpath_widgets[WIDX_CONSTRUCT].bottom - 23 }; - DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); - } - - // Draw cost - screenCoords = this->windowPos - + ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(), - window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12 }; - if (_windowFootpathCost != kMoney64Undefined) - { - if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) - { - auto ft = Formatter(); - ft.Add(_windowFootpathCost); - DrawTextBasic(dpi, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); - } - } - } - -#pragma endregion - -private: - /** - * - * rct2: 0x006A7760 - */ - void WindowFootpathUpdateProvisionalPathForBridgeMode() - { - if (_footpathConstructionMode != PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) - { - return; - } - - // Recheck area for construction. Set by ride_construction window - if (gProvisionalFootpath.Flags & PROVISIONAL_PATH_FLAG_2) - { - FootpathProvisionalRemove(); - gProvisionalFootpath.Flags &= ~PROVISIONAL_PATH_FLAG_2; - } - - // Update provisional bridge mode path - if (!(gProvisionalFootpath.Flags & PROVISIONAL_PATH_FLAG_1)) - { - ObjectEntryIndex type; - ObjectEntryIndex railings = gFootpathSelection.Railings; - - CoordsXYZ footpathLoc; - int32_t slope; - FootpathGetNextPathInfo(&type, footpathLoc, &slope); - auto pathConstructFlags = FootpathCreateConstructFlags(type); - - _windowFootpathCost = FootpathProvisionalSet(type, railings, footpathLoc, slope, pathConstructFlags); - WidgetInvalidate(*this, WIDX_CONSTRUCT); - } - - auto curTime = Platform::GetTicks(); - - // Update little directional arrow on provisional bridge mode path - if (_footpathConstructionNextArrowPulse < curTime) - { - _footpathConstructionNextArrowPulse = curTime + ARROW_PULSE_DURATION; - - gProvisionalFootpath.Flags ^= PROVISIONAL_PATH_FLAG_SHOW_ARROW; - CoordsXYZ footpathLoc; - int32_t slope; - FootpathGetNextPathInfo(nullptr, footpathLoc, &slope); - gMapSelectArrowPosition = footpathLoc; - gMapSelectArrowDirection = _footpathConstructDirection; - if (gProvisionalFootpath.Flags & PROVISIONAL_PATH_FLAG_SHOW_ARROW) - { - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; - } - else - { - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - } - MapInvalidateTileFull(footpathLoc); - } - } - - void WindowFootpathDrawDropdownButtons(DrawPixelInfo& dpi) - { - if (gFootpathSelection.LegacyPath == OBJECT_ENTRY_INDEX_NULL) - { - // Set footpath and queue type button images - auto pathImage = static_cast(SPR_NONE); - auto queueImage = static_cast(SPR_NONE); - auto pathEntry = GetPathSurfaceEntry(gFootpathSelection.NormalSurface); - if (pathEntry != nullptr) - { - pathImage = pathEntry->PreviewImageId; - } - - pathEntry = GetPathSurfaceEntry(gFootpathSelection.QueueSurface); - if (pathEntry != nullptr) - { - queueImage = pathEntry->PreviewImageId; - } - - WindowFootpathDrawDropdownButton(dpi, WIDX_FOOTPATH_TYPE, pathImage); - WindowFootpathDrawDropdownButton(dpi, WIDX_QUEUELINE_TYPE, queueImage); - - // Set railing - auto railingsImage = static_cast(SPR_NONE); - auto railingsEntry = GetPathRailingsEntry(gFootpathSelection.Railings); - if (railingsEntry != nullptr) - { - railingsImage = railingsEntry->PreviewImageId; - } - WindowFootpathDrawDropdownButton(dpi, WIDX_RAILINGS_TYPE, railingsImage); - } - else - { - auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); - - // Set footpath and queue type button images - auto pathImage = static_cast(SPR_NONE); - auto queueImage = static_cast(SPR_NONE); - auto pathObj = static_cast( - objManager.GetLoadedObject(ObjectType::Paths, gFootpathSelection.LegacyPath)); - if (pathObj != nullptr) - { - auto pathEntry = reinterpret_cast(pathObj->GetLegacyData()); - pathImage = pathEntry->GetPreviewImage(); - queueImage = pathEntry->GetQueuePreviewImage(); - } - - WindowFootpathDrawDropdownButton(dpi, WIDX_FOOTPATH_TYPE, pathImage); - WindowFootpathDrawDropdownButton(dpi, WIDX_QUEUELINE_TYPE, queueImage); - } - } - - void WindowFootpathDrawDropdownButton(DrawPixelInfo& dpi, WidgetIndex widgetIndex, ImageIndex image) - { - const auto& widget = widgets[widgetIndex]; - GfxDrawSprite(dpi, ImageId(image), { windowPos.x + widget.left, windowPos.y + widget.top }); - } - - /** - * - * rct2: 0x006A7F88 - */ - void WindowFootpathShowFootpathTypesDialog(Widget* widget, bool showQueues) - { - auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); - - uint32_t numPathTypes = 0; - // If the game is in sandbox mode, also show paths that are normally restricted to the scenario editor - bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode); - - _dropdownEntries.clear(); - std::optional defaultIndex; - for (ObjectEntryIndex i = 0; i < MAX_FOOTPATH_SURFACE_OBJECTS; i++) - { - const auto* pathType = static_cast( - objManager.GetLoadedObject(ObjectType::FootpathSurface, i)); - if (pathType == nullptr) - { - continue; - } - if ((pathType->Flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR) && !showEditorPaths) - { - continue; - } - // If regular paths can be used as queue, only hide the path if we’re _not_ looking at a queue, - // but the path surface is one. - if (gCheatsAllowRegularPathAsQueue && !showQueues && ((pathType->Flags & FOOTPATH_ENTRY_FLAG_IS_QUEUE) != 0)) - { - continue; - } - // If the cheat is disabled, hide queues from the regular path view and vice versa. - else if (!gCheatsAllowRegularPathAsQueue && showQueues != ((pathType->Flags & FOOTPATH_ENTRY_FLAG_IS_QUEUE) != 0)) - { - continue; - } - - if (gFootpathSelection.LegacyPath == OBJECT_ENTRY_INDEX_NULL - && i == (showQueues ? gFootpathSelection.QueueSurface : gFootpathSelection.NormalSurface)) - { - defaultIndex = numPathTypes; - } - - gDropdownItems[numPathTypes].Format = STR_NONE; - Dropdown::SetImage(numPathTypes, ImageId(pathType->PreviewImageId)); - _dropdownEntries.push_back({ ObjectType::FootpathSurface, i }); - numPathTypes++; - } - - for (ObjectEntryIndex i = 0; i < MAX_PATH_OBJECTS; i++) - { - auto* pathObj = static_cast(objManager.GetLoadedObject(ObjectType::Paths, i)); - if (pathObj == nullptr) - { - continue; - } - - auto pathEntry = reinterpret_cast(pathObj->GetLegacyData()); - if ((pathEntry->flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR) && !showEditorPaths) - { - continue; - } - - if (gFootpathSelection.LegacyPath != OBJECT_ENTRY_INDEX_NULL && gFootpathSelection.LegacyPath == i) - { - defaultIndex = numPathTypes; - } - - gDropdownItems[numPathTypes].Format = STR_NONE; - Dropdown::SetImage( - numPathTypes, ImageId(showQueues ? pathEntry->GetQueuePreviewImage() : pathEntry->GetPreviewImage())); - _dropdownEntries.push_back({ ObjectType::Paths, i }); - numPathTypes++; - } - - auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(numPathTypes); - WindowDropdownShowImage( - windowPos.x + widget->left, windowPos.y + widget->top, widget->height() + 1, colours[1], 0, numPathTypes, 47, 36, - itemsPerRow); - if (defaultIndex) - gDropdownDefaultIndex = static_cast(*defaultIndex); - } - - void WindowFootpathShowRailingsTypesDialog(Widget* widget) - { - uint32_t numRailingsTypes = 0; - // If the game is in sandbox mode, also show paths that are normally restricted to the scenario editor - - _dropdownEntries.clear(); - std::optional defaultIndex; - for (int32_t i = 0; i < MAX_FOOTPATH_RAILINGS_OBJECTS; i++) - { - const auto* railingsEntry = GetPathRailingsEntry(i); - if (railingsEntry == nullptr) - { - continue; - } - if (i == gFootpathSelection.Railings) - { - defaultIndex = numRailingsTypes; - } - - gDropdownItems[numRailingsTypes].Format = STR_NONE; - Dropdown::SetImage(numRailingsTypes, ImageId(railingsEntry->PreviewImageId)); - _dropdownEntries.push_back({ ObjectType::FootpathRailings, i }); - numRailingsTypes++; - } - - auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(numRailingsTypes); - WindowDropdownShowImage( - windowPos.x + widget->left, windowPos.y + widget->top, widget->height() + 1, colours[1], 0, numRailingsTypes, 47, - 36, itemsPerRow); - if (defaultIndex) - gDropdownDefaultIndex = static_cast(*defaultIndex); - } - - /** - * - * rct2: 0x006A8111 0x006A8135 0x006A815C 0x006A8183 - */ - void WindowFootpathMousedownDirection(int32_t direction) - { - FootpathProvisionalUpdate(); - _footpathConstructDirection = (direction - GetCurrentRotation()) & 3; - _windowFootpathCost = kMoney64Undefined; - WindowFootpathSetEnabledAndPressedWidgets(); - } - - /** - * - * rct2: 0x006A81AA 0x006A81C5 0x006A81E0 - */ - void WindowFootpathMousedownSlope(int32_t slope) - { - FootpathProvisionalUpdate(); - gFootpathConstructSlope = slope; - _windowFootpathCost = kMoney64Undefined; - WindowFootpathSetEnabledAndPressedWidgets(); - } - - /** - * - * rct2: 0x006A81FB - */ - void WindowFootpathSetProvisionalPathAtPoint(const ScreenCoordsXY& screenCoords) - { - MapInvalidateSelectionRect(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - - auto info = GetMapCoordinatesFromPos( - screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath)); - - if (info.SpriteType == ViewportInteractionItem::None || info.Element == nullptr) - { - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; FootpathProvisionalUpdate(); + ViewportSetVisibility(ViewportVisibility::Default); + MapInvalidateMapSelectionTiles(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + WindowInvalidateByClass(WindowClass::TopToolbar); + HideGridlines(); } - else + + void OnUpdate() override { - // Check for change - if ((gProvisionalFootpath.Flags & PROVISIONAL_PATH_FLAG_1) - && gProvisionalFootpath.Position == CoordsXYZ{ info.Loc, info.Element->GetBaseZ() }) + WidgetInvalidate(*this, WIDX_CONSTRUCT); + WindowFootpathUpdateProvisionalPathForBridgeMode(); + + // #2502: The camera might have changed rotation, so we need to update which directional buttons are pressed + uint8_t currentRotation = GetCurrentRotation(); + if (_lastUpdatedCameraRotation != currentRotation) + { + _lastUpdatedCameraRotation = currentRotation; + WindowFootpathSetEnabledAndPressedWidgets(); + } + + // Check tool + if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_LAND) + { + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) + { + Close(); + } + else if (gCurrentToolWidget.window_classification != WindowClass::Footpath) + { + Close(); + } + else if (gCurrentToolWidget.widget_index != WIDX_CONSTRUCT_ON_LAND) + { + Close(); + } + } + else if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL_TOOL) + { + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) + { + Close(); + } + else if (gCurrentToolWidget.window_classification != WindowClass::Footpath) + { + Close(); + } + else if (gCurrentToolWidget.widget_index != WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL) + { + Close(); + } + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_FOOTPATH_TYPE: + WindowFootpathShowFootpathTypesDialog(&window_footpath_widgets[widgetIndex], false); + break; + case WIDX_QUEUELINE_TYPE: + WindowFootpathShowFootpathTypesDialog(&window_footpath_widgets[widgetIndex], true); + break; + case WIDX_RAILINGS_TYPE: + WindowFootpathShowRailingsTypesDialog(&window_footpath_widgets[widgetIndex]); + break; + case WIDX_DIRECTION_NW: + WindowFootpathMousedownDirection(0); + break; + case WIDX_DIRECTION_NE: + WindowFootpathMousedownDirection(1); + break; + case WIDX_DIRECTION_SW: + WindowFootpathMousedownDirection(2); + break; + case WIDX_DIRECTION_SE: + WindowFootpathMousedownDirection(3); + break; + case WIDX_SLOPEDOWN: + WindowFootpathMousedownSlope(6); + break; + case WIDX_LEVEL: + WindowFootpathMousedownSlope(0); + break; + case WIDX_SLOPEUP: + WindowFootpathMousedownSlope(2); + break; + } + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_CONSTRUCT: + WindowFootpathConstruct(); + break; + case WIDX_REMOVE: + WindowFootpathRemove(); + break; + case WIDX_CONSTRUCT_ON_LAND: + if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_LAND) + { + break; + } + + _windowFootpathCost = kMoney64Undefined; + ToolCancel(); + FootpathProvisionalUpdate(); + MapInvalidateMapSelectionTiles(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + _footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND; + ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::PathDown); + InputSetFlag(INPUT_FLAG_6, true); + _footpathErrorOccured = false; + WindowFootpathSetEnabledAndPressedWidgets(); + break; + case WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL: + if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL_TOOL) + { + break; + } + + _windowFootpathCost = kMoney64Undefined; + ToolCancel(); + FootpathProvisionalUpdate(); + MapInvalidateMapSelectionTiles(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + _footpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL_TOOL; + ToolSet(*this, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, Tool::Crosshair); + InputSetFlag(INPUT_FLAG_6, true); + _footpathErrorOccured = false; + WindowFootpathSetEnabledAndPressedWidgets(); + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + if (selectedIndex < 0 || static_cast(selectedIndex) >= _dropdownEntries.size()) + return; + + auto entryIndex = _dropdownEntries[selectedIndex]; + if (widgetIndex == WIDX_FOOTPATH_TYPE) + { + gFootpathSelection.IsQueueSelected = false; + if (entryIndex.first == ObjectType::Paths) + { + gFootpathSelection.LegacyPath = entryIndex.second; + } + else + { + gFootpathSelection.LegacyPath = OBJECT_ENTRY_INDEX_NULL; + gFootpathSelection.NormalSurface = entryIndex.second; + } + } + else if (widgetIndex == WIDX_QUEUELINE_TYPE) + { + gFootpathSelection.IsQueueSelected = true; + if (entryIndex.first == ObjectType::Paths) + { + gFootpathSelection.LegacyPath = entryIndex.second; + } + else + { + gFootpathSelection.LegacyPath = OBJECT_ENTRY_INDEX_NULL; + gFootpathSelection.QueueSurface = entryIndex.second; + } + } + else if (widgetIndex == WIDX_RAILINGS_TYPE) + { + gFootpathSelection.Railings = entryIndex.second; + } + else + { + return; + } + + FootpathProvisionalUpdate(); + _windowFootpathCost = kMoney64Undefined; + Invalidate(); + } + + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) + { + WindowFootpathSetProvisionalPathAtPoint(screenCoords); + } + else if (widgetIndex == WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL) + { + WindowFootpathSetSelectionStartBridgeAtPoint(screenCoords); + } + } + + void OnToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY&) override + { + if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) + { + _footpathErrorOccured = false; + } + } + + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) + { + WindowFootpathPlacePathAtPoint(screenCoords); + } + else if (widgetIndex == WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL) + { + WindowFootpathStartBridgeAtPoint(screenCoords); + } + } + + void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) + { + WindowFootpathPlacePathAtPoint(screenCoords); + } + } + + void OnPrepareDraw() override + { + // Press / unpress footpath and queue type buttons + pressed_widgets &= ~(1uLL << WIDX_FOOTPATH_TYPE); + pressed_widgets &= ~(1uLL << WIDX_QUEUELINE_TYPE); + pressed_widgets |= gFootpathSelection.IsQueueSelected ? (1uLL << WIDX_QUEUELINE_TYPE) + : (1uLL << WIDX_FOOTPATH_TYPE); + + // Enable / disable construct button + window_footpath_widgets[WIDX_CONSTRUCT].type = _footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL + ? WindowWidgetType::ImgBtn + : WindowWidgetType::Empty; + + if (gFootpathSelection.LegacyPath == OBJECT_ENTRY_INDEX_NULL) + { + window_footpath_widgets[WIDX_RAILINGS_TYPE].type = WindowWidgetType::FlatBtn; + } + else + { + window_footpath_widgets[WIDX_RAILINGS_TYPE].type = WindowWidgetType::Empty; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + ScreenCoordsXY screenCoords; + WindowDrawWidgets(*this, dpi); + WindowFootpathDrawDropdownButtons(dpi); + + if (!IsWidgetDisabled(WIDX_CONSTRUCT)) + { + // Get construction image + uint8_t direction = (_footpathConstructDirection + GetCurrentRotation()) % 4; + uint8_t slope = 0; + if (gFootpathConstructSlope == 2) + { + slope = TILE_ELEMENT_SLOPE_N_CORNER_UP; + } + else if (gFootpathConstructSlope == 6) + { + slope = TILE_ELEMENT_SLOPE_E_CORNER_UP; + } + + std::optional baseImage; + if (gFootpathSelection.LegacyPath == OBJECT_ENTRY_INDEX_NULL) + { + auto selectedPath = gFootpathSelection.GetSelectedSurface(); + const auto* pathType = GetPathSurfaceEntry(selectedPath); + if (pathType != nullptr) + { + baseImage = pathType->BaseImageId; + } + } + else + { + auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + auto* pathObj = static_cast( + objManager.GetLoadedObject(ObjectType::Paths, gFootpathSelection.LegacyPath)); + if (pathObj != nullptr) + { + auto pathEntry = reinterpret_cast(pathObj->GetLegacyData()); + if (gFootpathSelection.IsQueueSelected) + baseImage = pathEntry->GetQueueImage(); + else + baseImage = pathEntry->image; + } + } + + if (baseImage) + { + auto image = *baseImage + ConstructionPreviewImages[slope][direction]; + + // Draw construction image + screenCoords = this->windowPos + + ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(), + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60 }; + GfxDrawSprite(dpi, ImageId(image), screenCoords); + } + + // Draw build this... label + screenCoords = this->windowPos + + ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(), + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 23 }; + DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); + } + + // Draw cost + screenCoords = this->windowPos + + ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(), + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12 }; + if (_windowFootpathCost != kMoney64Undefined) + { + if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + auto ft = Formatter(); + ft.Add(_windowFootpathCost); + DrawTextBasic(dpi, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); + } + } + } + +#pragma endregion + + private: + /** + * + * rct2: 0x006A7760 + */ + void WindowFootpathUpdateProvisionalPathForBridgeMode() + { + if (_footpathConstructionMode != PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) + { + return; + } + + // Recheck area for construction. Set by ride_construction window + if (gProvisionalFootpath.Flags & PROVISIONAL_PATH_FLAG_2) + { + FootpathProvisionalRemove(); + gProvisionalFootpath.Flags &= ~PROVISIONAL_PATH_FLAG_2; + } + + // Update provisional bridge mode path + if (!(gProvisionalFootpath.Flags & PROVISIONAL_PATH_FLAG_1)) + { + ObjectEntryIndex type; + ObjectEntryIndex railings = gFootpathSelection.Railings; + + CoordsXYZ footpathLoc; + int32_t slope; + FootpathGetNextPathInfo(&type, footpathLoc, &slope); + auto pathConstructFlags = FootpathCreateConstructFlags(type); + + _windowFootpathCost = FootpathProvisionalSet(type, railings, footpathLoc, slope, pathConstructFlags); + WidgetInvalidate(*this, WIDX_CONSTRUCT); + } + + auto curTime = Platform::GetTicks(); + + // Update little directional arrow on provisional bridge mode path + if (_footpathConstructionNextArrowPulse < curTime) + { + _footpathConstructionNextArrowPulse = curTime + ARROW_PULSE_DURATION; + + gProvisionalFootpath.Flags ^= PROVISIONAL_PATH_FLAG_SHOW_ARROW; + CoordsXYZ footpathLoc; + int32_t slope; + FootpathGetNextPathInfo(nullptr, footpathLoc, &slope); + gMapSelectArrowPosition = footpathLoc; + gMapSelectArrowDirection = _footpathConstructDirection; + if (gProvisionalFootpath.Flags & PROVISIONAL_PATH_FLAG_SHOW_ARROW) + { + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; + } + else + { + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + } + MapInvalidateTileFull(footpathLoc); + } + } + + void WindowFootpathDrawDropdownButtons(DrawPixelInfo& dpi) + { + if (gFootpathSelection.LegacyPath == OBJECT_ENTRY_INDEX_NULL) + { + // Set footpath and queue type button images + auto pathImage = static_cast(SPR_NONE); + auto queueImage = static_cast(SPR_NONE); + auto pathEntry = GetPathSurfaceEntry(gFootpathSelection.NormalSurface); + if (pathEntry != nullptr) + { + pathImage = pathEntry->PreviewImageId; + } + + pathEntry = GetPathSurfaceEntry(gFootpathSelection.QueueSurface); + if (pathEntry != nullptr) + { + queueImage = pathEntry->PreviewImageId; + } + + WindowFootpathDrawDropdownButton(dpi, WIDX_FOOTPATH_TYPE, pathImage); + WindowFootpathDrawDropdownButton(dpi, WIDX_QUEUELINE_TYPE, queueImage); + + // Set railing + auto railingsImage = static_cast(SPR_NONE); + auto railingsEntry = GetPathRailingsEntry(gFootpathSelection.Railings); + if (railingsEntry != nullptr) + { + railingsImage = railingsEntry->PreviewImageId; + } + WindowFootpathDrawDropdownButton(dpi, WIDX_RAILINGS_TYPE, railingsImage); + } + else + { + auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + + // Set footpath and queue type button images + auto pathImage = static_cast(SPR_NONE); + auto queueImage = static_cast(SPR_NONE); + auto pathObj = static_cast( + objManager.GetLoadedObject(ObjectType::Paths, gFootpathSelection.LegacyPath)); + if (pathObj != nullptr) + { + auto pathEntry = reinterpret_cast(pathObj->GetLegacyData()); + pathImage = pathEntry->GetPreviewImage(); + queueImage = pathEntry->GetQueuePreviewImage(); + } + + WindowFootpathDrawDropdownButton(dpi, WIDX_FOOTPATH_TYPE, pathImage); + WindowFootpathDrawDropdownButton(dpi, WIDX_QUEUELINE_TYPE, queueImage); + } + } + + void WindowFootpathDrawDropdownButton(DrawPixelInfo& dpi, WidgetIndex widgetIndex, ImageIndex image) + { + const auto& widget = widgets[widgetIndex]; + GfxDrawSprite(dpi, ImageId(image), { windowPos.x + widget.left, windowPos.y + widget.top }); + } + + /** + * + * rct2: 0x006A7F88 + */ + void WindowFootpathShowFootpathTypesDialog(Widget* widget, bool showQueues) + { + auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + + uint32_t numPathTypes = 0; + // If the game is in sandbox mode, also show paths that are normally restricted to the scenario editor + bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.SandboxMode); + + _dropdownEntries.clear(); + std::optional defaultIndex; + for (ObjectEntryIndex i = 0; i < MAX_FOOTPATH_SURFACE_OBJECTS; i++) + { + const auto* pathType = static_cast( + objManager.GetLoadedObject(ObjectType::FootpathSurface, i)); + if (pathType == nullptr) + { + continue; + } + if ((pathType->Flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR) && !showEditorPaths) + { + continue; + } + // If regular paths can be used as queue, only hide the path if we’re _not_ looking at a queue, + // but the path surface is one. + if (GetGameState().Cheats.AllowRegularPathAsQueue && !showQueues + && ((pathType->Flags & FOOTPATH_ENTRY_FLAG_IS_QUEUE) != 0)) + { + continue; + } + // If the cheat is disabled, hide queues from the regular path view and vice versa. + else if ( + !GetGameState().Cheats.AllowRegularPathAsQueue + && showQueues != ((pathType->Flags & FOOTPATH_ENTRY_FLAG_IS_QUEUE) != 0)) + { + continue; + } + + if (gFootpathSelection.LegacyPath == OBJECT_ENTRY_INDEX_NULL + && i == (showQueues ? gFootpathSelection.QueueSurface : gFootpathSelection.NormalSurface)) + { + defaultIndex = numPathTypes; + } + + gDropdownItems[numPathTypes].Format = STR_NONE; + Dropdown::SetImage(numPathTypes, ImageId(pathType->PreviewImageId)); + _dropdownEntries.push_back({ ObjectType::FootpathSurface, i }); + numPathTypes++; + } + + for (ObjectEntryIndex i = 0; i < MAX_PATH_OBJECTS; i++) + { + auto* pathObj = static_cast(objManager.GetLoadedObject(ObjectType::Paths, i)); + if (pathObj == nullptr) + { + continue; + } + + auto pathEntry = reinterpret_cast(pathObj->GetLegacyData()); + if ((pathEntry->flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR) && !showEditorPaths) + { + continue; + } + + if (gFootpathSelection.LegacyPath != OBJECT_ENTRY_INDEX_NULL && gFootpathSelection.LegacyPath == i) + { + defaultIndex = numPathTypes; + } + + gDropdownItems[numPathTypes].Format = STR_NONE; + Dropdown::SetImage( + numPathTypes, ImageId(showQueues ? pathEntry->GetQueuePreviewImage() : pathEntry->GetPreviewImage())); + _dropdownEntries.push_back({ ObjectType::Paths, i }); + numPathTypes++; + } + + auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(numPathTypes); + WindowDropdownShowImage( + windowPos.x + widget->left, windowPos.y + widget->top, widget->height() + 1, colours[1], 0, numPathTypes, 47, + 36, itemsPerRow); + if (defaultIndex) + gDropdownDefaultIndex = static_cast(*defaultIndex); + } + + void WindowFootpathShowRailingsTypesDialog(Widget* widget) + { + uint32_t numRailingsTypes = 0; + // If the game is in sandbox mode, also show paths that are normally restricted to the scenario editor + + _dropdownEntries.clear(); + std::optional defaultIndex; + for (int32_t i = 0; i < MAX_FOOTPATH_RAILINGS_OBJECTS; i++) + { + const auto* railingsEntry = GetPathRailingsEntry(i); + if (railingsEntry == nullptr) + { + continue; + } + if (i == gFootpathSelection.Railings) + { + defaultIndex = numRailingsTypes; + } + + gDropdownItems[numRailingsTypes].Format = STR_NONE; + Dropdown::SetImage(numRailingsTypes, ImageId(railingsEntry->PreviewImageId)); + _dropdownEntries.push_back({ ObjectType::FootpathRailings, i }); + numRailingsTypes++; + } + + auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(numRailingsTypes); + WindowDropdownShowImage( + windowPos.x + widget->left, windowPos.y + widget->top, widget->height() + 1, colours[1], 0, numRailingsTypes, + 47, 36, itemsPerRow); + if (defaultIndex) + gDropdownDefaultIndex = static_cast(*defaultIndex); + } + + /** + * + * rct2: 0x006A8111 0x006A8135 0x006A815C 0x006A8183 + */ + void WindowFootpathMousedownDirection(int32_t direction) + { + FootpathProvisionalUpdate(); + _footpathConstructDirection = (direction - GetCurrentRotation()) & 3; + _windowFootpathCost = kMoney64Undefined; + WindowFootpathSetEnabledAndPressedWidgets(); + } + + /** + * + * rct2: 0x006A81AA 0x006A81C5 0x006A81E0 + */ + void WindowFootpathMousedownSlope(int32_t slope) + { + FootpathProvisionalUpdate(); + gFootpathConstructSlope = slope; + _windowFootpathCost = kMoney64Undefined; + WindowFootpathSetEnabledAndPressedWidgets(); + } + + /** + * + * rct2: 0x006A81FB + */ + void WindowFootpathSetProvisionalPathAtPoint(const ScreenCoordsXY& screenCoords) + { + MapInvalidateSelectionRect(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + + auto info = GetMapCoordinatesFromPos( + screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath)); + + if (info.SpriteType == ViewportInteractionItem::None || info.Element == nullptr) + { + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + FootpathProvisionalUpdate(); + } + else + { + // Check for change + if ((gProvisionalFootpath.Flags & PROVISIONAL_PATH_FLAG_1) + && gProvisionalFootpath.Position == CoordsXYZ{ info.Loc, info.Element->GetBaseZ() }) + { + return; + } + + // Set map selection + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectType = MAP_SELECT_TYPE_FULL; + gMapSelectPositionA = info.Loc; + gMapSelectPositionB = info.Loc; + + FootpathProvisionalUpdate(); + + // Set provisional path + int32_t slope = 0; + switch (info.SpriteType) + { + case ViewportInteractionItem::Terrain: + { + auto surfaceElement = info.Element->AsSurface(); + if (surfaceElement != nullptr) + { + slope = DefaultPathSlope[surfaceElement->GetSlope() & kTileElementSurfaceRaisedCornersMask]; + } + break; + } + case ViewportInteractionItem::Footpath: + { + auto pathElement = info.Element->AsPath(); + if (pathElement != nullptr) + { + slope = pathElement->GetSlopeDirection(); + if (pathElement->IsSloped()) + { + slope |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED; + } + } + break; + } + default: + break; + } + auto z = info.Element->GetBaseZ(); + if (slope & RAISE_FOOTPATH_FLAG) + { + slope &= ~RAISE_FOOTPATH_FLAG; + z += PATH_HEIGHT_STEP; + } + + auto pathType = gFootpathSelection.GetSelectedSurface(); + auto constructFlags = FootpathCreateConstructFlags(pathType); + _windowFootpathCost = FootpathProvisionalSet( + pathType, gFootpathSelection.Railings, { info.Loc, z }, slope, constructFlags); + WindowInvalidateByClass(WindowClass::Footpath); + } + } + + /** + * + * rct2: 0x006A8388 + */ + void WindowFootpathSetSelectionStartBridgeAtPoint(const ScreenCoordsXY& screenCoords) + { + int32_t direction; + TileElement* tileElement; + + MapInvalidateSelectionRect(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + + auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement); + if (mapCoords.IsNull()) { return; } - // Set map selection gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; gMapSelectType = MAP_SELECT_TYPE_FULL; - gMapSelectPositionA = info.Loc; - gMapSelectPositionB = info.Loc; + gMapSelectPositionA = mapCoords; + gMapSelectPositionB = mapCoords; + + int32_t z = tileElement->GetBaseZ(); + + if (tileElement->GetType() == TileElementType::Surface) + { + uint8_t slope = tileElement->AsSurface()->GetSlope(); + if (slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) + { + z += PATH_HEIGHT_STEP; + } // Add 2 for a slope + if (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) + z += PATH_HEIGHT_STEP; // Add another 2 for a steep slope + } + + gMapSelectArrowPosition = CoordsXYZ{ mapCoords, z }; + gMapSelectArrowDirection = direction; + + MapInvalidateSelectionRect(); + } + + /** + * + * rct2: 0x006A82C5 + */ + void WindowFootpathPlacePathAtPoint(const ScreenCoordsXY& screenCoords) + { + if (_footpathErrorOccured) + { + return; + } FootpathProvisionalUpdate(); - // Set provisional path - int32_t slope = 0; + const auto info = GetMapCoordinatesFromPos( + screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath)); + + if (info.SpriteType == ViewportInteractionItem::None) + { + return; + } + + // Set path + auto slope = 0; switch (info.SpriteType) { case ViewportInteractionItem::Terrain: - { - auto surfaceElement = info.Element->AsSurface(); - if (surfaceElement != nullptr) - { - slope = DefaultPathSlope[surfaceElement->GetSlope() & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK]; - } + slope = DefaultPathSlope[info.Element->AsSurface()->GetSlope() & kTileElementSurfaceRaisedCornersMask]; break; - } case ViewportInteractionItem::Footpath: - { - auto pathElement = info.Element->AsPath(); - if (pathElement != nullptr) + slope = info.Element->AsPath()->GetSlopeDirection(); + if (info.Element->AsPath()->IsSloped()) { - slope = pathElement->GetSlopeDirection(); - if (pathElement->IsSloped()) - { - slope |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED; - } + slope |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED; } break; - } default: break; } @@ -839,680 +939,584 @@ private: z += PATH_HEIGHT_STEP; } - auto pathType = gFootpathSelection.GetSelectedSurface(); - auto constructFlags = FootpathCreateConstructFlags(pathType); - _windowFootpathCost = FootpathProvisionalSet( - pathType, gFootpathSelection.Railings, { info.Loc, z }, slope, constructFlags); - WindowInvalidateByClass(WindowClass::Footpath); - } - } + // Try and place path + auto selectedType = gFootpathSelection.GetSelectedSurface(); + PathConstructFlags constructFlags = FootpathCreateConstructFlags(selectedType); - /** - * - * rct2: 0x006A8388 - */ - void WindowFootpathSetSelectionStartBridgeAtPoint(const ScreenCoordsXY& screenCoords) - { - int32_t direction; - TileElement* tileElement; - - MapInvalidateSelectionRect(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - - auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement); - if (mapCoords.IsNull()) - { - return; - } - - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; - gMapSelectType = MAP_SELECT_TYPE_FULL; - gMapSelectPositionA = mapCoords; - gMapSelectPositionB = mapCoords; - - int32_t z = tileElement->GetBaseZ(); - - if (tileElement->GetType() == TileElementType::Surface) - { - uint8_t slope = tileElement->AsSurface()->GetSlope(); - if (slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) - { - z += PATH_HEIGHT_STEP; - } // Add 2 for a slope - if (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) - z += PATH_HEIGHT_STEP; // Add another 2 for a steep slope - } - - gMapSelectArrowPosition = CoordsXYZ{ mapCoords, z }; - gMapSelectArrowDirection = direction; - - MapInvalidateSelectionRect(); - } - - /** - * - * rct2: 0x006A82C5 - */ - void WindowFootpathPlacePathAtPoint(const ScreenCoordsXY& screenCoords) - { - if (_footpathErrorOccured) - { - return; - } - - FootpathProvisionalUpdate(); - - const auto info = GetMapCoordinatesFromPos( - screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath)); - - if (info.SpriteType == ViewportInteractionItem::None) - { - return; - } - - // Set path - auto slope = 0; - switch (info.SpriteType) - { - case ViewportInteractionItem::Terrain: - slope = DefaultPathSlope[info.Element->AsSurface()->GetSlope() & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK]; - break; - case ViewportInteractionItem::Footpath: - slope = info.Element->AsPath()->GetSlopeDirection(); - if (info.Element->AsPath()->IsSloped()) + auto footpathPlaceAction = FootpathPlaceAction( + { info.Loc, z }, slope, selectedType, gFootpathSelection.Railings, INVALID_DIRECTION, constructFlags); + footpathPlaceAction.SetCallback([this](const GameAction* ga, const GameActions::Result* result) { + if (result->Error == GameActions::Status::Ok) { - slope |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED; - } - break; - default: - break; - } - auto z = info.Element->GetBaseZ(); - if (slope & RAISE_FOOTPATH_FLAG) - { - slope &= ~RAISE_FOOTPATH_FLAG; - z += PATH_HEIGHT_STEP; - } - - // Try and place path - auto selectedType = gFootpathSelection.GetSelectedSurface(); - PathConstructFlags constructFlags = FootpathCreateConstructFlags(selectedType); - - auto footpathPlaceAction = FootpathPlaceAction( - { info.Loc, z }, slope, selectedType, gFootpathSelection.Railings, INVALID_DIRECTION, constructFlags); - footpathPlaceAction.SetCallback([this](const GameAction* ga, const GameActions::Result* result) { - 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) - { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); - } - } - else - { - _footpathErrorOccured = true; - } - }); - GameActions::Execute(&footpathPlaceAction); - } - - /** - * - * rct2: 0x006A840F - */ - void WindowFootpathStartBridgeAtPoint(const ScreenCoordsXY& screenCoords) - { - int32_t z, direction; - TileElement* tileElement; - - auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement); - if (mapCoords.IsNull()) - { - return; - } - - if (tileElement->GetType() == TileElementType::Surface) - { - // If we start the path on a slope, the arrow is slightly raised, so we - // expect the path to be slightly raised as well. - uint8_t slope = tileElement->AsSurface()->GetSlope(); - z = tileElement->GetBaseZ(); - if (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) - { - // Steep diagonal slope - z += 2 * PATH_HEIGHT_STEP; - } - else if (slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) - { - // Normal slope - z += PATH_HEIGHT_STEP; - } - } - else - { - z = tileElement->GetBaseZ(); - if (tileElement->GetType() == TileElementType::Path) - { - if (tileElement->AsPath()->IsSloped()) - { - if (direction == (tileElement->AsPath()->GetSlopeDirection())) + // 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) { - z += PATH_HEIGHT_STEP; + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); } } - } - } - - ToolCancel(); - gFootpathConstructFromPosition = { mapCoords, z }; - _footpathConstructDirection = direction; - gProvisionalFootpath.Flags = 0; - gFootpathConstructSlope = 0; - _footpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL; - _footpathConstructValidDirections = INVALID_DIRECTION; - WindowFootpathSetEnabledAndPressedWidgets(); - } - - /** - * Construct a piece of footpath while in bridge building mode. - * rct2: 0x006A79B7 - */ - void WindowFootpathConstruct() - { - _windowFootpathCost = kMoney64Undefined; - FootpathProvisionalUpdate(); - - ObjectEntryIndex type; - int32_t slope; - CoordsXYZ footpathLoc; - FootpathGetNextPathInfo(&type, footpathLoc, &slope); - - PathConstructFlags constructFlags = FootpathCreateConstructFlags(type); - - auto footpathPlaceAction = FootpathPlaceAction( - footpathLoc, slope, type, gFootpathSelection.Railings, _footpathConstructDirection, constructFlags); - - footpathPlaceAction.SetCallback([footpathLoc](const GameAction* ga, const GameActions::Result* result) { - if (result->Error == GameActions::Status::Ok) - { - Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); - } - - auto* self = static_cast(WindowFindByClass(WindowClass::Footpath)); - if (self == nullptr) - { - return; - } - - if (result->Error == GameActions::Status::Ok) - { - if (gFootpathConstructSlope == 0) - { - self->_footpathConstructValidDirections = INVALID_DIRECTION; - } else { - self->_footpathConstructValidDirections = self->_footpathConstructDirection; + _footpathErrorOccured = true; } - - if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND) - { - ViewportSetVisibility(ViewportVisibility::UndergroundViewOn); - } - - gFootpathConstructFromPosition = footpathLoc; - // If we have just built an upwards slope, the next path to construct is - // a bit higher. Note that the z returned by footpath_get_next_path_info - // already is lowered if we are building a downwards slope. - if (gFootpathConstructSlope == 2) - { - gFootpathConstructFromPosition.z += PATH_HEIGHT_STEP; - } - } - self->WindowFootpathSetEnabledAndPressedWidgets(); - }); - GameActions::Execute(&footpathPlaceAction); - } - - /** - * - * rct2: 0x006A78EF - */ - void FootpathRemoveTileElement(TileElement* tileElement) - { - auto z = tileElement->GetBaseZ(); - if (tileElement->AsPath()->IsSloped()) - { - uint8_t slopeDirection = tileElement->AsPath()->GetSlopeDirection(); - slopeDirection = DirectionReverse(slopeDirection); - if (slopeDirection == _footpathConstructDirection) - { - z += PATH_HEIGHT_STEP; - } + }); + GameActions::Execute(&footpathPlaceAction); } - // Find a connected edge - int32_t edge = DirectionReverse(_footpathConstructDirection); - if (!(tileElement->AsPath()->GetEdges() & (1 << edge))) + /** + * + * rct2: 0x006A840F + */ + void WindowFootpathStartBridgeAtPoint(const ScreenCoordsXY& screenCoords) { - edge = (edge + 1) & 3; - if (!(tileElement->AsPath()->GetEdges() & (1 << edge))) + int32_t z, direction; + TileElement* tileElement; + + auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement); + if (mapCoords.IsNull()) { - edge = (edge + 2) & 3; - if (!(tileElement->AsPath()->GetEdges() & (1 << edge))) - { - edge = (edge - 1) & 3; - if (!(tileElement->AsPath()->GetEdges() & (1 << edge))) - { - edge = DirectionReverse(edge); - } - } + return; } - } - gFootpathConstructFromPosition.z = tileElement->GetBaseZ(); - auto action = FootpathRemoveAction(gFootpathConstructFromPosition); - GameActions::Execute(&action); - - // Move selection - edge = DirectionReverse(edge); - gFootpathConstructFromPosition.x -= CoordsDirectionDelta[edge].x; - gFootpathConstructFromPosition.y -= CoordsDirectionDelta[edge].y; - gFootpathConstructFromPosition.z = z; - _footpathConstructDirection = edge; - _footpathConstructValidDirections = INVALID_DIRECTION; - } - - /** - * - * rct2: 0x006A7873 - */ - TileElement* FootpathGetTileElementToRemove() - { - TileElement* tileElement; - int32_t z, zLow; - - if (!MapIsLocationValid(gFootpathConstructFromPosition)) - { - return nullptr; - } - - z = std::min(255 * COORDS_Z_STEP, gFootpathConstructFromPosition.z); - zLow = z - PATH_HEIGHT_STEP; - - tileElement = MapGetFirstElementAt(gFootpathConstructFromPosition); - do - { - if (tileElement == nullptr) - break; - if (tileElement->GetType() == TileElementType::Path) + if (tileElement->GetType() == TileElementType::Surface) { - if (tileElement->GetBaseZ() == z) + // If we start the path on a slope, the arrow is slightly raised, so we + // expect the path to be slightly raised as well. + uint8_t slope = tileElement->AsSurface()->GetSlope(); + z = tileElement->GetBaseZ(); + if (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) { - if (tileElement->AsPath()->IsSloped()) - { - if (DirectionReverse(tileElement->AsPath()->GetSlopeDirection()) != _footpathConstructDirection) - { - continue; - } - } - - return tileElement; + // Steep diagonal slope + z += 2 * PATH_HEIGHT_STEP; } - if (tileElement->GetBaseZ() == zLow) + else if (slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) { - if (!tileElement->AsPath()->IsSloped()) - { - if ((tileElement->AsPath()->GetSlopeDirection()) == _footpathConstructDirection) - { - continue; - } - } - - return tileElement; + // Normal slope + z += PATH_HEIGHT_STEP; } } - } while (!(tileElement++)->IsLastForTile()); - - return nullptr; - } - - /** - * - * rct2: 0x006A7863 - */ - void WindowFootpathRemove() - { - TileElement* tileElement; - - _windowFootpathCost = kMoney64Undefined; - FootpathProvisionalUpdate(); - - tileElement = FootpathGetTileElementToRemove(); - if (tileElement != nullptr) - { - FootpathRemoveTileElement(tileElement); - } - - WindowFootpathSetEnabledAndPressedWidgets(); - } - - /** - * - * rct2: 0x006A855C - */ - void WindowFootpathSetEnabledAndPressedWidgets() - { - if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) - { - MapInvalidateMapSelectionTiles(); - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags |= MAP_SELECT_FLAG_GREEN; - - int32_t direction = _footpathConstructDirection; - gMapSelectionTiles.clear(); - gMapSelectionTiles.push_back({ gFootpathConstructFromPosition.x + CoordsDirectionDelta[direction].x, - gFootpathConstructFromPosition.y + CoordsDirectionDelta[direction].y }); - MapInvalidateMapSelectionTiles(); - } - - uint64_t pressedWidgets = pressed_widgets - & ~((1LL << WIDX_DIRECTION_NW) | (1LL << WIDX_DIRECTION_NE) | (1LL << WIDX_DIRECTION_SW) - | (1LL << WIDX_DIRECTION_SE) | (1LL << WIDX_SLOPEDOWN) | (1LL << WIDX_LEVEL) | (1LL << WIDX_SLOPEUP)); - uint64_t disabledWidgets = 0; - int32_t currentRotation = GetCurrentRotation(); - if (_footpathConstructionMode >= PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) - { - // Set pressed directional widget - int32_t direction = (_footpathConstructDirection + currentRotation) & 3; - pressedWidgets |= (1LL << (WIDX_DIRECTION_NW + direction)); - - // Set pressed slope widget - int32_t slope = gFootpathConstructSlope; - if (slope == TILE_ELEMENT_SLOPE_SE_SIDE_UP) - { - pressedWidgets |= (1uLL << WIDX_SLOPEDOWN); - } - else if (slope == TILE_ELEMENT_SLOPE_FLAT) - { - pressedWidgets |= (1uLL << WIDX_LEVEL); - } else { - pressedWidgets |= (1uLL << WIDX_SLOPEUP); + z = tileElement->GetBaseZ(); + if (tileElement->GetType() == TileElementType::Path) + { + if (tileElement->AsPath()->IsSloped()) + { + if (direction == (tileElement->AsPath()->GetSlopeDirection())) + { + z += PATH_HEIGHT_STEP; + } + } + } } - // Enable / disable directional widgets - direction = _footpathConstructValidDirections; - if (direction != INVALID_DIRECTION) - { - disabledWidgets |= (1uLL << WIDX_DIRECTION_NW) | (1uLL << WIDX_DIRECTION_NE) | (1uLL << WIDX_DIRECTION_SW) - | (1uLL << WIDX_DIRECTION_SE); - - direction = (direction + currentRotation) & 3; - disabledWidgets &= ~(1 << (WIDX_DIRECTION_NW + direction)); - } + ToolCancel(); + gFootpathConstructFromPosition = { mapCoords, z }; + _footpathConstructDirection = direction; + gProvisionalFootpath.Flags = 0; + gFootpathConstructSlope = 0; + _footpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL; + _footpathConstructValidDirections = INVALID_DIRECTION; + WindowFootpathSetEnabledAndPressedWidgets(); } - else + + /** + * Construct a piece of footpath while in bridge building mode. + * rct2: 0x006A79B7 + */ + void WindowFootpathConstruct() { - // Disable all bridge mode widgets - disabledWidgets |= (1uLL << WIDX_DIRECTION_GROUP) | (1uLL << WIDX_DIRECTION_NW) | (1uLL << WIDX_DIRECTION_NE) - | (1uLL << WIDX_DIRECTION_SW) | (1uLL << WIDX_DIRECTION_SE) | (1uLL << WIDX_SLOPE_GROUP) - | (1uLL << WIDX_SLOPEDOWN) | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPEUP) | (1uLL << WIDX_CONSTRUCT) - | (1uLL << WIDX_REMOVE); + _windowFootpathCost = kMoney64Undefined; + FootpathProvisionalUpdate(); + + ObjectEntryIndex type; + int32_t slope; + CoordsXYZ footpathLoc; + FootpathGetNextPathInfo(&type, footpathLoc, &slope); + + PathConstructFlags constructFlags = FootpathCreateConstructFlags(type); + + auto footpathPlaceAction = FootpathPlaceAction( + footpathLoc, slope, type, gFootpathSelection.Railings, _footpathConstructDirection, constructFlags); + + footpathPlaceAction.SetCallback([footpathLoc](const GameAction* ga, const GameActions::Result* result) { + if (result->Error == GameActions::Status::Ok) + { + Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); + } + + auto* self = static_cast(WindowFindByClass(WindowClass::Footpath)); + if (self == nullptr) + { + return; + } + + if (result->Error == GameActions::Status::Ok) + { + if (gFootpathConstructSlope == 0) + { + self->_footpathConstructValidDirections = INVALID_DIRECTION; + } + else + { + self->_footpathConstructValidDirections = self->_footpathConstructDirection; + } + + if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND) + { + ViewportSetVisibility(ViewportVisibility::UndergroundViewOn); + } + + gFootpathConstructFromPosition = footpathLoc; + // If we have just built an upwards slope, the next path to construct is + // a bit higher. Note that the z returned by footpath_get_next_path_info + // already is lowered if we are building a downwards slope. + if (gFootpathConstructSlope == 2) + { + gFootpathConstructFromPosition.z += PATH_HEIGHT_STEP; + } + } + self->WindowFootpathSetEnabledAndPressedWidgets(); + }); + GameActions::Execute(&footpathPlaceAction); } - pressed_widgets = pressedWidgets; - disabled_widgets = disabledWidgets; - Invalidate(); - } + /** + * + * rct2: 0x006A78EF + */ + void FootpathRemoveTileElement(TileElement* tileElement) + { + auto z = tileElement->GetBaseZ(); + if (tileElement->AsPath()->IsSloped()) + { + uint8_t slopeDirection = tileElement->AsPath()->GetSlopeDirection(); + slopeDirection = DirectionReverse(slopeDirection); + if (slopeDirection == _footpathConstructDirection) + { + z += PATH_HEIGHT_STEP; + } + } + + // Find a connected edge + int32_t edge = DirectionReverse(_footpathConstructDirection); + if (!(tileElement->AsPath()->GetEdges() & (1 << edge))) + { + edge = (edge + 1) & 3; + if (!(tileElement->AsPath()->GetEdges() & (1 << edge))) + { + edge = (edge + 2) & 3; + if (!(tileElement->AsPath()->GetEdges() & (1 << edge))) + { + edge = (edge - 1) & 3; + if (!(tileElement->AsPath()->GetEdges() & (1 << edge))) + { + edge = DirectionReverse(edge); + } + } + } + } + + gFootpathConstructFromPosition.z = tileElement->GetBaseZ(); + auto action = FootpathRemoveAction(gFootpathConstructFromPosition); + GameActions::Execute(&action); + + // Move selection + edge = DirectionReverse(edge); + gFootpathConstructFromPosition.x -= CoordsDirectionDelta[edge].x; + gFootpathConstructFromPosition.y -= CoordsDirectionDelta[edge].y; + gFootpathConstructFromPosition.z = z; + _footpathConstructDirection = edge; + _footpathConstructValidDirections = INVALID_DIRECTION; + } + + /** + * + * rct2: 0x006A7873 + */ + TileElement* FootpathGetTileElementToRemove() + { + TileElement* tileElement; + int32_t z, zLow; + + if (!MapIsLocationValid(gFootpathConstructFromPosition)) + { + return nullptr; + } + + z = std::min(255 * COORDS_Z_STEP, gFootpathConstructFromPosition.z); + zLow = z - PATH_HEIGHT_STEP; + + tileElement = MapGetFirstElementAt(gFootpathConstructFromPosition); + do + { + if (tileElement == nullptr) + break; + if (tileElement->GetType() == TileElementType::Path) + { + if (tileElement->GetBaseZ() == z) + { + if (tileElement->AsPath()->IsSloped()) + { + if (DirectionReverse(tileElement->AsPath()->GetSlopeDirection()) != _footpathConstructDirection) + { + continue; + } + } + + return tileElement; + } + if (tileElement->GetBaseZ() == zLow) + { + if (!tileElement->AsPath()->IsSloped()) + { + if ((tileElement->AsPath()->GetSlopeDirection()) == _footpathConstructDirection) + { + continue; + } + } + + return tileElement; + } + } + } while (!(tileElement++)->IsLastForTile()); + + return nullptr; + } + + /** + * + * rct2: 0x006A7863 + */ + void WindowFootpathRemove() + { + TileElement* tileElement; + + _windowFootpathCost = kMoney64Undefined; + FootpathProvisionalUpdate(); + + tileElement = FootpathGetTileElementToRemove(); + if (tileElement != nullptr) + { + FootpathRemoveTileElement(tileElement); + } + + WindowFootpathSetEnabledAndPressedWidgets(); + } + + /** + * + * rct2: 0x006A855C + */ + void WindowFootpathSetEnabledAndPressedWidgets() + { + if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) + { + MapInvalidateMapSelectionTiles(); + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags |= MAP_SELECT_FLAG_GREEN; + + int32_t direction = _footpathConstructDirection; + gMapSelectionTiles.clear(); + gMapSelectionTiles.push_back({ gFootpathConstructFromPosition.x + CoordsDirectionDelta[direction].x, + gFootpathConstructFromPosition.y + CoordsDirectionDelta[direction].y }); + MapInvalidateMapSelectionTiles(); + } + + uint64_t pressedWidgets = pressed_widgets + & ~((1LL << WIDX_DIRECTION_NW) | (1LL << WIDX_DIRECTION_NE) | (1LL << WIDX_DIRECTION_SW) + | (1LL << WIDX_DIRECTION_SE) | (1LL << WIDX_SLOPEDOWN) | (1LL << WIDX_LEVEL) | (1LL << WIDX_SLOPEUP)); + uint64_t disabledWidgets = 0; + int32_t currentRotation = GetCurrentRotation(); + if (_footpathConstructionMode >= PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) + { + // Set pressed directional widget + int32_t direction = (_footpathConstructDirection + currentRotation) & 3; + pressedWidgets |= (1LL << (WIDX_DIRECTION_NW + direction)); + + // Set pressed slope widget + int32_t slope = gFootpathConstructSlope; + if (slope == TILE_ELEMENT_SLOPE_SE_SIDE_UP) + { + pressedWidgets |= (1uLL << WIDX_SLOPEDOWN); + } + else if (slope == TILE_ELEMENT_SLOPE_FLAT) + { + pressedWidgets |= (1uLL << WIDX_LEVEL); + } + else + { + pressedWidgets |= (1uLL << WIDX_SLOPEUP); + } + + // Enable / disable directional widgets + direction = _footpathConstructValidDirections; + if (direction != INVALID_DIRECTION) + { + disabledWidgets |= (1uLL << WIDX_DIRECTION_NW) | (1uLL << WIDX_DIRECTION_NE) | (1uLL << WIDX_DIRECTION_SW) + | (1uLL << WIDX_DIRECTION_SE); + + direction = (direction + currentRotation) & 3; + disabledWidgets &= ~(1 << (WIDX_DIRECTION_NW + direction)); + } + } + else + { + // Disable all bridge mode widgets + disabledWidgets |= (1uLL << WIDX_DIRECTION_GROUP) | (1uLL << WIDX_DIRECTION_NW) | (1uLL << WIDX_DIRECTION_NE) + | (1uLL << WIDX_DIRECTION_SW) | (1uLL << WIDX_DIRECTION_SE) | (1uLL << WIDX_SLOPE_GROUP) + | (1uLL << WIDX_SLOPEDOWN) | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPEUP) | (1uLL << WIDX_CONSTRUCT) + | (1uLL << WIDX_REMOVE); + } + + pressed_widgets = pressedWidgets; + disabled_widgets = disabledWidgets; + Invalidate(); + } + + /** + * + * rct2: 0x006A7B20 + */ + void FootpathGetNextPathInfo(ObjectEntryIndex* type, CoordsXYZ& footpathLoc, int32_t* slope) + { + auto direction = _footpathConstructDirection; + footpathLoc.x = gFootpathConstructFromPosition.x + CoordsDirectionDelta[direction].x; + footpathLoc.y = gFootpathConstructFromPosition.y + CoordsDirectionDelta[direction].y; + footpathLoc.z = gFootpathConstructFromPosition.z; + if (type != nullptr) + { + *type = gFootpathSelection.GetSelectedSurface(); + } + *slope = TILE_ELEMENT_SLOPE_FLAT; + if (gFootpathConstructSlope != 0) + { + *slope = _footpathConstructDirection | TILE_ELEMENT_SLOPE_S_CORNER_UP; + if (gFootpathConstructSlope != 2) + { + footpathLoc.z -= PATH_HEIGHT_STEP; + *slope ^= TILE_ELEMENT_SLOPE_E_CORNER_UP; + } + } + } + + PathConstructFlags FootpathCreateConstructFlags(ObjectEntryIndex& type) + { + PathConstructFlags pathConstructFlags = 0; + if (gFootpathSelection.IsQueueSelected) + pathConstructFlags |= PathConstructFlag::IsQueue; + if (gFootpathSelection.LegacyPath != OBJECT_ENTRY_INDEX_NULL) + { + pathConstructFlags |= PathConstructFlag::IsLegacyPathObject; + type = gFootpathSelection.LegacyPath; + } + return pathConstructFlags; + } + +#pragma region Keyboard Shortcuts Events + public: + void KeyboardShortcutTurnLeft() + { + if (IsWidgetDisabled(WIDX_DIRECTION_NW) || IsWidgetDisabled(WIDX_DIRECTION_NE) + || IsWidgetDisabled(WIDX_DIRECTION_SW) || IsWidgetDisabled(WIDX_DIRECTION_SE) || _footpathConstructionMode != 2) + { + return; + } + int32_t currentRotation = GetCurrentRotation(); + int32_t turnedRotation = _footpathConstructDirection - currentRotation + (currentRotation % 2 == 1 ? 1 : -1); + WindowFootpathMousedownDirection(turnedRotation); + } + + void KeyboardShortcutTurnRight() + { + if (IsWidgetDisabled(WIDX_DIRECTION_NW) || IsWidgetDisabled(WIDX_DIRECTION_NE) + || IsWidgetDisabled(WIDX_DIRECTION_SW) || IsWidgetDisabled(WIDX_DIRECTION_SE) || _footpathConstructionMode != 2) + { + return; + } + int32_t currentRotation = GetCurrentRotation(); + int32_t turnedRotation = _footpathConstructDirection - currentRotation + (currentRotation % 2 == 1 ? -1 : 1); + WindowFootpathMousedownDirection(turnedRotation); + } + + void KeyboardShortcutShortcutSlopeDown() + { + if (IsWidgetDisabled(WIDX_SLOPEDOWN) || IsWidgetDisabled(WIDX_LEVEL) || IsWidgetDisabled(WIDX_SLOPEUP) + || widgets[WIDX_LEVEL].type == WindowWidgetType::Empty) + { + return; + } + + switch (gFootpathConstructSlope) + { + case 0: + OnMouseDown(WIDX_SLOPEDOWN); + break; + case 2: + OnMouseDown(WIDX_LEVEL); + break; + default: + case 6: + return; + } + } + + void KeyboardShortcutSlopeUp() + { + if (IsWidgetDisabled(WIDX_SLOPEDOWN) || IsWidgetDisabled(WIDX_LEVEL) || IsWidgetDisabled(WIDX_SLOPEUP) + || widgets[WIDX_LEVEL].type == WindowWidgetType::Empty) + { + return; + } + + switch (gFootpathConstructSlope) + { + case 6: + OnMouseDown(WIDX_LEVEL); + break; + case 0: + OnMouseDown(WIDX_SLOPEUP); + break; + default: + case 2: + return; + } + } + + void KeyboardShortcutSlopeLevel() + { + if (IsWidgetDisabled(WIDX_SLOPEDOWN) || IsWidgetDisabled(WIDX_LEVEL) || IsWidgetDisabled(WIDX_SLOPEUP) + || widgets[WIDX_LEVEL].type == WindowWidgetType::Empty || gFootpathConstructSlope == 0) + { + return; + } + + OnMouseDown(WIDX_LEVEL); + } + + void KeyboardShortcutDemolishCurrent() + { + if (IsWidgetDisabled(WIDX_REMOVE) || widgets[WIDX_REMOVE].type == WindowWidgetType::Empty + || (!GetGameState().Cheats.BuildInPauseMode && GameIsPaused())) + { + return; + } + + WindowFootpathRemove(); + } + + void KeyboardShortcutBuildCurrent() + { + if (IsWidgetDisabled(WIDX_CONSTRUCT) || widgets[WIDX_CONSTRUCT].type == WindowWidgetType::Empty) + { + return; + } + + OnMouseUp(WIDX_CONSTRUCT); + } + + void OnResize() override + { + ResizeFrame(); + } + +#pragma endregion + }; /** * - * rct2: 0x006A7B20 + * rct2: 0x006A7C43 */ - void FootpathGetNextPathInfo(ObjectEntryIndex* type, CoordsXYZ& footpathLoc, int32_t* slope) + WindowBase* FootpathOpen() { - auto direction = _footpathConstructDirection; - footpathLoc.x = gFootpathConstructFromPosition.x + CoordsDirectionDelta[direction].x; - footpathLoc.y = gFootpathConstructFromPosition.y + CoordsDirectionDelta[direction].y; - footpathLoc.z = gFootpathConstructFromPosition.z; - if (type != nullptr) + if (!FootpathSelectDefault()) { - *type = gFootpathSelection.GetSelectedSurface(); + // No path objects to select from, don't open window + return nullptr; } - *slope = TILE_ELEMENT_SLOPE_FLAT; - if (gFootpathConstructSlope != 0) + + return WindowFocusOrCreate(WindowClass::Footpath, WW_WINDOW, WH_WINDOW, 0); + } + + void WindowFootpathResetSelectedPath() + { + gFootpathSelection = {}; + } + + void WindowFootpathKeyboardShortcutTurnLeft() + { + WindowBase* w = WindowFindByClass(WindowClass::Footpath); + if (w != nullptr) { - *slope = _footpathConstructDirection | TILE_ELEMENT_SLOPE_S_CORNER_UP; - if (gFootpathConstructSlope != 2) + auto* footpathWindow = static_cast(w); + if (footpathWindow != nullptr) { - footpathLoc.z -= PATH_HEIGHT_STEP; - *slope ^= TILE_ELEMENT_SLOPE_E_CORNER_UP; + footpathWindow->KeyboardShortcutTurnLeft(); } } } - PathConstructFlags FootpathCreateConstructFlags(ObjectEntryIndex& type) + void WindowFootpathKeyboardShortcutTurnRight() { - PathConstructFlags pathConstructFlags = 0; - if (gFootpathSelection.IsQueueSelected) - pathConstructFlags |= PathConstructFlag::IsQueue; - if (gFootpathSelection.LegacyPath != OBJECT_ENTRY_INDEX_NULL) + WindowBase* w = WindowFindByClass(WindowClass::Footpath); + if (w != nullptr) { - pathConstructFlags |= PathConstructFlag::IsLegacyPathObject; - type = gFootpathSelection.LegacyPath; - } - return pathConstructFlags; - } - -#pragma region Keyboard Shortcuts Events -public: - void KeyboardShortcutTurnLeft() - { - if (IsWidgetDisabled(WIDX_DIRECTION_NW) || IsWidgetDisabled(WIDX_DIRECTION_NE) || IsWidgetDisabled(WIDX_DIRECTION_SW) - || IsWidgetDisabled(WIDX_DIRECTION_SE) || _footpathConstructionMode != 2) - { - return; - } - int32_t currentRotation = GetCurrentRotation(); - int32_t turnedRotation = _footpathConstructDirection - currentRotation + (currentRotation % 2 == 1 ? 1 : -1); - WindowFootpathMousedownDirection(turnedRotation); - } - - void KeyboardShortcutTurnRight() - { - if (IsWidgetDisabled(WIDX_DIRECTION_NW) || IsWidgetDisabled(WIDX_DIRECTION_NE) || IsWidgetDisabled(WIDX_DIRECTION_SW) - || IsWidgetDisabled(WIDX_DIRECTION_SE) || _footpathConstructionMode != 2) - { - return; - } - int32_t currentRotation = GetCurrentRotation(); - int32_t turnedRotation = _footpathConstructDirection - currentRotation + (currentRotation % 2 == 1 ? -1 : 1); - WindowFootpathMousedownDirection(turnedRotation); - } - - void KeyboardShortcutShortcutSlopeDown() - { - if (IsWidgetDisabled(WIDX_SLOPEDOWN) || IsWidgetDisabled(WIDX_LEVEL) || IsWidgetDisabled(WIDX_SLOPEUP) - || widgets[WIDX_LEVEL].type == WindowWidgetType::Empty) - { - return; - } - - switch (gFootpathConstructSlope) - { - case 0: - OnMouseDown(WIDX_SLOPEDOWN); - break; - case 2: - OnMouseDown(WIDX_LEVEL); - break; - default: - case 6: - return; + auto* footpathWindow = static_cast(w); + if (footpathWindow != nullptr) + { + footpathWindow->KeyboardShortcutTurnRight(); + } } } - void KeyboardShortcutSlopeUp() + void WindowFootpathKeyboardShortcutSlopeDown() { - if (IsWidgetDisabled(WIDX_SLOPEDOWN) || IsWidgetDisabled(WIDX_LEVEL) || IsWidgetDisabled(WIDX_SLOPEUP) - || widgets[WIDX_LEVEL].type == WindowWidgetType::Empty) + WindowBase* w = WindowFindByClass(WindowClass::Footpath); + if (w != nullptr) { - return; - } - - switch (gFootpathConstructSlope) - { - case 6: - OnMouseDown(WIDX_LEVEL); - break; - case 0: - OnMouseDown(WIDX_SLOPEUP); - break; - default: - case 2: - return; + auto* footpathWindow = static_cast(w); + if (footpathWindow != nullptr) + { + footpathWindow->KeyboardShortcutShortcutSlopeDown(); + } } } - void KeyboardShortcutSlopeLevel() + void WindowFootpathKeyboardShortcutSlopeUp() { - if (IsWidgetDisabled(WIDX_SLOPEDOWN) || IsWidgetDisabled(WIDX_LEVEL) || IsWidgetDisabled(WIDX_SLOPEUP) - || widgets[WIDX_LEVEL].type == WindowWidgetType::Empty || gFootpathConstructSlope == 0) + WindowBase* w = WindowFindByClass(WindowClass::Footpath); + if (w != nullptr) { - return; - } - - OnMouseDown(WIDX_LEVEL); - } - - void KeyboardShortcutDemolishCurrent() - { - if (IsWidgetDisabled(WIDX_REMOVE) || widgets[WIDX_REMOVE].type == WindowWidgetType::Empty - || (!gCheatsBuildInPauseMode && GameIsPaused())) - { - return; - } - - WindowFootpathRemove(); - } - - void KeyboardShortcutBuildCurrent() - { - if (IsWidgetDisabled(WIDX_CONSTRUCT) || widgets[WIDX_CONSTRUCT].type == WindowWidgetType::Empty) - { - return; - } - - OnMouseUp(WIDX_CONSTRUCT); - } - - void OnResize() override - { - ResizeFrame(); - } - -#pragma endregion -}; - -/** - * - * rct2: 0x006A7C43 - */ -WindowBase* WindowFootpathOpen() -{ - if (!FootpathSelectDefault()) - { - // No path objects to select from, don't open window - return nullptr; - } - - return WindowFocusOrCreate(WindowClass::Footpath, WW_WINDOW, WH_WINDOW, 0); -} - -void WindowFootpathResetSelectedPath() -{ - gFootpathSelection = {}; -} - -void WindowFootpathKeyboardShortcutTurnLeft() -{ - WindowBase* w = WindowFindByClass(WindowClass::Footpath); - if (w != nullptr) - { - auto* footpathWindow = static_cast(w); - if (footpathWindow != nullptr) - { - footpathWindow->KeyboardShortcutTurnLeft(); + auto* footpathWindow = static_cast(w); + if (footpathWindow != nullptr) + { + footpathWindow->KeyboardShortcutSlopeUp(); + } } } -} -void WindowFootpathKeyboardShortcutTurnRight() -{ - WindowBase* w = WindowFindByClass(WindowClass::Footpath); - if (w != nullptr) + void WindowFootpathKeyboardShortcutDemolishCurrent() { - auto* footpathWindow = static_cast(w); - if (footpathWindow != nullptr) + WindowBase* w = WindowFindByClass(WindowClass::Footpath); + if (w != nullptr) { - footpathWindow->KeyboardShortcutTurnRight(); + auto* footpathWindow = static_cast(w); + if (footpathWindow != nullptr) + { + footpathWindow->KeyboardShortcutDemolishCurrent(); + } } } -} -void WindowFootpathKeyboardShortcutSlopeDown() -{ - WindowBase* w = WindowFindByClass(WindowClass::Footpath); - if (w != nullptr) + void WindowFootpathKeyboardShortcutBuildCurrent() { - auto* footpathWindow = static_cast(w); - if (footpathWindow != nullptr) + WindowBase* w = WindowFindByClass(WindowClass::Footpath); + if (w != nullptr) { - footpathWindow->KeyboardShortcutShortcutSlopeDown(); + auto* footpathWindow = static_cast(w); + if (footpathWindow != nullptr) + { + footpathWindow->KeyboardShortcutBuildCurrent(); + } } } -} - -void WindowFootpathKeyboardShortcutSlopeUp() -{ - WindowBase* w = WindowFindByClass(WindowClass::Footpath); - if (w != nullptr) - { - auto* footpathWindow = static_cast(w); - if (footpathWindow != nullptr) - { - footpathWindow->KeyboardShortcutSlopeUp(); - } - } -} - -void WindowFootpathKeyboardShortcutDemolishCurrent() -{ - WindowBase* w = WindowFindByClass(WindowClass::Footpath); - if (w != nullptr) - { - auto* footpathWindow = static_cast(w); - if (footpathWindow != nullptr) - { - footpathWindow->KeyboardShortcutDemolishCurrent(); - } - } -} - -void WindowFootpathKeyboardShortcutBuildCurrent() -{ - WindowBase* w = WindowFindByClass(WindowClass::Footpath); - if (w != nullptr) - { - auto* footpathWindow = static_cast(w); - if (footpathWindow != nullptr) - { - footpathWindow->KeyboardShortcutBuildCurrent(); - } - } -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index 12fa470ae5..ee2e5461d1 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -29,9 +29,9 @@ #include #include -using namespace OpenRCT2; - -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum WindowGameBottomToolbarWidgetIdx { WIDX_LEFT_OUTSET, @@ -66,632 +66,633 @@ static Widget window_game_bottom_toolbar_widgets[] = MakeWidget({498, 0}, {142, 34}, WindowWidgetType::ImgBtn, WindowColour::Primary ), // Right outset panel MakeWidget({500, 2}, {138, 30}, WindowWidgetType::ImgBtn, WindowColour::Primary ), // Right inset panel MakeWidget({500, 2}, {138, 12}, WindowWidgetType::FlatBtn, WindowColour::Primary ), // Date - WIDGETS_END, + kWidgetsEnd, }; + // clang-format on -uint8_t gToolbarDirtyFlags; + uint8_t gToolbarDirtyFlags; -class GameBottomToolbar final : public Window -{ -private: - - void DrawLeftPanel(DrawPixelInfo &dpi) + class GameBottomToolbar final : public Window { - const auto topLeft = windowPos - + ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].left + 1, - window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].top + 1 }; - const auto bottomRight = windowPos - + ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].right - 1, - window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].bottom - 1 }; - // Draw green inset rectangle on panel - GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_30); - - // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); - - auto& gameState = GetGameState(); - - // Draw money - if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) + private: + void DrawLeftPanel(DrawPixelInfo& dpi) { - Widget widget = window_game_bottom_toolbar_widgets[WIDX_MONEY]; - auto screenCoords = ScreenCoordsXY{ windowPos.x + widget.midX(), - windowPos.y + widget.midY() - (line_height == 10 ? 5 : 6) }; + const auto topLeft = windowPos + + ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].left + 1, + window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].top + 1 }; + const auto bottomRight = windowPos + + ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].right - 1, + window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].bottom - 1 }; + // Draw green inset rectangle on panel + GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_30); + + // Figure out how much line height we have to work with. + uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + + auto& gameState = GetGameState(); + + // Draw money + if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) + { + Widget widget = window_game_bottom_toolbar_widgets[WIDX_MONEY]; + auto screenCoords = ScreenCoordsXY{ windowPos.x + widget.midX(), + windowPos.y + widget.midY() - (line_height == 10 ? 5 : 6) }; + + colour_t colour + = (gHoverWidget.window_classification == WindowClass::BottomToolbar + && gHoverWidget.widget_index == WIDX_MONEY + ? COLOUR_WHITE + : NOT_TRANSLUCENT(colours[0])); + StringId stringId = gameState.Cash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH; + auto ft = Formatter(); + ft.Add(gameState.Cash); + DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); + } + + static constexpr StringId _guestCountFormats[] = { + STR_BOTTOM_TOOLBAR_NUM_GUESTS_STABLE, + STR_BOTTOM_TOOLBAR_NUM_GUESTS_DECREASE, + STR_BOTTOM_TOOLBAR_NUM_GUESTS_INCREASE, + }; + + static constexpr StringId _guestCountFormatsSingular[] = { + STR_BOTTOM_TOOLBAR_NUM_GUESTS_STABLE_SINGULAR, + STR_BOTTOM_TOOLBAR_NUM_GUESTS_DECREASE_SINGULAR, + STR_BOTTOM_TOOLBAR_NUM_GUESTS_INCREASE_SINGULAR, + }; + + // Draw guests + { + Widget widget = window_game_bottom_toolbar_widgets[WIDX_GUESTS]; + auto screenCoords = ScreenCoordsXY{ windowPos.x + widget.midX(), windowPos.y + widget.midY() - 6 }; + + StringId stringId = gameState.NumGuestsInPark == 1 ? _guestCountFormatsSingular[gameState.GuestChangeModifier] + : _guestCountFormats[gameState.GuestChangeModifier]; + colour_t colour + = (gHoverWidget.window_classification == WindowClass::BottomToolbar + && gHoverWidget.widget_index == WIDX_GUESTS + ? COLOUR_WHITE + : NOT_TRANSLUCENT(colours[0])); + auto ft = Formatter(); + ft.Add(gameState.NumGuestsInPark); + DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); + } + + // Draw park rating + { + Widget widget = window_game_bottom_toolbar_widgets[WIDX_PARK_RATING]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 11, widget.midY() - 5 }; + + DrawParkRating(dpi, colours[3], screenCoords, std::max(10, ((gameState.ParkRating / 4) * 263) / 256)); + } + } + + void DrawParkRating(DrawPixelInfo& dpi, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor) + { + int16_t bar_width = (factor * 114) / 255; + GfxFillRectInset( + dpi, { coords + ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 114, 9 } }, colours[1], INSET_RECT_F_30); + if (!(colour & kBarBlink) || GameIsPaused() || (gCurrentRealTimeTicks & 8)) + { + if (bar_width > 2) + { + GfxFillRectInset( + dpi, { coords + ScreenCoordsXY{ 2, 2 }, coords + ScreenCoordsXY{ bar_width - 1, 8 } }, colour, 0); + } + } + + // Draw thumbs on the sides + GfxDrawSprite(dpi, ImageId(SPR_RATING_LOW), coords - ScreenCoordsXY{ 14, 0 }); + GfxDrawSprite(dpi, ImageId(SPR_RATING_HIGH), coords + ScreenCoordsXY{ 114, 0 }); + } + + void DrawRightPanel(DrawPixelInfo& dpi) + { + const auto topLeft = windowPos + + ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 1, + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + 1 }; + const auto bottomRight = windowPos + + ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right - 1, + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].bottom - 1 }; + // Draw green inset rectangle on panel + GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_30); + + auto screenCoords = ScreenCoordsXY{ (window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right) + / 2 + + windowPos.x, + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + windowPos.y + 2 }; + + // Date + auto& date = GetDate(); + int32_t year = date.GetYear() + 1; + int32_t month = date.GetMonth(); + int32_t day = date.GetDay(); colour_t colour - = (gHoverWidget.window_classification == WindowClass::BottomToolbar && gHoverWidget.widget_index == WIDX_MONEY + = (gHoverWidget.window_classification == WindowClass::BottomToolbar && gHoverWidget.widget_index == WIDX_DATE ? COLOUR_WHITE : NOT_TRANSLUCENT(colours[0])); - StringId stringId = gameState.Cash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH; + StringId stringId = DateFormatStringFormatIds[gConfigGeneral.DateFormat]; auto ft = Formatter(); - ft.Add(gameState.Cash); + ft.Add(DateDayNames[day]); + ft.Add(month); + ft.Add(year); DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); - } - static constexpr StringId _guestCountFormats[] = { - STR_BOTTOM_TOOLBAR_NUM_GUESTS_STABLE, - STR_BOTTOM_TOOLBAR_NUM_GUESTS_DECREASE, - STR_BOTTOM_TOOLBAR_NUM_GUESTS_INCREASE, - }; + // Figure out how much line height we have to work with. + uint32_t line_height = FontGetLineHeight(FontStyle::Medium); - static constexpr StringId _guestCountFormatsSingular[] = { - STR_BOTTOM_TOOLBAR_NUM_GUESTS_STABLE_SINGULAR, - STR_BOTTOM_TOOLBAR_NUM_GUESTS_DECREASE_SINGULAR, - STR_BOTTOM_TOOLBAR_NUM_GUESTS_INCREASE_SINGULAR, - }; + // Temperature + screenCoords = { windowPos.x + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 15, + static_cast(screenCoords.y + line_height + 1) }; - // Draw guests - { - Widget widget = window_game_bottom_toolbar_widgets[WIDX_GUESTS]; - auto screenCoords = ScreenCoordsXY{ windowPos.x + widget.midX(), windowPos.y + widget.midY() - 6 }; - - StringId stringId = gameState.NumGuestsInPark == 1 ? _guestCountFormatsSingular[gGuestChangeModifier] - : _guestCountFormats[gGuestChangeModifier]; - colour_t colour - = (gHoverWidget.window_classification == WindowClass::BottomToolbar && gHoverWidget.widget_index == WIDX_GUESTS - ? COLOUR_WHITE - : NOT_TRANSLUCENT(colours[0])); - auto ft = Formatter(); - ft.Add(gameState.NumGuestsInPark); - DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); - } - - // Draw park rating - { - Widget widget = window_game_bottom_toolbar_widgets[WIDX_PARK_RATING]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 11, widget.midY() - 5 }; - - DrawParkRating( - dpi, colours[3], screenCoords, std::max(10, ((gameState.ParkRating / 4) * 263) / 256)); - } - } - - void DrawParkRating(DrawPixelInfo &dpi, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor) - { - int16_t bar_width = (factor * 114) / 255; - GfxFillRectInset( - dpi, { coords + ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 114, 9 } }, colours[1], INSET_RECT_F_30); - if (!(colour & BAR_BLINK) || GameIsPaused() || (gCurrentRealTimeTicks & 8)) - { - if (bar_width > 2) + int32_t temperature = OpenRCT2::GetGameState().ClimateCurrent.Temperature; + StringId format = STR_CELSIUS_VALUE; + if (gConfigGeneral.TemperatureFormat == TemperatureUnit::Fahrenheit) { - GfxFillRectInset(dpi, { coords + ScreenCoordsXY{ 2, 2 }, coords + ScreenCoordsXY{ bar_width - 1, 8 } }, colour, 0); + temperature = ClimateCelsiusToFahrenheit(temperature); + format = STR_FAHRENHEIT_VALUE; + } + ft = Formatter(); + ft.Add(temperature); + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 0, 6 }, format, ft); + screenCoords.x += 30; + + // Current weather + auto currentWeatherSpriteId = ClimateGetWeatherSpriteId(OpenRCT2::GetGameState().ClimateCurrent); + GfxDrawSprite(dpi, ImageId(currentWeatherSpriteId), screenCoords); + + // Next weather + auto nextWeatherSpriteId = ClimateGetWeatherSpriteId(GetGameState().ClimateNext); + if (currentWeatherSpriteId != nextWeatherSpriteId) + { + if (GetGameState().ClimateUpdateTimer < 960) + { + GfxDrawSprite(dpi, ImageId(SPR_NEXT_WEATHER), screenCoords + ScreenCoordsXY{ 27, 5 }); + GfxDrawSprite(dpi, ImageId(nextWeatherSpriteId), screenCoords + ScreenCoordsXY{ 40, 0 }); + } } } - // Draw thumbs on the sides - GfxDrawSprite(dpi, ImageId(SPR_RATING_LOW), coords - ScreenCoordsXY{ 14, 0 }); - GfxDrawSprite(dpi, ImageId(SPR_RATING_HIGH), coords + ScreenCoordsXY{ 114, 0 }); - } - - void DrawRightPanel(DrawPixelInfo &dpi) - { - const auto topLeft = windowPos - + ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 1, - window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + 1 }; - const auto bottomRight = windowPos - + ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right - 1, - window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].bottom - 1 }; - // Draw green inset rectangle on panel - GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_30); - - auto screenCoords = ScreenCoordsXY{ (window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left - + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right) - / 2 - + windowPos.x, - window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + windowPos.y + 2 }; - - // Date - auto& date = GetDate(); - int32_t year = date.GetYear() + 1; - int32_t month = date.GetMonth(); - int32_t day = date.GetDay(); - - colour_t colour - = (gHoverWidget.window_classification == WindowClass::BottomToolbar && gHoverWidget.widget_index == WIDX_DATE - ? COLOUR_WHITE - : NOT_TRANSLUCENT(colours[0])); - StringId stringId = DateFormatStringFormatIds[gConfigGeneral.DateFormat]; - auto ft = Formatter(); - ft.Add(DateDayNames[day]); - ft.Add(month); - ft.Add(year); - DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); - - // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); - - // Temperature - screenCoords = { windowPos.x + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 15, - static_cast(screenCoords.y + line_height + 1) }; - - int32_t temperature = OpenRCT2::GetGameState().ClimateCurrent.Temperature; - StringId format = STR_CELSIUS_VALUE; - if (gConfigGeneral.TemperatureFormat == TemperatureUnit::Fahrenheit) + void DrawNewsItem(DrawPixelInfo& dpi) { - temperature = ClimateCelsiusToFahrenheit(temperature); - format = STR_FAHRENHEIT_VALUE; - } - ft = Formatter(); - ft.Add(temperature); - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 0, 6 }, format, ft); - screenCoords.x += 30; + auto* middleOutsetWidget = &window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET]; + auto* newsItem = News::GetItem(0); - // Current weather - auto currentWeatherSpriteId = ClimateGetWeatherSpriteId(OpenRCT2::GetGameState().ClimateCurrent); - GfxDrawSprite(dpi, ImageId(currentWeatherSpriteId), screenCoords); + // Current news item + GfxFillRectInset( + dpi, - // Next weather - auto nextWeatherSpriteId = ClimateGetWeatherSpriteId(GetGameState().ClimateNext); - if (currentWeatherSpriteId != nextWeatherSpriteId) - { - if (GetGameState().ClimateUpdateTimer < 960) + { windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 }, + windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } }, + colours[2], INSET_RECT_F_30); + + // Text + auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget->midX(), middleOutsetWidget->top + 11 }; + int32_t itemWidth = middleOutsetWidget->width() - 62; + DrawNewsTicker( + dpi, screenCoords, itemWidth, COLOUR_BRIGHT_GREEN, STR_BOTTOM_TOOLBAR_NEWS_TEXT, newsItem->Text, + newsItem->Ticks); + + screenCoords = windowPos + + ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].left, + window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].top }; + switch (newsItem->Type) { - GfxDrawSprite(dpi, ImageId(SPR_NEXT_WEATHER), screenCoords + ScreenCoordsXY{ 27, 5 }); - GfxDrawSprite(dpi, ImageId(nextWeatherSpriteId), screenCoords + ScreenCoordsXY{ 40, 0 }); - } - } - } - - void DrawNewsItem(DrawPixelInfo &dpi) - { - auto* middleOutsetWidget = &window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET]; - auto* newsItem = News::GetItem(0); - - // Current news item - GfxFillRectInset( - dpi, - - { windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 }, - windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } }, - colours[2], INSET_RECT_F_30); - - // Text - auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget->midX(), middleOutsetWidget->top + 11 }; - int32_t itemWidth = middleOutsetWidget->width() - 62; - DrawNewsTicker( - dpi, screenCoords, itemWidth, COLOUR_BRIGHT_GREEN, STR_BOTTOM_TOOLBAR_NEWS_TEXT, newsItem->Text, newsItem->Ticks); - - screenCoords = windowPos - + ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].left, - window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].top }; - switch (newsItem->Type) - { - case News::ItemType::Ride: - GfxDrawSprite(dpi, ImageId(SPR_RIDE), screenCoords); - break; - case News::ItemType::PeepOnRide: - case News::ItemType::Peep: - { - if (newsItem->HasButton()) + case News::ItemType::Ride: + GfxDrawSprite(dpi, ImageId(SPR_RIDE), screenCoords); break; - - DrawPixelInfo cliped_dpi; - if (!ClipDrawPixelInfo(cliped_dpi, dpi, screenCoords + ScreenCoordsXY{ 1, 1 }, 22, 22)) + case News::ItemType::PeepOnRide: + case News::ItemType::Peep: { - break; - } - - auto peep = TryGetEntity(EntityId::FromUnderlying(newsItem->Assoc)); - if (peep == nullptr) - return; - - auto clipCoords = ScreenCoordsXY{ 10, 19 }; - auto* staff = peep->As(); - if (staff != nullptr && staff->AssignedStaffType == StaffType::Entertainer) - { - clipCoords.y += 3; - } - - uint32_t image_id_base = GetPeepAnimation(peep->SpriteType).base_image; - image_id_base += frame_no & 0xFFFFFFFC; - image_id_base++; - - auto image_id = ImageId(image_id_base, peep->TshirtColour, peep->TrousersColour); - GfxDrawSprite(cliped_dpi, image_id, clipCoords); - - auto* guest = peep->As(); - if (guest != nullptr) - { - if (image_id_base >= 0x2A1D && image_id_base < 0x2A3D) - { - GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->BalloonColour), clipCoords); - } - else if (image_id_base >= 0x2BBD && image_id_base < 0x2BDD) - { - GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->UmbrellaColour), clipCoords); - } - else if (image_id_base >= 0x29DD && image_id_base < 0x29FD) - { - GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->HatColour), clipCoords); - } - } - break; - } - case News::ItemType::Money: - case News::ItemType::Campaign: - GfxDrawSprite(dpi, ImageId(SPR_FINANCE), screenCoords); - break; - case News::ItemType::Research: - GfxDrawSprite(dpi, ImageId(newsItem->Assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE), screenCoords); - break; - case News::ItemType::Peeps: - GfxDrawSprite(dpi, ImageId(SPR_GUESTS), screenCoords); - break; - case News::ItemType::Award: - GfxDrawSprite(dpi, ImageId(SPR_AWARD), screenCoords); - break; - case News::ItemType::Graph: - GfxDrawSprite(dpi, ImageId(SPR_GRAPH), screenCoords); - break; - case News::ItemType::Null: - case News::ItemType::Blank: - case News::ItemType::Count: - break; - } - } - - void DrawMiddlePanel(DrawPixelInfo &dpi) - { - Widget* middleOutsetWidget = &window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET]; - - GfxFillRectInset( - dpi, - { windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 }, - windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } }, - colours[1], INSET_RECT_F_30); - - // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); - - ScreenCoordsXY middleWidgetCoords( - windowPos.x + middleOutsetWidget->midX(), windowPos.y + middleOutsetWidget->top + line_height + 1); - int32_t panelWidth = middleOutsetWidget->width() - 62; - - // Check if there is a map tooltip to draw - StringId stringId; - auto ft = GetMapTooltip(); - std::memcpy(&stringId, ft.Data(), sizeof(StringId)); - if (stringId == STR_NONE) - { - DrawTextWrapped( - dpi, middleWidgetCoords, panelWidth, STR_TITLE_SEQUENCE_OPENRCT2, ft, { colours[0], TextAlignment::CENTRE }); - } - else - { - // Show tooltip in bottom toolbar - DrawTextWrapped(dpi, middleWidgetCoords, panelWidth, STR_STRINGID, ft, { colours[0], TextAlignment::CENTRE }); - } - } - - void InvalidateDirtyWidgets() - { - if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_MONEY) - { - gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_MONEY; - InvalidateWidget(WIDX_LEFT_INSET); - } - - if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_DATE) - { - gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_DATE; - InvalidateWidget(WIDX_RIGHT_INSET); - } - - if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_PEEP_COUNT) - { - gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_PEEP_COUNT; - InvalidateWidget(WIDX_LEFT_INSET); - } - - if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_CLIMATE) - { - gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_CLIMATE; - InvalidateWidget(WIDX_RIGHT_INSET); - } - - if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_PARK_RATING) - { - gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_PARK_RATING; - InvalidateWidget(WIDX_LEFT_INSET); - } - } - - -public: - GameBottomToolbar() - { - widgets = window_game_bottom_toolbar_widgets; - - frame_no = 0; - InitScrollWidgets(); - - // Reset the middle widget to not show by default. - // If it is required to be shown news_update will reshow it. - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::Empty; - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - - News::Item* newsItem; - - switch (widgetIndex) - { - case WIDX_LEFT_OUTSET: - case WIDX_MONEY: - if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) - ContextOpenWindow(WindowClass::Finances); - break; - case WIDX_GUESTS: - ContextOpenWindowView(WV_PARK_GUESTS); - break; - case WIDX_PARK_RATING: - ContextOpenWindowView(WV_PARK_RATING); - break; - case WIDX_MIDDLE_INSET: - if (News::IsQueueEmpty()) - { - ContextOpenWindow(WindowClass::RecentNews); - } - else - { - News::CloseCurrentItem(); - } - break; - case WIDX_NEWS_SUBJECT: - newsItem = News::GetItem(0); - News::OpenSubject(newsItem->Type, newsItem->Assoc); - break; - case WIDX_NEWS_LOCATE: - if (News::IsQueueEmpty()) - break; - - { - newsItem = News::GetItem(0); - - auto subjectLoc = News::GetSubjectLocation(newsItem->Type, newsItem->Assoc); - - if (!subjectLoc.has_value()) + if (newsItem->HasButton()) break; - WindowBase* mainWindow = WindowGetMain(); - if (mainWindow != nullptr) - WindowScrollToLocation(*mainWindow, subjectLoc.value()); + DrawPixelInfo cliped_dpi; + if (!ClipDrawPixelInfo(cliped_dpi, dpi, screenCoords + ScreenCoordsXY{ 1, 1 }, 22, 22)) + { + break; + } + + auto peep = TryGetEntity(EntityId::FromUnderlying(newsItem->Assoc)); + if (peep == nullptr) + return; + + auto clipCoords = ScreenCoordsXY{ 10, 19 }; + auto* staff = peep->As(); + if (staff != nullptr && staff->AssignedStaffType == StaffType::Entertainer) + { + clipCoords.y += 3; + } + + uint32_t image_id_base = GetPeepAnimation(peep->SpriteType).base_image; + image_id_base += frame_no & 0xFFFFFFFC; + image_id_base++; + + auto image_id = ImageId(image_id_base, peep->TshirtColour, peep->TrousersColour); + GfxDrawSprite(cliped_dpi, image_id, clipCoords); + + auto* guest = peep->As(); + if (guest != nullptr) + { + if (image_id_base >= 0x2A1D && image_id_base < 0x2A3D) + { + GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->BalloonColour), clipCoords); + } + else if (image_id_base >= 0x2BBD && image_id_base < 0x2BDD) + { + GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->UmbrellaColour), clipCoords); + } + else if (image_id_base >= 0x29DD && image_id_base < 0x29FD) + { + GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->HatColour), clipCoords); + } + } + break; } - break; - case WIDX_RIGHT_OUTSET: - case WIDX_DATE: - ContextOpenWindow(WindowClass::RecentNews); - break; - } - } - - OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override - { - const auto& gameState = GetGameState(); - auto ft = Formatter(); - - switch (widgetIndex) - { - case WIDX_MONEY: - ft.Add(gameState.CurrentProfit); - ft.Add(gameState.ParkValue); - break; - case WIDX_PARK_RATING: - ft.Add(gameState.ParkRating); - break; - } - return { fallback, ft }; - } - - void OnPrepareDraw() override - { - // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); - - // Reset dimensions as appropriate -- in case we're switching languages. - height = line_height * 2 + 12; - windowPos.y = ContextGetHeight() - height; - - // Change height of widgets in accordance with line height. - widgets[WIDX_LEFT_OUTSET].bottom = widgets[WIDX_MIDDLE_OUTSET].bottom = widgets[WIDX_RIGHT_OUTSET].bottom - = line_height * 3 + 3; - widgets[WIDX_LEFT_INSET].bottom = widgets[WIDX_MIDDLE_INSET].bottom = widgets[WIDX_RIGHT_INSET].bottom - = line_height * 3 + 1; - - // Reposition left widgets in accordance with line height... depending on whether there is money in play. - if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) - { - widgets[WIDX_MONEY].type = WindowWidgetType::Empty; - widgets[WIDX_GUESTS].top = 1; - widgets[WIDX_GUESTS].bottom = line_height + 7; - widgets[WIDX_PARK_RATING].top = line_height + 8; - widgets[WIDX_PARK_RATING].bottom = height - 1; - } - else - { - widgets[WIDX_MONEY].type = WindowWidgetType::FlatBtn; - widgets[WIDX_MONEY].bottom = widgets[WIDX_MONEY].top + line_height; - widgets[WIDX_GUESTS].top = widgets[WIDX_MONEY].bottom + 1; - widgets[WIDX_GUESTS].bottom = widgets[WIDX_GUESTS].top + line_height; - widgets[WIDX_PARK_RATING].top = widgets[WIDX_GUESTS].bottom - 1; - widgets[WIDX_PARK_RATING].bottom = height - 1; + case News::ItemType::Money: + case News::ItemType::Campaign: + GfxDrawSprite(dpi, ImageId(SPR_FINANCE), screenCoords); + break; + case News::ItemType::Research: + GfxDrawSprite(dpi, ImageId(newsItem->Assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE), screenCoords); + break; + case News::ItemType::Peeps: + GfxDrawSprite(dpi, ImageId(SPR_GUESTS), screenCoords); + break; + case News::ItemType::Award: + GfxDrawSprite(dpi, ImageId(SPR_AWARD), screenCoords); + break; + case News::ItemType::Graph: + GfxDrawSprite(dpi, ImageId(SPR_GRAPH), screenCoords); + break; + case News::ItemType::Null: + case News::ItemType::Blank: + case News::ItemType::Count: + break; + } } - // Reposition right widgets in accordance with line height, too. - widgets[WIDX_DATE].bottom = line_height + 1; - - // Anchor the middle and right panel to the right - int32_t x = ContextGetWidth(); - width = x; - x--; - window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right = x; - x -= 2; - window_game_bottom_toolbar_widgets[WIDX_RIGHT_INSET].right = x; - x -= 137; - window_game_bottom_toolbar_widgets[WIDX_RIGHT_INSET].left = x; - x -= 2; - window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left = x; - x--; - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].right = x; - x -= 2; - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].right = x; - x -= 3; - window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].right = x; - x -= 23; - window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].left = x; - window_game_bottom_toolbar_widgets[WIDX_DATE].left = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 2; - window_game_bottom_toolbar_widgets[WIDX_DATE].right = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right - 2; - - window_game_bottom_toolbar_widgets[WIDX_LEFT_INSET].type = WindowWidgetType::Empty; - window_game_bottom_toolbar_widgets[WIDX_RIGHT_INSET].type = WindowWidgetType::Empty; - - if (News::IsQueueEmpty()) + void DrawMiddlePanel(DrawPixelInfo& dpi) { - if (!(ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR)) + Widget* middleOutsetWidget = &window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET]; + + GfxFillRectInset( + dpi, + { windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 }, + windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } }, + colours[1], INSET_RECT_F_30); + + // Figure out how much line height we have to work with. + uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + + ScreenCoordsXY middleWidgetCoords( + windowPos.x + middleOutsetWidget->midX(), windowPos.y + middleOutsetWidget->top + line_height + 1); + int32_t panelWidth = middleOutsetWidget->width() - 62; + + // Check if there is a map tooltip to draw + StringId stringId; + auto ft = GetMapTooltip(); + std::memcpy(&stringId, ft.Data(), sizeof(StringId)); + if (stringId == STR_NONE) { - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::Empty; - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::Empty; - window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty; - window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::Empty; + DrawTextWrapped( + dpi, middleWidgetCoords, panelWidth, STR_TITLE_SEQUENCE_OPENRCT2, ft, + { colours[0], TextAlignment::CENTRE }); } else { + // Show tooltip in bottom toolbar + DrawTextWrapped(dpi, middleWidgetCoords, panelWidth, STR_STRINGID, ft, { colours[0], TextAlignment::CENTRE }); + } + } + + void InvalidateDirtyWidgets() + { + if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_MONEY) + { + gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_MONEY; + InvalidateWidget(WIDX_LEFT_INSET); + } + + if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_DATE) + { + gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_DATE; + InvalidateWidget(WIDX_RIGHT_INSET); + } + + if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_PEEP_COUNT) + { + gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_PEEP_COUNT; + InvalidateWidget(WIDX_LEFT_INSET); + } + + if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_CLIMATE) + { + gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_CLIMATE; + InvalidateWidget(WIDX_RIGHT_INSET); + } + + if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_PARK_RATING) + { + gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_PARK_RATING; + InvalidateWidget(WIDX_LEFT_INSET); + } + } + + public: + GameBottomToolbar() + { + widgets = window_game_bottom_toolbar_widgets; + + frame_no = 0; + InitScrollWidgets(); + + // Reset the middle widget to not show by default. + // If it is required to be shown news_update will reshow it. + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::Empty; + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + News::Item* newsItem; + + switch (widgetIndex) + { + case WIDX_LEFT_OUTSET: + case WIDX_MONEY: + if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + ContextOpenWindow(WindowClass::Finances); + break; + case WIDX_GUESTS: + ContextOpenWindowView(WV_PARK_GUESTS); + break; + case WIDX_PARK_RATING: + ContextOpenWindowView(WV_PARK_RATING); + break; + case WIDX_MIDDLE_INSET: + if (News::IsQueueEmpty()) + { + ContextOpenWindow(WindowClass::RecentNews); + } + else + { + News::CloseCurrentItem(); + } + break; + case WIDX_NEWS_SUBJECT: + newsItem = News::GetItem(0); + News::OpenSubject(newsItem->Type, newsItem->Assoc); + break; + case WIDX_NEWS_LOCATE: + if (News::IsQueueEmpty()) + break; + + { + newsItem = News::GetItem(0); + + auto subjectLoc = News::GetSubjectLocation(newsItem->Type, newsItem->Assoc); + + if (!subjectLoc.has_value()) + break; + + WindowBase* mainWindow = WindowGetMain(); + if (mainWindow != nullptr) + WindowScrollToLocation(*mainWindow, subjectLoc.value()); + } + break; + case WIDX_RIGHT_OUTSET: + case WIDX_DATE: + ContextOpenWindow(WindowClass::RecentNews); + break; + } + } + + OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override + { + const auto& gameState = GetGameState(); + auto ft = Formatter(); + + switch (widgetIndex) + { + case WIDX_MONEY: + ft.Add(gameState.CurrentProfit); + ft.Add(gameState.ParkValue); + break; + case WIDX_PARK_RATING: + ft.Add(gameState.ParkRating); + break; + } + return { fallback, ft }; + } + + void OnPrepareDraw() override + { + // Figure out how much line height we have to work with. + uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + + // Reset dimensions as appropriate -- in case we're switching languages. + height = line_height * 2 + 12; + windowPos.y = ContextGetHeight() - height; + + // Change height of widgets in accordance with line height. + widgets[WIDX_LEFT_OUTSET].bottom = widgets[WIDX_MIDDLE_OUTSET].bottom = widgets[WIDX_RIGHT_OUTSET].bottom + = line_height * 3 + 3; + widgets[WIDX_LEFT_INSET].bottom = widgets[WIDX_MIDDLE_INSET].bottom = widgets[WIDX_RIGHT_INSET].bottom = line_height + * 3 + + 1; + + // Reposition left widgets in accordance with line height... depending on whether there is money in play. + if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) + { + widgets[WIDX_MONEY].type = WindowWidgetType::Empty; + widgets[WIDX_GUESTS].top = 1; + widgets[WIDX_GUESTS].bottom = line_height + 7; + widgets[WIDX_PARK_RATING].top = line_height + 8; + widgets[WIDX_PARK_RATING].bottom = height - 1; + } + else + { + widgets[WIDX_MONEY].type = WindowWidgetType::FlatBtn; + widgets[WIDX_MONEY].bottom = widgets[WIDX_MONEY].top + line_height; + widgets[WIDX_GUESTS].top = widgets[WIDX_MONEY].bottom + 1; + widgets[WIDX_GUESTS].bottom = widgets[WIDX_GUESTS].top + line_height; + widgets[WIDX_PARK_RATING].top = widgets[WIDX_GUESTS].bottom - 1; + widgets[WIDX_PARK_RATING].bottom = height - 1; + } + + // Reposition right widgets in accordance with line height, too. + widgets[WIDX_DATE].bottom = line_height + 1; + + // Anchor the middle and right panel to the right + int32_t x = ContextGetWidth(); + width = x; + x--; + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right = x; + x -= 2; + window_game_bottom_toolbar_widgets[WIDX_RIGHT_INSET].right = x; + x -= 137; + window_game_bottom_toolbar_widgets[WIDX_RIGHT_INSET].left = x; + x -= 2; + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left = x; + x--; + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].right = x; + x -= 2; + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].right = x; + x -= 3; + window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].right = x; + x -= 23; + window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].left = x; + window_game_bottom_toolbar_widgets[WIDX_DATE].left = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 2; + window_game_bottom_toolbar_widgets[WIDX_DATE].right = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right + - 2; + + window_game_bottom_toolbar_widgets[WIDX_LEFT_INSET].type = WindowWidgetType::Empty; + window_game_bottom_toolbar_widgets[WIDX_RIGHT_INSET].type = WindowWidgetType::Empty; + + if (News::IsQueueEmpty()) + { + if (!(ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR)) + { + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::Empty; + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::Empty; + window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty; + window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::Empty; + } + else + { + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::ImgBtn; + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::FlatBtn; + window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty; + window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::Empty; + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].colour = 0; + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].colour = 0; + } + } + else + { + News::Item* newsItem = News::GetItem(0); window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::ImgBtn; window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::FlatBtn; - window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty; - window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::Empty; - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].colour = 0; - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].colour = 0; + window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::FlatBtn; + window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::FlatBtn; + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].colour = 2; + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].colour = 2; + disabled_widgets &= ~(1uLL << WIDX_NEWS_SUBJECT); + disabled_widgets &= ~(1uLL << WIDX_NEWS_LOCATE); + + // Find out if the news item is no longer valid + auto subjectLoc = News::GetSubjectLocation(newsItem->Type, newsItem->Assoc); + + if (!subjectLoc.has_value()) + disabled_widgets |= (1uLL << WIDX_NEWS_LOCATE); + + if (!(newsItem->TypeHasSubject())) + { + disabled_widgets |= (1uLL << WIDX_NEWS_SUBJECT); + window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty; + } + + if (newsItem->HasButton()) + { + disabled_widgets |= (1uLL << WIDX_NEWS_SUBJECT); + disabled_widgets |= (1uLL << WIDX_NEWS_LOCATE); + } } } - else + + void OnDraw(DrawPixelInfo& dpi) override { - News::Item* newsItem = News::GetItem(0); - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::ImgBtn; - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::FlatBtn; - window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::FlatBtn; - window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::FlatBtn; - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].colour = 2; - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].colour = 2; - disabled_widgets &= ~(1uLL << WIDX_NEWS_SUBJECT); - disabled_widgets &= ~(1uLL << WIDX_NEWS_LOCATE); + auto leftWidget = window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET]; + auto rightWidget = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET]; + auto middleWidget = window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET]; - // Find out if the news item is no longer valid - auto subjectLoc = News::GetSubjectLocation(newsItem->Type, newsItem->Assoc); - - if (!subjectLoc.has_value()) - disabled_widgets |= (1uLL << WIDX_NEWS_LOCATE); - - if (!(newsItem->TypeHasSubject())) - { - disabled_widgets |= (1uLL << WIDX_NEWS_SUBJECT); - window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty; - } - - if (newsItem->HasButton()) - { - disabled_widgets |= (1uLL << WIDX_NEWS_SUBJECT); - disabled_widgets |= (1uLL << WIDX_NEWS_LOCATE); - } - } - } - - void OnDraw(DrawPixelInfo &dpi) override - { - auto leftWidget = window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET]; - auto rightWidget = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET]; - auto middleWidget = window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET]; - - // Draw panel grey backgrounds - auto leftTop = windowPos + ScreenCoordsXY{ leftWidget.left, leftWidget.top }; - auto rightBottom = windowPos + ScreenCoordsXY{ leftWidget.right, leftWidget.bottom }; - GfxFilterRect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51); - - leftTop = windowPos + ScreenCoordsXY{ rightWidget.left, rightWidget.top }; - rightBottom = windowPos + ScreenCoordsXY{ rightWidget.right, rightWidget.bottom }; - GfxFilterRect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51); - - if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) - { - // Draw grey background - leftTop = windowPos + ScreenCoordsXY{ middleWidget.left, middleWidget.top }; - rightBottom = windowPos + ScreenCoordsXY{ middleWidget.right, middleWidget.bottom }; + // Draw panel grey backgrounds + auto leftTop = windowPos + ScreenCoordsXY{ leftWidget.left, leftWidget.top }; + auto rightBottom = windowPos + ScreenCoordsXY{ leftWidget.right, leftWidget.bottom }; GfxFilterRect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51); + + leftTop = windowPos + ScreenCoordsXY{ rightWidget.left, rightWidget.top }; + rightBottom = windowPos + ScreenCoordsXY{ rightWidget.right, rightWidget.bottom }; + GfxFilterRect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51); + + if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) + { + // Draw grey background + leftTop = windowPos + ScreenCoordsXY{ middleWidget.left, middleWidget.top }; + rightBottom = windowPos + ScreenCoordsXY{ middleWidget.right, middleWidget.bottom }; + GfxFilterRect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51); + } + + DrawWidgets(dpi); + + DrawLeftPanel(dpi); + DrawRightPanel(dpi); + + if (!News::IsQueueEmpty()) + { + DrawNewsItem(dpi); + } + else if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) + { + DrawMiddlePanel(dpi); + } } - DrawWidgets(dpi); - - DrawLeftPanel(dpi); - DrawRightPanel(dpi); - - if (!News::IsQueueEmpty()) + void OnUpdate() override { - DrawNewsItem(dpi); + frame_no++; + if (frame_no >= 24) + frame_no = 0; + + InvalidateDirtyWidgets(); } - else if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) + + CursorID OnCursor(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords, CursorID cursorId) override { - DrawMiddlePanel(dpi); + switch (widgetIndex) + { + case WIDX_MONEY: + case WIDX_GUESTS: + case WIDX_PARK_RATING: + case WIDX_DATE: + gTooltipCloseTimeout = gCurrentRealTimeTicks + 2000; + break; + } + return cursorId; } - } - void OnUpdate() override - { - frame_no++; - if (frame_no >= 24) - frame_no = 0; - - InvalidateDirtyWidgets(); - } - - CursorID OnCursor(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords, CursorID cursorId) override - { - switch (widgetIndex) + void OnPeriodicUpdate() override { - case WIDX_MONEY: - case WIDX_GUESTS: - case WIDX_PARK_RATING: - case WIDX_DATE: - gTooltipCloseTimeout = gCurrentRealTimeTicks + 2000; - break; + InvalidateDirtyWidgets(); } - return cursorId; - } + }; - void OnPeriodicUpdate() override + /** + * Creates the main game bottom toolbar window. + */ + WindowBase* GameBottomToolbarOpen() { - InvalidateDirtyWidgets(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + + // Figure out how much line height we have to work with. + uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + uint32_t toolbar_height = line_height * 2 + 12; + + GameBottomToolbar* window = WindowCreate( + WindowClass::BottomToolbar, ScreenCoordsXY(0, screenHeight - toolbar_height), screenWidth, toolbar_height, + WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); + + return window; } -}; -/** - * Creates the main game bottom toolbar window. - */ -WindowBase* WindowGameBottomToolbarOpen() -{ - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - - // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); - uint32_t toolbar_height = line_height * 2 + 12; - - GameBottomToolbar* window = WindowCreate( - WindowClass::BottomToolbar, - ScreenCoordsXY(0, screenHeight - toolbar_height), - screenWidth, - toolbar_height, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); - - return window; -} - -void WindowGameBottomToolbarInvalidateNewsItem() -{ - if (gScreenFlags == SCREEN_FLAGS_PLAYING) + void WindowGameBottomToolbarInvalidateNewsItem() { - WidgetInvalidateByClass(WindowClass::BottomToolbar, WIDX_MIDDLE_OUTSET); + if (gScreenFlags == SCREEN_FLAGS_PLAYING) + { + WidgetInvalidateByClass(WindowClass::BottomToolbar, WIDX_MIDDLE_OUTSET); + } } -} - +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index f49e9eba4e..fadc34476a 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -36,52 +36,52 @@ #include #include -using namespace OpenRCT2; - -static constexpr StringId WINDOW_TITLE = STR_STRINGID; -static constexpr int32_t WH = 157; -static constexpr int32_t WW = 192; - -enum WindowGuestPage +namespace OpenRCT2::Ui::Windows { - WINDOW_GUEST_OVERVIEW, - WINDOW_GUEST_STATS, - WINDOW_GUEST_RIDES, - WINDOW_GUEST_FINANCE, - WINDOW_GUEST_THOUGHTS, - WINDOW_GUEST_INVENTORY, - WINDOW_GUEST_DEBUG, - WINDOW_GUEST_PAGE_COUNT, -}; + static constexpr StringId WINDOW_TITLE = STR_STRINGID; + static constexpr int32_t WH = 157; + static constexpr int32_t WW = 192; -enum WindowGuestWidgetIdx -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_PAGE_BACKGROUND, - WIDX_TAB_1, - WIDX_TAB_2, - WIDX_TAB_3, - WIDX_TAB_4, - WIDX_TAB_5, - WIDX_TAB_6, - WIDX_TAB_7, + enum WindowGuestPage + { + WINDOW_GUEST_OVERVIEW, + WINDOW_GUEST_STATS, + WINDOW_GUEST_RIDES, + WINDOW_GUEST_FINANCE, + WINDOW_GUEST_THOUGHTS, + WINDOW_GUEST_INVENTORY, + WINDOW_GUEST_DEBUG, + WINDOW_GUEST_PAGE_COUNT, + }; - WIDX_MARQUEE = 11, - WIDX_VIEWPORT, - WIDX_ACTION_LBL, - WIDX_PICKUP, - WIDX_RENAME, - WIDX_LOCATE, - WIDX_TRACK, + enum WindowGuestWidgetIdx + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_PAGE_BACKGROUND, + WIDX_TAB_1, + WIDX_TAB_2, + WIDX_TAB_3, + WIDX_TAB_4, + WIDX_TAB_5, + WIDX_TAB_6, + WIDX_TAB_7, - WIDX_RIDE_SCROLL = 11 -}; + WIDX_MARQUEE = 11, + WIDX_VIEWPORT, + WIDX_ACTION_LBL, + WIDX_PICKUP, + WIDX_RENAME, + WIDX_LOCATE, + WIDX_TRACK, -validate_global_widx(WC_PEEP, WIDX_PICKUP); + WIDX_RIDE_SCROLL = 11 + }; -static constexpr int32_t TabWidth = 30; + validate_global_widx(WC_PEEP, WIDX_PICKUP); + + static constexpr int32_t TabWidth = 30; #define MAIN_GUEST_WIDGETS \ WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ @@ -94,7 +94,7 @@ static constexpr int32_t TabWidth = 30; MakeTab({ 158, 17 }, STR_SHOW_GUEST_ITEMS_TIP), /* Tab 6 */ \ MakeTab({ 189, 17 }, STR_DEBUG_TIP) /* Tab 7 */ -// clang-format off + // clang-format off static Widget _guestWindowWidgetsOverview[] = { MAIN_GUEST_WIDGETS, MakeWidget({ 3, 45}, {164, 12}, WindowWidgetType::LabelCentred, WindowColour::Secondary ), // Label Thought marquee @@ -104,42 +104,42 @@ static Widget _guestWindowWidgetsOverview[] = { MakeWidget({167, 69}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_NAME_GUEST_TIP ), // Rename Button MakeWidget({167, 93}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP ), // Locate Button MakeWidget({167, 117}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_TRACK_PEEP), STR_TOGGLE_GUEST_TRACKING_TIP), // Track Button - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -static Widget _guestWindowWidgetsStats[] = { - MAIN_GUEST_WIDGETS, - WIDGETS_END, -}; + static Widget _guestWindowWidgetsStats[] = { + MAIN_GUEST_WIDGETS, + kWidgetsEnd, + }; -static Widget _guestWindowWidgetsRides[] = { - MAIN_GUEST_WIDGETS, - MakeWidget({ 3, 57 }, { 186, 87 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), - WIDGETS_END, -}; + static Widget _guestWindowWidgetsRides[] = { + MAIN_GUEST_WIDGETS, + MakeWidget({ 3, 57 }, { 186, 87 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), + kWidgetsEnd, + }; -static Widget _guestWindowWidgetsFinance[] = { - MAIN_GUEST_WIDGETS, - WIDGETS_END, -}; + static Widget _guestWindowWidgetsFinance[] = { + MAIN_GUEST_WIDGETS, + kWidgetsEnd, + }; -static Widget _guestWindowWidgetsThoughts[] = { - MAIN_GUEST_WIDGETS, - WIDGETS_END, -}; + static Widget _guestWindowWidgetsThoughts[] = { + MAIN_GUEST_WIDGETS, + kWidgetsEnd, + }; -static Widget _guestWindowWidgetsInventory[] = { - MAIN_GUEST_WIDGETS, - WIDGETS_END, -}; + static Widget _guestWindowWidgetsInventory[] = { + MAIN_GUEST_WIDGETS, + kWidgetsEnd, + }; -static Widget _guestWindowWidgetsDebug[] = { - MAIN_GUEST_WIDGETS, - WIDGETS_END, -}; + static Widget _guestWindowWidgetsDebug[] = { + MAIN_GUEST_WIDGETS, + kWidgetsEnd, + }; -// clang-format off + // clang-format off static constexpr std::array _guestWindowPageWidgets = { _guestWindowWidgetsOverview, _guestWindowWidgetsStats, @@ -150,1787 +150,1789 @@ static constexpr std::array _guestWindowPageWidgets = { _guestWindowWidgetsDebug, }; static_assert(_guestWindowPageWidgets.size() == WINDOW_GUEST_PAGE_COUNT); -// clang-format on + // clang-format on -static constexpr std::array _guestWindowPageSizes = { - std::array{ ScreenSize{ 192, 159 }, ScreenSize{ 500, 450 } }, // WINDOW_GUEST_OVERVIEW - std::array{ ScreenSize{ 192, 180 }, ScreenSize{ 192, 180 } }, // WINDOW_GUEST_STATS - std::array{ ScreenSize{ 192, 180 }, ScreenSize{ 500, 400 } }, // WINDOW_GUEST_RIDES - std::array{ ScreenSize{ 210, 148 }, ScreenSize{ 210, 148 } }, // WINDOW_GUEST_FINANCE - std::array{ ScreenSize{ 192, 159 }, ScreenSize{ 500, 450 } }, // WINDOW_GUEST_THOUGHTS - std::array{ ScreenSize{ 192, 159 }, ScreenSize{ 500, 450 } }, // WINDOW_GUEST_INVENTORY - std::array{ ScreenSize{ 192, 171 }, ScreenSize{ 192, 171 } }, // WINDOW_GUEST_DEBUG -}; -static_assert(_guestWindowPageSizes.size() == WINDOW_GUEST_PAGE_COUNT); + static constexpr std::array _guestWindowPageSizes = { + std::array{ ScreenSize{ 192, 159 }, ScreenSize{ 500, 450 } }, // WINDOW_GUEST_OVERVIEW + std::array{ ScreenSize{ 192, 180 }, ScreenSize{ 192, 180 } }, // WINDOW_GUEST_STATS + std::array{ ScreenSize{ 192, 180 }, ScreenSize{ 500, 400 } }, // WINDOW_GUEST_RIDES + std::array{ ScreenSize{ 210, 148 }, ScreenSize{ 210, 148 } }, // WINDOW_GUEST_FINANCE + std::array{ ScreenSize{ 192, 159 }, ScreenSize{ 500, 450 } }, // WINDOW_GUEST_THOUGHTS + std::array{ ScreenSize{ 192, 159 }, ScreenSize{ 500, 450 } }, // WINDOW_GUEST_INVENTORY + std::array{ ScreenSize{ 192, 171 }, ScreenSize{ 192, 171 } }, // WINDOW_GUEST_DEBUG + }; + static_assert(_guestWindowPageSizes.size() == WINDOW_GUEST_PAGE_COUNT); -class GuestWindow final : public Window -{ -private: - uint16_t _marqueePosition = 0; - uint16_t _beingWatchedTimer = 0; - uint16_t _guestAnimationFrame = 0; - int16_t _pickedPeepX = LOCATION_NULL; // entity->x gets set to 0x8000 on pickup, this is the old value - std::vector _riddenRides; - -public: - void OnOpen() override + class GuestWindow final : public Window { - widgets = _guestWindowWidgetsOverview; - page = WINDOW_GUEST_OVERVIEW; - frame_no = 0; - _marqueePosition = 0; - picked_peep_frame = 0; - min_width = width; - min_height = 157; - max_width = 500; - max_height = 450; - selected_list_item = -1; - } + private: + uint16_t _marqueePosition = 0; + uint16_t _beingWatchedTimer = 0; + uint16_t _guestAnimationFrame = 0; + int16_t _pickedPeepX = LOCATION_NULL; // entity->x gets set to 0x8000 on pickup, this is the old value + std::vector _riddenRides; - void Init(EntityId id) - { - number = id.ToUnderlying(); - page = -1; // Set Page to something invalid so that SetPage doesn't set audio on viewport - SetPage(WINDOW_GUEST_OVERVIEW); - } - - void OnClose() override - { - if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) + public: + void OnOpen() override { - if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) - ToolCancel(); - } - } - - void OnMouseUp(WidgetIndex widx) override - { - switch (widx) - { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - SetPage(widx - WIDX_TAB_1); - return; + widgets = _guestWindowWidgetsOverview; + page = WINDOW_GUEST_OVERVIEW; + frame_no = 0; + _marqueePosition = 0; + picked_peep_frame = 0; + min_width = width; + min_height = 157; + max_width = 500; + max_height = 450; + selected_list_item = -1; } - switch (page) + void Init(EntityId id) { - case WINDOW_GUEST_OVERVIEW: - OnMouseUpOverview(widx); - break; + number = id.ToUnderlying(); + page = -1; // Set Page to something invalid so that SetPage doesn't set audio on viewport + SetPage(WINDOW_GUEST_OVERVIEW); } - } - void OnMouseDown(WidgetIndex widx) override - { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnMouseDownOverview(widx); - } - } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnDropdownOverview(widgetIndex, selectedIndex); - } - } - void OnResize() override - { - switch (page) - { - case WINDOW_GUEST_OVERVIEW: - OnResizeOverview(); - break; - case WINDOW_GUEST_STATS: - case WINDOW_GUEST_RIDES: - case WINDOW_GUEST_FINANCE: - case WINDOW_GUEST_THOUGHTS: - case WINDOW_GUEST_INVENTORY: - case WINDOW_GUEST_DEBUG: - OnResizeCommon(); - break; - } - } - void OnUpdate() override - { - switch (page) - { - case WINDOW_GUEST_OVERVIEW: - OnUpdateOverview(); - break; - case WINDOW_GUEST_STATS: - OnUpdateStats(); - break; - case WINDOW_GUEST_RIDES: - OnUpdateRides(); - break; - case WINDOW_GUEST_FINANCE: - OnUpdateFinance(); - break; - case WINDOW_GUEST_THOUGHTS: - OnUpdateThoughts(); - break; - case WINDOW_GUEST_INVENTORY: - OnUpdateInventory(); - break; - case WINDOW_GUEST_DEBUG: - OnUpdateDebug(); - break; - } - } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnToolUpdateOverview(widgetIndex, screenCoords); - } - } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnToolDownOverview(widgetIndex, screenCoords); - } - } - void OnToolAbort(WidgetIndex widgetIndex) override - { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnToolAbortOverview(widgetIndex); - } - } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnTextInputOverview(widgetIndex, text); - } - } - void OnViewportRotate() override - { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnViewportRotateOverview(); - } - } - void OnDraw(DrawPixelInfo& dpi) override - { - switch (page) - { - case WINDOW_GUEST_OVERVIEW: - OnDrawOverview(dpi); - break; - case WINDOW_GUEST_STATS: - OnDrawStats(dpi); - break; - case WINDOW_GUEST_RIDES: - OnDrawRides(dpi); - break; - case WINDOW_GUEST_FINANCE: - OnDrawFinance(dpi); - break; - case WINDOW_GUEST_THOUGHTS: - OnDrawThoughts(dpi); - break; - case WINDOW_GUEST_INVENTORY: - OnDrawInventory(dpi); - break; - case WINDOW_GUEST_DEBUG: - OnDrawDebug(dpi); - break; - } - } - void OnPrepareDraw() override - { - OnPrepareDrawCommon(); - switch (page) - { - case WINDOW_GUEST_OVERVIEW: - OnPrepareDrawOverview(); - break; - case WINDOW_GUEST_RIDES: - OnPrepareDrawRides(); - break; - } - } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - if (page == WINDOW_GUEST_RIDES) - { - return OnScrollGetSizeRides(scrollIndex); - } - return {}; - } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - if (page == WINDOW_GUEST_RIDES) + void OnClose() override { - OnScrollMouseOverRides(scrollIndex, screenCoords); - } - } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - if (page == WINDOW_GUEST_RIDES) - { - OnScrollMouseDownRides(scrollIndex, screenCoords); - } - } - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - if (page == WINDOW_GUEST_RIDES) - { - OnScrollDrawRides(scrollIndex, dpi); - } - } - -private: - Guest* GetGuest() - { - auto guest = GetEntity(EntityId::FromUnderlying(number)); - if (guest == nullptr) - { - Close(); - return nullptr; - } - return guest; - } - - void OnResizeCommon() - { - // Get page specific min and max size - int32_t minWidth = _guestWindowPageSizes[page][0].width; - int32_t minHeight = _guestWindowPageSizes[page][0].height; - int32_t maxWidth = _guestWindowPageSizes[page][1].width; - int32_t maxHeight = _guestWindowPageSizes[page][1].height; - - // Ensure min size is large enough for all tabs to fit - for (int32_t i = WIDX_TAB_1; i <= WIDX_TAB_7; i++) - { - if (!WidgetIsDisabled(*this, i)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { - minWidth = std::max(minWidth, widgets[i].right + 3); + if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) + ToolCancel(); } } - maxWidth = std::max(minWidth, maxWidth); - WindowSetResize(*this, minWidth, minHeight, maxWidth, maxHeight); - } - - void OnPrepareDrawCommon() - { - if (_guestWindowPageWidgets[page] != widgets) + void OnMouseUp(WidgetIndex widx) override { + switch (widx) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + SetPage(widx - WIDX_TAB_1); + return; + } + + switch (page) + { + case WINDOW_GUEST_OVERVIEW: + OnMouseUpOverview(widx); + break; + } + } + void OnMouseDown(WidgetIndex widx) override + { + if (page == WINDOW_GUEST_OVERVIEW) + { + OnMouseDownOverview(widx); + } + } + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + if (page == WINDOW_GUEST_OVERVIEW) + { + OnDropdownOverview(widgetIndex, selectedIndex); + } + } + void OnResize() override + { + switch (page) + { + case WINDOW_GUEST_OVERVIEW: + OnResizeOverview(); + break; + case WINDOW_GUEST_STATS: + case WINDOW_GUEST_RIDES: + case WINDOW_GUEST_FINANCE: + case WINDOW_GUEST_THOUGHTS: + case WINDOW_GUEST_INVENTORY: + case WINDOW_GUEST_DEBUG: + OnResizeCommon(); + break; + } + } + void OnUpdate() override + { + switch (page) + { + case WINDOW_GUEST_OVERVIEW: + OnUpdateOverview(); + break; + case WINDOW_GUEST_STATS: + OnUpdateStats(); + break; + case WINDOW_GUEST_RIDES: + OnUpdateRides(); + break; + case WINDOW_GUEST_FINANCE: + OnUpdateFinance(); + break; + case WINDOW_GUEST_THOUGHTS: + OnUpdateThoughts(); + break; + case WINDOW_GUEST_INVENTORY: + OnUpdateInventory(); + break; + case WINDOW_GUEST_DEBUG: + OnUpdateDebug(); + break; + } + } + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + if (page == WINDOW_GUEST_OVERVIEW) + { + OnToolUpdateOverview(widgetIndex, screenCoords); + } + } + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + if (page == WINDOW_GUEST_OVERVIEW) + { + OnToolDownOverview(widgetIndex, screenCoords); + } + } + void OnToolAbort(WidgetIndex widgetIndex) override + { + if (page == WINDOW_GUEST_OVERVIEW) + { + OnToolAbortOverview(widgetIndex); + } + } + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (page == WINDOW_GUEST_OVERVIEW) + { + OnTextInputOverview(widgetIndex, text); + } + } + void OnViewportRotate() override + { + if (page == WINDOW_GUEST_OVERVIEW) + { + OnViewportRotateOverview(); + } + } + void OnDraw(DrawPixelInfo& dpi) override + { + switch (page) + { + case WINDOW_GUEST_OVERVIEW: + OnDrawOverview(dpi); + break; + case WINDOW_GUEST_STATS: + OnDrawStats(dpi); + break; + case WINDOW_GUEST_RIDES: + OnDrawRides(dpi); + break; + case WINDOW_GUEST_FINANCE: + OnDrawFinance(dpi); + break; + case WINDOW_GUEST_THOUGHTS: + OnDrawThoughts(dpi); + break; + case WINDOW_GUEST_INVENTORY: + OnDrawInventory(dpi); + break; + case WINDOW_GUEST_DEBUG: + OnDrawDebug(dpi); + break; + } + } + void OnPrepareDraw() override + { + OnPrepareDrawCommon(); + switch (page) + { + case WINDOW_GUEST_OVERVIEW: + OnPrepareDrawOverview(); + break; + case WINDOW_GUEST_RIDES: + OnPrepareDrawRides(); + break; + } + } + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + if (page == WINDOW_GUEST_RIDES) + { + return OnScrollGetSizeRides(scrollIndex); + } + return {}; + } + + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + if (page == WINDOW_GUEST_RIDES) + { + OnScrollMouseOverRides(scrollIndex, screenCoords); + } + } + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + if (page == WINDOW_GUEST_RIDES) + { + OnScrollMouseDownRides(scrollIndex, screenCoords); + } + } + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + if (page == WINDOW_GUEST_RIDES) + { + OnScrollDrawRides(scrollIndex, dpi); + } + } + + private: + Guest* GetGuest() + { + auto guest = GetEntity(EntityId::FromUnderlying(number)); + if (guest == nullptr) + { + Close(); + return nullptr; + } + return guest; + } + + void OnResizeCommon() + { + // Get page specific min and max size + int32_t minWidth = _guestWindowPageSizes[page][0].width; + int32_t minHeight = _guestWindowPageSizes[page][0].height; + int32_t maxWidth = _guestWindowPageSizes[page][1].width; + int32_t maxHeight = _guestWindowPageSizes[page][1].height; + + // Ensure min size is large enough for all tabs to fit + for (int32_t i = WIDX_TAB_1; i <= WIDX_TAB_7; i++) + { + if (!WidgetIsDisabled(*this, i)) + { + minWidth = std::max(minWidth, widgets[i].right + 3); + } + } + maxWidth = std::max(minWidth, maxWidth); + + WindowSetResize(*this, minWidth, minHeight, maxWidth, maxHeight); + } + + void OnPrepareDrawCommon() + { + if (_guestWindowPageWidgets[page] != widgets) + { + widgets = _guestWindowPageWidgets[page]; + InitScrollWidgets(); + } + + pressed_widgets |= 1uLL << (page + WIDX_TAB_1); + + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + auto ft = Formatter::Common(); + peep->FormatNameTo(ft); + + ResizeFrameWithPage(); + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); + } + + void DisableWidgets() + { + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + uint64_t newDisabledWidgets = 0; + + if (peep->CanBePickedUp()) + { + if (WidgetIsDisabled(*this, WIDX_PICKUP)) + Invalidate(); + } + else + { + newDisabledWidgets = (1uLL << WIDX_PICKUP); + if (!WidgetIsDisabled(*this, WIDX_PICKUP)) + Invalidate(); + } + if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) + { + newDisabledWidgets |= (1uLL << WIDX_TAB_4); // Disable finance tab if no money + } + if (!gConfigGeneral.DebuggingTools) + { + newDisabledWidgets |= (1uLL << WIDX_TAB_7); // Disable debug tab when debug tools not turned on + } + disabled_widgets = newDisabledWidgets; + } + + void SetPage(int32_t newPage) + { + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) + { + if (number == gCurrentToolWidget.window_number && classification == gCurrentToolWidget.window_classification) + ToolCancel(); + } + int32_t listen = 0; + if (newPage == WINDOW_GUEST_OVERVIEW && page == WINDOW_GUEST_OVERVIEW && viewport != nullptr) + { + if (!(viewport->flags & VIEWPORT_FLAG_SOUND_ON)) + listen = 1; + } + + page = newPage; + frame_no = 0; + _riddenRides.clear(); + selected_list_item = -1; + + RemoveViewport(); + + hold_down_widgets = 0; + pressed_widgets = 0; widgets = _guestWindowPageWidgets[page]; + DisableWidgets(); + Invalidate(); + OnResize(); + OnPrepareDraw(); InitScrollWidgets(); + Invalidate(); + + if (listen && viewport != nullptr) + viewport->flags |= VIEWPORT_FLAG_SOUND_ON; } - pressed_widgets |= 1uLL << (page + WIDX_TAB_1); - - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - auto ft = Formatter::Common(); - peep->FormatNameTo(ft); - - ResizeFrameWithPage(); - - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); - } - - void DisableWidgets() - { - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - uint64_t newDisabledWidgets = 0; - - if (peep->CanBePickedUp()) - { - if (WidgetIsDisabled(*this, WIDX_PICKUP)) - Invalidate(); - } - else - { - newDisabledWidgets = (1uLL << WIDX_PICKUP); - if (!WidgetIsDisabled(*this, WIDX_PICKUP)) - Invalidate(); - } - if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) - { - newDisabledWidgets |= (1uLL << WIDX_TAB_4); // Disable finance tab if no money - } - if (!gConfigGeneral.DebuggingTools) - { - newDisabledWidgets |= (1uLL << WIDX_TAB_7); // Disable debug tab when debug tools not turned on - } - disabled_widgets = newDisabledWidgets; - } - - void SetPage(int32_t newPage) - { - if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) - { - if (number == gCurrentToolWidget.window_number && classification == gCurrentToolWidget.window_classification) - ToolCancel(); - } - int32_t listen = 0; - if (newPage == WINDOW_GUEST_OVERVIEW && page == WINDOW_GUEST_OVERVIEW && viewport != nullptr) - { - if (!(viewport->flags & VIEWPORT_FLAG_SOUND_ON)) - listen = 1; - } - - page = newPage; - frame_no = 0; - _riddenRides.clear(); - selected_list_item = -1; - - RemoveViewport(); - - hold_down_widgets = 0; - pressed_widgets = 0; - widgets = _guestWindowPageWidgets[page]; - DisableWidgets(); - Invalidate(); - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); - - if (listen && viewport != nullptr) - viewport->flags |= VIEWPORT_FLAG_SOUND_ON; - } - #pragma region Overview - void OverviewTabDraw(DrawPixelInfo& dpi) - { - if (WidgetIsDisabled(*this, WIDX_TAB_1)) - return; - - const auto& widget = widgets[WIDX_TAB_1]; - int32_t widgWidth = widget.width() - 1; - int32_t widgHeight = widget.height() - 1; - auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; - if (page == WINDOW_GUEST_OVERVIEW) - widgHeight++; - - DrawPixelInfo clipDpi; - if (!ClipDrawPixelInfo(clipDpi, dpi, screenCoords, widgWidth, widgHeight)) + void OverviewTabDraw(DrawPixelInfo& dpi) { - return; - } - - screenCoords = ScreenCoordsXY{ 14, 20 }; - - const auto* peep = GetGuest(); - if (peep == nullptr) - { - return; - } - - int32_t animationFrame = GetPeepAnimation(peep->SpriteType).base_image + 1; - - int32_t animationFrameOffset = 0; - - if (page == WINDOW_GUEST_OVERVIEW) - { - animationFrameOffset = _guestAnimationFrame; - animationFrameOffset &= 0xFFFC; - } - animationFrame += animationFrameOffset; - - auto spriteId = ImageId(animationFrame, peep->TshirtColour, peep->TrousersColour); - GfxDrawSprite(clipDpi, spriteId, screenCoords); - - auto* guest = peep->As(); - if (guest != nullptr) - { - // If holding a balloon - if (animationFrame >= 0x2A1D && animationFrame < 0x2A3D) - { - GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->BalloonColour), screenCoords); - } - - // If holding umbrella - if (animationFrame >= 0x2BBD && animationFrame < 0x2BDD) - { - GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->UmbrellaColour), screenCoords); - } - - // If wearing hat - if (animationFrame >= 0x29DD && animationFrame < 0x29FD) - { - GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->HatColour), screenCoords); - } - } - } - - void OnResizeOverview() - { - DisableWidgets(); - OnPrepareDraw(); - - WidgetInvalidate(*this, WIDX_MARQUEE); - - OnResizeCommon(); - - if (viewport != nullptr) - { - auto reqViewportWidth = width - 30; - auto reqViewportHeight = height - 72; - if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight) - { - viewport->width = reqViewportWidth; - viewport->height = reqViewportHeight; - viewport->view_width = viewport->zoom.ApplyInversedTo(viewport->width); - viewport->view_height = viewport->zoom.ApplyInversedTo(viewport->height); - } - } - OnViewportRotate(); - } - - void OnMouseUpOverview(WidgetIndex widgetIndex) - { - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - - switch (widgetIndex) - { - case WIDX_PICKUP: - { - if (!peep->CanBePickedUp()) - { - return; - } - _pickedPeepX = peep->x; - CoordsXYZ nullLoc{}; - nullLoc.SetNull(); - PeepPickupAction pickupAction{ PeepPickupType::Pickup, EntityId::FromUnderlying(number), nullLoc, - NetworkGetCurrentPlayerId() }; - pickupAction.SetCallback([peepnum = number](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) - return; - WindowBase* wind = WindowFindByNumber(WindowClass::Peep, peepnum); - if (wind != nullptr) - { - ToolSet(*wind, WC_PEEP__WIDX_PICKUP, Tool::Picker); - } - }); - GameActions::Execute(&pickupAction); - } - break; - case WIDX_RENAME: - { - auto peepName = peep->GetName(); - WindowTextInputRawOpen( - this, widgetIndex, STR_GUEST_RENAME_TITLE, STR_GUEST_RENAME_PROMPT, {}, peepName.c_str(), 32); - break; - } - case WIDX_TRACK: - { - uint32_t guestFlags = peep->PeepFlags ^ PEEP_FLAGS_TRACKING; - - auto guestSetFlagsAction = GuestSetFlagsAction(EntityId::FromUnderlying(number), guestFlags); - GameActions::Execute(&guestSetFlagsAction); - } - break; - } - } - - void OnMouseDownOverview(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_LOCATE: - ShowLocateDropdown(widgets[widgetIndex]); - break; - } - } - - void OnDropdownOverview(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - switch (widgetIndex) - { - case WIDX_LOCATE: - { - if (dropdownIndex == 0) - { - ScrollToViewport(); - } - else if (dropdownIndex == 1) - { - GuestFollow(); - } - break; - } - } - } - - void ShowLocateDropdown(Widget& widget) - { - gDropdownItems[0].Format = STR_LOCATE_SUBJECT_TIP; - gDropdownItems[1].Format = STR_FOLLOW_SUBJECT_TIP; - - WindowDropdownShowText({ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1], 0, 2); - gDropdownDefaultIndex = 0; - } - - void GuestFollow() - { - WindowBase* main = WindowGetMain(); - WindowFollowSprite(*main, EntityId::FromUnderlying(number)); - } - - void OnViewportRotateOverview() - { - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - - ViewportUpdateSmartFollowGuest(this, peep); - bool reCreateViewport = false; - uint16_t origViewportFlags{}; - if (viewport != nullptr) - { - if (focus.has_value()) + if (WidgetIsDisabled(*this, WIDX_TAB_1)) return; - origViewportFlags = viewport->flags; + const auto& widget = widgets[WIDX_TAB_1]; + int32_t widgWidth = widget.width() - 1; + int32_t widgHeight = widget.height() - 1; + auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; + if (page == WINDOW_GUEST_OVERVIEW) + widgHeight++; - reCreateViewport = true; - RemoveViewport(); + DrawPixelInfo clipDpi; + if (!ClipDrawPixelInfo(clipDpi, dpi, screenCoords, widgWidth, widgHeight)) + { + return; + } + + screenCoords = ScreenCoordsXY{ 14, 20 }; + + const auto* peep = GetGuest(); + if (peep == nullptr) + { + return; + } + + int32_t animationFrame = GetPeepAnimation(peep->SpriteType).base_image + 1; + + int32_t animationFrameOffset = 0; + + if (page == WINDOW_GUEST_OVERVIEW) + { + animationFrameOffset = _guestAnimationFrame; + animationFrameOffset &= 0xFFFC; + } + animationFrame += animationFrameOffset; + + auto spriteId = ImageId(animationFrame, peep->TshirtColour, peep->TrousersColour); + GfxDrawSprite(clipDpi, spriteId, screenCoords); + + auto* guest = peep->As(); + if (guest != nullptr) + { + // If holding a balloon + if (animationFrame >= 0x2A1D && animationFrame < 0x2A3D) + { + GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->BalloonColour), screenCoords); + } + + // If holding umbrella + if (animationFrame >= 0x2BBD && animationFrame < 0x2BDD) + { + GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->UmbrellaColour), screenCoords); + } + + // If wearing hat + if (animationFrame >= 0x29DD && animationFrame < 0x29FD) + { + GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->HatColour), screenCoords); + } + } } - OnPrepareDraw(); - - if (peep->State != PeepState::Picked && viewport == nullptr) + void OnResizeOverview() { - const auto& viewWidget = widgets[WIDX_VIEWPORT]; - auto screenPos = ScreenCoordsXY{ viewWidget.left + 1 + windowPos.x, viewWidget.top + 1 + windowPos.y }; - int32_t widgWidth = viewWidget.width() - 1; - int32_t widgHeight = viewWidget.height() - 1; + DisableWidgets(); + OnPrepareDraw(); - ViewportCreate(this, screenPos, widgWidth, widgHeight, focus.value()); - if (viewport != nullptr && reCreateViewport) + WidgetInvalidate(*this, WIDX_MARQUEE); + + OnResizeCommon(); + + if (viewport != nullptr) { - viewport->flags = origViewportFlags; + auto reqViewportWidth = width - 30; + auto reqViewportHeight = height - 72; + if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight) + { + viewport->width = reqViewportWidth; + viewport->height = reqViewportHeight; + viewport->view_width = viewport->zoom.ApplyInversedTo(viewport->width); + viewport->view_height = viewport->zoom.ApplyInversedTo(viewport->height); + } + } + OnViewportRotate(); + } + + void OnMouseUpOverview(WidgetIndex widgetIndex) + { + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + + switch (widgetIndex) + { + case WIDX_PICKUP: + { + if (!peep->CanBePickedUp()) + { + return; + } + _pickedPeepX = peep->x; + CoordsXYZ nullLoc{}; + nullLoc.SetNull(); + PeepPickupAction pickupAction{ PeepPickupType::Pickup, EntityId::FromUnderlying(number), nullLoc, + NetworkGetCurrentPlayerId() }; + pickupAction.SetCallback([peepnum = number](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) + return; + WindowBase* wind = WindowFindByNumber(WindowClass::Peep, peepnum); + if (wind != nullptr) + { + ToolSet(*wind, WC_PEEP__WIDX_PICKUP, Tool::Picker); + } + }); + GameActions::Execute(&pickupAction); + } + break; + case WIDX_RENAME: + { + auto peepName = peep->GetName(); + WindowTextInputRawOpen( + this, widgetIndex, STR_GUEST_RENAME_TITLE, STR_GUEST_RENAME_PROMPT, {}, peepName.c_str(), 32); + break; + } + case WIDX_TRACK: + { + uint32_t guestFlags = peep->PeepFlags ^ PEEP_FLAGS_TRACKING; + + auto guestSetFlagsAction = GuestSetFlagsAction(EntityId::FromUnderlying(number), guestFlags); + GameActions::Execute(&guestSetFlagsAction); + } + break; + } + } + + void OnMouseDownOverview(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_LOCATE: + ShowLocateDropdown(widgets[widgetIndex]); + break; + } + } + + void OnDropdownOverview(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + switch (widgetIndex) + { + case WIDX_LOCATE: + { + if (dropdownIndex == 0) + { + ScrollToViewport(); + } + else if (dropdownIndex == 1) + { + GuestFollow(); + } + break; + } + } + } + + void ShowLocateDropdown(Widget& widget) + { + gDropdownItems[0].Format = STR_LOCATE_SUBJECT_TIP; + gDropdownItems[1].Format = STR_FOLLOW_SUBJECT_TIP; + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1], 0, 2); + gDropdownDefaultIndex = 0; + } + + void GuestFollow() + { + WindowBase* main = WindowGetMain(); + WindowFollowSprite(*main, EntityId::FromUnderlying(number)); + } + + void OnViewportRotateOverview() + { + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + + ViewportUpdateSmartFollowGuest(this, *peep); + bool reCreateViewport = false; + uint16_t origViewportFlags{}; + if (viewport != nullptr) + { + if (focus.has_value()) + return; + + origViewportFlags = viewport->flags; + + reCreateViewport = true; + RemoveViewport(); + } + + OnPrepareDraw(); + + if (peep->State != PeepState::Picked && viewport == nullptr) + { + const auto& viewWidget = widgets[WIDX_VIEWPORT]; + auto screenPos = ScreenCoordsXY{ viewWidget.left + 1 + windowPos.x, viewWidget.top + 1 + windowPos.y }; + int32_t widgWidth = viewWidget.width() - 1; + int32_t widgHeight = viewWidget.height() - 1; + + ViewportCreate(this, screenPos, widgWidth, widgHeight, focus.value()); + if (viewport != nullptr && reCreateViewport) + { + viewport->flags = origViewportFlags; + } + flags |= WF_NO_SCROLLING; + Invalidate(); } - flags |= WF_NO_SCROLLING; Invalidate(); } - Invalidate(); - } - void OnDrawOverview(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - OverviewTabDraw(dpi); - StatsTabDraw(dpi); - RidesTabDraw(dpi); - FinanceTabDraw(dpi); - ThoughtsTabDraw(dpi); - InventoryTabDraw(dpi); - DebugTabDraw(dpi); - - // Draw the viewport no sound sprite - if (viewport != nullptr) + void OnDrawOverview(DrawPixelInfo& dpi) { - WindowDrawViewport(dpi, *this); - if (viewport->flags & VIEWPORT_FLAG_SOUND_ON) + DrawWidgets(dpi); + OverviewTabDraw(dpi); + StatsTabDraw(dpi); + RidesTabDraw(dpi); + FinanceTabDraw(dpi); + ThoughtsTabDraw(dpi); + InventoryTabDraw(dpi); + DebugTabDraw(dpi); + + // Draw the viewport no sound sprite + if (viewport != nullptr) { - GfxDrawSprite(dpi, ImageId(SPR_HEARING_VIEWPORT), WindowGetViewportSoundIconPos(*this)); + WindowDrawViewport(dpi, *this); + if (viewport->flags & VIEWPORT_FLAG_SOUND_ON) + { + GfxDrawSprite(dpi, ImageId(SPR_HEARING_VIEWPORT), WindowGetViewportSoundIconPos(*this)); + } } - } - // Draw the centred label - const auto* peep = GetGuest(); - if (peep == nullptr) - { - return; - } + // Draw the centred label + const auto* peep = GetGuest(); + if (peep == nullptr) + { + return; + } - const auto& actionLabelWidget = widgets[WIDX_ACTION_LBL]; - auto screenPos = windowPos + ScreenCoordsXY{ actionLabelWidget.midX(), actionLabelWidget.top - 1 }; + const auto& actionLabelWidget = widgets[WIDX_ACTION_LBL]; + auto screenPos = windowPos + ScreenCoordsXY{ actionLabelWidget.midX(), actionLabelWidget.top - 1 }; - { - auto ft = Formatter(); - peep->FormatActionTo(ft); - int32_t textWidth = actionLabelWidget.width(); - DrawTextEllipsised(dpi, screenPos, textWidth, STR_BLACK_STRING, ft, { TextAlignment::CENTRE }); - } + { + auto ft = Formatter(); + peep->FormatActionTo(ft); + int32_t textWidth = actionLabelWidget.width(); + DrawTextEllipsised(dpi, screenPos, textWidth, STR_BLACK_STRING, ft, { TextAlignment::CENTRE }); + } - // Draw the marquee thought - const auto& marqueeWidget = widgets[WIDX_MARQUEE]; - auto marqWidth = marqueeWidget.width() - 3; - int32_t left = marqueeWidget.left + 2 + windowPos.x; - int32_t top = marqueeWidget.top + windowPos.y; - int32_t marqHeight = marqueeWidget.height(); - DrawPixelInfo dpiMarquee; - if (!ClipDrawPixelInfo(dpiMarquee, dpi, { left, top }, marqWidth, marqHeight)) - { - return; - } + // Draw the marquee thought + const auto& marqueeWidget = widgets[WIDX_MARQUEE]; + auto marqWidth = marqueeWidget.width() - 3; + int32_t left = marqueeWidget.left + 2 + windowPos.x; + int32_t top = marqueeWidget.top + windowPos.y; + int32_t marqHeight = marqueeWidget.height(); + DrawPixelInfo dpiMarquee; + if (!ClipDrawPixelInfo(dpiMarquee, dpi, { left, top }, marqWidth, marqHeight)) + { + return; + } - int32_t i = 0; - for (; i < PEEP_MAX_THOUGHTS; ++i) - { - if (peep->Thoughts[i].type == PeepThoughtType::None) + int32_t i = 0; + for (; i < PEEP_MAX_THOUGHTS; ++i) + { + if (peep->Thoughts[i].type == PeepThoughtType::None) + { + _marqueePosition = 0; + return; + } + if (peep->Thoughts[i].freshness == 1) + { // If a fresh thought + break; + } + } + if (i == PEEP_MAX_THOUGHTS) { _marqueePosition = 0; return; } - if (peep->Thoughts[i].freshness == 1) - { // If a fresh thought - break; + + screenPos.x = marqueeWidget.width() - _marqueePosition; + { + auto ft = Formatter(); + PeepThoughtSetFormatArgs(&peep->Thoughts[i], ft); + DrawTextBasic(dpiMarquee, { screenPos.x, 0 }, STR_WINDOW_COLOUR_2_STRINGID, ft, { FontStyle::Small }); } } - if (i == PEEP_MAX_THOUGHTS) + + void OnPrepareDrawOverview() { - _marqueePosition = 0; - return; - } - - screenPos.x = marqueeWidget.width() - _marqueePosition; - { - auto ft = Formatter(); - PeepThoughtSetFormatArgs(&peep->Thoughts[i], ft); - DrawTextBasic(dpiMarquee, { screenPos.x, 0 }, STR_WINDOW_COLOUR_2_STRINGID, ft, { FontStyle::Small }); - } - } - - void OnPrepareDrawOverview() - { - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - pressed_widgets &= ~(1uLL << WIDX_TRACK); - if (peep->PeepFlags & PEEP_FLAGS_TRACKING) - { - pressed_widgets |= (1uLL << WIDX_TRACK); - } - - widgets[WIDX_VIEWPORT].right = width - 26; - widgets[WIDX_VIEWPORT].bottom = height - 14; - - widgets[WIDX_ACTION_LBL].top = height - 12; - widgets[WIDX_ACTION_LBL].bottom = height - 3; - widgets[WIDX_ACTION_LBL].right = width - 24; - - widgets[WIDX_MARQUEE].right = width - 24; - - widgets[WIDX_PICKUP].right = width - 2; - widgets[WIDX_RENAME].right = width - 2; - widgets[WIDX_LOCATE].right = width - 2; - widgets[WIDX_TRACK].right = width - 2; - - widgets[WIDX_PICKUP].left = width - 25; - widgets[WIDX_RENAME].left = width - 25; - widgets[WIDX_LOCATE].left = width - 25; - widgets[WIDX_TRACK].left = width - 25; - } - - void OnUpdateOverview() - { - _guestAnimationFrame++; - _guestAnimationFrame %= 24; - - // Update pickup animation, can only happen in this tab. - picked_peep_frame++; - picked_peep_frame %= 48; - - WidgetInvalidate(*this, WIDX_TAB_1); - WidgetInvalidate(*this, WIDX_TAB_2); - - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_PEEP_ACTION) - { - peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_ACTION; - WidgetInvalidate(*this, WIDX_ACTION_LBL); - } - - _marqueePosition += 2; - - _beingWatchedTimer++; - - // Disable peep watching thought for multiplayer as it's client specific - if (NetworkGetMode() == NETWORK_MODE_NONE) - { - // Create the "I have the strangest feeling I am being watched thought" - if (_beingWatchedTimer >= 3840) + const auto peep = GetGuest(); + if (peep == nullptr) { - if (!(_beingWatchedTimer & 0x3FF)) + return; + } + pressed_widgets &= ~(1uLL << WIDX_TRACK); + if (peep->PeepFlags & PEEP_FLAGS_TRACKING) + { + pressed_widgets |= (1uLL << WIDX_TRACK); + } + + widgets[WIDX_VIEWPORT].right = width - 26; + widgets[WIDX_VIEWPORT].bottom = height - 14; + + widgets[WIDX_ACTION_LBL].top = height - 12; + widgets[WIDX_ACTION_LBL].bottom = height - 3; + widgets[WIDX_ACTION_LBL].right = width - 24; + + widgets[WIDX_MARQUEE].right = width - 24; + + widgets[WIDX_PICKUP].right = width - 2; + widgets[WIDX_RENAME].right = width - 2; + widgets[WIDX_LOCATE].right = width - 2; + widgets[WIDX_TRACK].right = width - 2; + + widgets[WIDX_PICKUP].left = width - 25; + widgets[WIDX_RENAME].left = width - 25; + widgets[WIDX_LOCATE].left = width - 25; + widgets[WIDX_TRACK].left = width - 25; + } + + void OnUpdateOverview() + { + _guestAnimationFrame++; + _guestAnimationFrame %= 24; + + // Update pickup animation, can only happen in this tab. + picked_peep_frame++; + picked_peep_frame %= 48; + + WidgetInvalidate(*this, WIDX_TAB_1); + WidgetInvalidate(*this, WIDX_TAB_2); + + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_PEEP_ACTION) + { + peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_ACTION; + WidgetInvalidate(*this, WIDX_ACTION_LBL); + } + + _marqueePosition += 2; + + _beingWatchedTimer++; + + // Disable peep watching thought for multiplayer as it's client specific + if (NetworkGetMode() == NETWORK_MODE_NONE) + { + // Create the "I have the strangest feeling I am being watched thought" + if (_beingWatchedTimer >= 3840) { - int32_t random = UtilRand() & 0xFFFF; - if (random <= 0x2AAA) + if (!(_beingWatchedTimer & 0x3FF)) { - peep->InsertNewThought(PeepThoughtType::Watched); + int32_t random = UtilRand() & 0xFFFF; + if (random <= 0x2AAA) + { + peep->InsertNewThought(PeepThoughtType::Watched); + } } } } } - } - void OnTextInputOverview(WidgetIndex widgetIndex, std::string_view text) - { - if (widgetIndex != WIDX_RENAME) - return; - - if (text.empty()) - return; - std::string sText(text); - auto gameAction = GuestSetNameAction(EntityId::FromUnderlying(number), sText); - GameActions::Execute(&gameAction); - } - - void OnToolUpdateOverview(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) - { - if (widgetIndex != WIDX_PICKUP) - return; - - MapInvalidateSelectionRect(); - - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - - auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr); - if (!mapCoords.IsNull()) + void OnTextInputOverview(WidgetIndex widgetIndex, std::string_view text) { - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectType = MAP_SELECT_TYPE_FULL; - gMapSelectPositionA = mapCoords; - gMapSelectPositionB = mapCoords; - MapInvalidateSelectionRect(); - } - - gPickupPeepImage = ImageId(); - - auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll); - if (info.SpriteType == ViewportInteractionItem::None) - return; - - gPickupPeepX = screenCoords.x - 1; - gPickupPeepY = screenCoords.y + 16; - - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - - auto baseImageId = GetPeepAnimation(peep->SpriteType, PeepActionSpriteType::Ui).base_image; - baseImageId += picked_peep_frame >> 2; - gPickupPeepImage = ImageId(baseImageId, peep->TshirtColour, peep->TrousersColour); - } - - void OnToolDownOverview(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) - { - if (widgetIndex != WIDX_PICKUP) - return; - - TileElement* tileElement; - auto destCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, &tileElement); - - if (destCoords.IsNull()) - return; - - PeepPickupAction pickupAction{ PeepPickupType::Place, - EntityId::FromUnderlying(number), - { destCoords, tileElement->GetBaseZ() }, - NetworkGetCurrentPlayerId() }; - pickupAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) + if (widgetIndex != WIDX_RENAME) return; - ToolCancel(); + + if (text.empty()) + return; + std::string sText(text); + auto gameAction = GuestSetNameAction(EntityId::FromUnderlying(number), sText); + GameActions::Execute(&gameAction); + } + + void OnToolUpdateOverview(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + { + if (widgetIndex != WIDX_PICKUP) + return; + + MapInvalidateSelectionRect(); + + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + + auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr); + if (!mapCoords.IsNull()) + { + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectType = MAP_SELECT_TYPE_FULL; + gMapSelectPositionA = mapCoords; + gMapSelectPositionB = mapCoords; + MapInvalidateSelectionRect(); + } + gPickupPeepImage = ImageId(); - }); - GameActions::Execute(&pickupAction); - } - void OnToolAbortOverview(WidgetIndex widgetIndex) - { - if (widgetIndex != WIDX_PICKUP) - return; + auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll); + if (info.SpriteType == ViewportInteractionItem::None) + return; - PeepPickupAction pickupAction{ - PeepPickupType::Cancel, EntityId::FromUnderlying(number), { _pickedPeepX, 0, 0 }, NetworkGetCurrentPlayerId() - }; - GameActions::Execute(&pickupAction); - } + gPickupPeepX = screenCoords.x - 1; + gPickupPeepY = screenCoords.y + 16; + + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + + auto baseImageId = GetPeepAnimation(peep->SpriteType, PeepActionSpriteType::Ui).base_image; + baseImageId += picked_peep_frame >> 2; + gPickupPeepImage = ImageId(baseImageId, peep->TshirtColour, peep->TrousersColour); + } + + void OnToolDownOverview(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + { + if (widgetIndex != WIDX_PICKUP) + return; + + TileElement* tileElement; + auto destCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, &tileElement); + + if (destCoords.IsNull()) + return; + + PeepPickupAction pickupAction{ PeepPickupType::Place, + EntityId::FromUnderlying(number), + { destCoords, tileElement->GetBaseZ() }, + NetworkGetCurrentPlayerId() }; + pickupAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) + return; + ToolCancel(); + gPickupPeepImage = ImageId(); + }); + GameActions::Execute(&pickupAction); + } + + void OnToolAbortOverview(WidgetIndex widgetIndex) + { + if (widgetIndex != WIDX_PICKUP) + return; + + PeepPickupAction pickupAction{ + PeepPickupType::Cancel, EntityId::FromUnderlying(number), { _pickedPeepX, 0, 0 }, NetworkGetCurrentPlayerId() + }; + GameActions::Execute(&pickupAction); + } #pragma endregion #pragma region Stats - void StatsTabDraw(DrawPixelInfo& dpi) - { - if (WidgetIsDisabled(*this, WIDX_TAB_2)) - return; - - const auto& widget = widgets[WIDX_TAB_2]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - - const auto peep = GetGuest(); - if (peep == nullptr) + void StatsTabDraw(DrawPixelInfo& dpi) { - return; - } - int32_t imageId = GetPeepFaceSpriteLarge(peep); - if (page == WINDOW_GUEST_STATS) - { - // If currently viewing this tab animate tab - // if it is very sick or angry. - switch (imageId) - { - case SPR_PEEP_LARGE_FACE_VERY_VERY_SICK_0: - imageId += (frame_no / 4) & 0xF; - break; - case SPR_PEEP_LARGE_FACE_VERY_SICK_0: - imageId += (frame_no / 8) & 0x3; - break; - case SPR_PEEP_LARGE_FACE_ANGRY_0: - imageId += (frame_no / 8) & 0x3; - break; - } - } - GfxDrawSprite(dpi, ImageId(imageId), screenCoords); - } - - void OnUpdateStats() - { - frame_no++; - auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_STATS; - - Invalidate(); - } - - void StatsBarsDraw(int32_t value, const ScreenCoordsXY& origCoords, DrawPixelInfo& dpi, int32_t colour, bool blinkFlag) - { - auto coords = origCoords; - if (FontGetLineHeight(FontStyle::Medium) > 10) - { - coords.y += 1; - } - - GfxFillRectInset( - dpi, { coords + ScreenCoordsXY{ 61, 1 }, coords + ScreenCoordsXY{ 61 + 121, 9 } }, colours[1], INSET_RECT_F_30); - - if (!blinkFlag || GameIsPaused() || (gCurrentRealTimeTicks & 8) == 0) - { - value *= 118; - value >>= 8; - - if (value <= 2) + if (WidgetIsDisabled(*this, WIDX_TAB_2)) return; + const auto& widget = widgets[WIDX_TAB_2]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; + + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + int32_t imageId = GetPeepFaceSpriteLarge(peep); + if (page == WINDOW_GUEST_STATS) + { + // If currently viewing this tab animate tab + // if it is very sick or angry. + switch (imageId) + { + case SPR_PEEP_LARGE_FACE_VERY_VERY_SICK_0: + imageId += (frame_no / 4) & 0xF; + break; + case SPR_PEEP_LARGE_FACE_VERY_SICK_0: + imageId += (frame_no / 8) & 0x3; + break; + case SPR_PEEP_LARGE_FACE_ANGRY_0: + imageId += (frame_no / 8) & 0x3; + break; + } + } + GfxDrawSprite(dpi, ImageId(imageId), screenCoords); + } + + void OnUpdateStats() + { + frame_no++; + auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_STATS; + + Invalidate(); + } + + void StatsBarsDraw(int32_t value, const ScreenCoordsXY& origCoords, DrawPixelInfo& dpi, int32_t colour, bool blinkFlag) + { + auto coords = origCoords; + if (FontGetLineHeight(FontStyle::Medium) > 10) + { + coords.y += 1; + } + GfxFillRectInset( - dpi, { coords + ScreenCoordsXY{ 63, 2 }, coords + ScreenCoordsXY{ 63 + value - 1, 8 } }, colour, 0); - } - } + dpi, { coords + ScreenCoordsXY{ 61, 1 }, coords + ScreenCoordsXY{ 61 + 121, 9 } }, colours[1], INSET_RECT_F_30); - /** - * Takes a guest stat value (scaled to currMax) and adjusts it to be scaled out of 255. - * Then clamp the value to between newMin and 255. - */ - int32_t NormalizeGuestStatValue(int32_t value, int32_t currMax, int32_t newMin) const - { - int32_t newValue = (value * 255) / currMax; - return std::clamp(newValue, newMin, 255); - } - - void OnDrawStats(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - OverviewTabDraw(dpi); - StatsTabDraw(dpi); - RidesTabDraw(dpi); - FinanceTabDraw(dpi); - ThoughtsTabDraw(dpi); - InventoryTabDraw(dpi); - DebugTabDraw(dpi); - - // ebx - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - - // Not sure why this is not stats widgets - // cx dx - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - - // Happiness - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_HAPPINESS_LABEL); - - int32_t happiness = NormalizeGuestStatValue(peep->Happiness, PEEP_MAX_HAPPINESS, 10); - int32_t barColour = COLOUR_BRIGHT_GREEN; - bool barBlink = happiness < 50; - StatsBarsDraw(happiness, screenCoords, dpi, barColour, barBlink); - - // Energy - screenCoords.y += LIST_ROW_HEIGHT; - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_ENERGY_LABEL); - - int32_t energy = NormalizeGuestStatValue(peep->Energy - PEEP_MIN_ENERGY, PEEP_MAX_ENERGY - PEEP_MIN_ENERGY, 10); - barColour = COLOUR_BRIGHT_GREEN; - barBlink = energy < 50; - StatsBarsDraw(energy, screenCoords, dpi, barColour, barBlink); - - // Hunger - screenCoords.y += LIST_ROW_HEIGHT; - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_HUNGER_LABEL); - - int32_t hunger = NormalizeGuestStatValue(peep->Hunger - 32, 158, 0); - hunger = 255 - hunger; // the bar should be longer when peep->Hunger is low - barColour = COLOUR_BRIGHT_RED; - barBlink = hunger > 170; - StatsBarsDraw(hunger, screenCoords, dpi, barColour, barBlink); - - // Thirst - screenCoords.y += LIST_ROW_HEIGHT; - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_THIRST_LABEL); - - int32_t thirst = NormalizeGuestStatValue(peep->Thirst - 32, 158, 0); - thirst = 255 - thirst; // the bar should be longer when peep->Thirst is low - barColour = COLOUR_BRIGHT_RED; - barBlink = thirst > 170; - StatsBarsDraw(thirst, screenCoords, dpi, barColour, barBlink); - - // Nausea - screenCoords.y += LIST_ROW_HEIGHT; - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_NAUSEA_LABEL); - - int32_t nausea = NormalizeGuestStatValue(peep->Nausea - 32, 223, 0); - barColour = COLOUR_BRIGHT_RED; - barBlink = nausea > 120; - StatsBarsDraw(nausea, screenCoords, dpi, barColour, barBlink); - - // Toilet - screenCoords.y += LIST_ROW_HEIGHT; - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_TOILET_LABEL); - - int32_t toilet = NormalizeGuestStatValue(peep->Toilet - 64, 178, 0); - barColour = COLOUR_BRIGHT_RED; - barBlink = toilet > 160; - StatsBarsDraw(toilet, screenCoords, dpi, barColour, barBlink); - - // Time in park - screenCoords.y += LIST_ROW_HEIGHT + 1; - int32_t guestEntryTime = peep->GetParkEntryTime(); - if (guestEntryTime != -1) - { - int32_t timeInPark = (GetGameState().CurrentTicks - guestEntryTime) >> 11; - auto ft = Formatter(); - ft.Add(timeInPark & 0xFFFF); - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_TIME_IN_PARK, ft); - } - - screenCoords.y += LIST_ROW_HEIGHT + 9; - GfxFillRectInset( - dpi, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 179, -5 } }, colours[1], - INSET_RECT_FLAG_BORDER_INSET); - - // Preferred Ride - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_PREFERRED_RIDE); - screenCoords.y += LIST_ROW_HEIGHT; - - // Intensity - { - auto ft = Formatter(); - auto maxIntensity = peep->Intensity.GetMaximum(); - int32_t string_id = STR_GUEST_STAT_PREFERRED_INTESITY_BELOW; - if (peep->Intensity.GetMinimum() != 0) + if (!blinkFlag || GameIsPaused() || (gCurrentRealTimeTicks & 8) == 0) { - ft.Add(peep->Intensity.GetMinimum()); - ft.Add(maxIntensity); - string_id = STR_GUEST_STAT_PREFERRED_INTESITY_BETWEEN; - if (maxIntensity == 15) - string_id = STR_GUEST_STAT_PREFERRED_INTESITY_ABOVE; + value *= 118; + value >>= 8; + + if (value <= 2) + return; + + GfxFillRectInset( + dpi, { coords + ScreenCoordsXY{ 63, 2 }, coords + ScreenCoordsXY{ 63 + value - 1, 8 } }, colour, 0); } - else + } + + /** + * Takes a guest stat value (scaled to currMax) and adjusts it to be scaled out of 255. + * Then clamp the value to between newMin and 255. + */ + int32_t NormalizeGuestStatValue(int32_t value, int32_t currMax, int32_t newMin) const + { + int32_t newValue = (value * 255) / currMax; + return std::clamp(newValue, newMin, 255); + } + + void OnDrawStats(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + OverviewTabDraw(dpi); + StatsTabDraw(dpi); + RidesTabDraw(dpi); + FinanceTabDraw(dpi); + ThoughtsTabDraw(dpi); + InventoryTabDraw(dpi); + DebugTabDraw(dpi); + + // ebx + const auto peep = GetGuest(); + if (peep == nullptr) { - ft.Add(maxIntensity); + return; } - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, string_id, ft); - } + // Not sure why this is not stats widgets + // cx dx + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - // Nausea tolerance - { - static constexpr StringId _nauseaTolerances[] = { - STR_PEEP_STAT_NAUSEA_TOLERANCE_NONE, - STR_PEEP_STAT_NAUSEA_TOLERANCE_LOW, - STR_PEEP_STAT_NAUSEA_TOLERANCE_AVERAGE, - STR_PEEP_STAT_NAUSEA_TOLERANCE_HIGH, - }; + // Happiness + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_HAPPINESS_LABEL); + + int32_t happiness = NormalizeGuestStatValue(peep->Happiness, PEEP_MAX_HAPPINESS, 10); + int32_t barColour = COLOUR_BRIGHT_GREEN; + bool barBlink = happiness < 50; + StatsBarsDraw(happiness, screenCoords, dpi, barColour, barBlink); + + // Energy screenCoords.y += LIST_ROW_HEIGHT; - auto nausea_tolerance = EnumValue(peep->NauseaTolerance) & 0x3; - auto ft = Formatter(); - ft.Add(_nauseaTolerances[nausea_tolerance]); - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_NAUSEA_TOLERANCE, ft); + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_ENERGY_LABEL); + + int32_t energy = NormalizeGuestStatValue(peep->Energy - PEEP_MIN_ENERGY, PEEP_MAX_ENERGY - PEEP_MIN_ENERGY, 10); + barColour = COLOUR_BRIGHT_GREEN; + barBlink = energy < 50; + StatsBarsDraw(energy, screenCoords, dpi, barColour, barBlink); + + // Hunger + screenCoords.y += LIST_ROW_HEIGHT; + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_HUNGER_LABEL); + + int32_t hunger = NormalizeGuestStatValue(peep->Hunger - 32, 158, 0); + hunger = 255 - hunger; // the bar should be longer when peep->Hunger is low + barColour = COLOUR_BRIGHT_RED; + barBlink = hunger > 170; + StatsBarsDraw(hunger, screenCoords, dpi, barColour, barBlink); + + // Thirst + screenCoords.y += LIST_ROW_HEIGHT; + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_THIRST_LABEL); + + int32_t thirst = NormalizeGuestStatValue(peep->Thirst - 32, 158, 0); + thirst = 255 - thirst; // the bar should be longer when peep->Thirst is low + barColour = COLOUR_BRIGHT_RED; + barBlink = thirst > 170; + StatsBarsDraw(thirst, screenCoords, dpi, barColour, barBlink); + + // Nausea + screenCoords.y += LIST_ROW_HEIGHT; + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_NAUSEA_LABEL); + + int32_t nausea = NormalizeGuestStatValue(peep->Nausea - 32, 223, 0); + barColour = COLOUR_BRIGHT_RED; + barBlink = nausea > 120; + StatsBarsDraw(nausea, screenCoords, dpi, barColour, barBlink); + + // Toilet + screenCoords.y += LIST_ROW_HEIGHT; + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_TOILET_LABEL); + + int32_t toilet = NormalizeGuestStatValue(peep->Toilet - 64, 178, 0); + barColour = COLOUR_BRIGHT_RED; + barBlink = toilet > 160; + StatsBarsDraw(toilet, screenCoords, dpi, barColour, barBlink); + + // Time in park + screenCoords.y += LIST_ROW_HEIGHT + 1; + int32_t guestEntryTime = peep->GetParkEntryTime(); + if (guestEntryTime != -1) + { + int32_t timeInPark = (GetGameState().CurrentTicks - guestEntryTime) >> 11; + auto ft = Formatter(); + ft.Add(timeInPark & 0xFFFF); + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_TIME_IN_PARK, ft); + } + + screenCoords.y += LIST_ROW_HEIGHT + 9; + GfxFillRectInset( + dpi, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 179, -5 } }, colours[1], + INSET_RECT_FLAG_BORDER_INSET); + + // Preferred Ride + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_PREFERRED_RIDE); + screenCoords.y += LIST_ROW_HEIGHT; + + // Intensity + { + auto ft = Formatter(); + auto maxIntensity = peep->Intensity.GetMaximum(); + int32_t string_id = STR_GUEST_STAT_PREFERRED_INTESITY_BELOW; + if (peep->Intensity.GetMinimum() != 0) + { + ft.Add(peep->Intensity.GetMinimum()); + ft.Add(maxIntensity); + string_id = STR_GUEST_STAT_PREFERRED_INTESITY_BETWEEN; + if (maxIntensity == 15) + string_id = STR_GUEST_STAT_PREFERRED_INTESITY_ABOVE; + } + else + { + ft.Add(maxIntensity); + } + + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, string_id, ft); + } + + // Nausea tolerance + { + static constexpr StringId _nauseaTolerances[] = { + STR_PEEP_STAT_NAUSEA_TOLERANCE_NONE, + STR_PEEP_STAT_NAUSEA_TOLERANCE_LOW, + STR_PEEP_STAT_NAUSEA_TOLERANCE_AVERAGE, + STR_PEEP_STAT_NAUSEA_TOLERANCE_HIGH, + }; + screenCoords.y += LIST_ROW_HEIGHT; + auto nausea_tolerance = EnumValue(peep->NauseaTolerance) & 0x3; + auto ft = Formatter(); + ft.Add(_nauseaTolerances[nausea_tolerance]); + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_NAUSEA_TOLERANCE, ft); + } } - } #pragma endregion #pragma region Rides - void RidesTabDraw(DrawPixelInfo& dpi) - { - if (WidgetIsDisabled(*this, WIDX_TAB_3)) - return; - - const auto& widget = widgets[WIDX_TAB_3]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - - int32_t imageId = SPR_TAB_RIDE_0; - - if (page == WINDOW_GUEST_RIDES) + void RidesTabDraw(DrawPixelInfo& dpi) { - imageId += (frame_no / 4) & 0xF; - } + if (WidgetIsDisabled(*this, WIDX_TAB_3)) + return; - GfxDrawSprite(dpi, ImageId(imageId), screenCoords); - } + const auto& widget = widgets[WIDX_TAB_3]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - void OnUpdateRides() - { - frame_no++; + int32_t imageId = SPR_TAB_RIDE_0; - WidgetInvalidate(*this, WIDX_TAB_2); - WidgetInvalidate(*this, WIDX_TAB_3); - - const auto guest = GetGuest(); - if (guest == nullptr) - { - return; - } - - // Every 2048 ticks do a full window_invalidate - int32_t numTicks = GetGameState().CurrentTicks - guest->GetParkEntryTime(); - if (!(numTicks & 0x7FF)) - Invalidate(); - - const auto oldSize = _riddenRides.size(); - _riddenRides.clear(); - for (const auto& r : GetRideManager()) - { - if (r.IsRide() && guest->HasRidden(r)) + if (page == WINDOW_GUEST_RIDES) { - _riddenRides.push_back(r.id); + imageId += (frame_no / 4) & 0xF; + } + + GfxDrawSprite(dpi, ImageId(imageId), screenCoords); + } + + void OnUpdateRides() + { + frame_no++; + + WidgetInvalidate(*this, WIDX_TAB_2); + WidgetInvalidate(*this, WIDX_TAB_3); + + const auto guest = GetGuest(); + if (guest == nullptr) + { + return; + } + + // Every 2048 ticks do a full window_invalidate + int32_t numTicks = GetGameState().CurrentTicks - guest->GetParkEntryTime(); + if (!(numTicks & 0x7FF)) + Invalidate(); + + const auto oldSize = _riddenRides.size(); + _riddenRides.clear(); + for (const auto& r : GetRideManager()) + { + if (r.IsRide() && guest->HasRidden(r)) + { + _riddenRides.push_back(r.id); + } + } + + // If there are new items + if (oldSize != _riddenRides.size()) + { + Invalidate(); } } - // If there are new items - if (oldSize != _riddenRides.size()) + ScreenSize OnScrollGetSizeRides(int32_t scrollIndex) { - Invalidate(); - } - } + ScreenSize newSize; + newSize.height = static_cast(_riddenRides.size()) * 10; - ScreenSize OnScrollGetSizeRides(int32_t scrollIndex) - { - ScreenSize newSize; - newSize.height = static_cast(_riddenRides.size()) * 10; - - if (selected_list_item != -1) - { - selected_list_item = -1; - Invalidate(); - } - - int32_t visableHeight = newSize.height - widgets[WIDX_RIDE_SCROLL].bottom + widgets[WIDX_RIDE_SCROLL].top + 21; - - if (visableHeight < 0) - visableHeight = 0; - - if (visableHeight < scrolls[0].v_top) - { - scrolls[0].v_top = visableHeight; - Invalidate(); - } - return newSize; - } - - void OnScrollMouseDownRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) - { - auto index = screenCoords.y / 10; - if (index >= static_cast(_riddenRides.size())) - return; - - auto intent = Intent(WindowClass::Ride); - intent.PutExtra(INTENT_EXTRA_RIDE_ID, _riddenRides[index]); - ContextOpenIntent(&intent); - } - - void OnScrollMouseOverRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) - { - auto index = screenCoords.y / 10; - if (index >= static_cast(_riddenRides.size())) - return; - - if (index == selected_list_item) - return; - selected_list_item = index; - - Invalidate(); - } - - void OnPrepareDrawRides() - { - widgets[WIDX_RIDE_SCROLL].right = width - 4; - widgets[WIDX_RIDE_SCROLL].bottom = height - 15; - } - - void OnDrawRides(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - OverviewTabDraw(dpi); - StatsTabDraw(dpi); - RidesTabDraw(dpi); - FinanceTabDraw(dpi); - ThoughtsTabDraw(dpi); - InventoryTabDraw(dpi); - DebugTabDraw(dpi); - - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - - // cx dx - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 2, widgets[WIDX_PAGE_BACKGROUND].top + 2 }; - - DrawTextBasic(dpi, screenCoords, STR_GUEST_LABEL_RIDES_BEEN_ON); - - screenCoords.y = windowPos.y + widgets[WIDX_PAGE_BACKGROUND].bottom - 12; - - auto ft = Formatter(); - auto* r = GetRide(peep->FavouriteRide); - if (r != nullptr) - { - r->FormatNameTo(ft); - } - else - { - ft.Add(STR_PEEP_FAVOURITE_RIDE_NOT_AVAILABLE); - } - - DrawTextEllipsised(dpi, screenCoords, width - 14, STR_FAVOURITE_RIDE, ft); - } - - void OnScrollDrawRides(int32_t scrollIndex, DrawPixelInfo& dpi) - { - auto colour = ColourMapA[colours[1]].mid_light; - GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, colour); - - for (int32_t listIndex = 0; listIndex < static_cast(_riddenRides.size()); listIndex++) - { - int32_t y = listIndex * 10; - StringId stringId = STR_BLACK_STRING; - if (listIndex == selected_list_item) + if (selected_list_item != -1) { - GfxFilterRect(dpi, { 0, y, 800, y + 9 }, FilterPaletteID::PaletteDarken1); - stringId = STR_WINDOW_COLOUR_2_STRINGID; + selected_list_item = -1; + Invalidate(); } - auto* r = GetRide(_riddenRides[listIndex]); + int32_t visableHeight = newSize.height - widgets[WIDX_RIDE_SCROLL].bottom + widgets[WIDX_RIDE_SCROLL].top + 21; + + if (visableHeight < 0) + visableHeight = 0; + + if (visableHeight < scrolls[0].v_top) + { + scrolls[0].v_top = visableHeight; + Invalidate(); + } + return newSize; + } + + void OnScrollMouseDownRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) + { + auto index = screenCoords.y / 10; + if (index >= static_cast(_riddenRides.size())) + return; + + auto intent = Intent(WindowClass::Ride); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, _riddenRides[index]); + ContextOpenIntent(&intent); + } + + void OnScrollMouseOverRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) + { + auto index = screenCoords.y / 10; + if (index >= static_cast(_riddenRides.size())) + return; + + if (index == selected_list_item) + return; + selected_list_item = index; + + Invalidate(); + } + + void OnPrepareDrawRides() + { + widgets[WIDX_RIDE_SCROLL].right = width - 4; + widgets[WIDX_RIDE_SCROLL].bottom = height - 15; + } + + void OnDrawRides(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + OverviewTabDraw(dpi); + StatsTabDraw(dpi); + RidesTabDraw(dpi); + FinanceTabDraw(dpi); + ThoughtsTabDraw(dpi); + InventoryTabDraw(dpi); + DebugTabDraw(dpi); + + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + + // cx dx + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 2, widgets[WIDX_PAGE_BACKGROUND].top + 2 }; + + DrawTextBasic(dpi, screenCoords, STR_GUEST_LABEL_RIDES_BEEN_ON); + + screenCoords.y = windowPos.y + widgets[WIDX_PAGE_BACKGROUND].bottom - 12; + + auto ft = Formatter(); + auto* r = GetRide(peep->FavouriteRide); if (r != nullptr) { - auto ft = Formatter(); r->FormatNameTo(ft); - DrawTextBasic(dpi, { 0, y - 1 }, stringId, ft); + } + else + { + ft.Add(STR_PEEP_FAVOURITE_RIDE_NOT_AVAILABLE); + } + + DrawTextEllipsised(dpi, screenCoords, width - 14, STR_FAVOURITE_RIDE, ft); + } + + void OnScrollDrawRides(int32_t scrollIndex, DrawPixelInfo& dpi) + { + auto colour = ColourMapA[colours[1]].mid_light; + GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, colour); + + for (int32_t listIndex = 0; listIndex < static_cast(_riddenRides.size()); listIndex++) + { + int32_t y = listIndex * 10; + StringId stringId = STR_BLACK_STRING; + if (listIndex == selected_list_item) + { + GfxFilterRect(dpi, { 0, y, 800, y + 9 }, FilterPaletteID::PaletteDarken1); + stringId = STR_WINDOW_COLOUR_2_STRINGID; + } + + auto* r = GetRide(_riddenRides[listIndex]); + if (r != nullptr) + { + auto ft = Formatter(); + r->FormatNameTo(ft); + DrawTextBasic(dpi, { 0, y - 1 }, stringId, ft); + } } } - } #pragma endregion #pragma region Finance - void FinanceTabDraw(DrawPixelInfo& dpi) - { - if (WidgetIsDisabled(*this, WIDX_TAB_4)) - return; - - const auto& widget = widgets[WIDX_TAB_4]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - - int32_t imageId = SPR_TAB_FINANCES_SUMMARY_0; - - if (page == WINDOW_GUEST_FINANCE) + void FinanceTabDraw(DrawPixelInfo& dpi) { - imageId += (frame_no / 2) & 0x7; - } + if (WidgetIsDisabled(*this, WIDX_TAB_4)) + return; - GfxDrawSprite(dpi, ImageId(imageId), screenCoords); - } + const auto& widget = widgets[WIDX_TAB_4]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - void OnUpdateFinance() - { - frame_no++; + int32_t imageId = SPR_TAB_FINANCES_SUMMARY_0; - WidgetInvalidate(*this, WIDX_TAB_2); - WidgetInvalidate(*this, WIDX_TAB_4); - } - - void OnDrawFinance(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - OverviewTabDraw(dpi); - StatsTabDraw(dpi); - RidesTabDraw(dpi); - FinanceTabDraw(dpi); - ThoughtsTabDraw(dpi); - InventoryTabDraw(dpi); - DebugTabDraw(dpi); - - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - - // cx dx - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - - // Cash in pocket - { - auto ft = Formatter(); - ft.Add(peep->CashInPocket); - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_CASH_IN_POCKET, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - // Cash spent - { - auto ft = Formatter(); - ft.Add(peep->CashSpent); - DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_CASH_SPENT, ft); - screenCoords.y += LIST_ROW_HEIGHT * 2; - } - - GfxFillRectInset( - dpi, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 179, -5 } }, colours[1], - INSET_RECT_FLAG_BORDER_INSET); - - // Paid to enter - { - auto ft = Formatter(); - ft.Add(peep->PaidToEnter); - DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_ENTRANCE_FEE, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - // Paid on rides - { - auto ft = Formatter(); - ft.Add(peep->PaidOnRides); - ft.Add(peep->GuestNumRides); - if (peep->GuestNumRides != 1) + if (page == WINDOW_GUEST_FINANCE) { - DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_RIDE_PLURAL, ft); + imageId += (frame_no / 2) & 0x7; } - else - { - DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_RIDE, ft); - } - screenCoords.y += LIST_ROW_HEIGHT; - } - // Paid on food - { - auto ft = Formatter(); - ft.Add(peep->PaidOnFood); - ft.Add(peep->AmountOfFood); - if (peep->AmountOfFood != 1) - { - DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_FOOD_PLURAL, ft); - } - else - { - DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_FOOD, ft); - } - screenCoords.y += LIST_ROW_HEIGHT; + + GfxDrawSprite(dpi, ImageId(imageId), screenCoords); } - // Paid on drinks + void OnUpdateFinance() { - auto ft = Formatter(); - ft.Add(peep->PaidOnDrink); - ft.Add(peep->AmountOfDrinks); - if (peep->AmountOfDrinks != 1) - { - DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_DRINK_PLURAL, ft); - } - else - { - DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_DRINK, ft); - } - screenCoords.y += LIST_ROW_HEIGHT; + frame_no++; + + WidgetInvalidate(*this, WIDX_TAB_2); + WidgetInvalidate(*this, WIDX_TAB_4); } - // Paid on souvenirs + + void OnDrawFinance(DrawPixelInfo& dpi) { - auto ft = Formatter(); - ft.Add(peep->PaidOnSouvenirs); - ft.Add(peep->AmountOfSouvenirs); - if (peep->AmountOfSouvenirs != 1) + DrawWidgets(dpi); + OverviewTabDraw(dpi); + StatsTabDraw(dpi); + RidesTabDraw(dpi); + FinanceTabDraw(dpi); + ThoughtsTabDraw(dpi); + InventoryTabDraw(dpi); + DebugTabDraw(dpi); + + const auto peep = GetGuest(); + if (peep == nullptr) { - DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_SOUVENIR_PLURAL, ft); + return; } - else + + // cx dx + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; + + // Cash in pocket { - DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_SOUVENIR, ft); + auto ft = Formatter(); + ft.Add(peep->CashInPocket); + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_CASH_IN_POCKET, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + + // Cash spent + { + auto ft = Formatter(); + ft.Add(peep->CashSpent); + DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_CASH_SPENT, ft); + screenCoords.y += LIST_ROW_HEIGHT * 2; + } + + GfxFillRectInset( + dpi, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 179, -5 } }, colours[1], + INSET_RECT_FLAG_BORDER_INSET); + + // Paid to enter + { + auto ft = Formatter(); + ft.Add(peep->PaidToEnter); + DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_ENTRANCE_FEE, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + // Paid on rides + { + auto ft = Formatter(); + ft.Add(peep->PaidOnRides); + ft.Add(peep->GuestNumRides); + if (peep->GuestNumRides != 1) + { + DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_RIDE_PLURAL, ft); + } + else + { + DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_RIDE, ft); + } + screenCoords.y += LIST_ROW_HEIGHT; + } + // Paid on food + { + auto ft = Formatter(); + ft.Add(peep->PaidOnFood); + ft.Add(peep->AmountOfFood); + if (peep->AmountOfFood != 1) + { + DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_FOOD_PLURAL, ft); + } + else + { + DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_FOOD, ft); + } + screenCoords.y += LIST_ROW_HEIGHT; + } + + // Paid on drinks + { + auto ft = Formatter(); + ft.Add(peep->PaidOnDrink); + ft.Add(peep->AmountOfDrinks); + if (peep->AmountOfDrinks != 1) + { + DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_DRINK_PLURAL, ft); + } + else + { + DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_DRINK, ft); + } + screenCoords.y += LIST_ROW_HEIGHT; + } + // Paid on souvenirs + { + auto ft = Formatter(); + ft.Add(peep->PaidOnSouvenirs); + ft.Add(peep->AmountOfSouvenirs); + if (peep->AmountOfSouvenirs != 1) + { + DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_SOUVENIR_PLURAL, ft); + } + else + { + DrawTextBasic(dpi, screenCoords, STR_GUEST_EXPENSES_SOUVENIR, ft); + } } } - } #pragma endregion #pragma region Thoughts - void ThoughtsTabDraw(DrawPixelInfo& dpi) - { - if (WidgetIsDisabled(*this, WIDX_TAB_5)) - return; - - const auto& widget = widgets[WIDX_TAB_5]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - - int32_t imageId = SPR_TAB_THOUGHTS_0; - - if (page == WINDOW_GUEST_THOUGHTS) + void ThoughtsTabDraw(DrawPixelInfo& dpi) { - imageId += (frame_no / 2) & 0x7; - } - - GfxDrawSprite(dpi, ImageId(imageId), screenCoords); - } - - void OnUpdateThoughts() - { - frame_no++; - - WidgetInvalidate(*this, WIDX_TAB_2); - WidgetInvalidate(*this, WIDX_TAB_5); - - auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_PEEP_THOUGHTS) - { - peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_THOUGHTS; - Invalidate(); - } - } - - void OnDrawThoughts(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - OverviewTabDraw(dpi); - StatsTabDraw(dpi); - RidesTabDraw(dpi); - FinanceTabDraw(dpi); - ThoughtsTabDraw(dpi); - InventoryTabDraw(dpi); - DebugTabDraw(dpi); - - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - - // cx dx - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - - DrawTextBasic(dpi, screenCoords, STR_GUEST_RECENT_THOUGHTS_LABEL); - - screenCoords.y += 10; - for (const auto& thought : peep->Thoughts) - { - if (thought.type == PeepThoughtType::None) + if (WidgetIsDisabled(*this, WIDX_TAB_5)) return; - if (thought.freshness == 0) - continue; - int32_t widgWidth = widgets[WIDX_PAGE_BACKGROUND].right - widgets[WIDX_PAGE_BACKGROUND].left - 8; + const auto& widget = widgets[WIDX_TAB_5]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - auto ft = Formatter(); - PeepThoughtSetFormatArgs(&thought, ft); - screenCoords.y += DrawTextWrapped(dpi, screenCoords, widgWidth, STR_BLACK_STRING, ft, { FontStyle::Small }); + int32_t imageId = SPR_TAB_THOUGHTS_0; - // If this is the last visible line end drawing. - if (screenCoords.y > windowPos.y + widgets[WIDX_PAGE_BACKGROUND].bottom - 32) + if (page == WINDOW_GUEST_THOUGHTS) + { + imageId += (frame_no / 2) & 0x7; + } + + GfxDrawSprite(dpi, ImageId(imageId), screenCoords); + } + + void OnUpdateThoughts() + { + frame_no++; + + WidgetInvalidate(*this, WIDX_TAB_2); + WidgetInvalidate(*this, WIDX_TAB_5); + + auto peep = GetGuest(); + if (peep == nullptr) + { return; + } + if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_PEEP_THOUGHTS) + { + peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_THOUGHTS; + Invalidate(); + } + } + + void OnDrawThoughts(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + OverviewTabDraw(dpi); + StatsTabDraw(dpi); + RidesTabDraw(dpi); + FinanceTabDraw(dpi); + ThoughtsTabDraw(dpi); + InventoryTabDraw(dpi); + DebugTabDraw(dpi); + + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + + // cx dx + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; + + DrawTextBasic(dpi, screenCoords, STR_GUEST_RECENT_THOUGHTS_LABEL); + + screenCoords.y += 10; + for (const auto& thought : peep->Thoughts) + { + if (thought.type == PeepThoughtType::None) + return; + if (thought.freshness == 0) + continue; + + int32_t widgWidth = widgets[WIDX_PAGE_BACKGROUND].right - widgets[WIDX_PAGE_BACKGROUND].left - 8; + + auto ft = Formatter(); + PeepThoughtSetFormatArgs(&thought, ft); + screenCoords.y += DrawTextWrapped(dpi, screenCoords, widgWidth, STR_BLACK_STRING, ft, { FontStyle::Small }); + + // If this is the last visible line end drawing. + if (screenCoords.y > windowPos.y + widgets[WIDX_PAGE_BACKGROUND].bottom - 32) + return; + } } - } #pragma endregion #pragma region Inventory - void InventoryTabDraw(DrawPixelInfo& dpi) - { - if (WidgetIsDisabled(*this, WIDX_TAB_6)) - return; - - const auto& widget = widgets[WIDX_TAB_6]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - - GfxDrawSprite(dpi, ImageId(SPR_TAB_GUEST_INVENTORY), screenCoords); - } - - void OnUpdateInventory() - { - frame_no++; - - WidgetInvalidate(*this, WIDX_TAB_2); - WidgetInvalidate(*this, WIDX_TAB_6); - - auto peep = GetGuest(); - if (peep == nullptr) + void InventoryTabDraw(DrawPixelInfo& dpi) { - return; + if (WidgetIsDisabled(*this, WIDX_TAB_6)) + return; + + const auto& widget = widgets[WIDX_TAB_6]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; + + GfxDrawSprite(dpi, ImageId(SPR_TAB_GUEST_INVENTORY), screenCoords); } - if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_PEEP_INVENTORY) + + void OnUpdateInventory() { - peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_INVENTORY; - Invalidate(); + frame_no++; + + WidgetInvalidate(*this, WIDX_TAB_2); + WidgetInvalidate(*this, WIDX_TAB_6); + + auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_PEEP_INVENTORY) + { + peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_INVENTORY; + Invalidate(); + } } - } - std::pair InventoryFormatItem(Guest& guest, ShopItem item) const - { - auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); - auto parkName = park.Name.c_str(); - - // Default arguments - auto ft = Formatter(); - ft.Add(GetShopItemDescriptor(item).Image); - ft.Add(GetShopItemDescriptor(item).Naming.Display); - ft.Add(STR_STRING); - ft.Add(parkName); - - // Special overrides - Ride* invRide{}; - switch (item) + std::pair InventoryFormatItem(Guest& guest, ShopItem item) const { - case ShopItem::Balloon: - ft.Rewind(); - ft.Add(ImageId(GetShopItemDescriptor(item).Image, (guest.BalloonColour)).ToUInt32()); - break; - case ShopItem::Photo: - invRide = GetRide(guest.Photo1RideRef); - if (invRide != nullptr) - { + auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); + auto parkName = park.Name.c_str(); + + // Default arguments + auto ft = Formatter(); + ft.Add(GetShopItemDescriptor(item).Image); + ft.Add(GetShopItemDescriptor(item).Naming.Display); + ft.Add(STR_STRING); + ft.Add(parkName); + + // Special overrides + Ride* invRide{}; + switch (item) + { + case ShopItem::Balloon: ft.Rewind(); - ft.Increment(6); - invRide->FormatNameTo(ft); - } - - break; - case ShopItem::Umbrella: - ft.Rewind(); - ft.Add(ImageId(GetShopItemDescriptor(item).Image, (guest.UmbrellaColour)).ToUInt32()); - break; - case ShopItem::Voucher: - switch (guest.VoucherType) - { - case VOUCHER_TYPE_PARK_ENTRY_FREE: + ft.Add(ImageId(GetShopItemDescriptor(item).Image, (guest.BalloonColour)).ToUInt32()); + break; + case ShopItem::Photo: + invRide = GetRide(guest.Photo1RideRef); + if (invRide != nullptr) + { ft.Rewind(); ft.Increment(6); - ft.Add(STR_PEEP_INVENTORY_VOUCHER_PARK_ENTRY_FREE); - ft.Add(STR_STRING); - ft.Add(parkName); - break; - case VOUCHER_TYPE_RIDE_FREE: - invRide = GetRide(guest.VoucherRideId); - if (invRide != nullptr) - { + invRide->FormatNameTo(ft); + } + + break; + case ShopItem::Umbrella: + ft.Rewind(); + ft.Add(ImageId(GetShopItemDescriptor(item).Image, (guest.UmbrellaColour)).ToUInt32()); + break; + case ShopItem::Voucher: + switch (guest.VoucherType) + { + case VOUCHER_TYPE_PARK_ENTRY_FREE: ft.Rewind(); ft.Increment(6); - ft.Add(STR_PEEP_INVENTORY_VOUCHER_RIDE_FREE); - invRide->FormatNameTo(ft); - } - break; - case VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE: + ft.Add(STR_PEEP_INVENTORY_VOUCHER_PARK_ENTRY_FREE); + ft.Add(STR_STRING); + ft.Add(parkName); + break; + case VOUCHER_TYPE_RIDE_FREE: + invRide = GetRide(guest.VoucherRideId); + if (invRide != nullptr) + { + ft.Rewind(); + ft.Increment(6); + ft.Add(STR_PEEP_INVENTORY_VOUCHER_RIDE_FREE); + invRide->FormatNameTo(ft); + } + break; + case VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE: + ft.Rewind(); + ft.Increment(6); + ft.Add(STR_PEEP_INVENTORY_VOUCHER_PARK_ENTRY_HALF_PRICE); + ft.Add(STR_STRING); + ft.Add(parkName); + break; + case VOUCHER_TYPE_FOOD_OR_DRINK_FREE: + ft.Rewind(); + ft.Increment(6); + ft.Add(STR_PEEP_INVENTORY_VOUCHER_FOOD_OR_DRINK_FREE); + ft.Add(GetShopItemDescriptor(guest.VoucherShopItem).Naming.Singular); + break; + } + break; + case ShopItem::Hat: + ft.Rewind(); + ft.Add(ImageId(GetShopItemDescriptor(item).Image, (guest.HatColour)).ToUInt32()); + break; + case ShopItem::TShirt: + ft.Rewind(); + ft.Add(ImageId(GetShopItemDescriptor(item).Image, (guest.TshirtColour)).ToUInt32()); + break; + case ShopItem::Photo2: + invRide = GetRide(guest.Photo2RideRef); + if (invRide != nullptr) + { ft.Rewind(); ft.Increment(6); - ft.Add(STR_PEEP_INVENTORY_VOUCHER_PARK_ENTRY_HALF_PRICE); - ft.Add(STR_STRING); - ft.Add(parkName); - break; - case VOUCHER_TYPE_FOOD_OR_DRINK_FREE: + invRide->FormatNameTo(ft); + } + break; + case ShopItem::Photo3: + invRide = GetRide(guest.Photo3RideRef); + if (invRide != nullptr) + { ft.Rewind(); ft.Increment(6); - ft.Add(STR_PEEP_INVENTORY_VOUCHER_FOOD_OR_DRINK_FREE); - ft.Add(GetShopItemDescriptor(guest.VoucherShopItem).Naming.Singular); - break; - } - break; - case ShopItem::Hat: - ft.Rewind(); - ft.Add(ImageId(GetShopItemDescriptor(item).Image, (guest.HatColour)).ToUInt32()); - break; - case ShopItem::TShirt: - ft.Rewind(); - ft.Add(ImageId(GetShopItemDescriptor(item).Image, (guest.TshirtColour)).ToUInt32()); - break; - case ShopItem::Photo2: - invRide = GetRide(guest.Photo2RideRef); - if (invRide != nullptr) - { - ft.Rewind(); - ft.Increment(6); - invRide->FormatNameTo(ft); - } - break; - case ShopItem::Photo3: - invRide = GetRide(guest.Photo3RideRef); - if (invRide != nullptr) - { - ft.Rewind(); - ft.Increment(6); - invRide->FormatNameTo(ft); - } - break; - case ShopItem::Photo4: - invRide = GetRide(guest.Photo4RideRef); - if (invRide != nullptr) - { - ft.Rewind(); - ft.Increment(6); - invRide->FormatNameTo(ft); - } - break; - default: - // This switch handles only items visible in peep window - break; + invRide->FormatNameTo(ft); + } + break; + case ShopItem::Photo4: + invRide = GetRide(guest.Photo4RideRef); + if (invRide != nullptr) + { + ft.Rewind(); + ft.Increment(6); + invRide->FormatNameTo(ft); + } + break; + default: + // This switch handles only items visible in peep window + break; + } + + return std::make_pair(STR_GUEST_ITEM_FORMAT, ft); } - return std::make_pair(STR_GUEST_ITEM_FORMAT, ft); - } - - void OnDrawInventory(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - OverviewTabDraw(dpi); - StatsTabDraw(dpi); - RidesTabDraw(dpi); - FinanceTabDraw(dpi); - ThoughtsTabDraw(dpi); - InventoryTabDraw(dpi); - DebugTabDraw(dpi); - - const auto guest = GetGuest(); - if (guest == nullptr) + void OnDrawInventory(DrawPixelInfo& dpi) { - return; + DrawWidgets(dpi); + OverviewTabDraw(dpi); + StatsTabDraw(dpi); + RidesTabDraw(dpi); + FinanceTabDraw(dpi); + ThoughtsTabDraw(dpi); + InventoryTabDraw(dpi); + DebugTabDraw(dpi); + + const auto guest = GetGuest(); + if (guest == nullptr) + { + return; + } + + Widget* pageBackgroundWidget = &widgets[WIDX_PAGE_BACKGROUND]; + auto screenCoords = windowPos + ScreenCoordsXY{ pageBackgroundWidget->left + 4, pageBackgroundWidget->top + 2 }; + int32_t itemNameWidth = pageBackgroundWidget->width() - 8; + + int32_t maxY = windowPos.y + height - 22; + int32_t numItems = 0; + + DrawTextBasic(dpi, screenCoords, STR_CARRYING); + screenCoords.y += 10; + + for (ShopItem item = ShopItem::Balloon; item < ShopItem::Count; item++) + { + if (screenCoords.y >= maxY) + break; + if (!guest->HasItem(item)) + continue; + + auto [stringId, ft] = InventoryFormatItem(*guest, item); + screenCoords.y += DrawTextWrapped(dpi, screenCoords, itemNameWidth, stringId, ft); + numItems++; + } + + if (numItems == 0) + { + DrawTextBasic(dpi, screenCoords, STR_NOTHING); + } } - - Widget* pageBackgroundWidget = &widgets[WIDX_PAGE_BACKGROUND]; - auto screenCoords = windowPos + ScreenCoordsXY{ pageBackgroundWidget->left + 4, pageBackgroundWidget->top + 2 }; - int32_t itemNameWidth = pageBackgroundWidget->width() - 8; - - int32_t maxY = windowPos.y + height - 22; - int32_t numItems = 0; - - DrawTextBasic(dpi, screenCoords, STR_CARRYING); - screenCoords.y += 10; - - for (ShopItem item = ShopItem::Balloon; item < ShopItem::Count; item++) - { - if (screenCoords.y >= maxY) - break; - if (!guest->HasItem(item)) - continue; - - auto [stringId, ft] = InventoryFormatItem(*guest, item); - screenCoords.y += DrawTextWrapped(dpi, screenCoords, itemNameWidth, stringId, ft); - numItems++; - } - - if (numItems == 0) - { - DrawTextBasic(dpi, screenCoords, STR_NOTHING); - } - } #pragma endregion #pragma region Debug - void DebugTabDraw(DrawPixelInfo& dpi) - { - if (WidgetIsDisabled(*this, WIDX_TAB_7)) - return; - - const auto& widget = widgets[WIDX_TAB_7]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - - int32_t imageId = SPR_TAB_GEARS_0; - if (page == WINDOW_GUEST_DEBUG) + void DebugTabDraw(DrawPixelInfo& dpi) { - imageId += (frame_no / 2) & 0x3; - } + if (WidgetIsDisabled(*this, WIDX_TAB_7)) + return; - GfxDrawSprite(dpi, ImageId(imageId), screenCoords); - } + const auto& widget = widgets[WIDX_TAB_7]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - void OnUpdateDebug() - { - frame_no++; - Invalidate(); - } - - void OnDrawDebug(DrawPixelInfo& dpi) - { - char buffer[512]{}; - char buffer2[512]{}; - - DrawWidgets(dpi); - OverviewTabDraw(dpi); - StatsTabDraw(dpi); - RidesTabDraw(dpi); - FinanceTabDraw(dpi); - ThoughtsTabDraw(dpi); - InventoryTabDraw(dpi); - DebugTabDraw(dpi); - - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - { - auto ft = Formatter(); - ft.Add(peep->Id); - DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_SPRITE_INDEX, ft); - } - screenCoords.y += LIST_ROW_HEIGHT; - { - auto ft = Formatter(); - ft.Add(peep->x); - ft.Add(peep->y); - ft.Add(peep->z); - DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_POSITION, ft); - } - screenCoords.y += LIST_ROW_HEIGHT; - { - auto ft = Formatter(); - ft.Add(peep->NextLoc.x); - ft.Add(peep->NextLoc.y); - ft.Add(peep->NextLoc.z); - OpenRCT2::FormatStringLegacy(buffer, sizeof(buffer), STR_PEEP_DEBUG_NEXT, ft.Data()); - if (peep->GetNextIsSurface()) + int32_t imageId = SPR_TAB_GEARS_0; + if (page == WINDOW_GUEST_DEBUG) { - OpenRCT2::FormatStringLegacy(buffer2, sizeof(buffer2), STR_PEEP_DEBUG_NEXT_SURFACE, nullptr); - SafeStrCat(buffer, buffer2, sizeof(buffer)); + imageId += (frame_no / 2) & 0x3; } - if (peep->GetNextIsSloped()) - { - auto ft2 = Formatter(); - ft2.Add(peep->GetNextDirection()); - OpenRCT2::FormatStringLegacy(buffer2, sizeof(buffer2), STR_PEEP_DEBUG_NEXT_SLOPE, ft2.Data()); - SafeStrCat(buffer, buffer2, sizeof(buffer)); - } - GfxDrawString(dpi, screenCoords, buffer, {}); - } - screenCoords.y += LIST_ROW_HEIGHT; - { - auto ft = Formatter(); - ft.Add(peep->DestinationX); - ft.Add(peep->DestinationY); - ft.Add(peep->DestinationTolerance); - DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_DEST, ft); - } - screenCoords.y += LIST_ROW_HEIGHT; - { - auto ft = Formatter(); - ft.Add(peep->PathfindGoal.x); - ft.Add(peep->PathfindGoal.y); - ft.Add(peep->PathfindGoal.z); - ft.Add(peep->PathfindGoal.direction); - DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_PATHFIND_GOAL, ft); - } - screenCoords.y += LIST_ROW_HEIGHT; - DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_PATHFIND_HISTORY); - screenCoords.y += LIST_ROW_HEIGHT; - screenCoords.x += 10; - for (auto& point : peep->PathfindHistory) + GfxDrawSprite(dpi, ImageId(imageId), screenCoords); + } + + void OnUpdateDebug() { - auto ft = Formatter(); - ft.Add(point.x); - ft.Add(point.y); - ft.Add(point.z); - ft.Add(point.direction); - DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_PATHFIND_HISTORY_ITEM, ft); + frame_no++; + Invalidate(); + } + + void OnDrawDebug(DrawPixelInfo& dpi) + { + char buffer[512]{}; + char buffer2[512]{}; + + DrawWidgets(dpi); + OverviewTabDraw(dpi); + StatsTabDraw(dpi); + RidesTabDraw(dpi); + FinanceTabDraw(dpi); + ThoughtsTabDraw(dpi); + InventoryTabDraw(dpi); + DebugTabDraw(dpi); + + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; + { + auto ft = Formatter(); + ft.Add(peep->Id); + DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_SPRITE_INDEX, ft); + } screenCoords.y += LIST_ROW_HEIGHT; + { + auto ft = Formatter(); + ft.Add(peep->x); + ft.Add(peep->y); + ft.Add(peep->z); + DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_POSITION, ft); + } + screenCoords.y += LIST_ROW_HEIGHT; + { + auto ft = Formatter(); + ft.Add(peep->NextLoc.x); + ft.Add(peep->NextLoc.y); + ft.Add(peep->NextLoc.z); + OpenRCT2::FormatStringLegacy(buffer, sizeof(buffer), STR_PEEP_DEBUG_NEXT, ft.Data()); + if (peep->GetNextIsSurface()) + { + OpenRCT2::FormatStringLegacy(buffer2, sizeof(buffer2), STR_PEEP_DEBUG_NEXT_SURFACE, nullptr); + SafeStrCat(buffer, buffer2, sizeof(buffer)); + } + if (peep->GetNextIsSloped()) + { + auto ft2 = Formatter(); + ft2.Add(peep->GetNextDirection()); + OpenRCT2::FormatStringLegacy(buffer2, sizeof(buffer2), STR_PEEP_DEBUG_NEXT_SLOPE, ft2.Data()); + SafeStrCat(buffer, buffer2, sizeof(buffer)); + } + GfxDrawString(dpi, screenCoords, buffer, {}); + } + screenCoords.y += LIST_ROW_HEIGHT; + { + auto ft = Formatter(); + ft.Add(peep->DestinationX); + ft.Add(peep->DestinationY); + ft.Add(peep->DestinationTolerance); + DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_DEST, ft); + } + screenCoords.y += LIST_ROW_HEIGHT; + { + auto ft = Formatter(); + ft.Add(peep->PathfindGoal.x); + ft.Add(peep->PathfindGoal.y); + ft.Add(peep->PathfindGoal.z); + ft.Add(peep->PathfindGoal.direction); + DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_PATHFIND_GOAL, ft); + } + screenCoords.y += LIST_ROW_HEIGHT; + DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_PATHFIND_HISTORY); + screenCoords.y += LIST_ROW_HEIGHT; + + screenCoords.x += 10; + for (auto& point : peep->PathfindHistory) + { + auto ft = Formatter(); + ft.Add(point.x); + ft.Add(point.y); + ft.Add(point.z); + ft.Add(point.direction); + DrawTextBasic(dpi, screenCoords, STR_PEEP_DEBUG_PATHFIND_HISTORY_ITEM, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + screenCoords.x -= 10; } - screenCoords.x -= 10; - } #pragma endregion -}; + }; -/** - * - * rct2: 0x006989E9 - * - */ -WindowBase* WindowGuestOpen(Peep* peep) -{ - if (peep == nullptr) + /** + * + * rct2: 0x006989E9 + * + */ + WindowBase* GuestOpen(Peep* peep) { - return nullptr; - } - if (peep->Is()) - { - return WindowStaffOpen(peep); - } - - auto* window = static_cast(WindowBringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying())); - if (window == nullptr) - { - int32_t windowWidth = 192; - if (gConfigGeneral.DebuggingTools) - windowWidth += TabWidth; - - window = WindowCreate(WindowClass::Peep, windowWidth, 157, WF_RESIZABLE); - if (window == nullptr) + if (peep == nullptr) { return nullptr; } + if (peep->Is()) + { + return StaffOpen(peep); + } + + auto* window = static_cast(WindowBringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying())); + if (window == nullptr) + { + int32_t windowWidth = 192; + if (gConfigGeneral.DebuggingTools) + windowWidth += TabWidth; + + window = WindowCreate(WindowClass::Peep, windowWidth, 157, WF_RESIZABLE); + if (window == nullptr) + { + return nullptr; + } + } + + window->Init(peep->Id); + + return window; } - - window->Init(peep->Id); - - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index 1871352059..423f0161c1 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -29,31 +29,31 @@ #include #include -using namespace OpenRCT2; - -static constexpr StringId WINDOW_TITLE = STR_GUESTS; -static constexpr int32_t WH = 330; -static constexpr int32_t WW = 350; - -enum WindowGuestListWidgetIdx +namespace OpenRCT2::Ui::Windows { - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_TAB_CONTENT_PANEL, - WIDX_PAGE_DROPDOWN, - WIDX_PAGE_DROPDOWN_BUTTON, - WIDX_INFO_TYPE_DROPDOWN, - WIDX_INFO_TYPE_DROPDOWN_BUTTON, - WIDX_MAP, - WIDX_FILTER_BY_NAME, - WIDX_TRACKING, - WIDX_TAB_1, - WIDX_TAB_2, - WIDX_GUEST_LIST -}; + static constexpr StringId WINDOW_TITLE = STR_GUESTS; + static constexpr int32_t WH = 330; + static constexpr int32_t WW = 350; -// clang-format off + enum WindowGuestListWidgetIdx + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_TAB_CONTENT_PANEL, + WIDX_PAGE_DROPDOWN, + WIDX_PAGE_DROPDOWN_BUTTON, + WIDX_INFO_TYPE_DROPDOWN, + WIDX_INFO_TYPE_DROPDOWN_BUTTON, + WIDX_MAP, + WIDX_FILTER_BY_NAME, + WIDX_TRACKING, + WIDX_TAB_1, + WIDX_TAB_2, + WIDX_GUEST_LIST + }; + + // clang-format off static Widget window_guest_list_widgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, {350, 287}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab content panel @@ -67,929 +67,933 @@ static Widget window_guest_list_widgets[] = { MakeTab ({ 3, 17}, STR_INDIVIDUAL_GUESTS_TIP ), // tab 1 MakeTab ({ 34, 17}, STR_SUMMARISED_GUESTS_TIP ), // tab 2 MakeWidget({ 3, 72}, {344, 255}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ), // guest list - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class GuestListWindow final : public Window -{ -private: - enum class TabId + class GuestListWindow final : public Window { - Individual, - Summarised - }; - - enum class GuestViewType - { - Actions, - Thoughts, - }; - - enum class GuestFilterType - { - Guests, - GuestsThinking, - GuestsThinkingAbout, - }; - - struct FilterArguments - { - uint8_t args[12]{}; - - StringId GetFirstStringId() + private: + enum class TabId { - StringId firstStrId{}; - std::memcpy(&firstStrId, args, sizeof(firstStrId)); - return firstStrId; - } + Individual, + Summarised + }; - bool operator==(const FilterArguments& other) const + enum class GuestViewType { - return std::memcmp(args, other.args, sizeof(args)) == 0; - } - bool operator!=(const FilterArguments& other) const + Actions, + Thoughts, + }; + + enum class GuestFilterType { - return !(*this == other); - } - }; + Guests, + GuestsThinking, + GuestsThinkingAbout, + }; - struct GuestGroup - { - size_t NumGuests{}; - FilterArguments Arguments; - uint8_t Faces[58]{}; - }; - - struct GuestItem - { - using CompareFunc = bool (*)(const GuestItem&, const GuestItem&); - - EntityId Id; - char Name[256]; - }; - - static constexpr uint8_t SUMMARISED_GUEST_ROW_HEIGHT = SCROLLABLE_ROW_HEIGHT + 11; - static constexpr auto GUESTS_PER_PAGE = 2000; - static constexpr const auto GUEST_PAGE_HEIGHT = GUESTS_PER_PAGE * SCROLLABLE_ROW_HEIGHT; - static constexpr size_t MaxGroups = 240; - - TabId _selectedTab{}; - GuestViewType _selectedView{}; - bool _trackingOnly{}; - std::optional _selectedFilter; - FilterArguments _filterArguments; - std::string _filterName; - - size_t _numPages{}; - size_t _selectedPage{}; - - GuestViewType _lastFindGroupsSelectedView{}; - uint32_t _lastFindGroupsTick{}; - uint32_t _lastFindGroupsWait{}; - std::vector _groups; - - std::vector _guestList; - std::optional _highlightedIndex; - - uint32_t _tabAnimationIndex{}; - -public: - void OnOpen() override - { - widgets = window_guest_list_widgets; - WindowInitScrollWidgets(*this); - - _selectedTab = TabId::Summarised; - _selectedView = GuestViewType::Thoughts; - _numPages = 1; - widgets[WIDX_TRACKING].type = WindowWidgetType::FlatBtn; - widgets[WIDX_FILTER_BY_NAME].type = WindowWidgetType::FlatBtn; - widgets[WIDX_PAGE_DROPDOWN].type = WindowWidgetType::Empty; - widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WindowWidgetType::Empty; - min_width = 350; - min_height = 330; - max_width = 500; - max_height = 450; - RefreshList(); - } - - void SetFilter(GuestListFilterType type, int32_t index) - { - _selectedPage = 0; - _numPages = 1; - _trackingOnly = false; - _filterArguments = {}; - - Formatter ft(_filterArguments.args); - - switch (type) + struct FilterArguments { - case GuestListFilterType::GuestsOnRide: + uint8_t args[12]{}; + + StringId GetFirstStringId() { - auto guestRide = GetRide(RideId::FromUnderlying(index)); - if (guestRide != nullptr) - { - ft.Add( - guestRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IN_RIDE) ? STR_IN_RIDE : STR_ON_RIDE); - guestRide->FormatNameTo(ft); - - _selectedFilter = GuestFilterType::Guests; - _highlightedIndex = {}; - _selectedTab = TabId::Individual; - _selectedView = GuestViewType::Thoughts; - } - break; + StringId firstStrId{}; + std::memcpy(&firstStrId, args, sizeof(firstStrId)); + return firstStrId; } - case GuestListFilterType::GuestsInQueue: - { - auto guestRide = GetRide(RideId::FromUnderlying(index)); - if (guestRide != nullptr) - { - ft.Add(STR_QUEUING_FOR); - guestRide->FormatNameTo(ft); - _selectedFilter = GuestFilterType::Guests; - _highlightedIndex = {}; - _selectedTab = TabId::Individual; - _selectedView = GuestViewType::Thoughts; - } - break; - } - case GuestListFilterType::GuestsThinkingAboutRide: + bool operator==(const FilterArguments& other) const { - auto guestRide = GetRide(RideId::FromUnderlying(index)); - if (guestRide != nullptr) + return std::memcmp(args, other.args, sizeof(args)) == 0; + } + bool operator!=(const FilterArguments& other) const + { + return !(*this == other); + } + }; + + struct GuestGroup + { + size_t NumGuests{}; + FilterArguments Arguments; + uint8_t Faces[58]{}; + }; + + struct GuestItem + { + using CompareFunc = bool (*)(const GuestItem&, const GuestItem&); + + EntityId Id; + char Name[256]; + }; + + static constexpr uint8_t SUMMARISED_GUEST_ROW_HEIGHT = SCROLLABLE_ROW_HEIGHT + 11; + static constexpr auto GUESTS_PER_PAGE = 2000; + static constexpr const auto GUEST_PAGE_HEIGHT = GUESTS_PER_PAGE * SCROLLABLE_ROW_HEIGHT; + static constexpr size_t MaxGroups = 240; + + TabId _selectedTab{}; + GuestViewType _selectedView{}; + bool _trackingOnly{}; + std::optional _selectedFilter; + FilterArguments _filterArguments; + std::string _filterName; + + size_t _numPages{}; + size_t _selectedPage{}; + + GuestViewType _lastFindGroupsSelectedView{}; + uint32_t _lastFindGroupsTick{}; + uint32_t _lastFindGroupsWait{}; + std::vector _groups; + + std::vector _guestList; + std::optional _highlightedIndex; + + uint32_t _tabAnimationIndex{}; + + public: + void OnOpen() override + { + widgets = window_guest_list_widgets; + WindowInitScrollWidgets(*this); + + _selectedTab = TabId::Summarised; + _selectedView = GuestViewType::Thoughts; + _numPages = 1; + widgets[WIDX_TRACKING].type = WindowWidgetType::FlatBtn; + widgets[WIDX_FILTER_BY_NAME].type = WindowWidgetType::FlatBtn; + widgets[WIDX_PAGE_DROPDOWN].type = WindowWidgetType::Empty; + widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WindowWidgetType::Empty; + min_width = 350; + min_height = 330; + max_width = 500; + max_height = 450; + RefreshList(); + } + + void SetFilter(GuestListFilterType type, int32_t index) + { + _selectedPage = 0; + _numPages = 1; + _trackingOnly = false; + _filterArguments = {}; + + Formatter ft(_filterArguments.args); + + switch (type) + { + case GuestListFilterType::GuestsOnRide: { - ft.Add(STR_NONE); - guestRide->FormatNameTo(ft); + auto guestRide = GetRide(RideId::FromUnderlying(index)); + if (guestRide != nullptr) + { + ft.Add( + guestRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IN_RIDE) ? STR_IN_RIDE : STR_ON_RIDE); + guestRide->FormatNameTo(ft); + + _selectedFilter = GuestFilterType::Guests; + _highlightedIndex = {}; + _selectedTab = TabId::Individual; + _selectedView = GuestViewType::Thoughts; + } + break; + } + case GuestListFilterType::GuestsInQueue: + { + auto guestRide = GetRide(RideId::FromUnderlying(index)); + if (guestRide != nullptr) + { + ft.Add(STR_QUEUING_FOR); + guestRide->FormatNameTo(ft); + + _selectedFilter = GuestFilterType::Guests; + _highlightedIndex = {}; + _selectedTab = TabId::Individual; + _selectedView = GuestViewType::Thoughts; + } + break; + } + case GuestListFilterType::GuestsThinkingAboutRide: + { + auto guestRide = GetRide(RideId::FromUnderlying(index)); + if (guestRide != nullptr) + { + ft.Add(STR_NONE); + guestRide->FormatNameTo(ft); + + _selectedFilter = GuestFilterType::GuestsThinking; + _highlightedIndex = {}; + _selectedTab = TabId::Individual; + _selectedView = GuestViewType::Thoughts; + } + break; + } + case GuestListFilterType::GuestsThinkingX: + { + ft.Add(PeepThoughts[index & 0xFF]); _selectedFilter = GuestFilterType::GuestsThinking; _highlightedIndex = {}; _selectedTab = TabId::Individual; _selectedView = GuestViewType::Thoughts; - } - break; - } - case GuestListFilterType::GuestsThinkingX: - { - ft.Add(PeepThoughts[index & 0xFF]); - - _selectedFilter = GuestFilterType::GuestsThinking; - _highlightedIndex = {}; - _selectedTab = TabId::Individual; - _selectedView = GuestViewType::Thoughts; - break; - } - } - - RefreshList(); - } - - void OnResize() override - { - min_width = 350; - min_height = 330; - if (width < min_width) - { - Invalidate(); - width = min_width; - } - if (height < min_height) - { - Invalidate(); - height = min_height; - } - } - - void OnUpdate() override - { - if (_lastFindGroupsWait != 0) - { - _lastFindGroupsWait--; - } - - // Current tab image animation - _tabAnimationIndex++; - if (_tabAnimationIndex >= (_selectedTab == TabId::Individual ? 24uL : 32uL)) - _tabAnimationIndex = 0; - InvalidateWidget(WIDX_TAB_1 + static_cast(_selectedTab)); - - gWindowMapFlashingFlags |= MapFlashingFlags::GuestListOpen; - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_MAP: - ContextOpenWindow(WindowClass::Map); - break; - case WIDX_TRACKING: - _trackingOnly = !_trackingOnly; - SetWidgetPressed(WIDX_TRACKING, _trackingOnly); - Invalidate(); - scrolls[0].v_top = 0; - RefreshList(); - break; - case WIDX_FILTER_BY_NAME: - if (!_filterName.empty()) - { - // Unset the search filter. - _filterName.clear(); - SetWidgetPressed(WIDX_FILTER_BY_NAME, false); - RefreshList(); - } - else - { - WindowTextInputRawOpen( - this, WIDX_FILTER_BY_NAME, STR_GUESTS_FILTER_BY_NAME, STR_GUESTS_ENTER_NAME_TO_SEARCH, {}, - _filterName.c_str(), 32); - } - break; - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_TAB_1: - case WIDX_TAB_2: - { - if (_selectedFilter && _selectedTab == static_cast(widgetIndex - WIDX_TAB_1)) break; - _selectedTab = static_cast(widgetIndex - WIDX_TAB_1); - _selectedPage = 0; - _numPages = 1; - widgets[WIDX_TRACKING].type = WindowWidgetType::Empty; - if (_selectedTab == TabId::Summarised) - { - widgets[WIDX_FILTER_BY_NAME].type = WindowWidgetType::Empty; - SetWidgetPressed(WIDX_FILTER_BY_NAME, false); - _filterName.clear(); } - else if (_selectedTab == TabId::Individual) - { - widgets[WIDX_TRACKING].type = WindowWidgetType::FlatBtn; - widgets[WIDX_FILTER_BY_NAME].type = WindowWidgetType::FlatBtn; - } - widgets[WIDX_PAGE_DROPDOWN].type = WindowWidgetType::Empty; - widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WindowWidgetType::Empty; - _tabAnimationIndex = 0; - _selectedFilter = {}; - Invalidate(); - scrolls[0].v_top = 0; - RefreshList(); - break; } - case WIDX_PAGE_DROPDOWN_BUTTON: - { - auto* widget = &widgets[widgetIndex - 1]; - WindowDropdownShowTextCustomWidth( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, _numPages, widget->width() - 3); - - for (size_t i = 0; i < _numPages; i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - uint16_t* args = reinterpret_cast(&gDropdownItems[i].Args); - args[0] = STR_PAGE_X; - args[1] = static_cast(i + 1); - } - Dropdown::SetChecked(static_cast(_selectedPage), true); - break; - } - case WIDX_INFO_TYPE_DROPDOWN_BUTTON: - { - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = GetViewName(GuestViewType::Actions); - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Args = GetViewName(GuestViewType::Thoughts); - - auto* widget = &widgets[widgetIndex - 1]; - WindowDropdownShowTextCustomWidth( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, 2, widget->width() - 3); - - Dropdown::SetChecked(static_cast(_selectedView), true); - break; - } - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - if (dropdownIndex == -1) - { - return; - } - switch (widgetIndex) - { - case WIDX_PAGE_DROPDOWN_BUTTON: - _selectedPage = dropdownIndex; - Invalidate(); - break; - case WIDX_INFO_TYPE_DROPDOWN_BUTTON: - _selectedView = static_cast(dropdownIndex); - Invalidate(); - break; - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (!text.empty()) - { - _filterName = text; - SetWidgetPressed(WIDX_FILTER_BY_NAME, true); RefreshList(); } - } - void OnPrepareDraw() override - { - SetWidgetPressed(WIDX_TAB_1, false); - SetWidgetPressed(WIDX_TAB_2, false); - SetWidgetPressed(WIDX_TAB_1 + static_cast(_selectedTab), true); - - widgets[WIDX_INFO_TYPE_DROPDOWN].text = GetViewName(_selectedView); - widgets[WIDX_MAP].type = WindowWidgetType::Empty; - if (_selectedTab == TabId::Individual && _selectedFilter) - widgets[WIDX_MAP].type = WindowWidgetType::FlatBtn; - - ResizeFrameWithPage(); - widgets[WIDX_GUEST_LIST].right = width - 4; - widgets[WIDX_GUEST_LIST].bottom = height - 15; - widgets[WIDX_MAP].left = 273 - 350 + width; - widgets[WIDX_MAP].right = 296 - 350 + width; - widgets[WIDX_FILTER_BY_NAME].left = 297 - 350 + width; - widgets[WIDX_FILTER_BY_NAME].right = 320 - 350 + width; - widgets[WIDX_TRACKING].left = 321 - 350 + width; - widgets[WIDX_TRACKING].right = 344 - 350 + width; - - if (_numPages > 1) + void OnResize() override { - widgets[WIDX_PAGE_DROPDOWN].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WindowWidgetType::Button; - auto ft = Formatter::Common(); - ft.Increment(4); - ft.Add(_selectedPage + 1); - } - else - { - widgets[WIDX_PAGE_DROPDOWN].type = WindowWidgetType::Empty; - widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WindowWidgetType::Empty; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - // Filter description - StringId format; - auto screenCoords = windowPos + ScreenCoordsXY{ 6, widgets[WIDX_TAB_CONTENT_PANEL].top + 3 }; - if (_selectedTab == TabId::Individual) - { - if (_selectedFilter) + min_width = 350; + min_height = 330; + if (width < min_width) { - if (_filterArguments.GetFirstStringId() != STR_NONE) + Invalidate(); + width = min_width; + } + if (height < min_height) + { + Invalidate(); + height = min_height; + } + } + + void OnUpdate() override + { + if (_lastFindGroupsWait != 0) + { + _lastFindGroupsWait--; + } + + // Current tab image animation + _tabAnimationIndex++; + if (_tabAnimationIndex >= (_selectedTab == TabId::Individual ? 24uL : 32uL)) + _tabAnimationIndex = 0; + InvalidateWidget(WIDX_TAB_1 + static_cast(_selectedTab)); + + gWindowMapFlashingFlags |= MapFlashingFlags::GuestListOpen; + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_MAP: + ContextOpenWindow(WindowClass::Map); + break; + case WIDX_TRACKING: + _trackingOnly = !_trackingOnly; + SetWidgetPressed(WIDX_TRACKING, _trackingOnly); + Invalidate(); + scrolls[0].v_top = 0; + RefreshList(); + break; + case WIDX_FILTER_BY_NAME: + if (!_filterName.empty()) + { + // Unset the search filter. + _filterName.clear(); + SetWidgetPressed(WIDX_FILTER_BY_NAME, false); + RefreshList(); + } + else + { + WindowTextInputRawOpen( + this, WIDX_FILTER_BY_NAME, STR_GUESTS_FILTER_BY_NAME, STR_GUESTS_ENTER_NAME_TO_SEARCH, {}, + _filterName.c_str(), 32); + } + break; + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_TAB_1: + case WIDX_TAB_2: { - format = GetFilterString(*_selectedFilter); + if (_selectedFilter && _selectedTab == static_cast(widgetIndex - WIDX_TAB_1)) + break; + _selectedTab = static_cast(widgetIndex - WIDX_TAB_1); + _selectedPage = 0; + _numPages = 1; + widgets[WIDX_TRACKING].type = WindowWidgetType::Empty; + if (_selectedTab == TabId::Summarised) + { + widgets[WIDX_FILTER_BY_NAME].type = WindowWidgetType::Empty; + SetWidgetPressed(WIDX_FILTER_BY_NAME, false); + _filterName.clear(); + } + else if (_selectedTab == TabId::Individual) + { + widgets[WIDX_TRACKING].type = WindowWidgetType::FlatBtn; + widgets[WIDX_FILTER_BY_NAME].type = WindowWidgetType::FlatBtn; + } + widgets[WIDX_PAGE_DROPDOWN].type = WindowWidgetType::Empty; + widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WindowWidgetType::Empty; + _tabAnimationIndex = 0; + _selectedFilter = {}; + Invalidate(); + scrolls[0].v_top = 0; + RefreshList(); + break; + } + case WIDX_PAGE_DROPDOWN_BUTTON: + { + auto* widget = &widgets[widgetIndex - 1]; + + WindowDropdownShowTextCustomWidth( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, + Dropdown::Flag::StayOpen, _numPages, widget->width() - 3); + + for (size_t i = 0; i < _numPages; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + uint16_t* args = reinterpret_cast(&gDropdownItems[i].Args); + args[0] = STR_PAGE_X; + args[1] = static_cast(i + 1); + } + Dropdown::SetChecked(static_cast(_selectedPage), true); + break; + } + case WIDX_INFO_TYPE_DROPDOWN_BUTTON: + { + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = GetViewName(GuestViewType::Actions); + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Args = GetViewName(GuestViewType::Thoughts); + + auto* widget = &widgets[widgetIndex - 1]; + WindowDropdownShowTextCustomWidth( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, + Dropdown::Flag::StayOpen, 2, widget->width() - 3); + + Dropdown::SetChecked(static_cast(_selectedView), true); + break; + } + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + { + if (dropdownIndex == -1) + { + return; + } + switch (widgetIndex) + { + case WIDX_PAGE_DROPDOWN_BUTTON: + _selectedPage = dropdownIndex; + Invalidate(); + break; + case WIDX_INFO_TYPE_DROPDOWN_BUTTON: + _selectedView = static_cast(dropdownIndex); + Invalidate(); + break; + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (!text.empty()) + { + _filterName = text; + SetWidgetPressed(WIDX_FILTER_BY_NAME, true); + RefreshList(); + } + } + + void OnPrepareDraw() override + { + SetWidgetPressed(WIDX_TAB_1, false); + SetWidgetPressed(WIDX_TAB_2, false); + SetWidgetPressed(WIDX_TAB_1 + static_cast(_selectedTab), true); + + widgets[WIDX_INFO_TYPE_DROPDOWN].text = GetViewName(_selectedView); + widgets[WIDX_MAP].type = WindowWidgetType::Empty; + if (_selectedTab == TabId::Individual && _selectedFilter) + widgets[WIDX_MAP].type = WindowWidgetType::FlatBtn; + + ResizeFrameWithPage(); + widgets[WIDX_GUEST_LIST].right = width - 4; + widgets[WIDX_GUEST_LIST].bottom = height - 15; + widgets[WIDX_MAP].left = 273 - 350 + width; + widgets[WIDX_MAP].right = 296 - 350 + width; + widgets[WIDX_FILTER_BY_NAME].left = 297 - 350 + width; + widgets[WIDX_FILTER_BY_NAME].right = 320 - 350 + width; + widgets[WIDX_TRACKING].left = 321 - 350 + width; + widgets[WIDX_TRACKING].right = 344 - 350 + width; + + if (_numPages > 1) + { + widgets[WIDX_PAGE_DROPDOWN].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WindowWidgetType::Button; + auto ft = Formatter::Common(); + ft.Increment(4); + ft.Add(_selectedPage + 1); + } + else + { + widgets[WIDX_PAGE_DROPDOWN].type = WindowWidgetType::Empty; + widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WindowWidgetType::Empty; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + // Filter description + StringId format; + auto screenCoords = windowPos + ScreenCoordsXY{ 6, widgets[WIDX_TAB_CONTENT_PANEL].top + 3 }; + if (_selectedTab == TabId::Individual) + { + if (_selectedFilter) + { + if (_filterArguments.GetFirstStringId() != STR_NONE) + { + format = GetFilterString(*_selectedFilter); + } + else + { + format = STR_GUESTS_FILTER_THINKING_ABOUT; + } } else { - format = STR_GUESTS_FILTER_THINKING_ABOUT; + format = STR_ALL_GUESTS; } } else { - format = STR_ALL_GUESTS; + format = STR_ALL_GUESTS_SUMMARISED; + } + + { + Formatter ft(_filterArguments.args); + DrawTextEllipsised(dpi, screenCoords, 310, format, ft); + } + + // Number of guests (list items) + if (_selectedTab == TabId::Individual) + { + screenCoords = windowPos + ScreenCoordsXY{ 4, widgets[WIDX_GUEST_LIST].bottom + 2 }; + auto ft = Formatter(); + ft.Add(static_cast(_guestList.size())); + DrawTextBasic( + dpi, screenCoords, (_guestList.size() == 1 ? STR_FORMAT_NUM_GUESTS_SINGULAR : STR_FORMAT_NUM_GUESTS_PLURAL), + ft); } } - else + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override { - format = STR_ALL_GUESTS_SUMMARISED; - } - - { - Formatter ft(_filterArguments.args); - DrawTextEllipsised(dpi, screenCoords, 310, format, ft); - } - - // Number of guests (list items) - if (_selectedTab == TabId::Individual) - { - screenCoords = windowPos + ScreenCoordsXY{ 4, widgets[WIDX_GUEST_LIST].bottom + 2 }; - auto ft = Formatter(); - ft.Add(static_cast(_guestList.size())); - DrawTextBasic( - dpi, screenCoords, (_guestList.size() == 1 ? STR_FORMAT_NUM_GUESTS_SINGULAR : STR_FORMAT_NUM_GUESTS_PLURAL), - ft); - } - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - int32_t y = 0; - switch (_selectedTab) - { - case TabId::Individual: - // Count the number of guests - y = static_cast(_guestList.size()) * SCROLLABLE_ROW_HEIGHT; - _numPages = (_guestList.size() + GUESTS_PER_PAGE - 1) / GUESTS_PER_PAGE; - if (_numPages == 0) - _selectedPage = 0; - else if (_selectedPage >= _numPages) - _selectedPage = _numPages - 1; - break; - case TabId::Summarised: - default: - // Find the groups - if (IsRefreshOfGroupsRequired()) - { - RefreshGroups(); - } - y = static_cast(_groups.size() * SUMMARISED_GUEST_ROW_HEIGHT); - break; - } - - y -= static_cast(GUEST_PAGE_HEIGHT * _selectedPage); - y = std::max(0, std::min(y, GUEST_PAGE_HEIGHT)); - - if (_highlightedIndex) - { - _highlightedIndex = {}; - Invalidate(); - } - - auto i = std::max(0, y - widgets[WIDX_GUEST_LIST].bottom + widgets[WIDX_GUEST_LIST].top + 21); - if (i < scrolls[0].v_top) - { - scrolls[0].v_top = i; - Invalidate(); - } - - return { 447, y }; - } - - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - auto i = screenCoords.y / (_selectedTab == TabId::Individual ? SCROLLABLE_ROW_HEIGHT : SUMMARISED_GUEST_ROW_HEIGHT); - i += static_cast(_selectedPage * GUESTS_PER_PAGE); - if (static_cast(i) != _highlightedIndex) - { - _highlightedIndex = i; - Invalidate(); - } - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - switch (_selectedTab) - { - case TabId::Individual: + int32_t y = 0; + switch (_selectedTab) { - auto i = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - i += static_cast(_selectedPage * GUESTS_PER_PAGE); - for (const auto& guestItem : _guestList) - { - if (i == 0) + case TabId::Individual: + // Count the number of guests + y = static_cast(_guestList.size()) * SCROLLABLE_ROW_HEIGHT; + _numPages = (_guestList.size() + GUESTS_PER_PAGE - 1) / GUESTS_PER_PAGE; + if (_numPages == 0) + _selectedPage = 0; + else if (_selectedPage >= _numPages) + _selectedPage = _numPages - 1; + break; + case TabId::Summarised: + default: + // Find the groups + if (IsRefreshOfGroupsRequired()) { - auto guest = GetEntity(guestItem.Id); - if (guest != nullptr) - { - WindowGuestOpen(guest); - } - break; + RefreshGroups(); } - i--; - } - break; + y = static_cast(_groups.size() * SUMMARISED_GUEST_ROW_HEIGHT); + break; } - case TabId::Summarised: + + y -= static_cast(GUEST_PAGE_HEIGHT * _selectedPage); + y = std::max(0, std::min(y, GUEST_PAGE_HEIGHT)); + + if (_highlightedIndex) { - auto i = static_cast(screenCoords.y / SUMMARISED_GUEST_ROW_HEIGHT); - if (i < _groups.size()) - { - _filterArguments = _groups[i].Arguments; - _selectedFilter = _selectedView == GuestViewType::Actions ? GuestFilterType::Guests - : GuestFilterType::GuestsThinking; - _selectedTab = TabId::Individual; - widgets[WIDX_TRACKING].type = WindowWidgetType::FlatBtn; - Invalidate(); - widgets[WIDX_FILTER_BY_NAME].type = WindowWidgetType::FlatBtn; - scrolls[0].v_top = 0; - RefreshList(); - } - break; + _highlightedIndex = {}; + Invalidate(); + } + + auto i = std::max(0, y - widgets[WIDX_GUEST_LIST].bottom + widgets[WIDX_GUEST_LIST].top + 21); + if (i < scrolls[0].v_top) + { + scrolls[0].v_top = i; + Invalidate(); + } + + return { 447, y }; + } + + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + auto i = screenCoords.y / (_selectedTab == TabId::Individual ? SCROLLABLE_ROW_HEIGHT : SUMMARISED_GUEST_ROW_HEIGHT); + i += static_cast(_selectedPage * GUESTS_PER_PAGE); + if (static_cast(i) != _highlightedIndex) + { + _highlightedIndex = i; + Invalidate(); } } - } - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - GfxFillRect( - dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); - switch (_selectedTab) + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { - case TabId::Individual: - DrawScrollIndividual(dpi); - break; - case TabId::Summarised: - DrawScrollSummarised(dpi); - break; + switch (_selectedTab) + { + case TabId::Individual: + { + auto i = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + i += static_cast(_selectedPage * GUESTS_PER_PAGE); + for (const auto& guestItem : _guestList) + { + if (i == 0) + { + auto guest = GetEntity(guestItem.Id); + if (guest != nullptr) + { + GuestOpen(guest); + } + break; + } + i--; + } + break; + } + case TabId::Summarised: + { + auto i = static_cast(screenCoords.y / SUMMARISED_GUEST_ROW_HEIGHT); + if (i < _groups.size()) + { + _filterArguments = _groups[i].Arguments; + _selectedFilter = _selectedView == GuestViewType::Actions ? GuestFilterType::Guests + : GuestFilterType::GuestsThinking; + _selectedTab = TabId::Individual; + widgets[WIDX_TRACKING].type = WindowWidgetType::FlatBtn; + Invalidate(); + widgets[WIDX_FILTER_BY_NAME].type = WindowWidgetType::FlatBtn; + scrolls[0].v_top = 0; + RefreshList(); + } + break; + } + } } - } - void RefreshList() - { - // Only the individual tab uses the GuestList so no point calculating it - if (_selectedTab != TabId::Individual) + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override { - RefreshGroups(); + GfxFillRect( + dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); + switch (_selectedTab) + { + case TabId::Individual: + DrawScrollIndividual(dpi); + break; + case TabId::Summarised: + DrawScrollSummarised(dpi); + break; + } } - else + + void RefreshList() { - _guestList.clear(); + // Only the individual tab uses the GuestList so no point calculating it + if (_selectedTab != TabId::Individual) + { + RefreshGroups(); + } + else + { + _guestList.clear(); + + for (auto peep : EntityList()) + { + EntitySetFlashing(peep, false); + if (peep->OutsideOfPark) + continue; + if (_selectedFilter) + { + if (!IsPeepInFilter(*peep)) + continue; + EntitySetFlashing(peep, true); + } + if (!GuestShouldBeVisible(*peep)) + continue; + + auto& item = _guestList.emplace_back(); + item.Id = peep->Id; + + Formatter ft; + peep->FormatNameTo(ft); + OpenRCT2::FormatStringLegacy(item.Name, sizeof(item.Name), STR_STRINGID, ft.Data()); + } + + std::sort(_guestList.begin(), _guestList.end(), GetGuestCompareFunc()); + } + } + + private: + void DrawTabImages(DrawPixelInfo& dpi) + { + // Tab 1 image + auto i = (_selectedTab == TabId::Individual ? _tabAnimationIndex & ~3 : 0); + i += GetPeepAnimation(PeepSpriteType::Normal).base_image + 1; + GfxDrawSprite( + dpi, ImageId(i, COLOUR_GREY, COLOUR_DARK_OLIVE_GREEN), + windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].midX(), widgets[WIDX_TAB_1].bottom - 6 }); + + // Tab 2 image + i = (_selectedTab == TabId::Summarised ? _tabAnimationIndex / 4 : 0); + GfxDrawSprite( + dpi, ImageId(SPR_TAB_GUESTS_0 + i), + windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top }); + } + + void DrawScrollIndividual(DrawPixelInfo& dpi) + { + size_t index = 0; + auto y = static_cast(_selectedPage) * -GUEST_PAGE_HEIGHT; + for (const auto& guestItem : _guestList) + { + // Check if y is beyond the scroll control + if (y + SCROLLABLE_ROW_HEIGHT + 1 >= -0x7FFF && y + SCROLLABLE_ROW_HEIGHT + 1 > dpi.y && y < 0x7FFF + && y < dpi.y + dpi.height) + { + // Highlight backcolour and text colour (format) + StringId format = STR_BLACK_STRING; + if (index == _highlightedIndex) + { + GfxFilterRect(dpi, { 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1); + format = STR_WINDOW_COLOUR_2_STRINGID; + } + + // Guest name + auto peep = GetEntity(guestItem.Id); + if (peep == nullptr) + { + continue; + } + auto ft = Formatter(); + peep->FormatNameTo(ft); + DrawTextEllipsised(dpi, { 0, y }, 113, format, ft); + + switch (_selectedView) + { + case GuestViewType::Actions: + // Guest face + GfxDrawSprite(dpi, ImageId(GetPeepFaceSpriteSmall(peep)), { 118, y + 1 }); + + // Tracking icon + if (peep->PeepFlags & PEEP_FLAGS_TRACKING) + GfxDrawSprite(dpi, ImageId(STR_ENTER_SELECTION_SIZE), { 112, y + 1 }); + + // Action + ft = Formatter(); + peep->FormatActionTo(ft); + DrawTextEllipsised(dpi, { 133, y }, 314, format, ft); + break; + case GuestViewType::Thoughts: + // For each thought + for (const auto& thought : peep->Thoughts) + { + if (thought.type == PeepThoughtType::None) + break; + if (thought.freshness == 0) + continue; + if (thought.freshness > 5) + break; + + ft = Formatter(); + PeepThoughtSetFormatArgs(&thought, ft); + DrawTextEllipsised(dpi, { 118, y }, 329, format, ft, { FontStyle::Small }); + break; + } + break; + } + } + y += SCROLLABLE_ROW_HEIGHT; + index++; + } + } + + void DrawScrollSummarised(DrawPixelInfo& dpi) + { + size_t index = 0; + auto y = 0; + for (auto& group : _groups) + { + // Check if y is beyond the scroll control + if (y + SUMMARISED_GUEST_ROW_HEIGHT + 1 >= dpi.y) + { + // Check if y is beyond the scroll control + if (y >= dpi.y + dpi.height) + break; + + // Highlight backcolour and text colour (format) + StringId format = STR_BLACK_STRING; + if (index == _highlightedIndex) + { + GfxFilterRect(dpi, { 0, y, 800, y + SUMMARISED_GUEST_ROW_HEIGHT }, FilterPaletteID::PaletteDarken1); + format = STR_WINDOW_COLOUR_2_STRINGID; + } + + // Draw guest faces + for (uint32_t j = 0; j < std::size(group.Faces) && j < group.NumGuests; j++) + { + GfxDrawSprite( + dpi, ImageId(group.Faces[j] + SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY), + { static_cast(j) * 8, y + 12 }); + } + + // Draw action/thoughts + Formatter ft(group.Arguments.args); + // Draw small font if displaying guests + if (_selectedView == GuestViewType::Thoughts) + { + DrawTextEllipsised(dpi, { 0, y }, 414, format, ft, { FontStyle::Small }); + } + else + { + DrawTextEllipsised(dpi, { 0, y }, 414, format, ft); + } + + // Draw guest count + ft = Formatter(); + ft.Add(STR_GUESTS_COUNT_COMMA_SEP); + ft.Add(group.NumGuests); + DrawTextBasic(dpi, { 326, y }, format, ft, { TextAlignment::RIGHT }); + } + y += SUMMARISED_GUEST_ROW_HEIGHT; + index++; + } + } + + bool GuestShouldBeVisible(const Guest& peep) + { + if (_trackingOnly && !(peep.PeepFlags & PEEP_FLAGS_TRACKING)) + return false; + + if (!_filterName.empty()) + { + char name[256]{}; + + Formatter ft; + peep.FormatNameTo(ft); + OpenRCT2::FormatStringLegacy(name, sizeof(name), STR_STRINGID, ft.Data()); + if (!String::Contains(name, _filterName.c_str(), true)) + { + return false; + } + } + + return true; + } + + bool IsPeepInFilter(const Guest& peep) + { + auto guestViewType = _selectedFilter == GuestFilterType::Guests ? GuestViewType::Actions : GuestViewType::Thoughts; + auto peepArgs = GetArgumentsFromPeep(peep, guestViewType); + if (_filterArguments.GetFirstStringId() == STR_NONE && _selectedFilter == GuestFilterType::GuestsThinking) + { + Formatter(peepArgs.args).Add(STR_NONE); + } + return _filterArguments == peepArgs; + } + + bool IsRefreshOfGroupsRequired() + { + uint32_t tick256 = Floor2(GetGameState().CurrentTicks, 256); + if (_selectedView == _lastFindGroupsSelectedView) + { + if (_lastFindGroupsWait != 0 || _lastFindGroupsTick == tick256) + { + return false; + } + } + + return true; + } + + GuestGroup& FindOrAddGroup(FilterArguments&& arguments) + { + auto foundGroup = std::find_if(std::begin(_groups), std::end(_groups), [&arguments](GuestGroup& group) { + return group.Arguments == arguments; + }); + if (foundGroup != std::end(_groups)) + { + return *foundGroup; + } + auto& newGroup = _groups.emplace_back(); + newGroup.Arguments = arguments; + return newGroup; + } + + void RefreshGroups() + { + _lastFindGroupsTick = Floor2(GetGameState().CurrentTicks, 256); + _lastFindGroupsSelectedView = _selectedView; + _lastFindGroupsWait = 320; + _groups.clear(); for (auto peep : EntityList()) { - EntitySetFlashing(peep, false); if (peep->OutsideOfPark) continue; - if (_selectedFilter) + + auto& group = FindOrAddGroup(GetArgumentsFromPeep(*peep, _selectedView)); + if (group.NumGuests < std::size(group.Faces)) { - if (!IsPeepInFilter(*peep)) - continue; - EntitySetFlashing(peep, true); + group.Faces[group.NumGuests] = GetPeepFaceSpriteSmall(peep) - SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY; } - if (!GuestShouldBeVisible(*peep)) - continue; - - auto& item = _guestList.emplace_back(); - item.Id = peep->Id; - - Formatter ft; - peep->FormatNameTo(ft); - OpenRCT2::FormatStringLegacy(item.Name, sizeof(item.Name), STR_STRINGID, ft.Data()); + group.NumGuests++; } - std::sort(_guestList.begin(), _guestList.end(), GetGuestCompareFunc()); - } - } - -private: - void DrawTabImages(DrawPixelInfo& dpi) - { - // Tab 1 image - auto i = (_selectedTab == TabId::Individual ? _tabAnimationIndex & ~3 : 0); - i += GetPeepAnimation(PeepSpriteType::Normal).base_image + 1; - GfxDrawSprite( - dpi, ImageId(i, COLOUR_GREY, COLOUR_DARK_OLIVE_GREEN), - windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].midX(), widgets[WIDX_TAB_1].bottom - 6 }); - - // Tab 2 image - i = (_selectedTab == TabId::Summarised ? _tabAnimationIndex / 4 : 0); - GfxDrawSprite( - dpi, ImageId(SPR_TAB_GUESTS_0 + i), - windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top }); - } - - void DrawScrollIndividual(DrawPixelInfo& dpi) - { - size_t index = 0; - auto y = static_cast(_selectedPage) * -GUEST_PAGE_HEIGHT; - for (const auto& guestItem : _guestList) - { - // Check if y is beyond the scroll control - if (y + SCROLLABLE_ROW_HEIGHT + 1 >= -0x7FFF && y + SCROLLABLE_ROW_HEIGHT + 1 > dpi.y && y < 0x7FFF - && y < dpi.y + dpi.height) + // Remove empty group (basically guests with no thoughts) + auto foundGroup = std::find_if(std::begin(_groups), std::end(_groups), [](GuestGroup& group) { + return group.Arguments.GetFirstStringId() == STR_EMPTY; + }); + if (foundGroup != std::end(_groups)) { - // Highlight backcolour and text colour (format) - StringId format = STR_BLACK_STRING; - if (index == _highlightedIndex) - { - GfxFilterRect(dpi, { 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1); - format = STR_WINDOW_COLOUR_2_STRINGID; - } - - // Guest name - auto peep = GetEntity(guestItem.Id); - if (peep == nullptr) - { - continue; - } - auto ft = Formatter(); - peep->FormatNameTo(ft); - DrawTextEllipsised(dpi, { 0, y }, 113, format, ft); - - switch (_selectedView) - { - case GuestViewType::Actions: - // Guest face - GfxDrawSprite(dpi, ImageId(GetPeepFaceSpriteSmall(peep)), { 118, y + 1 }); - - // Tracking icon - if (peep->PeepFlags & PEEP_FLAGS_TRACKING) - GfxDrawSprite(dpi, ImageId(STR_ENTER_SELECTION_SIZE), { 112, y + 1 }); - - // Action - ft = Formatter(); - peep->FormatActionTo(ft); - DrawTextEllipsised(dpi, { 133, y }, 314, format, ft); - break; - case GuestViewType::Thoughts: - // For each thought - for (const auto& thought : peep->Thoughts) - { - if (thought.type == PeepThoughtType::None) - break; - if (thought.freshness == 0) - continue; - if (thought.freshness > 5) - break; - - ft = Formatter(); - PeepThoughtSetFormatArgs(&thought, ft); - DrawTextEllipsised(dpi, { 118, y }, 329, format, ft, { FontStyle::Small }); - break; - } - break; - } + _groups.erase(foundGroup); } - y += SCROLLABLE_ROW_HEIGHT; - index++; - } - } - void DrawScrollSummarised(DrawPixelInfo& dpi) - { - size_t index = 0; - auto y = 0; - for (auto& group : _groups) - { - // Check if y is beyond the scroll control - if (y + SUMMARISED_GUEST_ROW_HEIGHT + 1 >= dpi.y) + // Sort groups by number of guests + std::sort(_groups.begin(), _groups.end(), [](const GuestGroup& a, const GuestGroup& b) { + return a.NumGuests > b.NumGuests; + }); + + // Remove up to MaxGroups + if (_groups.size() > MaxGroups) { - // Check if y is beyond the scroll control - if (y >= dpi.y + dpi.height) + _groups.resize(MaxGroups); + } + } + + /** + * Calculates a hash value (arguments) for comparing peep actions/thoughts + */ + static FilterArguments GetArgumentsFromPeep(const Guest& peep, GuestViewType type) + { + FilterArguments result; + Formatter ft(result.args); + switch (type) + { + case GuestViewType::Actions: + peep.FormatActionTo(ft); break; - - // Highlight backcolour and text colour (format) - StringId format = STR_BLACK_STRING; - if (index == _highlightedIndex) + case GuestViewType::Thoughts: { - GfxFilterRect(dpi, { 0, y, 800, y + SUMMARISED_GUEST_ROW_HEIGHT }, FilterPaletteID::PaletteDarken1); - format = STR_WINDOW_COLOUR_2_STRINGID; + const auto& thought = peep.Thoughts[0]; + if (thought.type != PeepThoughtType::None && thought.freshness <= 5) + { + PeepThoughtSetFormatArgs(&thought, ft); + } + break; } - - // Draw guest faces - for (uint32_t j = 0; j < std::size(group.Faces) && j < group.NumGuests; j++) - { - GfxDrawSprite( - dpi, ImageId(group.Faces[j] + SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY), - { static_cast(j) * 8, y + 12 }); - } - - // Draw action/thoughts - Formatter ft(group.Arguments.args); - // Draw small font if displaying guests - if (_selectedView == GuestViewType::Thoughts) - { - DrawTextEllipsised(dpi, { 0, y }, 414, format, ft, { FontStyle::Small }); - } - else - { - DrawTextEllipsised(dpi, { 0, y }, 414, format, ft); - } - - // Draw guest count - ft = Formatter(); - ft.Add(STR_GUESTS_COUNT_COMMA_SEP); - ft.Add(group.NumGuests); - DrawTextBasic(dpi, { 326, y }, format, ft, { TextAlignment::RIGHT }); } - y += SUMMARISED_GUEST_ROW_HEIGHT; - index++; + return result; } - } - bool GuestShouldBeVisible(const Guest& peep) - { - if (_trackingOnly && !(peep.PeepFlags & PEEP_FLAGS_TRACKING)) - return false; - - if (!_filterName.empty()) + static constexpr StringId GetViewName(GuestViewType type) { - char name[256]{}; - - Formatter ft; - peep.FormatNameTo(ft); - OpenRCT2::FormatStringLegacy(name, sizeof(name), STR_STRINGID, ft.Data()); - if (!String::Contains(name, _filterName.c_str(), true)) + switch (type) { - return false; + default: + case GuestViewType::Actions: + return STR_ACTIONS; + case GuestViewType::Thoughts: + return STR_THOUGHTS; } } - return true; - } - - bool IsPeepInFilter(const Guest& peep) - { - auto guestViewType = _selectedFilter == GuestFilterType::Guests ? GuestViewType::Actions : GuestViewType::Thoughts; - auto peepArgs = GetArgumentsFromPeep(peep, guestViewType); - if (_filterArguments.GetFirstStringId() == STR_NONE && _selectedFilter == GuestFilterType::GuestsThinking) + static constexpr StringId GetFilterString(GuestFilterType type) { - Formatter(peepArgs.args).Add(STR_NONE); - } - return _filterArguments == peepArgs; - } - - bool IsRefreshOfGroupsRequired() - { - uint32_t tick256 = Floor2(GetGameState().CurrentTicks, 256); - if (_selectedView == _lastFindGroupsSelectedView) - { - if (_lastFindGroupsWait != 0 || _lastFindGroupsTick == tick256) + switch (type) { - return false; + default: + case GuestFilterType::Guests: + return STR_GUESTS_FILTER; + case GuestFilterType::GuestsThinking: + return STR_GUESTS_FILTER_THINKING; + case GuestFilterType::GuestsThinkingAbout: + return STR_GUESTS_FILTER_THINKING_ABOUT; } } - return true; - } - - GuestGroup& FindOrAddGroup(FilterArguments&& arguments) - { - auto foundGroup = std::find_if( - std::begin(_groups), std::end(_groups), [&arguments](GuestGroup& group) { return group.Arguments == arguments; }); - if (foundGroup != std::end(_groups)) + template static bool CompareGuestItem(const GuestItem& a, const GuestItem& b) { - return *foundGroup; - } - auto& newGroup = _groups.emplace_back(); - newGroup.Arguments = arguments; - return newGroup; - } - - void RefreshGroups() - { - _lastFindGroupsTick = Floor2(GetGameState().CurrentTicks, 256); - _lastFindGroupsSelectedView = _selectedView; - _lastFindGroupsWait = 320; - _groups.clear(); - - for (auto peep : EntityList()) - { - if (peep->OutsideOfPark) - continue; - - auto& group = FindOrAddGroup(GetArgumentsFromPeep(*peep, _selectedView)); - if (group.NumGuests < std::size(group.Faces)) + const auto* peepA = GetEntity(a.Id); + const auto* peepB = GetEntity(b.Id); + if (peepA != nullptr && peepB != nullptr) { - group.Faces[group.NumGuests] = GetPeepFaceSpriteSmall(peep) - SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY; + // Compare types + if (peepA->Type != peepB->Type) + { + return static_cast(peepA->Type) < static_cast(peepB->Type); + } + + // Compare name + if constexpr (!TRealNames) + { + if (peepA->Name == nullptr && peepB->Name == nullptr) + { + // Simple ID comparison for when both peeps use a number or a generated name + return peepA->PeepId < peepB->PeepId; + } + } } - group.NumGuests++; + return StrLogicalCmp(a.Name, b.Name) < 0; } - // Remove empty group (basically guests with no thoughts) - auto foundGroup = std::find_if(std::begin(_groups), std::end(_groups), [](GuestGroup& group) { - return group.Arguments.GetFirstStringId() == STR_EMPTY; - }); - if (foundGroup != std::end(_groups)) + static GuestItem::CompareFunc GetGuestCompareFunc() { - _groups.erase(foundGroup); + return GetGameState().ParkFlags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? CompareGuestItem + : CompareGuestItem; } + }; - // Sort groups by number of guests - std::sort( - _groups.begin(), _groups.end(), [](const GuestGroup& a, const GuestGroup& b) { return a.NumGuests > b.NumGuests; }); - - // Remove up to MaxGroups - if (_groups.size() > MaxGroups) + WindowBase* GuestListOpen() + { + auto* window = WindowBringToFrontByClass(WindowClass::GuestList); + if (window == nullptr) { - _groups.resize(MaxGroups); + window = WindowCreate(WindowClass::GuestList, 350, 330, WF_10 | WF_RESIZABLE); } + return window; } /** - * Calculates a hash value (arguments) for comparing peep actions/thoughts + * @param index The number of the ride or index of the thought */ - static FilterArguments GetArgumentsFromPeep(const Guest& peep, GuestViewType type) + WindowBase* GuestListOpenWithFilter(GuestListFilterType type, int32_t index) { - FilterArguments result; - Formatter ft(result.args); - switch (type) + auto* w = static_cast(GuestListOpen()); + if (w != nullptr) { - case GuestViewType::Actions: - peep.FormatActionTo(ft); - break; - case GuestViewType::Thoughts: - { - const auto& thought = peep.Thoughts[0]; - if (thought.type != PeepThoughtType::None && thought.freshness <= 5) - { - PeepThoughtSetFormatArgs(&thought, ft); - } - break; - } + w->SetFilter(type, index); } - return result; + return w; } - static constexpr StringId GetViewName(GuestViewType type) + void WindowGuestListRefreshList() { - switch (type) + auto* w = WindowFindByClass(WindowClass::GuestList); + if (w != nullptr) { - default: - case GuestViewType::Actions: - return STR_ACTIONS; - case GuestViewType::Thoughts: - return STR_THOUGHTS; + static_cast(w)->RefreshList(); } } - - static constexpr StringId GetFilterString(GuestFilterType type) - { - switch (type) - { - default: - case GuestFilterType::Guests: - return STR_GUESTS_FILTER; - case GuestFilterType::GuestsThinking: - return STR_GUESTS_FILTER_THINKING; - case GuestFilterType::GuestsThinkingAbout: - return STR_GUESTS_FILTER_THINKING_ABOUT; - } - } - - template static bool CompareGuestItem(const GuestItem& a, const GuestItem& b) - { - const auto* peepA = GetEntity(a.Id); - const auto* peepB = GetEntity(b.Id); - if (peepA != nullptr && peepB != nullptr) - { - // Compare types - if (peepA->Type != peepB->Type) - { - return static_cast(peepA->Type) < static_cast(peepB->Type); - } - - // Compare name - if constexpr (!TRealNames) - { - if (peepA->Name == nullptr && peepB->Name == nullptr) - { - // Simple ID comparison for when both peeps use a number or a generated name - return peepA->PeepId < peepB->PeepId; - } - } - } - return StrLogicalCmp(a.Name, b.Name) < 0; - } - - static GuestItem::CompareFunc GetGuestCompareFunc() - { - return GetGameState().ParkFlags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? CompareGuestItem : CompareGuestItem; - } -}; - -WindowBase* WindowGuestListOpen() -{ - auto* window = WindowBringToFrontByClass(WindowClass::GuestList); - if (window == nullptr) - { - window = WindowCreate(WindowClass::GuestList, 350, 330, WF_10 | WF_RESIZABLE); - } - return window; -} - -/** - * @param index The number of the ride or index of the thought - */ -WindowBase* WindowGuestListOpenWithFilter(GuestListFilterType type, int32_t index) -{ - auto* w = static_cast(WindowGuestListOpen()); - if (w != nullptr) - { - w->SetFilter(type, index); - } - return w; -} - -void WindowGuestListRefreshList() -{ - auto* w = WindowFindByClass(WindowClass::GuestList); - if (w != nullptr) - { - static_cast(w)->RefreshList(); - } -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 12a509d186..62661b9d0d 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -28,7 +28,9 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum { WIDX_BACKGROUND, WIDX_TITLE, @@ -53,390 +55,391 @@ static Widget window_install_track_widgets[] = { MakeWidget({PREVIEW_BUTTONS_LEFT, 398}, { 22, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_SCENERY), STR_TOGGLE_SCENERY_TIP), MakeWidget({ ACTION_BUTTONS_LEFT, 241}, { 97, 15}, WindowWidgetType::Button, WindowColour::Primary, STR_INSTALL_NEW_TRACK_DESIGN_INSTALL ), MakeWidget({ ACTION_BUTTONS_LEFT, 259}, { 97, 15}, WindowWidgetType::Button, WindowColour::Primary, STR_INSTALL_NEW_TRACK_DESIGN_CANCEL ), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class InstallTrackWindow final : public Window -{ -private: - std::unique_ptr _trackDesign; - std::string _trackPath; - std::string _trackName; - std::vector _trackDesignPreviewPixels; - -public: - void SetupTrack(const utf8* path, std::unique_ptr trackDesign) + class InstallTrackWindow final : public Window { - _trackDesign = std::move(trackDesign); - _trackPath = path; - _trackName = GetNameFromTrackPath(path); - _trackDesignPreviewPixels.resize(4 * TRACK_PREVIEW_IMAGE_SIZE); + private: + std::unique_ptr _trackDesign; + std::string _trackPath; + std::string _trackName; + std::vector _trackDesignPreviewPixels; - UpdatePreview(); - Invalidate(); - } - - void OnOpen() override - { - widgets = window_install_track_widgets; - - WindowInitScrollWidgets(*this); - WindowPushOthersRight(*this); - } - - void OnClose() override - { - _trackPath.clear(); - _trackName.clear(); - _trackDesignPreviewPixels.clear(); - _trackDesignPreviewPixels.shrink_to_fit(); - _trackDesign = nullptr; - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void SetupTrack(const utf8* path, std::unique_ptr trackDesign) { - case WIDX_CLOSE: - case WIDX_CANCEL: - Close(); - break; - case WIDX_ROTATE: - _currentTrackPieceDirection++; - _currentTrackPieceDirection %= 4; - Invalidate(); - break; - case WIDX_TOGGLE_SCENERY: - gTrackDesignSceneryToggle = !gTrackDesignSceneryToggle; - UpdatePreview(); - Invalidate(); - break; - case WIDX_INSTALL: - InstallTrackDesign(); - break; - } - } + _trackDesign = std::move(trackDesign); + _trackPath = path; + _trackName = GetNameFromTrackPath(path); + _trackDesignPreviewPixels.resize(4 * kTrackPreviewImageSize); - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (widgetIndex != WIDX_INSTALL || text.empty()) - { - return; + UpdatePreview(); + Invalidate(); } - _trackName = std::string(text); - - WindowEventMouseUpCall(this, WIDX_INSTALL); - } - - void OnPrepareDraw() override - { - pressed_widgets |= 1uLL << WIDX_TRACK_PREVIEW; - if (!gTrackDesignSceneryToggle) + void OnOpen() override { - pressed_widgets |= (1uLL << WIDX_TOGGLE_SCENERY); + widgets = window_install_track_widgets; + + WindowInitScrollWidgets(*this); + WindowPushOthersRight(*this); } - else + + void OnClose() override { - pressed_widgets &= ~(1uLL << WIDX_TOGGLE_SCENERY); + _trackPath.clear(); + _trackName.clear(); + _trackDesignPreviewPixels.clear(); + _trackDesignPreviewPixels.shrink_to_fit(); + _trackDesign = nullptr; } - } - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - // Track preview - Widget* widget = &window_install_track_widgets[WIDX_TRACK_PREVIEW]; - auto screenPos = windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 }; - int32_t colour = ColourMapA[colours[0]].darkest; - GfxFillRect(dpi, { screenPos, screenPos + ScreenCoordsXY{ 369, 216 } }, colour); - - G1Element g1temp = {}; - g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * TRACK_PREVIEW_IMAGE_SIZE); - g1temp.width = 370; - g1temp.height = 217; - g1temp.flags = G1_FLAG_HAS_TRANSPARENCY; - GfxSetG1Element(SPR_TEMP, &g1temp); - DrawingEngineInvalidateImage(SPR_TEMP); - GfxDrawSprite(dpi, ImageId(SPR_TEMP), screenPos); - - screenPos = windowPos + ScreenCoordsXY{ widget->midX(), widget->bottom - 12 }; - - // Warnings - const TrackDesign* td6 = _trackDesign.get(); - if (td6->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE) + void OnMouseUp(WidgetIndex widgetIndex) override { + switch (widgetIndex) + { + case WIDX_CLOSE: + case WIDX_CANCEL: + Close(); + break; + case WIDX_ROTATE: + _currentTrackPieceDirection++; + _currentTrackPieceDirection %= 4; + Invalidate(); + break; + case WIDX_TOGGLE_SCENERY: + gTrackDesignSceneryToggle = !gTrackDesignSceneryToggle; + UpdatePreview(); + Invalidate(); + break; + case WIDX_INSTALL: + InstallTrackDesign(); + break; + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (widgetIndex != WIDX_INSTALL || text.empty()) + { + return; + } + + _trackName = std::string(text); + + OnMouseUp(WIDX_INSTALL); + } + + void OnPrepareDraw() override + { + pressed_widgets |= 1uLL << WIDX_TRACK_PREVIEW; if (!gTrackDesignSceneryToggle) { - // Scenery not available - DrawTextEllipsised( - dpi, screenPos, 308, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE }); - screenPos.y -= LIST_ROW_HEIGHT; - } - } - - // Information - screenPos = windowPos + ScreenCoordsXY{ widget->left + 1, widget->bottom + 4 }; - // 0x006D3CF1 -- 0x006d3d71 missing - - // Track design name & type - { - auto trackName = _trackName.c_str(); - auto ft = Formatter(); - ft.Add(trackName); - DrawTextBasic(dpi, screenPos - ScreenCoordsXY{ 1, 0 }, STR_TRACK_DESIGN_NAME, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - - // Friendly Track name - { - auto ft = Formatter(); - - const auto* objectEntry = ObjectManagerLoadObject(&td6->vehicle_object.Entry); - if (objectEntry != nullptr) - { - auto groupIndex = ObjectManagerGetLoadedObjectEntryIndex(objectEntry); - auto rideName = GetRideNaming(td6->type, *GetRideEntryByIndex(groupIndex)); - ft.Add(rideName.Name); + pressed_widgets |= (1uLL << WIDX_TOGGLE_SCENERY); } else { - // Fall back on the technical track name if the vehicle object cannot be loaded - ft.Add(GetRideTypeDescriptor(td6->type).Naming.Name); + pressed_widgets &= ~(1uLL << WIDX_TOGGLE_SCENERY); + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + // Track preview + Widget* widget = &window_install_track_widgets[WIDX_TRACK_PREVIEW]; + auto screenPos = windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 }; + int32_t colour = ColourMapA[colours[0]].darkest; + GfxFillRect(dpi, { screenPos, screenPos + ScreenCoordsXY{ 369, 216 } }, colour); + + G1Element g1temp = {}; + g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * kTrackPreviewImageSize); + g1temp.width = 370; + g1temp.height = 217; + g1temp.flags = G1_FLAG_HAS_TRANSPARENCY; + GfxSetG1Element(SPR_TEMP, &g1temp); + DrawingEngineInvalidateImage(SPR_TEMP); + GfxDrawSprite(dpi, ImageId(SPR_TEMP), screenPos); + + screenPos = windowPos + ScreenCoordsXY{ widget->midX(), widget->bottom - 12 }; + + // Warnings + const TrackDesign* td6 = _trackDesign.get(); + if (td6->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE) + { + if (!gTrackDesignSceneryToggle) + { + // Scenery not available + DrawTextEllipsised( + dpi, screenPos, 308, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE }); + screenPos.y -= LIST_ROW_HEIGHT; + } } - DrawTextBasic(dpi, screenPos, STR_TRACK_DESIGN_TYPE, ft); - screenPos.y += LIST_ROW_HEIGHT + 4; - } + // Information + screenPos = windowPos + ScreenCoordsXY{ widget->left + 1, widget->bottom + 4 }; + // 0x006D3CF1 -- 0x006d3d71 missing - // Stats - { - fixed32_2dp rating = td6->excitement * 10; - auto ft = Formatter(); - ft.Add(rating); - DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_EXCITEMENT_RATING, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - { - fixed32_2dp rating = td6->intensity * 10; - auto ft = Formatter(); - ft.Add(rating); - DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_INTENSITY_RATING, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - { - fixed32_2dp rating = td6->nausea * 10; - auto ft = Formatter(); - ft.Add(rating); - DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_NAUSEA_RATING, ft); - screenPos.y += LIST_ROW_HEIGHT + 4; - } - - const auto& rtd = GetRideTypeDescriptor(td6->type); - if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) - { - if (td6->type == RIDE_TYPE_MINI_GOLF) + // Track design name & type { - // Holes - uint16_t holes = td6->holes & 0x1F; + auto trackName = _trackName.c_str(); auto ft = Formatter(); - ft.Add(holes); - DrawTextBasic(dpi, screenPos, STR_HOLES, ft); + ft.Add(trackName); + DrawTextBasic(dpi, screenPos - ScreenCoordsXY{ 1, 0 }, STR_TRACK_DESIGN_NAME, ft); screenPos.y += LIST_ROW_HEIGHT; } - else + + // Friendly Track name { - // Maximum speed + auto ft = Formatter(); + + const auto* objectEntry = ObjectManagerLoadObject(&td6->vehicle_object.Entry); + if (objectEntry != nullptr) { - uint16_t speed = ((td6->max_speed << 16) * 9) >> 18; + auto groupIndex = ObjectManagerGetLoadedObjectEntryIndex(objectEntry); + auto rideName = GetRideNaming(td6->type, *GetRideEntryByIndex(groupIndex)); + ft.Add(rideName.Name); + } + else + { + // Fall back on the technical track name if the vehicle object cannot be loaded + ft.Add(GetRideTypeDescriptor(td6->type).Naming.Name); + } + + DrawTextBasic(dpi, screenPos, STR_TRACK_DESIGN_TYPE, ft); + screenPos.y += LIST_ROW_HEIGHT + 4; + } + + // Stats + { + fixed32_2dp rating = td6->excitement * 10; + auto ft = Formatter(); + ft.Add(rating); + DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_EXCITEMENT_RATING, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + { + fixed32_2dp rating = td6->intensity * 10; + auto ft = Formatter(); + ft.Add(rating); + DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_INTENSITY_RATING, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + { + fixed32_2dp rating = td6->nausea * 10; + auto ft = Formatter(); + ft.Add(rating); + DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_NAUSEA_RATING, ft); + screenPos.y += LIST_ROW_HEIGHT + 4; + } + + const auto& rtd = GetRideTypeDescriptor(td6->type); + if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) + { + if (td6->type == RIDE_TYPE_MINI_GOLF) + { + // Holes + uint16_t holes = td6->holes & 0x1F; auto ft = Formatter(); - ft.Add(speed); - DrawTextBasic(dpi, screenPos, STR_MAX_SPEED, ft); + ft.Add(holes); + DrawTextBasic(dpi, screenPos, STR_HOLES, ft); screenPos.y += LIST_ROW_HEIGHT; } - // Average speed + else { - uint16_t speed = ((td6->average_speed << 16) * 9) >> 18; + // Maximum speed + { + uint16_t speed = ((td6->max_speed << 16) * 9) >> 18; + auto ft = Formatter(); + ft.Add(speed); + DrawTextBasic(dpi, screenPos, STR_MAX_SPEED, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + // Average speed + { + uint16_t speed = ((td6->average_speed << 16) * 9) >> 18; + auto ft = Formatter(); + ft.Add(speed); + DrawTextBasic(dpi, screenPos, STR_AVERAGE_SPEED, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + } + + // Ride length + auto ft = Formatter(); + ft.Add(STR_RIDE_LENGTH_ENTRY); + ft.Add(td6->ride_length); + DrawTextEllipsised(dpi, screenPos, 214, STR_TRACK_LIST_RIDE_LENGTH, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + + if (GetRideTypeDescriptor(td6->type).HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES)) + { + // Maximum positive vertical Gs + { + int32_t gForces = td6->max_positive_vertical_g * 32; auto ft = Formatter(); - ft.Add(speed); - DrawTextBasic(dpi, screenPos, STR_AVERAGE_SPEED, ft); + ft.Add(gForces); + DrawTextBasic(dpi, screenPos, STR_MAX_POSITIVE_VERTICAL_G, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + // Maximum negative vertical Gs + { + int32_t gForces = td6->max_negative_vertical_g * 32; + auto ft = Formatter(); + ft.Add(gForces); + DrawTextBasic(dpi, screenPos, STR_MAX_NEGATIVE_VERTICAL_G, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + // Maximum lateral Gs + { + int32_t gForces = td6->max_lateral_g * 32; + auto ft = Formatter(); + ft.Add(gForces); + DrawTextBasic(dpi, screenPos, STR_MAX_LATERAL_G, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + if (td6->total_air_time != 0) + { + // Total air time + int32_t airTime = td6->total_air_time * 25; + auto ft = Formatter(); + ft.Add(airTime); + DrawTextBasic(dpi, screenPos, STR_TOTAL_AIR_TIME, ft); screenPos.y += LIST_ROW_HEIGHT; } } - // Ride length - auto ft = Formatter(); - ft.Add(STR_RIDE_LENGTH_ENTRY); - ft.Add(td6->ride_length); - DrawTextEllipsised(dpi, screenPos, 214, STR_TRACK_LIST_RIDE_LENGTH, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - - if (GetRideTypeDescriptor(td6->type).HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES)) - { - // Maximum positive vertical Gs + if (GetRideTypeDescriptor(td6->type).HasFlag(RIDE_TYPE_FLAG_HAS_DROPS)) { - int32_t gForces = td6->max_positive_vertical_g * 32; + // Drops + uint16_t drops = td6->drops & 0x3F; auto ft = Formatter(); - ft.Add(gForces); - DrawTextBasic(dpi, screenPos, STR_MAX_POSITIVE_VERTICAL_G, ft); + ft.Add(drops); + DrawTextBasic(dpi, screenPos, STR_DROPS, ft); + screenPos.y += LIST_ROW_HEIGHT; + + // Drop height is multiplied by 0.75 + DrawTextBasic(dpi, screenPos, STR_HIGHEST_DROP_HEIGHT, ft); screenPos.y += LIST_ROW_HEIGHT; } - // Maximum negative vertical Gs + + if (td6->type != RIDE_TYPE_MINI_GOLF) { - int32_t gForces = td6->max_negative_vertical_g * 32; + uint16_t inversions = td6->inversions & 0x1F; + if (inversions != 0) + { + // Inversions + auto ft = Formatter(); + ft.Add(inversions); + DrawTextBasic(dpi, screenPos, STR_INVERSIONS, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + } + screenPos.y += 4; + + if (td6->space_required_x != 0xFF) + { + // Space required auto ft = Formatter(); - ft.Add(gForces); - DrawTextBasic(dpi, screenPos, STR_MAX_NEGATIVE_VERTICAL_G, ft); + ft.Add(td6->space_required_x); + ft.Add(td6->space_required_y); + DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_SPACE_REQUIRED, ft); screenPos.y += LIST_ROW_HEIGHT; } - // Maximum lateral Gs + + if (td6->cost != 0) { - int32_t gForces = td6->max_lateral_g * 32; auto ft = Formatter(); - ft.Add(gForces); - DrawTextBasic(dpi, screenPos, STR_MAX_LATERAL_G, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - if (td6->total_air_time != 0) - { - // Total air time - int32_t airTime = td6->total_air_time * 25; - auto ft = Formatter(); - ft.Add(airTime); - DrawTextBasic(dpi, screenPos, STR_TOTAL_AIR_TIME, ft); - screenPos.y += LIST_ROW_HEIGHT; + ft.Add(td6->cost); + DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_COST_AROUND, ft); } } - if (GetRideTypeDescriptor(td6->type).HasFlag(RIDE_TYPE_FLAG_HAS_DROPS)) + void OnResize() override { - // Drops - uint16_t drops = td6->drops & 0x3F; - auto ft = Formatter(); - ft.Add(drops); - DrawTextBasic(dpi, screenPos, STR_DROPS, ft); - screenPos.y += LIST_ROW_HEIGHT; - - // Drop height is multiplied by 0.75 - DrawTextBasic(dpi, screenPos, STR_HIGHEST_DROP_HEIGHT, ft); - screenPos.y += LIST_ROW_HEIGHT; + ResizeFrame(); } - if (td6->type != RIDE_TYPE_MINI_GOLF) + private: + void UpdatePreview() { - uint16_t inversions = td6->inversions & 0x1F; - if (inversions != 0) - { - // Inversions - auto ft = Formatter(); - ft.Add(inversions); - DrawTextBasic(dpi, screenPos, STR_INVERSIONS, ft); - screenPos.y += LIST_ROW_HEIGHT; - } + TrackDesignDrawPreview(_trackDesign.get(), _trackDesignPreviewPixels.data()); } - screenPos.y += 4; - if (td6->space_required_x != 0xFF) + void InstallTrackDesign() { - // Space required - auto ft = Formatter(); - ft.Add(td6->space_required_x); - ft.Add(td6->space_required_y); - DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_SPACE_REQUIRED, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - - if (td6->cost != 0) - { - auto ft = Formatter(); - ft.Add(td6->cost); - DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_COST_AROUND, ft); - } - } - - void OnResize() override - { - ResizeFrame(); - } - -private: - void UpdatePreview() - { - TrackDesignDrawPreview(_trackDesign.get(), _trackDesignPreviewPixels.data()); - } - - void InstallTrackDesign() - { - auto env = OpenRCT2::GetContext()->GetPlatformEnvironment(); - auto destPath = env->GetDirectoryPath(OpenRCT2::DIRBASE::USER, OpenRCT2::DIRID::TRACK); - if (!Path::CreateDirectory(destPath)) - { - LOG_ERROR("Unable to create directory '%s'", destPath.c_str()); - ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); - return; - } - - destPath = Path::Combine(destPath, _trackName + u8".td6"); - - if (File::Exists(destPath)) - { - LOG_INFO("%s already exists, prompting user for a different track design name", destPath.c_str()); - ContextShowError(STR_UNABLE_TO_INSTALL_THIS_TRACK_DESIGN, STR_NONE, {}); - WindowTextInputRawOpen( - this, WIDX_INSTALL, STR_SELECT_NEW_NAME_FOR_TRACK_DESIGN, STR_AN_EXISTING_TRACK_DESIGN_ALREADY_HAS_THIS_NAME, - {}, _trackName.c_str(), 255); - } - else - { - if (TrackRepositoryInstall(_trackPath.c_str(), _trackName.c_str())) - { - Close(); - } - else + auto env = OpenRCT2::GetContext()->GetPlatformEnvironment(); + auto destPath = env->GetDirectoryPath(OpenRCT2::DIRBASE::USER, OpenRCT2::DIRID::TRACK); + if (!Path::CreateDirectory(destPath)) { + LOG_ERROR("Unable to create directory '%s'", destPath.c_str()); ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); + return; + } + + destPath = Path::Combine(destPath, _trackName + u8".td6"); + + if (File::Exists(destPath)) + { + LOG_INFO("%s already exists, prompting user for a different track design name", destPath.c_str()); + ContextShowError(STR_UNABLE_TO_INSTALL_THIS_TRACK_DESIGN, STR_NONE, {}); + WindowTextInputRawOpen( + this, WIDX_INSTALL, STR_SELECT_NEW_NAME_FOR_TRACK_DESIGN, + STR_AN_EXISTING_TRACK_DESIGN_ALREADY_HAS_THIS_NAME, {}, _trackName.c_str(), 255); + } + else + { + if (TrackRepositoryInstall(_trackPath.c_str(), _trackName.c_str())) + { + Close(); + } + else + { + ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); + } } } - } -}; + }; -WindowBase* WindowInstallTrackOpen(const utf8* path) -{ - auto trackDesign = TrackDesignImport(path); - if (trackDesign == nullptr) + WindowBase* InstallTrackOpen(const utf8* path) { - ContextShowError(STR_UNABLE_TO_LOAD_FILE, STR_NONE, {}); - return nullptr; + auto trackDesign = TrackDesignImport(path); + if (trackDesign == nullptr) + { + ContextShowError(STR_UNABLE_TO_LOAD_FILE, STR_NONE, {}); + return nullptr; + } + + ObjectManagerUnloadAllObjects(); + if (trackDesign->type == RIDE_TYPE_NULL) + { + LOG_ERROR("Failed to load track (ride type null): %s", path); + return nullptr; + } + if (ObjectManagerLoadObject(&trackDesign->vehicle_object.Entry) == nullptr) + { + LOG_ERROR("Failed to load track (vehicle load fail): %s", path); + return nullptr; + } + + WindowCloseByClass(WindowClass::EditorObjectSelection); + WindowCloseConstructionWindows(); + + gTrackDesignSceneryToggle = false; + _currentTrackPieceDirection = 2; + + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + auto screenPos = ScreenCoordsXY{ screenWidth / 2 - 201, std::max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200) }; + + auto* window = WindowFocusOrCreate(WindowClass::InstallTrack, screenPos, WW, WH, 0); + window->SetupTrack(path, std::move(trackDesign)); + + return window; } - - ObjectManagerUnloadAllObjects(); - if (trackDesign->type == RIDE_TYPE_NULL) - { - LOG_ERROR("Failed to load track (ride type null): %s", path); - return nullptr; - } - if (ObjectManagerLoadObject(&trackDesign->vehicle_object.Entry) == nullptr) - { - LOG_ERROR("Failed to load track (vehicle load fail): %s", path); - return nullptr; - } - - WindowCloseByClass(WindowClass::EditorObjectSelection); - WindowCloseConstructionWindows(); - - gTrackDesignSceneryToggle = false; - _currentTrackPieceDirection = 2; - - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - auto screenPos = ScreenCoordsXY{ screenWidth / 2 - 201, std::max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200) }; - - auto* window = WindowFocusOrCreate(WindowClass::InstallTrack, screenPos, WW, WH, 0); - window->SetupTrack(path, std::move(trackDesign)); - - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index f7e185f66c..d019d2c3df 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -20,13 +20,13 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_LAND; + static constexpr int32_t WH = 160; + static constexpr int32_t WW = 98; -static constexpr StringId WINDOW_TITLE = STR_LAND; -static constexpr int32_t WH = 160; -static constexpr int32_t WW = 98; - -// clang-format off + // clang-format off enum WindowLandWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -49,304 +49,307 @@ static Widget window_land_widgets[] = { MakeRemapWidget({54, 63}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_LAND_TIP), // increment size MakeWidget ({ 2, 106}, {47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_BASE_LAND_TIP), // floor texture MakeWidget ({49, 106}, {47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_VERTICAL_LAND_TIP), // wall texture - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class LandWindow final : public Window -{ -private: - ObjectEntryIndex _selectedFloorTexture = 0; - ObjectEntryIndex _selectedWallTexture = 0; - - void InputSize() + class LandWindow final : public Window { - Formatter ft; - ft.Add(kLandToolMinimumSize); - ft.Add(kLandToolMaximumSize); - WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); - } + private: + ObjectEntryIndex _selectedFloorTexture = 0; + ObjectEntryIndex _selectedWallTexture = 0; -public: - void OnOpen() override - { - widgets = window_land_widgets; - hold_down_widgets = (1uLL << WIDX_DECREMENT) | (1uLL << WIDX_INCREMENT); - WindowInitScrollWidgets(*this); - WindowPushOthersBelow(*this); - - gLandToolSize = 1; - gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL; - gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL; - gLandMountainMode = false; - gLandPaintMode = false; - _selectedFloorTexture = LandTool::GetSurfaceStyleFromDropdownIndex(0); - _selectedWallTexture = LandTool::GetEdgeStyleFromDropdownIndex(0); - gLandToolRaiseCost = kMoney64Undefined; - gLandToolLowerCost = kMoney64Undefined; - } - - void OnClose() override - { - // If the tool wasn't changed, turn tool off - if (LandToolIsActive()) - ToolCancel(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + void InputSize() { - case WIDX_CLOSE: + Formatter ft; + ft.Add(kLandToolMinimumSize); + ft.Add(kLandToolMaximumSize); + WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); + } + + public: + void OnOpen() override + { + widgets = window_land_widgets; + hold_down_widgets = (1uLL << WIDX_DECREMENT) | (1uLL << WIDX_INCREMENT); + WindowInitScrollWidgets(*this); + WindowPushOthersBelow(*this); + + gLandToolSize = 1; + gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL; + gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL; + gLandMountainMode = false; + gLandPaintMode = false; + _selectedFloorTexture = LandTool::GetSurfaceStyleFromDropdownIndex(0); + _selectedWallTexture = LandTool::GetEdgeStyleFromDropdownIndex(0); + gLandToolRaiseCost = kMoney64Undefined; + gLandToolLowerCost = kMoney64Undefined; + } + + void OnClose() override + { + // If the tool wasn't changed, turn tool off + if (LandToolIsActive()) + ToolCancel(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_MOUNTAINMODE: + gLandMountainMode ^= 1; + gLandPaintMode = 0; + Invalidate(); + break; + case WIDX_PAINTMODE: + gLandMountainMode = 0; + gLandPaintMode ^= 1; + Invalidate(); + break; + case WIDX_PREVIEW: + InputSize(); + break; + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + Widget* widget = &widgets[widgetIndex]; + switch (widgetIndex) + { + case WIDX_FLOOR: + LandTool::ShowSurfaceStyleDropdown(this, widget, _selectedFloorTexture); + break; + case WIDX_WALL: + LandTool::ShowEdgeStyleDropdown(this, widget, _selectedWallTexture); + break; + case WIDX_PREVIEW: + InputSize(); + break; + case WIDX_DECREMENT: + // Decrement land tool size + gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); + + // Invalidate the window + Invalidate(); + break; + case WIDX_INCREMENT: + // Increment land tool size + gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); + + // Invalidate the window + Invalidate(); + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + { + int32_t type; + + switch (widgetIndex) + { + case WIDX_FLOOR: + if (dropdownIndex == -1) + dropdownIndex = gDropdownHighlightedIndex; + + type = (dropdownIndex == -1) + ? _selectedFloorTexture + : LandTool::GetSurfaceStyleFromDropdownIndex(static_cast(dropdownIndex)); + + if (gLandToolTerrainSurface == type) + { + gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL; + } + else + { + gLandToolTerrainSurface = type; + _selectedFloorTexture = type; + } + Invalidate(); + break; + case WIDX_WALL: + if (dropdownIndex == -1) + dropdownIndex = gDropdownHighlightedIndex; + + type = (dropdownIndex == -1) ? _selectedWallTexture + : LandTool::GetEdgeStyleFromDropdownIndex(static_cast(dropdownIndex)); + + if (gLandToolTerrainEdge == type) + { + gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL; + } + else + { + gLandToolTerrainEdge = type; + _selectedWallTexture = type; + } + Invalidate(); + break; + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (widgetIndex != WIDX_PREVIEW) + return; + + char* end; + std::string textStr = std::string(text); + int32_t size = strtol(textStr.c_str(), &end, 10); + if (*end == '\0') + { + size = std::max(kLandToolMinimumSize, size); + size = std::min(kLandToolMaximumSize, size); + gLandToolSize = size; + + Invalidate(); + } + } + + void OnUpdate() override + { + if (!LandToolIsActive()) Close(); - break; - case WIDX_MOUNTAINMODE: - gLandMountainMode ^= 1; - gLandPaintMode = 0; - Invalidate(); - break; - case WIDX_PAINTMODE: - gLandMountainMode = 0; - gLandPaintMode ^= 1; - Invalidate(); - break; - case WIDX_PREVIEW: - InputSize(); - break; - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - Widget* widget = &widgets[widgetIndex]; - switch (widgetIndex) - { - case WIDX_FLOOR: - LandTool::ShowSurfaceStyleDropdown(this, widget, _selectedFloorTexture); - break; - case WIDX_WALL: - LandTool::ShowEdgeStyleDropdown(this, widget, _selectedWallTexture); - break; - case WIDX_PREVIEW: - InputSize(); - break; - case WIDX_DECREMENT: - // Decrement land tool size - gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); - - // Invalidate the window - Invalidate(); - break; - case WIDX_INCREMENT: - // Increment land tool size - gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); - - // Invalidate the window - Invalidate(); - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - int32_t type; - - switch (widgetIndex) - { - case WIDX_FLOOR: - if (dropdownIndex == -1) - dropdownIndex = gDropdownHighlightedIndex; - - type = (dropdownIndex == -1) ? _selectedFloorTexture - : LandTool::GetSurfaceStyleFromDropdownIndex(static_cast(dropdownIndex)); - - if (gLandToolTerrainSurface == type) - { - gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL; - } - else - { - gLandToolTerrainSurface = type; - _selectedFloorTexture = type; - } - Invalidate(); - break; - case WIDX_WALL: - if (dropdownIndex == -1) - dropdownIndex = gDropdownHighlightedIndex; - - type = (dropdownIndex == -1) ? _selectedWallTexture - : LandTool::GetEdgeStyleFromDropdownIndex(static_cast(dropdownIndex)); - - if (gLandToolTerrainEdge == type) - { - gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL; - } - else - { - gLandToolTerrainEdge = type; - _selectedWallTexture = type; - } - Invalidate(); - break; - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (widgetIndex != WIDX_PREVIEW) - return; - - char* end; - std::string textStr = std::string(text); - int32_t size = strtol(textStr.c_str(), &end, 10); - if (*end == '\0') - { - size = std::max(kLandToolMinimumSize, size); - size = std::min(kLandToolMaximumSize, size); - gLandToolSize = size; - - Invalidate(); - } - } - - void OnUpdate() override - { - if (!LandToolIsActive()) - Close(); - } - - void OnPrepareDraw() override - { - pressed_widgets = 0; - SetWidgetPressed(WIDX_PREVIEW, true); - if (gLandToolTerrainSurface != OBJECT_ENTRY_INDEX_NULL) - SetWidgetPressed(WIDX_FLOOR, true); - if (gLandToolTerrainEdge != OBJECT_ENTRY_INDEX_NULL) - SetWidgetPressed(WIDX_WALL, true); - if (gLandMountainMode) - SetWidgetPressed(WIDX_MOUNTAINMODE, true); - if (gLandPaintMode) - SetWidgetPressed(WIDX_PAINTMODE, true); - - // Update the preview image (for tool sizes up to 7) - widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - ScreenCoordsXY screenCoords; - int32_t numTiles; - money64 price; - Widget* previewWidget = &widgets[WIDX_PREVIEW]; - - DrawWidgets(dpi); - DrawDropdownButtons(dpi); - - // Draw number for tool sizes bigger than 7 - if (gLandToolSize > kLandToolMaximumSizeWithSprite) - { - auto ft = Formatter(); - ft.Add(gLandToolSize); - screenCoords = { windowPos.x + previewWidget->midX(), windowPos.y + previewWidget->midY() }; - DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); - } - else if (gLandMountainMode) - { - screenCoords = { windowPos.x + previewWidget->left, windowPos.y + previewWidget->top }; - auto sprite = ImageId(gLandToolSize % 2 == 0 ? SPR_G2_MOUNTAIN_TOOL_EVEN : SPR_G2_MOUNTAIN_TOOL_ODD); - GfxDrawSprite(dpi, sprite, screenCoords); - WidgetDraw(dpi, *this, WIDX_DECREMENT); - WidgetDraw(dpi, *this, WIDX_INCREMENT); } - screenCoords = { windowPos.x + previewWidget->midX(), windowPos.y + previewWidget->bottom + 5 }; - - if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + void OnPrepareDraw() override { - // Draw raise cost amount - if (gLandToolRaiseCost != kMoney64Undefined && gLandToolRaiseCost != 0) - { - auto ft = Formatter(); - ft.Add(gLandToolRaiseCost); - DrawTextBasic(dpi, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::CENTRE }); - } - screenCoords.y += 10; - - // Draw lower cost amount - if (gLandToolLowerCost != kMoney64Undefined && gLandToolLowerCost != 0) - { - auto ft = Formatter(); - ft.Add(gLandToolLowerCost); - DrawTextBasic(dpi, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::CENTRE }); - } - screenCoords.y += 50; - - // Draw paint price - numTiles = gLandToolSize * gLandToolSize; - price = 0; + pressed_widgets = 0; + SetWidgetPressed(WIDX_PREVIEW, true); if (gLandToolTerrainSurface != OBJECT_ENTRY_INDEX_NULL) - { - auto& objManager = GetContext()->GetObjectManager(); - const auto surfaceObj = static_cast( - objManager.GetLoadedObject(ObjectType::TerrainSurface, gLandToolTerrainSurface)); - if (surfaceObj != nullptr) - { - price += numTiles * static_cast(surfaceObj->Price); - } - } - + SetWidgetPressed(WIDX_FLOOR, true); if (gLandToolTerrainEdge != OBJECT_ENTRY_INDEX_NULL) - price += numTiles * 100LL; + SetWidgetPressed(WIDX_WALL, true); + if (gLandMountainMode) + SetWidgetPressed(WIDX_MOUNTAINMODE, true); + if (gLandPaintMode) + SetWidgetPressed(WIDX_PAINTMODE, true); - if (price != 0) + // Update the preview image (for tool sizes up to 7) + widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + ScreenCoordsXY screenCoords; + int32_t numTiles; + money64 price; + Widget* previewWidget = &widgets[WIDX_PREVIEW]; + + DrawWidgets(dpi); + DrawDropdownButtons(dpi); + + // Draw number for tool sizes bigger than 7 + if (gLandToolSize > kLandToolMaximumSizeWithSprite) { auto ft = Formatter(); - ft.Add(price); - DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + ft.Add(gLandToolSize); + screenCoords = { windowPos.x + previewWidget->midX(), windowPos.y + previewWidget->midY() }; + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + } + else if (gLandMountainMode) + { + screenCoords = { windowPos.x + previewWidget->left, windowPos.y + previewWidget->top }; + auto sprite = ImageId(gLandToolSize % 2 == 0 ? SPR_G2_MOUNTAIN_TOOL_EVEN : SPR_G2_MOUNTAIN_TOOL_ODD); + GfxDrawSprite(dpi, sprite, screenCoords); + WidgetDraw(dpi, *this, WIDX_DECREMENT); + WidgetDraw(dpi, *this, WIDX_INCREMENT); + } + + screenCoords = { windowPos.x + previewWidget->midX(), windowPos.y + previewWidget->bottom + 5 }; + + if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + // Draw raise cost amount + if (gLandToolRaiseCost != kMoney64Undefined && gLandToolRaiseCost != 0) + { + auto ft = Formatter(); + ft.Add(gLandToolRaiseCost); + DrawTextBasic(dpi, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + } + screenCoords.y += 10; + + // Draw lower cost amount + if (gLandToolLowerCost != kMoney64Undefined && gLandToolLowerCost != 0) + { + auto ft = Formatter(); + ft.Add(gLandToolLowerCost); + DrawTextBasic(dpi, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + } + screenCoords.y += 50; + + // Draw paint price + numTiles = gLandToolSize * gLandToolSize; + price = 0; + if (gLandToolTerrainSurface != OBJECT_ENTRY_INDEX_NULL) + { + auto& objManager = GetContext()->GetObjectManager(); + const auto surfaceObj = static_cast( + objManager.GetLoadedObject(ObjectType::TerrainSurface, gLandToolTerrainSurface)); + if (surfaceObj != nullptr) + { + price += numTiles * static_cast(surfaceObj->Price); + } + } + + if (gLandToolTerrainEdge != OBJECT_ENTRY_INDEX_NULL) + price += numTiles * 100LL; + + if (price != 0) + { + auto ft = Formatter(); + ft.Add(price); + DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + } } } - } - void OnResize() override - { - ResizeFrame(); - } - -private: - void DrawDropdownButtons(DrawPixelInfo& dpi) - { - auto& objManager = GetContext()->GetObjectManager(); - const auto surfaceObj = static_cast( - objManager.GetLoadedObject(ObjectType::TerrainSurface, _selectedFloorTexture)); - ImageId surfaceImage; - if (surfaceObj != nullptr) + void OnResize() override { - surfaceImage = ImageId(surfaceObj->IconImageId); - if (surfaceObj->Colour != 255) - surfaceImage = surfaceImage.WithPrimary(surfaceObj->Colour); + ResizeFrame(); } - const auto edgeObj = static_cast( - objManager.GetLoadedObject(ObjectType::TerrainEdge, _selectedWallTexture)); - ImageId edgeImage; - if (edgeObj != nullptr) + private: + void DrawDropdownButtons(DrawPixelInfo& dpi) { - edgeImage = ImageId(edgeObj->IconImageId); + auto& objManager = GetContext()->GetObjectManager(); + const auto surfaceObj = static_cast( + objManager.GetLoadedObject(ObjectType::TerrainSurface, _selectedFloorTexture)); + ImageId surfaceImage; + if (surfaceObj != nullptr) + { + surfaceImage = ImageId(surfaceObj->IconImageId); + if (surfaceObj->Colour != 255) + surfaceImage = surfaceImage.WithPrimary(surfaceObj->Colour); + } + + const auto edgeObj = static_cast( + objManager.GetLoadedObject(ObjectType::TerrainEdge, _selectedWallTexture)); + ImageId edgeImage; + if (edgeObj != nullptr) + { + edgeImage = ImageId(edgeObj->IconImageId); + } + + DrawDropdownButton(dpi, WIDX_FLOOR, surfaceImage); + DrawDropdownButton(dpi, WIDX_WALL, edgeImage); } - DrawDropdownButton(dpi, WIDX_FLOOR, surfaceImage); - DrawDropdownButton(dpi, WIDX_WALL, edgeImage); - } + void DrawDropdownButton(DrawPixelInfo& dpi, WidgetIndex widgetIndex, ImageId image) + { + const auto& widget = widgets[widgetIndex]; + GfxDrawSprite(dpi, image, { windowPos.x + widget.left, windowPos.y + widget.top }); + } + }; - void DrawDropdownButton(DrawPixelInfo& dpi, WidgetIndex widgetIndex, ImageId image) + WindowBase* LandOpen() { - const auto& widget = widgets[widgetIndex]; - GfxDrawSprite(dpi, image, { windowPos.x + widget.left, windowPos.y + widget.top }); + return WindowFocusOrCreate(WindowClass::Land, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); } -}; - -WindowBase* WindowLandOpen() -{ - return WindowFocusOrCreate(WindowClass::Land, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 38523d4daa..9bdc0fb49e 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -23,13 +23,13 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_LAND_RIGHTS; + static constexpr int32_t WH = 94; + static constexpr int32_t WW = 98; -static constexpr StringId WINDOW_TITLE = STR_LAND_RIGHTS; -static constexpr int32_t WH = 94; -static constexpr int32_t WW = 98; - -// clang-format off + // clang-format off enum WindowLandRightsWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -48,368 +48,371 @@ static Widget window_land_rights_widgets[] = { MakeRemapWidget({54, 32}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_LAND_RIGHTS_TIP ), // increment size MakeRemapWidget({22, 53}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Tertiary, SPR_BUY_LAND_RIGHTS, STR_BUY_LAND_RIGHTS_TIP ), // land rights MakeRemapWidget({52, 53}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Tertiary, SPR_BUY_CONSTRUCTION_RIGHTS, STR_BUY_CONSTRUCTION_RIGHTS_TIP ), // construction rights - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -constexpr uint8_t LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS = 0; -constexpr uint8_t LAND_RIGHTS_MODE_BUY_LAND = 1; + constexpr uint8_t LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS = 0; + constexpr uint8_t LAND_RIGHTS_MODE_BUY_LAND = 1; -class LandRightsWindow final : public Window -{ -public: - void OnOpen() override + class LandRightsWindow final : public Window { - widgets = window_land_rights_widgets; - hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); - WindowInitScrollWidgets(*this); - WindowPushOthersBelow(*this); - _landRightsMode = LAND_RIGHTS_MODE_BUY_LAND; - pressed_widgets = (1uLL << WIDX_BUY_LAND_RIGHTS); - - gLandToolSize = 1; - - ShowGridlines(); - ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow); - InputSetFlag(INPUT_FLAG_6, true); - - ShowLandRights(); - - if (gLandRemainingConstructionSales == 0) + public: + void OnOpen() override { - ShowConstructionRights(); - } - } + widgets = window_land_rights_widgets; + hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); + WindowInitScrollWidgets(*this); + WindowPushOthersBelow(*this); + _landRightsMode = LAND_RIGHTS_MODE_BUY_LAND; + pressed_widgets = (1uLL << WIDX_BUY_LAND_RIGHTS); - void OnClose() override - { - HideGridlines(); - if (gLandRemainingConstructionSales == 0) - { - HideConstructionRights(); + gLandToolSize = 1; + + ShowGridlines(); + ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow); + InputSetFlag(INPUT_FLAG_6, true); + + ShowLandRights(); + + if (gLandRemainingConstructionSales == 0) + { + ShowConstructionRights(); + } } - // If the tool wasn't changed, turn tool off - if (LandRightsToolIsActive()) - ToolCancel(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + void OnClose() override { - case WIDX_CLOSE: + HideGridlines(); + if (gLandRemainingConstructionSales == 0) + { + HideConstructionRights(); + } + + // If the tool wasn't changed, turn tool off + if (LandRightsToolIsActive()) + ToolCancel(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_PREVIEW: + InputSize(); + break; + case WIDX_BUY_LAND_RIGHTS: + if (_landRightsMode != LAND_RIGHTS_MODE_BUY_LAND) + { + ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow); + _landRightsMode = LAND_RIGHTS_MODE_BUY_LAND; + ShowLandRights(); + Invalidate(); + } + break; + case WIDX_BUY_CONSTRUCTION_RIGHTS: + if (_landRightsMode != LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS) + { + ToolSet(*this, WIDX_BUY_CONSTRUCTION_RIGHTS, Tool::UpArrow); + _landRightsMode = LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS; + ShowConstructionRights(); + Invalidate(); + } + break; + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_DECREMENT: + // Decrement land rights tool size + gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); + + // Invalidate the window + Invalidate(); + break; + case WIDX_INCREMENT: + // Decrement land rights tool size + gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); + + // Invalidate the window + Invalidate(); + break; + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (text.empty()) + return; + + if (widgetIndex != WIDX_PREVIEW) + return; + + const auto res = String::Parse(text); + if (res.has_value()) + { + uint16_t size; + size = res.value(); + size = std::max(kLandToolMinimumSize, size); + size = std::min(kLandToolMaximumSize, size); + gLandToolSize = size; + Invalidate(); + } + } + + void OnUpdate() override + { + frame_no++; + // Close window if another tool is open + if (!LandRightsToolIsActive()) Close(); - break; - case WIDX_PREVIEW: - InputSize(); - break; - case WIDX_BUY_LAND_RIGHTS: - if (_landRightsMode != LAND_RIGHTS_MODE_BUY_LAND) + } + + void OnPrepareDraw() override + { + SetWidgetPressed(WIDX_PREVIEW, true); + if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND) + { + SetWidgetPressed(WIDX_BUY_LAND_RIGHTS, true); + SetWidgetPressed(WIDX_BUY_CONSTRUCTION_RIGHTS, false); + } + else if (_landRightsMode == LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS) + { + SetWidgetPressed(WIDX_BUY_LAND_RIGHTS, false); + SetWidgetPressed(WIDX_BUY_CONSTRUCTION_RIGHTS, true); + } + + window_land_rights_widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); + + if (gLandRemainingOwnershipSales == 0) + { + SetWidgetDisabled(WIDX_BUY_LAND_RIGHTS, true); + window_land_rights_widgets[WIDX_BUY_LAND_RIGHTS].tooltip = STR_NO_LAND_RIGHTS_FOR_SALE_TIP; + } + else + { + SetWidgetDisabled(WIDX_BUY_LAND_RIGHTS, false); + window_land_rights_widgets[WIDX_BUY_LAND_RIGHTS].tooltip = STR_BUY_LAND_RIGHTS_TIP; + } + + if (gLandRemainingConstructionSales == 0) + { + SetWidgetDisabled(WIDX_BUY_CONSTRUCTION_RIGHTS, true); + window_land_rights_widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].tooltip = STR_NO_CONSTRUCTION_RIGHTS_FOR_SALE_TIP; + } + else + { + SetWidgetDisabled(WIDX_BUY_CONSTRUCTION_RIGHTS, false); + window_land_rights_widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].tooltip = STR_BUY_CONSTRUCTION_RIGHTS_TIP; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + auto screenCoords = ScreenCoordsXY{ windowPos.x + window_land_rights_widgets[WIDX_PREVIEW].midX(), + windowPos.y + window_land_rights_widgets[WIDX_PREVIEW].midY() }; + + DrawWidgets(dpi); + // Draw number for tool sizes bigger than 7 + if (gLandToolSize > kLandToolMaximumSizeWithSprite) + { + auto ft = Formatter(); + ft.Add(gLandToolSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + } + + // Draw cost amount + if (_landRightsCost != kMoney64Undefined && _landRightsCost != 0 + && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + auto ft = Formatter(); + ft.Add(_landRightsCost); + screenCoords = { window_land_rights_widgets[WIDX_PREVIEW].midX() + windowPos.x, + window_land_rights_widgets[WIDX_PREVIEW].bottom + windowPos.y + 32 }; + DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + } + } + + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + MapInvalidateSelectionRect(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + + auto info = GetMapCoordinatesFromPos( + screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water)); + if (info.SpriteType == ViewportInteractionItem::None) + { + if (_landRightsCost != kMoney64Undefined) { - ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow); - _landRightsMode = LAND_RIGHTS_MODE_BUY_LAND; - ShowLandRights(); - Invalidate(); + _landRightsCost = kMoney64Undefined; + WindowInvalidateByClass(WindowClass::ClearScenery); } - break; - case WIDX_BUY_CONSTRUCTION_RIGHTS: - if (_landRightsMode != LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS) + return; + } + auto mapTile = info.Loc; + + uint8_t state_changed = 0; + + if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) + { + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + state_changed++; + } + + if (gMapSelectType != MAP_SELECT_TYPE_FULL_LAND_RIGHTS) + { + gMapSelectType = MAP_SELECT_TYPE_FULL_LAND_RIGHTS; + state_changed++; + } + + int16_t tool_size = gLandToolSize; + if (tool_size == 0) + tool_size = 1; + + int16_t tool_length = (tool_size - 1) * 32; + + // Move to tool bottom left + mapTile.x -= (tool_size - 1) * 16; + mapTile.y -= (tool_size - 1) * 16; + mapTile = mapTile.ToTileStart(); + + if (gMapSelectPositionA.x != mapTile.x) + { + gMapSelectPositionA.x = mapTile.x; + state_changed++; + } + + if (gMapSelectPositionA.y != mapTile.y) + { + gMapSelectPositionA.y = mapTile.y; + state_changed++; + } + + mapTile.x += tool_length; + mapTile.y += tool_length; + + if (gMapSelectPositionB.x != mapTile.x) + { + gMapSelectPositionB.x = mapTile.x; + state_changed++; + } + + if (gMapSelectPositionB.y != mapTile.y) + { + gMapSelectPositionB.y = mapTile.y; + state_changed++; + } + + MapInvalidateSelectionRect(); + if (!state_changed) + return; + + auto landBuyRightsAction = LandBuyRightsAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND) ? LandBuyRightSetting::BuyLand + : LandBuyRightSetting::BuyConstructionRights); + auto res = GameActions::Query(&landBuyRightsAction); + + _landRightsCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; + } + + void OnToolAbort(WidgetIndex widgetIndex) override + { + if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND) + { + HideLandRights(); + } + else + { + HideConstructionRights(); + } + } + + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND) + { + if (screenCoords.x != LOCATION_NULL) { - ToolSet(*this, WIDX_BUY_CONSTRUCTION_RIGHTS, Tool::UpArrow); - _landRightsMode = LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS; - ShowConstructionRights(); - Invalidate(); + auto landBuyRightsAction = LandBuyRightsAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + LandBuyRightSetting::BuyLand); + GameActions::Execute(&landBuyRightsAction); } - break; - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_DECREMENT: - // Decrement land rights tool size - gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); - - // Invalidate the window - Invalidate(); - break; - case WIDX_INCREMENT: - // Decrement land rights tool size - gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); - - // Invalidate the window - Invalidate(); - break; - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (text.empty()) - return; - - if (widgetIndex != WIDX_PREVIEW) - return; - - const auto res = String::Parse(text); - if (res.has_value()) - { - uint16_t size; - size = res.value(); - size = std::max(kLandToolMinimumSize, size); - size = std::min(kLandToolMaximumSize, size); - gLandToolSize = size; - Invalidate(); - } - } - - void OnUpdate() override - { - frame_no++; - // Close window if another tool is open - if (!LandRightsToolIsActive()) - Close(); - } - - void OnPrepareDraw() override - { - SetWidgetPressed(WIDX_PREVIEW, true); - if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND) - { - SetWidgetPressed(WIDX_BUY_LAND_RIGHTS, true); - SetWidgetPressed(WIDX_BUY_CONSTRUCTION_RIGHTS, false); - } - else if (_landRightsMode == LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS) - { - SetWidgetPressed(WIDX_BUY_LAND_RIGHTS, false); - SetWidgetPressed(WIDX_BUY_CONSTRUCTION_RIGHTS, true); - } - - window_land_rights_widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); - - if (gLandRemainingOwnershipSales == 0) - { - SetWidgetDisabled(WIDX_BUY_LAND_RIGHTS, true); - window_land_rights_widgets[WIDX_BUY_LAND_RIGHTS].tooltip = STR_NO_LAND_RIGHTS_FOR_SALE_TIP; - } - else - { - SetWidgetDisabled(WIDX_BUY_LAND_RIGHTS, false); - window_land_rights_widgets[WIDX_BUY_LAND_RIGHTS].tooltip = STR_BUY_LAND_RIGHTS_TIP; - } - - if (gLandRemainingConstructionSales == 0) - { - SetWidgetDisabled(WIDX_BUY_CONSTRUCTION_RIGHTS, true); - window_land_rights_widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].tooltip = STR_NO_CONSTRUCTION_RIGHTS_FOR_SALE_TIP; - } - else - { - SetWidgetDisabled(WIDX_BUY_CONSTRUCTION_RIGHTS, false); - window_land_rights_widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].tooltip = STR_BUY_CONSTRUCTION_RIGHTS_TIP; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - auto screenCoords = ScreenCoordsXY{ windowPos.x + window_land_rights_widgets[WIDX_PREVIEW].midX(), - windowPos.y + window_land_rights_widgets[WIDX_PREVIEW].midY() }; - - DrawWidgets(dpi); - // Draw number for tool sizes bigger than 7 - if (gLandToolSize > kLandToolMaximumSizeWithSprite) - { - auto ft = Formatter(); - ft.Add(gLandToolSize); - DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); - } - - // Draw cost amount - if (_landRightsCost != kMoney64Undefined && _landRightsCost != 0 && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) - { - auto ft = Formatter(); - ft.Add(_landRightsCost); - screenCoords = { window_land_rights_widgets[WIDX_PREVIEW].midX() + windowPos.x, - window_land_rights_widgets[WIDX_PREVIEW].bottom + windowPos.y + 32 }; - DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); - } - } - - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - MapInvalidateSelectionRect(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - - auto info = GetMapCoordinatesFromPos( - screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water)); - if (info.SpriteType == ViewportInteractionItem::None) - { - if (_landRightsCost != kMoney64Undefined) - { - _landRightsCost = kMoney64Undefined; - WindowInvalidateByClass(WindowClass::ClearScenery); } - return; - } - auto mapTile = info.Loc; - - uint8_t state_changed = 0; - - if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) - { - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - state_changed++; - } - - if (gMapSelectType != MAP_SELECT_TYPE_FULL_LAND_RIGHTS) - { - gMapSelectType = MAP_SELECT_TYPE_FULL_LAND_RIGHTS; - state_changed++; - } - - int16_t tool_size = gLandToolSize; - if (tool_size == 0) - tool_size = 1; - - int16_t tool_length = (tool_size - 1) * 32; - - // Move to tool bottom left - mapTile.x -= (tool_size - 1) * 16; - mapTile.y -= (tool_size - 1) * 16; - mapTile = mapTile.ToTileStart(); - - if (gMapSelectPositionA.x != mapTile.x) - { - gMapSelectPositionA.x = mapTile.x; - state_changed++; - } - - if (gMapSelectPositionA.y != mapTile.y) - { - gMapSelectPositionA.y = mapTile.y; - state_changed++; - } - - mapTile.x += tool_length; - mapTile.y += tool_length; - - if (gMapSelectPositionB.x != mapTile.x) - { - gMapSelectPositionB.x = mapTile.x; - state_changed++; - } - - if (gMapSelectPositionB.y != mapTile.y) - { - gMapSelectPositionB.y = mapTile.y; - state_changed++; - } - - MapInvalidateSelectionRect(); - if (!state_changed) - return; - - auto landBuyRightsAction = LandBuyRightsAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, - (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND) ? LandBuyRightSetting::BuyLand - : LandBuyRightSetting::BuyConstructionRights); - auto res = GameActions::Query(&landBuyRightsAction); - - _landRightsCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; - } - - void OnToolAbort(WidgetIndex widgetIndex) override - { - if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND) - { - HideLandRights(); - } - else - { - HideConstructionRights(); - } - } - - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND) - { - if (screenCoords.x != LOCATION_NULL) + else { - auto landBuyRightsAction = LandBuyRightsAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, - LandBuyRightSetting::BuyLand); - GameActions::Execute(&landBuyRightsAction); + if (screenCoords.x != LOCATION_NULL) + { + auto landBuyRightsAction = LandBuyRightsAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + LandBuyRightSetting::BuyConstructionRights); + GameActions::Execute(&landBuyRightsAction); + } } } - else + + void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - if (screenCoords.x != LOCATION_NULL) + if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND) { - auto landBuyRightsAction = LandBuyRightsAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, - LandBuyRightSetting::BuyConstructionRights); - GameActions::Execute(&landBuyRightsAction); + if (screenCoords.x != LOCATION_NULL) + { + auto landBuyRightsAction = LandBuyRightsAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + LandBuyRightSetting::BuyLand); + GameActions::Execute(&landBuyRightsAction); + } + } + else + { + if (screenCoords.x != LOCATION_NULL) + { + auto landBuyRightsAction = LandBuyRightsAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + LandBuyRightSetting::BuyConstructionRights); + GameActions::Execute(&landBuyRightsAction); + } } } - } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND) + void OnResize() override { - if (screenCoords.x != LOCATION_NULL) - { - auto landBuyRightsAction = LandBuyRightsAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, - LandBuyRightSetting::BuyLand); - GameActions::Execute(&landBuyRightsAction); - } + ResizeFrame(); } - else + + private: + uint8_t _landRightsMode; + money64 _landRightsCost; + + void InputSize() { - if (screenCoords.x != LOCATION_NULL) - { - auto landBuyRightsAction = LandBuyRightsAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, - LandBuyRightSetting::BuyConstructionRights); - GameActions::Execute(&landBuyRightsAction); - } + Formatter ft; + ft.Add(kLandToolMinimumSize); + ft.Add(kLandToolMaximumSize); + WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); } - } - void OnResize() override + bool LandRightsToolIsActive() + { + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) + return false; + if (gCurrentToolWidget.window_classification != WindowClass::LandRights) + return false; + return true; + } + }; + + WindowBase* LandRightsOpen() { - ResizeFrame(); + return WindowFocusOrCreate( + WindowClass::LandRights, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); } - -private: - uint8_t _landRightsMode; - money64 _landRightsCost; - - void InputSize() - { - Formatter ft; - ft.Add(kLandToolMinimumSize); - ft.Add(kLandToolMaximumSize); - WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); - } - - bool LandRightsToolIsActive() - { - if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) - return false; - if (gCurrentToolWidget.window_classification != WindowClass::LandRights) - return false; - return true; - } -}; - -WindowBase* WindowLandRightsOpen() -{ - return WindowFocusOrCreate( - WindowClass::LandRights, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index aac1fd5180..dd5f9dd067 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -39,33 +39,33 @@ #include #include -using namespace OpenRCT2; - +namespace OpenRCT2::Ui::Windows +{ #pragma region Widgets -static constexpr StringId WINDOW_TITLE = STR_NONE; -static constexpr int32_t WW = 350; -static constexpr int32_t WH = 400; + static constexpr StringId WINDOW_TITLE = STR_NONE; + static constexpr int32_t WW = 350; + static constexpr int32_t WH = 400; -static constexpr uint16_t DATE_TIME_GAP = 2; + static constexpr uint16_t DATE_TIME_GAP = 2; -enum -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_RESIZE, - WIDX_DEFAULT, - WIDX_UP, - WIDX_NEW_FOLDER, - WIDX_NEW_FILE, - WIDX_SORT_NAME, - WIDX_SORT_DATE, - WIDX_SCROLL, - WIDX_BROWSE, -}; + enum + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_RESIZE, + WIDX_DEFAULT, + WIDX_UP, + WIDX_NEW_FOLDER, + WIDX_NEW_FILE, + WIDX_SORT_NAME, + WIDX_SORT_DATE, + WIDX_SCROLL, + WIDX_BROWSE, + }; -// clang-format off + // clang-format off static Widget window_loadsave_widgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), @@ -78,1083 +78,1088 @@ static Widget window_loadsave_widgets[] = MakeWidget({(WW - 5) / 2 + 1, 55}, {170, 14}, WindowWidgetType::TableHeader, WindowColour::Primary ), // WIDX_SORT_DATE MakeWidget({ 4, 68}, {342, 303}, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL ), // WIDX_SCROLL MakeWidget({ 4, WH - 24}, {197, 19}, WindowWidgetType::Button, WindowColour::Primary, STR_FILEBROWSER_USE_SYSTEM_WINDOW ), // WIDX_BROWSE - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on #pragma endregion -static WindowBase* WindowOverwritePromptOpen(const std::string_view name, const std::string_view path); + static WindowBase* WindowOverwritePromptOpen(const std::string_view name, const std::string_view path); -enum -{ - TYPE_DIRECTORY, - TYPE_FILE, -}; - -struct LoadSaveListItem -{ - std::string name{}; - std::string path{}; - time_t date_modified{ 0 }; - std::string date_formatted{}; - std::string time_formatted{}; - uint8_t type{ 0 }; - bool loaded{ false }; -}; - -static std::function _loadSaveCallback; -static TrackDesign* _trackDesign; - -static std::vector _listItems; -static char _directory[MAX_PATH]; -static char _parentDirectory[MAX_PATH]; -static u8string _extensionPattern; -static u8string _defaultPath; -static int32_t _type; - -static bool ListItemSort(LoadSaveListItem& a, LoadSaveListItem& b) -{ - if (a.type != b.type) - return a.type - b.type < 0; - - switch (gConfigGeneral.LoadSaveSort) + enum { - case Sort::NameAscending: - return StrLogicalCmp(a.name.c_str(), b.name.c_str()) < 0; - case Sort::NameDescending: - return -StrLogicalCmp(a.name.c_str(), b.name.c_str()) < 0; - case Sort::DateDescending: - return -difftime(a.date_modified, b.date_modified) < 0; - case Sort::DateAscending: - return difftime(a.date_modified, b.date_modified) < 0; - } - return StrLogicalCmp(a.name.c_str(), b.name.c_str()) < 0; -} + TYPE_DIRECTORY, + TYPE_FILE, + }; -static void SetAndSaveConfigPath(u8string& config_str, u8string_view path) -{ - config_str = Path::GetDirectory(path); - ConfigSaveDefault(); -} - -static bool IsValidPath(const char* path) -{ - // HACK This is needed because tracks get passed through with td? - // I am sure this will change eventually to use the new FileScanner - // which handles multiple patterns - auto filename = Path::GetFileNameWithoutExtension(path); - - return Platform::IsFilenameValid(filename); -} - -static u8string GetLastDirectoryByType(int32_t type) -{ - switch (type & 0x0E) + struct LoadSaveListItem { - case LOADSAVETYPE_GAME: - return gConfigGeneral.LastSaveGameDirectory; + std::string name{}; + std::string path{}; + time_t date_modified{ 0 }; + std::string date_formatted{}; + std::string time_formatted{}; + uint8_t type{ 0 }; + bool loaded{ false }; + }; - case LOADSAVETYPE_LANDSCAPE: - return gConfigGeneral.LastSaveLandscapeDirectory; + static std::function _loadSaveCallback; + static TrackDesign* _trackDesign; - case LOADSAVETYPE_SCENARIO: - return gConfigGeneral.LastSaveScenarioDirectory; + static std::vector _listItems; + static char _directory[MAX_PATH]; + static char _parentDirectory[MAX_PATH]; + static u8string _extensionPattern; + static u8string _defaultPath; + static int32_t _type; - case LOADSAVETYPE_TRACK: - return gConfigGeneral.LastSaveTrackDirectory; - - default: - return u8string(); - } -} - -static u8string GetInitialDirectoryByType(const int32_t type) -{ - std::optional subdir = std::nullopt; - switch (type & 0x0E) + static bool ListItemSort(LoadSaveListItem& a, LoadSaveListItem& b) { - case LOADSAVETYPE_GAME: - subdir = OpenRCT2::DIRID::SAVE; - break; + if (a.type != b.type) + return a.type - b.type < 0; - case LOADSAVETYPE_LANDSCAPE: - subdir = OpenRCT2::DIRID::LANDSCAPE; - break; - - case LOADSAVETYPE_SCENARIO: - subdir = OpenRCT2::DIRID::SCENARIO; - break; - - case LOADSAVETYPE_TRACK: - subdir = OpenRCT2::DIRID::TRACK; - break; - - case LOADSAVETYPE_HEIGHTMAP: - subdir = OpenRCT2::DIRID::HEIGHTMAP; - break; - } - - auto env = OpenRCT2::GetContext()->GetPlatformEnvironment(); - if (subdir.has_value()) - return env->GetDirectoryPath(OpenRCT2::DIRBASE::USER, subdir.value()); - else - return env->GetDirectoryPath(OpenRCT2::DIRBASE::USER); -} - -static const char* GetFilterPatternByType(const int32_t type, const bool isSave) -{ - switch (type & 0x0E) - { - case LOADSAVETYPE_GAME: - return isSave ? "*.park" : "*.park;*.sv6;*.sc6;*.sc4;*.sv4;*.sv7;*.sea"; - - case LOADSAVETYPE_LANDSCAPE: - return isSave ? "*.park" : "*.park;*.sc6;*.sv6;*.sc4;*.sv4;*.sv7;*.sea"; - - case LOADSAVETYPE_SCENARIO: - return isSave ? "*.park" : "*.park;*.sc6;*.sc4"; - - case LOADSAVETYPE_TRACK: - return isSave ? "*.td6" : "*.td6;*.td4"; - - case LOADSAVETYPE_HEIGHTMAP: - return "*.bmp;*.png"; - - default: - Guard::Fail("Unsupported load/save directory type."); - } - - return ""; -} - -static u8string RemovePatternWildcard(u8string_view pattern) -{ - while (pattern.length() >= 1 && pattern.front() == '*') - { - pattern.remove_prefix(1); - } - return u8string{ pattern }; -} - -static u8string GetDir(const int32_t type) -{ - u8string result = GetLastDirectoryByType(type); - if (result.empty() || !Path::DirectoryExists(result)) - { - result = GetInitialDirectoryByType(type); - } - return result; -} - -static void InvokeCallback(int32_t result, const utf8* path) -{ - if (_loadSaveCallback != nullptr) - { - _loadSaveCallback(result, path); - } -} - -static void Select(const char* path) -{ - if (!IsValidPath(path)) - { - ContextShowError(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); - return; - } - - char pathBuffer[MAX_PATH]; - SafeStrCpy(pathBuffer, path, sizeof(pathBuffer)); - - auto& gameState = GetGameState(); - - switch (_type & 0x0F) - { - case (LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME): - SetAndSaveConfigPath(gConfigGeneral.LastSaveGameDirectory, pathBuffer); - if (OpenRCT2::GetContext()->LoadParkFromFile(pathBuffer)) - { - InvokeCallback(MODAL_RESULT_OK, pathBuffer); - WindowCloseByClass(WindowClass::Loadsave); - GfxInvalidateScreen(); - } - else - { - // Not the best message... - ContextShowError(STR_LOAD_GAME, STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, {}); - InvokeCallback(MODAL_RESULT_FAIL, pathBuffer); - } - break; - - case (LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME): - SetAndSaveConfigPath(gConfigGeneral.LastSaveGameDirectory, pathBuffer); - if (ScenarioSave(gameState, pathBuffer, gConfigGeneral.SavePluginData ? 1 : 0)) - { - gScenarioSavePath = pathBuffer; - gCurrentLoadedPath = pathBuffer; - gIsAutosaveLoaded = false; - gFirstTimeSaving = false; - - WindowCloseByClass(WindowClass::Loadsave); - GfxInvalidateScreen(); - - InvokeCallback(MODAL_RESULT_OK, pathBuffer); - } - else - { - ContextShowError(STR_SAVE_GAME, STR_GAME_SAVE_FAILED, {}); - InvokeCallback(MODAL_RESULT_FAIL, pathBuffer); - } - break; - - case (LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE): - SetAndSaveConfigPath(gConfigGeneral.LastSaveLandscapeDirectory, pathBuffer); - if (Editor::LoadLandscape(pathBuffer)) - { - gCurrentLoadedPath = pathBuffer; - GfxInvalidateScreen(); - InvokeCallback(MODAL_RESULT_OK, pathBuffer); - } - else - { - // Not the best message... - ContextShowError(STR_LOAD_LANDSCAPE, STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, {}); - InvokeCallback(MODAL_RESULT_FAIL, pathBuffer); - } - break; - - case (LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE): - SetAndSaveConfigPath(gConfigGeneral.LastSaveLandscapeDirectory, pathBuffer); - gScenarioFileName = std::string(String::ToStringView(pathBuffer, std::size(pathBuffer))); - if (ScenarioSave(gameState, pathBuffer, gConfigGeneral.SavePluginData ? 3 : 2)) - { - gCurrentLoadedPath = pathBuffer; - WindowCloseByClass(WindowClass::Loadsave); - GfxInvalidateScreen(); - InvokeCallback(MODAL_RESULT_OK, pathBuffer); - } - else - { - ContextShowError(STR_SAVE_LANDSCAPE, STR_LANDSCAPE_SAVE_FAILED, {}); - InvokeCallback(MODAL_RESULT_FAIL, pathBuffer); - } - break; - - case (LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO): + switch (gConfigGeneral.LoadSaveSort) { - SetAndSaveConfigPath(gConfigGeneral.LastSaveScenarioDirectory, pathBuffer); - int32_t parkFlagsBackup = gameState.ParkFlags; - gameState.ParkFlags &= ~PARK_FLAGS_SPRITES_INITIALISED; - gameState.EditorStep = EditorStep::Invalid; - gScenarioFileName = std::string(String::ToStringView(pathBuffer, std::size(pathBuffer))); - int32_t success = ScenarioSave(gameState, pathBuffer, gConfigGeneral.SavePluginData ? 3 : 2); - gameState.ParkFlags = parkFlagsBackup; + case Sort::NameAscending: + return StrLogicalCmp(a.name.c_str(), b.name.c_str()) < 0; + case Sort::NameDescending: + return -StrLogicalCmp(a.name.c_str(), b.name.c_str()) < 0; + case Sort::DateDescending: + return -difftime(a.date_modified, b.date_modified) < 0; + case Sort::DateAscending: + return difftime(a.date_modified, b.date_modified) < 0; + } + return StrLogicalCmp(a.name.c_str(), b.name.c_str()) < 0; + } - if (success) - { - WindowCloseByClass(WindowClass::Loadsave); - InvokeCallback(MODAL_RESULT_OK, pathBuffer); - TitleLoad(); - } - else - { - ContextShowError(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_SCENARIO_SAVE_FAILED, {}); - gameState.EditorStep = EditorStep::ObjectiveSelection; - InvokeCallback(MODAL_RESULT_FAIL, pathBuffer); - } - break; + static void SetAndSaveConfigPath(u8string& config_str, u8string_view path) + { + config_str = Path::GetDirectory(path); + ConfigSaveDefault(); + } + + static bool IsValidPath(const char* path) + { + // HACK This is needed because tracks get passed through with td? + // I am sure this will change eventually to use the new FileScanner + // which handles multiple patterns + auto filename = Path::GetFileNameWithoutExtension(path); + + return Platform::IsFilenameValid(filename); + } + + static u8string GetLastDirectoryByType(int32_t type) + { + switch (type & 0x0E) + { + case LOADSAVETYPE_GAME: + return gConfigGeneral.LastSaveGameDirectory; + + case LOADSAVETYPE_LANDSCAPE: + return gConfigGeneral.LastSaveLandscapeDirectory; + + case LOADSAVETYPE_SCENARIO: + return gConfigGeneral.LastSaveScenarioDirectory; + + case LOADSAVETYPE_TRACK: + return gConfigGeneral.LastSaveTrackDirectory; + + default: + return u8string(); + } + } + + static u8string GetInitialDirectoryByType(const int32_t type) + { + std::optional subdir = std::nullopt; + switch (type & 0x0E) + { + case LOADSAVETYPE_GAME: + subdir = OpenRCT2::DIRID::SAVE; + break; + + case LOADSAVETYPE_LANDSCAPE: + subdir = OpenRCT2::DIRID::LANDSCAPE; + break; + + case LOADSAVETYPE_SCENARIO: + subdir = OpenRCT2::DIRID::SCENARIO; + break; + + case LOADSAVETYPE_TRACK: + subdir = OpenRCT2::DIRID::TRACK; + break; + + case LOADSAVETYPE_HEIGHTMAP: + subdir = OpenRCT2::DIRID::HEIGHTMAP; + break; } - case (LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK): - { - SetAndSaveConfigPath(gConfigGeneral.LastSaveTrackDirectory, pathBuffer); - auto intent = Intent(WindowClass::InstallTrack); - intent.PutExtra(INTENT_EXTRA_PATH, std::string{ pathBuffer }); - ContextOpenIntent(&intent); - WindowCloseByClass(WindowClass::Loadsave); - InvokeCallback(MODAL_RESULT_OK, pathBuffer); - break; - } - - case (LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK): - { - SetAndSaveConfigPath(gConfigGeneral.LastSaveTrackDirectory, pathBuffer); - - const auto withExtension = Path::WithExtension(pathBuffer, ".td6"); - String::Set(pathBuffer, sizeof(pathBuffer), withExtension.c_str()); - - RCT2::T6Exporter t6Export{ _trackDesign }; - - auto success = t6Export.SaveTrack(pathBuffer); - - if (success) - { - WindowCloseByClass(WindowClass::Loadsave); - WindowRideMeasurementsDesignCancel(); - InvokeCallback(MODAL_RESULT_OK, path); - } - else - { - ContextShowError(STR_FILE_DIALOG_TITLE_SAVE_TRACK, STR_TRACK_SAVE_FAILED, {}); - InvokeCallback(MODAL_RESULT_FAIL, path); - } - break; - } - - case (LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP): - WindowCloseByClass(WindowClass::Loadsave); - InvokeCallback(MODAL_RESULT_OK, pathBuffer); - break; - } -} - -static u8string OpenSystemFileBrowser(bool isSave) -{ - OpenRCT2::Ui::FileDialogDesc desc = {}; - u8string extension; - StringId title = STR_NONE; - switch (_type & 0x0E) - { - case LOADSAVETYPE_GAME: - extension = u8".park"; - title = isSave ? STR_FILE_DIALOG_TITLE_SAVE_GAME : STR_FILE_DIALOG_TITLE_LOAD_GAME; - desc.Filters.emplace_back(LanguageGetString(STR_OPENRCT2_SAVED_GAME), GetFilterPatternByType(_type, isSave)); - break; - - case LOADSAVETYPE_LANDSCAPE: - extension = u8".park"; - title = isSave ? STR_FILE_DIALOG_TITLE_SAVE_LANDSCAPE : STR_FILE_DIALOG_TITLE_LOAD_LANDSCAPE; - desc.Filters.emplace_back(LanguageGetString(STR_OPENRCT2_LANDSCAPE_FILE), GetFilterPatternByType(_type, isSave)); - break; - - case LOADSAVETYPE_SCENARIO: - extension = u8".park"; - title = STR_FILE_DIALOG_TITLE_SAVE_SCENARIO; - desc.Filters.emplace_back(LanguageGetString(STR_OPENRCT2_SCENARIO_FILE), GetFilterPatternByType(_type, isSave)); - break; - - case LOADSAVETYPE_TRACK: - extension = u8".td6"; - title = isSave ? STR_FILE_DIALOG_TITLE_SAVE_TRACK : STR_FILE_DIALOG_TITLE_INSTALL_NEW_TRACK_DESIGN; - desc.Filters.emplace_back(LanguageGetString(STR_OPENRCT2_TRACK_DESIGN_FILE), GetFilterPatternByType(_type, isSave)); - break; - - case LOADSAVETYPE_HEIGHTMAP: - title = STR_FILE_DIALOG_TITLE_LOAD_HEIGHTMAP; - desc.Filters.emplace_back(LanguageGetString(STR_OPENRCT2_HEIGHTMAP_FILE), GetFilterPatternByType(_type, isSave)); - break; - } - - u8string path = _directory; - if (isSave) - { - // The file browser requires a file path instead of just a directory - if (!_defaultPath.empty()) - { - path = Path::Combine(path, _defaultPath); - } + auto env = OpenRCT2::GetContext()->GetPlatformEnvironment(); + if (subdir.has_value()) + return env->GetDirectoryPath(OpenRCT2::DIRBASE::USER, subdir.value()); else + return env->GetDirectoryPath(OpenRCT2::DIRBASE::USER); + } + + static const char* GetFilterPatternByType(const int32_t type, const bool isSave) + { + switch (type & 0x0E) { - auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); - auto buffer = park.Name; - if (buffer.empty()) - { - // Use localised "Unnamed Park" if park name was empty. - buffer = FormatStringID(STR_UNNAMED_PARK, nullptr); - } - path = Path::Combine(path, buffer); + case LOADSAVETYPE_GAME: + return isSave ? "*.park" : "*.park;*.sv6;*.sc6;*.sc4;*.sv4;*.sv7;*.sea"; + + case LOADSAVETYPE_LANDSCAPE: + return isSave ? "*.park" : "*.park;*.sc6;*.sv6;*.sc4;*.sv4;*.sv7;*.sea"; + + case LOADSAVETYPE_SCENARIO: + return isSave ? "*.park" : "*.park;*.sc6;*.sc4"; + + case LOADSAVETYPE_TRACK: + return isSave ? "*.td6" : "*.td6;*.td4"; + + case LOADSAVETYPE_HEIGHTMAP: + return "*.bmp;*.png"; + + default: + Guard::Fail("Unsupported load/save directory type."); + } + + return ""; + } + + static u8string RemovePatternWildcard(u8string_view pattern) + { + while (pattern.length() >= 1 && pattern.front() == '*') + { + pattern.remove_prefix(1); + } + return u8string{ pattern }; + } + + static u8string GetDir(const int32_t type) + { + u8string result = GetLastDirectoryByType(type); + if (result.empty() || !Path::DirectoryExists(result)) + { + result = GetInitialDirectoryByType(type); + } + return result; + } + + static void InvokeCallback(int32_t result, const utf8* path) + { + if (_loadSaveCallback != nullptr) + { + _loadSaveCallback(result, path); } } - desc.InitialDirectory = _directory; - desc.Type = isSave ? OpenRCT2::Ui::FileDialogType::Save : OpenRCT2::Ui::FileDialogType::Open; - desc.DefaultFilename = isSave ? path : u8string(); - - desc.Filters.emplace_back(LanguageGetString(STR_ALL_FILES), "*"); - - desc.Title = LanguageGetString(title); - return ContextOpenCommonFileDialog(desc); -} - -class LoadSaveWindow final : public Window -{ -public: - LoadSaveWindow(int32_t loadSaveType) - : type(loadSaveType) + static void Select(const char* path) { - } - -private: - int32_t maxDateWidth{ 0 }; - int32_t maxTimeWidth{ 0 }; - int32_t type; - -public: - void PopulateList(int32_t includeNewItem, const u8string& directory, std::string_view extensionPattern) - { - const auto absoluteDirectory = Path::GetAbsolute(directory); - SafeStrCpy(_directory, absoluteDirectory.c_str(), std::size(_directory)); - // Note: This compares the pointers, not values - _extensionPattern = extensionPattern; - - _listItems.clear(); - - // Show "new" buttons when saving - window_loadsave_widgets[WIDX_NEW_FILE].type = includeNewItem ? WindowWidgetType::Button : WindowWidgetType::Empty; - window_loadsave_widgets[WIDX_NEW_FOLDER].type = includeNewItem ? WindowWidgetType::Button : WindowWidgetType::Empty; - - int32_t drives = Platform::GetDrives(); - if (directory.empty() && drives) - { - // List Windows drives - disabled_widgets |= (1uLL << WIDX_NEW_FILE) | (1uLL << WIDX_NEW_FOLDER) | (1uLL << WIDX_UP); - static constexpr auto NumDriveLetters = 26; - for (int32_t x = 0; x < NumDriveLetters; x++) - { - if (drives & (1 << x)) - { - // If the drive exists, list it - LoadSaveListItem newListItem; - newListItem.path = std::string(1, 'A' + x) + ":" PATH_SEPARATOR; - newListItem.name = newListItem.path; - newListItem.type = TYPE_DIRECTORY; - - _listItems.push_back(std::move(newListItem)); - } - } - } - else - { - // Remove the separator at the end of the path, if present - SafeStrCpy(_parentDirectory, absoluteDirectory.c_str(), std::size(_parentDirectory)); - if (_parentDirectory[strlen(_parentDirectory) - 1] == *PATH_SEPARATOR - || _parentDirectory[strlen(_parentDirectory) - 1] == '/') - _parentDirectory[strlen(_parentDirectory) - 1] = '\0'; - - // Remove everything past the now last separator - char* ch = strrchr(_parentDirectory, *PATH_SEPARATOR); - char* posix_ch = strrchr(_parentDirectory, '/'); - ch = ch < posix_ch ? posix_ch : ch; - if (ch != nullptr) - { - *(ch + 1) = '\0'; - } - else if (drives) - { - // If on Windows, clear the entire path to show the drives - _parentDirectory[0] = '\0'; - } - else - { - // Else, go to the root directory - snprintf(_parentDirectory, MAX_PATH, "%c", *PATH_SEPARATOR); - } - - // Disable the Up button if the current directory is the root directory - if (String::IsNullOrEmpty(_parentDirectory) && !drives) - disabled_widgets |= (1uLL << WIDX_UP); - else - disabled_widgets &= ~(1uLL << WIDX_UP); - - // Re-enable the "new" buttons if these were disabled - disabled_widgets &= ~(1uLL << WIDX_NEW_FILE); - disabled_widgets &= ~(1uLL << WIDX_NEW_FOLDER); - - // List all directories - auto subDirectories = Path::GetDirectories(absoluteDirectory); - for (const auto& sdName : subDirectories) - { - auto subDir = sdName + PATH_SEPARATOR; - - LoadSaveListItem newListItem; - newListItem.path = Path::Combine(absoluteDirectory, subDir); - newListItem.name = std::move(subDir); - newListItem.type = TYPE_DIRECTORY; - newListItem.loaded = false; - - _listItems.push_back(std::move(newListItem)); - } - - // List all files with the wanted extensions - bool showExtension = false; - for (const u8string& extToken : String::Split(extensionPattern, ";")) - { - const u8string filter = Path::Combine(directory, extToken); - auto scanner = Path::ScanDirectory(filter, false); - while (scanner->Next()) - { - LoadSaveListItem newListItem; - newListItem.path = scanner->GetPath(); - newListItem.type = TYPE_FILE; - newListItem.date_modified = Platform::FileGetModifiedTime(newListItem.path.c_str()); - - // Cache a human-readable version of the modified date. - newListItem.date_formatted = Platform::FormatShortDate(newListItem.date_modified); - newListItem.time_formatted = Platform::FormatTime(newListItem.date_modified); - - // Mark if file is the currently loaded game - newListItem.loaded = newListItem.path.compare(gCurrentLoadedPath) == 0; - - // Remove the extension (but only the first extension token) - if (!showExtension) - { - newListItem.name = Path::GetFileNameWithoutExtension(newListItem.path); - } - else - { - newListItem.name = Path::GetFileName(newListItem.path); - } - - _listItems.push_back(std::move(newListItem)); - } - - showExtension = true; // Show any extension after the first iteration - } - - SortList(); - } - - Invalidate(); - } - - void ComputeMaxDateWidth() - { - // Generate a time object for a relatively wide time: 2000-02-20 00:00:00 - std::tm tm; - tm.tm_sec = 0; - tm.tm_min = 0; - tm.tm_hour = 0; - tm.tm_mday = 20; - tm.tm_mon = 2; - tm.tm_year = 100; - tm.tm_wday = 5; - tm.tm_yday = 51; - tm.tm_isdst = -1; - - std::time_t long_time = mktime(&tm); - - // Check how this date is represented (e.g. 2000-02-20, or 00/02/20) - std::string date = Platform::FormatShortDate(long_time); - maxDateWidth = GfxGetStringWidth(date.c_str(), FontStyle::Medium) + DATE_TIME_GAP; - - // Some locales do not use leading zeros for months and days, so let's try October, too. - tm.tm_mon = 10; - tm.tm_yday = 294; - long_time = mktime(&tm); - - // Again, check how this date is represented (e.g. 2000-10-20, or 00/10/20) - date = Platform::FormatShortDate(long_time); - maxDateWidth = std::max(maxDateWidth, GfxGetStringWidth(date.c_str(), FontStyle::Medium) + DATE_TIME_GAP); - - // Time appears to be universally represented with two digits for minutes, so 12:00 or 00:00 should be representable. - std::string time = Platform::FormatTime(long_time); - maxTimeWidth = GfxGetStringWidth(time.c_str(), FontStyle::Medium) + DATE_TIME_GAP; - } - - void SortList() - { - std::sort(_listItems.begin(), _listItems.end(), ListItemSort); - } - -#pragma region Events -public: - void OnOpen() override - { - widgets = window_loadsave_widgets; - - const auto uiContext = OpenRCT2::GetContext()->GetUiContext(); - if (!uiContext->HasFilePicker()) - { - disabled_widgets |= (1uLL << WIDX_BROWSE); - window_loadsave_widgets[WIDX_BROWSE].type = WindowWidgetType::Empty; - } - - // TODO: Split LOADSAVETYPE_* into two proper enum classes (one for load/save, the other for the type) - const bool isSave = (type & 0x01) == LOADSAVETYPE_SAVE; - const auto path = GetDir(type); - - const char* pattern = GetFilterPatternByType(type, isSave); - PopulateList(isSave, path, pattern); - no_list_items = static_cast(_listItems.size()); - selected_list_item = -1; - - InitScrollWidgets(); - ComputeMaxDateWidth(); - min_width = WW; - min_height = WH / 2; - max_width = WW * 2; - max_height = WH * 2; - } - - void OnClose() override - { - _listItems.clear(); - WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt); - } - - void OnResize() override - { - if (width < min_width) - { - Invalidate(); - width = min_width; - } - if (height < min_height) - { - Invalidate(); - height = min_height; - } - } - - void OnPrepareDraw() override - { - ResizeFrameWithPage(); - - Widget* date_widget = &window_loadsave_widgets[WIDX_SORT_DATE]; - date_widget->right = width - 5; - date_widget->left = date_widget->right - (maxDateWidth + maxTimeWidth + (4 * DATE_TIME_GAP) + (SCROLLBAR_WIDTH + 1)); - - window_loadsave_widgets[WIDX_SORT_NAME].left = 4; - window_loadsave_widgets[WIDX_SORT_NAME].right = window_loadsave_widgets[WIDX_SORT_DATE].left - 1; - - window_loadsave_widgets[WIDX_SCROLL].right = width - 5; - window_loadsave_widgets[WIDX_SCROLL].bottom = height - 30; - - window_loadsave_widgets[WIDX_BROWSE].top = height - 24; - window_loadsave_widgets[WIDX_BROWSE].bottom = height - 6; - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - const auto shortPath = ShortenPath(_directory, width - 8, FontStyle::Medium); - - // Format text - std::string buffer; - buffer.assign("{BLACK}"); - buffer += shortPath; - - // Draw path text - const auto normalisedPath = Platform::StrDecompToPrecomp(buffer.data()); - const auto* normalisedPathC = normalisedPath.c_str(); - auto ft = Formatter(); - ft.Add(normalisedPathC); - DrawTextEllipsised(dpi, windowPos + ScreenCoordsXY{ 4, 20 }, width - 8, STR_STRING, ft); - - // Name button text - StringId id = STR_NONE; - if (gConfigGeneral.LoadSaveSort == Sort::NameAscending) - id = STR_UP; - else if (gConfigGeneral.LoadSaveSort == Sort::NameDescending) - id = STR_DOWN; - - // Draw name button indicator. - Widget sort_name_widget = window_loadsave_widgets[WIDX_SORT_NAME]; - ft = Formatter(); - ft.Add(id); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ sort_name_widget.left + 11, sort_name_widget.top + 1 }, STR_NAME, ft, - { COLOUR_GREY }); - - // Date button text - if (gConfigGeneral.LoadSaveSort == Sort::DateAscending) - id = STR_UP; - else if (gConfigGeneral.LoadSaveSort == Sort::DateDescending) - id = STR_DOWN; - else - id = STR_NONE; - - Widget sort_date_widget = window_loadsave_widgets[WIDX_SORT_DATE]; - ft = Formatter(); - ft.Add(id); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ sort_date_widget.left + 5, sort_date_widget.top + 1 }, STR_DATE, ft, - { COLOUR_GREY }); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - bool isSave = (_type & 0x01) == LOADSAVETYPE_SAVE; - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - - case WIDX_UP: - PopulateList(isSave, _parentDirectory, _extensionPattern); - InitScrollWidgets(); - no_list_items = static_cast(_listItems.size()); - break; - - case WIDX_NEW_FILE: - WindowTextInputOpen( - this, WIDX_NEW_FILE, STR_NONE, STR_FILEBROWSER_FILE_NAME_PROMPT, {}, STR_STRING, - reinterpret_cast(_defaultPath.c_str()), 64); - break; - - case WIDX_NEW_FOLDER: - WindowTextInputRawOpen(this, WIDX_NEW_FOLDER, STR_NONE, STR_FILEBROWSER_FOLDER_NAME_PROMPT, {}, "", 64); - break; - - case WIDX_BROWSE: - { - u8string path = OpenSystemFileBrowser(isSave); - if (!path.empty()) - { - Select(path.c_str()); - } - else - { - // If user cancels file dialog, refresh list - PopulateList(isSave, _directory, _extensionPattern); - InitScrollWidgets(); - no_list_items = static_cast(_listItems.size()); - } - } - break; - - case WIDX_SORT_NAME: - if (gConfigGeneral.LoadSaveSort == Sort::NameAscending) - { - gConfigGeneral.LoadSaveSort = Sort::NameDescending; - } - else - { - gConfigGeneral.LoadSaveSort = Sort::NameAscending; - } - ConfigSaveDefault(); - SortList(); - Invalidate(); - break; - - case WIDX_SORT_DATE: - if (gConfigGeneral.LoadSaveSort == Sort::DateDescending) - { - gConfigGeneral.LoadSaveSort = Sort::DateAscending; - } - else - { - gConfigGeneral.LoadSaveSort = Sort::DateDescending; - } - ConfigSaveDefault(); - SortList(); - Invalidate(); - break; - - case WIDX_DEFAULT: - PopulateList(isSave, GetInitialDirectoryByType(_type).c_str(), _extensionPattern); - InitScrollWidgets(); - no_list_items = static_cast(_listItems.size()); - break; - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (text.empty()) - return; - - if (!Platform::IsFilenameValid(text)) + if (!IsValidPath(path)) { ContextShowError(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); return; } - switch (widgetIndex) + char pathBuffer[MAX_PATH]; + SafeStrCpy(pathBuffer, path, sizeof(pathBuffer)); + + auto& gameState = GetGameState(); + + switch (_type & 0x0F) { - case WIDX_NEW_FOLDER: - { - const u8string path = Path::Combine(_directory, text); - if (!Path::CreateDirectory(path)) + case (LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME): + SetAndSaveConfigPath(gConfigGeneral.LastSaveGameDirectory, pathBuffer); + if (OpenRCT2::GetContext()->LoadParkFromFile(pathBuffer)) { - ContextShowError(STR_UNABLE_TO_CREATE_FOLDER, STR_NONE, {}); - return; + InvokeCallback(MODAL_RESULT_OK, pathBuffer); + WindowCloseByClass(WindowClass::Loadsave); + GfxInvalidateScreen(); } + else + { + // Not the best message... + ContextShowError(STR_LOAD_GAME, STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, {}); + InvokeCallback(MODAL_RESULT_FAIL, pathBuffer); + } + break; + + case (LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME): + SetAndSaveConfigPath(gConfigGeneral.LastSaveGameDirectory, pathBuffer); + if (ScenarioSave(gameState, pathBuffer, gConfigGeneral.SavePluginData ? 1 : 0)) + { + gScenarioSavePath = pathBuffer; + gCurrentLoadedPath = pathBuffer; + gIsAutosaveLoaded = false; + gFirstTimeSaving = false; + + WindowCloseByClass(WindowClass::Loadsave); + GfxInvalidateScreen(); + + InvokeCallback(MODAL_RESULT_OK, pathBuffer); + } + else + { + ContextShowError(STR_SAVE_GAME, STR_GAME_SAVE_FAILED, {}); + InvokeCallback(MODAL_RESULT_FAIL, pathBuffer); + } + break; + + case (LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE): + SetAndSaveConfigPath(gConfigGeneral.LastSaveLandscapeDirectory, pathBuffer); + if (Editor::LoadLandscape(pathBuffer)) + { + gCurrentLoadedPath = pathBuffer; + GfxInvalidateScreen(); + InvokeCallback(MODAL_RESULT_OK, pathBuffer); + } + else + { + // Not the best message... + ContextShowError(STR_LOAD_LANDSCAPE, STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, {}); + InvokeCallback(MODAL_RESULT_FAIL, pathBuffer); + } + break; + + case (LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE): + SetAndSaveConfigPath(gConfigGeneral.LastSaveLandscapeDirectory, pathBuffer); + gScenarioFileName = std::string(String::ToStringView(pathBuffer, std::size(pathBuffer))); + if (ScenarioSave(gameState, pathBuffer, gConfigGeneral.SavePluginData ? 3 : 2)) + { + gCurrentLoadedPath = pathBuffer; + WindowCloseByClass(WindowClass::Loadsave); + GfxInvalidateScreen(); + InvokeCallback(MODAL_RESULT_OK, pathBuffer); + } + else + { + ContextShowError(STR_SAVE_LANDSCAPE, STR_LANDSCAPE_SAVE_FAILED, {}); + InvokeCallback(MODAL_RESULT_FAIL, pathBuffer); + } + break; + + case (LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO): + { + SetAndSaveConfigPath(gConfigGeneral.LastSaveScenarioDirectory, pathBuffer); + int32_t parkFlagsBackup = gameState.ParkFlags; + gameState.ParkFlags &= ~PARK_FLAGS_SPRITES_INITIALISED; + gameState.EditorStep = EditorStep::Invalid; + gScenarioFileName = std::string(String::ToStringView(pathBuffer, std::size(pathBuffer))); + int32_t success = ScenarioSave(gameState, pathBuffer, gConfigGeneral.SavePluginData ? 3 : 2); + gameState.ParkFlags = parkFlagsBackup; + + if (success) + { + WindowCloseByClass(WindowClass::Loadsave); + InvokeCallback(MODAL_RESULT_OK, pathBuffer); + TitleLoad(); + } + else + { + ContextShowError(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_SCENARIO_SAVE_FAILED, {}); + gameState.EditorStep = EditorStep::ObjectiveSelection; + InvokeCallback(MODAL_RESULT_FAIL, pathBuffer); + } + break; + } + + case (LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK): + { + SetAndSaveConfigPath(gConfigGeneral.LastSaveTrackDirectory, pathBuffer); + auto intent = Intent(WindowClass::InstallTrack); + intent.PutExtra(INTENT_EXTRA_PATH, std::string{ pathBuffer }); + ContextOpenIntent(&intent); + WindowCloseByClass(WindowClass::Loadsave); + InvokeCallback(MODAL_RESULT_OK, pathBuffer); + break; + } + + case (LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK): + { + SetAndSaveConfigPath(gConfigGeneral.LastSaveTrackDirectory, pathBuffer); + + const auto withExtension = Path::WithExtension(pathBuffer, ".td6"); + String::Set(pathBuffer, sizeof(pathBuffer), withExtension.c_str()); + + RCT2::T6Exporter t6Export{ _trackDesign }; + + auto success = t6Export.SaveTrack(pathBuffer); + + if (success) + { + WindowCloseByClass(WindowClass::Loadsave); + WindowRideMeasurementsDesignCancel(); + InvokeCallback(MODAL_RESULT_OK, path); + } + else + { + ContextShowError(STR_FILE_DIALOG_TITLE_SAVE_TRACK, STR_TRACK_SAVE_FAILED, {}); + InvokeCallback(MODAL_RESULT_FAIL, path); + } + break; + } + + case (LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP): + WindowCloseByClass(WindowClass::Loadsave); + InvokeCallback(MODAL_RESULT_OK, pathBuffer); + break; + } + } + + static u8string OpenSystemFileBrowser(bool isSave) + { + OpenRCT2::Ui::FileDialogDesc desc = {}; + u8string extension; + StringId title = STR_NONE; + switch (_type & 0x0E) + { + case LOADSAVETYPE_GAME: + extension = u8".park"; + title = isSave ? STR_FILE_DIALOG_TITLE_SAVE_GAME : STR_FILE_DIALOG_TITLE_LOAD_GAME; + desc.Filters.emplace_back(LanguageGetString(STR_OPENRCT2_SAVED_GAME), GetFilterPatternByType(_type, isSave)); + break; + + case LOADSAVETYPE_LANDSCAPE: + extension = u8".park"; + title = isSave ? STR_FILE_DIALOG_TITLE_SAVE_LANDSCAPE : STR_FILE_DIALOG_TITLE_LOAD_LANDSCAPE; + desc.Filters.emplace_back( + LanguageGetString(STR_OPENRCT2_LANDSCAPE_FILE), GetFilterPatternByType(_type, isSave)); + break; + + case LOADSAVETYPE_SCENARIO: + extension = u8".park"; + title = STR_FILE_DIALOG_TITLE_SAVE_SCENARIO; + desc.Filters.emplace_back(LanguageGetString(STR_OPENRCT2_SCENARIO_FILE), GetFilterPatternByType(_type, isSave)); + break; + + case LOADSAVETYPE_TRACK: + extension = u8".td6"; + title = isSave ? STR_FILE_DIALOG_TITLE_SAVE_TRACK : STR_FILE_DIALOG_TITLE_INSTALL_NEW_TRACK_DESIGN; + desc.Filters.emplace_back( + LanguageGetString(STR_OPENRCT2_TRACK_DESIGN_FILE), GetFilterPatternByType(_type, isSave)); + break; + + case LOADSAVETYPE_HEIGHTMAP: + title = STR_FILE_DIALOG_TITLE_LOAD_HEIGHTMAP; + desc.Filters.emplace_back( + LanguageGetString(STR_OPENRCT2_HEIGHTMAP_FILE), GetFilterPatternByType(_type, isSave)); + break; + } + + u8string path = _directory; + if (isSave) + { + // The file browser requires a file path instead of just a directory + if (!_defaultPath.empty()) + { + path = Path::Combine(path, _defaultPath); + } + else + { + auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); + auto buffer = park.Name; + if (buffer.empty()) + { + buffer = LanguageGetString(STR_UNNAMED_PARK); + } + path = Path::Combine(path, buffer); + } + } + + desc.InitialDirectory = _directory; + desc.Type = isSave ? OpenRCT2::Ui::FileDialogType::Save : OpenRCT2::Ui::FileDialogType::Open; + desc.DefaultFilename = isSave ? path : u8string(); + + desc.Filters.emplace_back(LanguageGetString(STR_ALL_FILES), "*"); + + desc.Title = LanguageGetString(title); + return ContextOpenCommonFileDialog(desc); + } + + class LoadSaveWindow final : public Window + { + public: + LoadSaveWindow(int32_t loadSaveType) + : type(loadSaveType) + { + } + + private: + int32_t maxDateWidth{ 0 }; + int32_t maxTimeWidth{ 0 }; + int32_t type; + + public: + void PopulateList(int32_t includeNewItem, const u8string& directory, std::string_view extensionPattern) + { + const auto absoluteDirectory = Path::GetAbsolute(directory); + SafeStrCpy(_directory, absoluteDirectory.c_str(), std::size(_directory)); + // Note: This compares the pointers, not values + _extensionPattern = extensionPattern; + + _listItems.clear(); + + // Show "new" buttons when saving + window_loadsave_widgets[WIDX_NEW_FILE].type = includeNewItem ? WindowWidgetType::Button : WindowWidgetType::Empty; + window_loadsave_widgets[WIDX_NEW_FOLDER].type = includeNewItem ? WindowWidgetType::Button : WindowWidgetType::Empty; + + int32_t drives = Platform::GetDrives(); + if (directory.empty() && drives) + { + // List Windows drives + disabled_widgets |= (1uLL << WIDX_NEW_FILE) | (1uLL << WIDX_NEW_FOLDER) | (1uLL << WIDX_UP); + static constexpr auto NumDriveLetters = 26; + for (int32_t x = 0; x < NumDriveLetters; x++) + { + if (drives & (1 << x)) + { + // If the drive exists, list it + LoadSaveListItem newListItem; + newListItem.path = std::string(1, 'A' + x) + ":" PATH_SEPARATOR; + newListItem.name = newListItem.path; + newListItem.type = TYPE_DIRECTORY; + + _listItems.push_back(std::move(newListItem)); + } + } + } + else + { + // Remove the separator at the end of the path, if present + SafeStrCpy(_parentDirectory, absoluteDirectory.c_str(), std::size(_parentDirectory)); + if (_parentDirectory[strlen(_parentDirectory) - 1] == *PATH_SEPARATOR + || _parentDirectory[strlen(_parentDirectory) - 1] == '/') + _parentDirectory[strlen(_parentDirectory) - 1] = '\0'; + + // Remove everything past the now last separator + char* ch = strrchr(_parentDirectory, *PATH_SEPARATOR); + char* posix_ch = strrchr(_parentDirectory, '/'); + ch = ch < posix_ch ? posix_ch : ch; + if (ch != nullptr) + { + *(ch + 1) = '\0'; + } + else if (drives) + { + // If on Windows, clear the entire path to show the drives + _parentDirectory[0] = '\0'; + } + else + { + // Else, go to the root directory + snprintf(_parentDirectory, MAX_PATH, "%c", *PATH_SEPARATOR); + } + + // Disable the Up button if the current directory is the root directory + if (String::IsNullOrEmpty(_parentDirectory) && !drives) + disabled_widgets |= (1uLL << WIDX_UP); + else + disabled_widgets &= ~(1uLL << WIDX_UP); + + // Re-enable the "new" buttons if these were disabled + disabled_widgets &= ~(1uLL << WIDX_NEW_FILE); + disabled_widgets &= ~(1uLL << WIDX_NEW_FOLDER); + + // List all directories + auto subDirectories = Path::GetDirectories(absoluteDirectory); + for (const auto& sdName : subDirectories) + { + auto subDir = sdName + PATH_SEPARATOR; + + LoadSaveListItem newListItem; + newListItem.path = Path::Combine(absoluteDirectory, subDir); + newListItem.name = std::move(subDir); + newListItem.type = TYPE_DIRECTORY; + newListItem.loaded = false; + + _listItems.push_back(std::move(newListItem)); + } + + // List all files with the wanted extensions + bool showExtension = false; + for (const u8string& extToken : String::Split(extensionPattern, ";")) + { + const u8string filter = Path::Combine(directory, extToken); + auto scanner = Path::ScanDirectory(filter, false); + while (scanner->Next()) + { + LoadSaveListItem newListItem; + newListItem.path = scanner->GetPath(); + newListItem.type = TYPE_FILE; + newListItem.date_modified = Platform::FileGetModifiedTime(newListItem.path.c_str()); + + // Cache a human-readable version of the modified date. + newListItem.date_formatted = Platform::FormatShortDate(newListItem.date_modified); + newListItem.time_formatted = Platform::FormatTime(newListItem.date_modified); + + // Mark if file is the currently loaded game + newListItem.loaded = newListItem.path.compare(gCurrentLoadedPath) == 0; + + // Remove the extension (but only the first extension token) + if (!showExtension) + { + newListItem.name = Path::GetFileNameWithoutExtension(newListItem.path); + } + else + { + newListItem.name = Path::GetFileName(newListItem.path); + } + + _listItems.push_back(std::move(newListItem)); + } + + showExtension = true; // Show any extension after the first iteration + } + + SortList(); + } + + Invalidate(); + } + + void ComputeMaxDateWidth() + { + // Generate a time object for a relatively wide time: 2000-02-20 00:00:00 + std::tm tm; + tm.tm_sec = 0; + tm.tm_min = 0; + tm.tm_hour = 0; + tm.tm_mday = 20; + tm.tm_mon = 2; + tm.tm_year = 100; + tm.tm_wday = 5; + tm.tm_yday = 51; + tm.tm_isdst = -1; + + std::time_t long_time = mktime(&tm); + + // Check how this date is represented (e.g. 2000-02-20, or 00/02/20) + std::string date = Platform::FormatShortDate(long_time); + maxDateWidth = GfxGetStringWidth(date.c_str(), FontStyle::Medium) + DATE_TIME_GAP; + + // Some locales do not use leading zeros for months and days, so let's try October, too. + tm.tm_mon = 10; + tm.tm_yday = 294; + long_time = mktime(&tm); + + // Again, check how this date is represented (e.g. 2000-10-20, or 00/10/20) + date = Platform::FormatShortDate(long_time); + maxDateWidth = std::max(maxDateWidth, GfxGetStringWidth(date.c_str(), FontStyle::Medium) + DATE_TIME_GAP); + + // Time appears to be universally represented with two digits for minutes, so 12:00 or 00:00 should be + // representable. + std::string time = Platform::FormatTime(long_time); + maxTimeWidth = GfxGetStringWidth(time.c_str(), FontStyle::Medium) + DATE_TIME_GAP; + } + + void SortList() + { + std::sort(_listItems.begin(), _listItems.end(), ListItemSort); + } + +#pragma region Events + public: + void OnOpen() override + { + widgets = window_loadsave_widgets; + + const auto uiContext = OpenRCT2::GetContext()->GetUiContext(); + if (!uiContext->HasFilePicker()) + { + disabled_widgets |= (1uLL << WIDX_BROWSE); + window_loadsave_widgets[WIDX_BROWSE].type = WindowWidgetType::Empty; + } + + // TODO: Split LOADSAVETYPE_* into two proper enum classes (one for load/save, the other for the type) + const bool isSave = (type & 0x01) == LOADSAVETYPE_SAVE; + const auto path = GetDir(type); + + const char* pattern = GetFilterPatternByType(type, isSave); + PopulateList(isSave, path, pattern); + no_list_items = static_cast(_listItems.size()); + selected_list_item = -1; + + InitScrollWidgets(); + ComputeMaxDateWidth(); + min_width = WW; + min_height = WH / 2; + max_width = WW * 2; + max_height = WH * 2; + } + + void OnClose() override + { + _listItems.clear(); + WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt); + } + + void OnResize() override + { + if (width < min_width) + { + Invalidate(); + width = min_width; + } + if (height < min_height) + { + Invalidate(); + height = min_height; + } + } + + void OnPrepareDraw() override + { + ResizeFrameWithPage(); + + Widget* date_widget = &window_loadsave_widgets[WIDX_SORT_DATE]; + date_widget->right = width - 5; + date_widget->left = date_widget->right + - (maxDateWidth + maxTimeWidth + (4 * DATE_TIME_GAP) + (kScrollBarWidth + 1)); + + window_loadsave_widgets[WIDX_SORT_NAME].left = 4; + window_loadsave_widgets[WIDX_SORT_NAME].right = window_loadsave_widgets[WIDX_SORT_DATE].left - 1; + + window_loadsave_widgets[WIDX_SCROLL].right = width - 5; + window_loadsave_widgets[WIDX_SCROLL].bottom = height - 30; + + window_loadsave_widgets[WIDX_BROWSE].top = height - 24; + window_loadsave_widgets[WIDX_BROWSE].bottom = height - 6; + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + const auto shortPath = ShortenPath(_directory, width - 8, FontStyle::Medium); + + // Format text + std::string buffer; + buffer.assign("{BLACK}"); + buffer += shortPath; + + // Draw path text + const auto normalisedPath = Platform::StrDecompToPrecomp(buffer.data()); + const auto* normalisedPathC = normalisedPath.c_str(); + auto ft = Formatter(); + ft.Add(normalisedPathC); + DrawTextEllipsised(dpi, windowPos + ScreenCoordsXY{ 4, 20 }, width - 8, STR_STRING, ft); + + // Name button text + StringId id = STR_NONE; + if (gConfigGeneral.LoadSaveSort == Sort::NameAscending) + id = STR_UP; + else if (gConfigGeneral.LoadSaveSort == Sort::NameDescending) + id = STR_DOWN; + + // Draw name button indicator. + Widget sort_name_widget = window_loadsave_widgets[WIDX_SORT_NAME]; + ft = Formatter(); + ft.Add(id); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ sort_name_widget.left + 11, sort_name_widget.top + 1 }, STR_NAME, ft, + { COLOUR_GREY }); + + // Date button text + if (gConfigGeneral.LoadSaveSort == Sort::DateAscending) + id = STR_UP; + else if (gConfigGeneral.LoadSaveSort == Sort::DateDescending) + id = STR_DOWN; + else + id = STR_NONE; + + Widget sort_date_widget = window_loadsave_widgets[WIDX_SORT_DATE]; + ft = Formatter(); + ft.Add(id); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ sort_date_widget.left + 5, sort_date_widget.top + 1 }, STR_DATE, ft, + { COLOUR_GREY }); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + bool isSave = (_type & 0x01) == LOADSAVETYPE_SAVE; + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + + case WIDX_UP: + PopulateList(isSave, _parentDirectory, _extensionPattern); + InitScrollWidgets(); + no_list_items = static_cast(_listItems.size()); + break; + + case WIDX_NEW_FILE: + WindowTextInputOpen( + this, WIDX_NEW_FILE, STR_NONE, STR_FILEBROWSER_FILE_NAME_PROMPT, {}, STR_STRING, + reinterpret_cast(_defaultPath.c_str()), 64); + break; + + case WIDX_NEW_FOLDER: + WindowTextInputRawOpen(this, WIDX_NEW_FOLDER, STR_NONE, STR_FILEBROWSER_FOLDER_NAME_PROMPT, {}, "", 64); + break; + + case WIDX_BROWSE: + { + u8string path = OpenSystemFileBrowser(isSave); + if (!path.empty()) + { + Select(path.c_str()); + } + else + { + // If user cancels file dialog, refresh list + PopulateList(isSave, _directory, _extensionPattern); + InitScrollWidgets(); + no_list_items = static_cast(_listItems.size()); + } + } + break; + + case WIDX_SORT_NAME: + if (gConfigGeneral.LoadSaveSort == Sort::NameAscending) + { + gConfigGeneral.LoadSaveSort = Sort::NameDescending; + } + else + { + gConfigGeneral.LoadSaveSort = Sort::NameAscending; + } + ConfigSaveDefault(); + SortList(); + Invalidate(); + break; + + case WIDX_SORT_DATE: + if (gConfigGeneral.LoadSaveSort == Sort::DateDescending) + { + gConfigGeneral.LoadSaveSort = Sort::DateAscending; + } + else + { + gConfigGeneral.LoadSaveSort = Sort::DateDescending; + } + ConfigSaveDefault(); + SortList(); + Invalidate(); + break; + + case WIDX_DEFAULT: + PopulateList(isSave, GetInitialDirectoryByType(_type).c_str(), _extensionPattern); + InitScrollWidgets(); + no_list_items = static_cast(_listItems.size()); + break; + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (text.empty()) + return; + + if (!Platform::IsFilenameValid(text)) + { + ContextShowError(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); + return; + } + + switch (widgetIndex) + { + case WIDX_NEW_FOLDER: + { + const u8string path = Path::Combine(_directory, text); + if (!Path::CreateDirectory(path)) + { + ContextShowError(STR_UNABLE_TO_CREATE_FOLDER, STR_NONE, {}); + return; + } + + no_list_items = 0; + selected_list_item = -1; + + PopulateList((_type & 1) == LOADSAVETYPE_SAVE, path, _extensionPattern); + InitScrollWidgets(); + + no_list_items = static_cast(_listItems.size()); + Invalidate(); + break; + } + + case WIDX_NEW_FILE: + { + const u8string path = Path::WithExtension( + Path::Combine(_directory, text), RemovePatternWildcard(_extensionPattern)); + + if (File::Exists(path)) + WindowOverwritePromptOpen(text, path); + else + Select(path.c_str()); + break; + } + } + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + return { 0, no_list_items * SCROLLABLE_ROW_HEIGHT }; + } + + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + int32_t selectedItem; + + selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + if (selectedItem >= no_list_items) + return; + + selected_list_item = selectedItem; + + Invalidate(); + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + int32_t selectedItem; + + selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + if (selectedItem >= no_list_items) + return; + + if (_listItems[selectedItem].type == TYPE_DIRECTORY) + { + // The selected item is a folder + int32_t includeNewItem; no_list_items = 0; selected_list_item = -1; + includeNewItem = (_type & 1) == LOADSAVETYPE_SAVE; - PopulateList((_type & 1) == LOADSAVETYPE_SAVE, path, _extensionPattern); + char directory[MAX_PATH]; + SafeStrCpy(directory, _listItems[selectedItem].path.c_str(), sizeof(directory)); + + PopulateList(includeNewItem, directory, _extensionPattern); InitScrollWidgets(); no_list_items = static_cast(_listItems.size()); - Invalidate(); - break; } - - case WIDX_NEW_FILE: - { - const u8string path = Path::WithExtension( - Path::Combine(_directory, text), RemovePatternWildcard(_extensionPattern)); - - if (File::Exists(path)) - WindowOverwritePromptOpen(text, path); - else - Select(path.c_str()); - break; - } - } - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - return { 0, no_list_items * SCROLLABLE_ROW_HEIGHT }; - } - - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - int32_t selectedItem; - - selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - if (selectedItem >= no_list_items) - return; - - selected_list_item = selectedItem; - - Invalidate(); - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - int32_t selectedItem; - - selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - if (selectedItem >= no_list_items) - return; - - if (_listItems[selectedItem].type == TYPE_DIRECTORY) - { - // The selected item is a folder - int32_t includeNewItem; - - no_list_items = 0; - selected_list_item = -1; - includeNewItem = (_type & 1) == LOADSAVETYPE_SAVE; - - char directory[MAX_PATH]; - SafeStrCpy(directory, _listItems[selectedItem].path.c_str(), sizeof(directory)); - - PopulateList(includeNewItem, directory, _extensionPattern); - InitScrollWidgets(); - - no_list_items = static_cast(_listItems.size()); - } - else - { - // TYPE_FILE - // Load or overwrite - if ((_type & 0x01) == LOADSAVETYPE_SAVE) - WindowOverwritePromptOpen(_listItems[selectedItem].name, _listItems[selectedItem].path); else - Select(_listItems[selectedItem].path.c_str()); + { + // TYPE_FILE + // Load or overwrite + if ((_type & 0x01) == LOADSAVETYPE_SAVE) + WindowOverwritePromptOpen(_listItems[selectedItem].name, _listItems[selectedItem].path); + else + Select(_listItems[selectedItem].path.c_str()); + } } - } - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - GfxFillRect( - dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); - const int32_t listWidth = widgets[WIDX_SCROLL].width(); - const int32_t dateAnchor = widgets[WIDX_SORT_DATE].left + maxDateWidth + DATE_TIME_GAP; - - for (int32_t i = 0; i < no_list_items; i++) + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override { - int32_t y = i * SCROLLABLE_ROW_HEIGHT; - if (y > dpi.y + dpi.height) + GfxFillRect( + dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); + const int32_t listWidth = widgets[WIDX_SCROLL].width(); + const int32_t dateAnchor = widgets[WIDX_SORT_DATE].left + maxDateWidth + DATE_TIME_GAP; + + for (int32_t i = 0; i < no_list_items; i++) + { + int32_t y = i * SCROLLABLE_ROW_HEIGHT; + if (y > dpi.y + dpi.height) + break; + + if (y + SCROLLABLE_ROW_HEIGHT < dpi.y) + continue; + + StringId stringId = STR_BLACK_STRING; + + // If hovering over item, change the color and fill the backdrop. + if (i == selected_list_item) + { + stringId = STR_WINDOW_COLOUR_2_STRINGID; + GfxFilterRect(dpi, { 0, y, listWidth, y + SCROLLABLE_ROW_HEIGHT }, FilterPaletteID::PaletteDarken1); + } + // display a marker next to the currently loaded game file + if (_listItems[i].loaded) + { + auto ft = Formatter(); + ft.Add(STR_RIGHTGUILLEMET); + DrawTextBasic(dpi, { 0, y }, stringId, ft); + } + + // Print filename + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(_listItems[i].name.c_str()); + int32_t max_file_width = widgets[WIDX_SORT_NAME].width() - 10; + DrawTextEllipsised(dpi, { 10, y }, max_file_width, stringId, ft); + + // Print formatted modified date, if this is a file + if (_listItems[i].type == TYPE_FILE) + { + ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(_listItems[i].date_formatted.c_str()); + DrawTextEllipsised( + dpi, { dateAnchor - DATE_TIME_GAP, y }, maxDateWidth, stringId, ft, { TextAlignment::RIGHT }); + + ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(_listItems[i].time_formatted.c_str()); + DrawTextEllipsised(dpi, { dateAnchor + DATE_TIME_GAP, y }, maxTimeWidth, stringId, ft); + } + } + } +#pragma endregion + }; + + WindowBase* LoadsaveOpen( + int32_t type, std::string_view defaultPath, std::function callback, + TrackDesign* trackDesign) + { + _loadSaveCallback = callback; + _trackDesign = trackDesign; + _type = type; + _defaultPath = defaultPath; + + bool isSave = (type & 0x01) == LOADSAVETYPE_SAVE; + + // Bypass the lot? + auto hasFilePicker = OpenRCT2::GetContext()->GetUiContext()->HasFilePicker(); + if (gConfigGeneral.UseNativeBrowseDialog && hasFilePicker) + { + const u8string path = OpenSystemFileBrowser(isSave); + if (!path.empty()) + { + Select(path.c_str()); + } + return nullptr; + } + + const u8string path = GetDir(type); + + auto* w = static_cast(WindowBringToFrontByClass(WindowClass::Loadsave)); + if (w == nullptr) + { + w = WindowCreate( + WindowClass::Loadsave, WW, WH, WF_STICK_TO_FRONT | WF_RESIZABLE | WF_AUTO_POSITION | WF_CENTRE_SCREEN, type); + } + + switch (type & 0x0E) + { + case LOADSAVETYPE_GAME: + w->widgets[WIDX_TITLE].text = isSave ? STR_FILE_DIALOG_TITLE_SAVE_GAME : STR_FILE_DIALOG_TITLE_LOAD_GAME; break; - if (y + SCROLLABLE_ROW_HEIGHT < dpi.y) - continue; + case LOADSAVETYPE_LANDSCAPE: + w->widgets[WIDX_TITLE].text = isSave ? STR_FILE_DIALOG_TITLE_SAVE_LANDSCAPE + : STR_FILE_DIALOG_TITLE_LOAD_LANDSCAPE; + break; - StringId stringId = STR_BLACK_STRING; + case LOADSAVETYPE_SCENARIO: + w->widgets[WIDX_TITLE].text = STR_FILE_DIALOG_TITLE_SAVE_SCENARIO; + break; - // If hovering over item, change the color and fill the backdrop. - if (i == selected_list_item) - { - stringId = STR_WINDOW_COLOUR_2_STRINGID; - GfxFilterRect(dpi, { 0, y, listWidth, y + SCROLLABLE_ROW_HEIGHT }, FilterPaletteID::PaletteDarken1); - } - // display a marker next to the currently loaded game file - if (_listItems[i].loaded) - { - auto ft = Formatter(); - ft.Add(STR_RIGHTGUILLEMET); - DrawTextBasic(dpi, { 0, y }, stringId, ft); - } + case LOADSAVETYPE_TRACK: + w->widgets[WIDX_TITLE].text = isSave ? STR_FILE_DIALOG_TITLE_SAVE_TRACK + : STR_FILE_DIALOG_TITLE_INSTALL_NEW_TRACK_DESIGN; + break; - // Print filename - auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(_listItems[i].name.c_str()); - int32_t max_file_width = widgets[WIDX_SORT_NAME].width() - 10; - DrawTextEllipsised(dpi, { 10, y }, max_file_width, stringId, ft); + case LOADSAVETYPE_HEIGHTMAP: + Guard::Assert(!isSave, "Cannot save images through loadsave window"); + w->widgets[WIDX_TITLE].text = STR_FILE_DIALOG_TITLE_LOAD_HEIGHTMAP; + break; - // Print formatted modified date, if this is a file - if (_listItems[i].type == TYPE_FILE) - { - ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(_listItems[i].date_formatted.c_str()); - DrawTextEllipsised( - dpi, { dateAnchor - DATE_TIME_GAP, y }, maxDateWidth, stringId, ft, { TextAlignment::RIGHT }); - - ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(_listItems[i].time_formatted.c_str()); - DrawTextEllipsised(dpi, { dateAnchor + DATE_TIME_GAP, y }, maxTimeWidth, stringId, ft); - } + default: + Guard::Fail("Unsupported load/save type: %d", type & 0x0F); + break; } + + return w; } -#pragma endregion -}; - -WindowBase* WindowLoadsaveOpen( - int32_t type, std::string_view defaultPath, std::function callback, - TrackDesign* trackDesign) -{ - _loadSaveCallback = callback; - _trackDesign = trackDesign; - _type = type; - _defaultPath = defaultPath; - - bool isSave = (type & 0x01) == LOADSAVETYPE_SAVE; - - // Bypass the lot? - auto hasFilePicker = OpenRCT2::GetContext()->GetUiContext()->HasFilePicker(); - if (gConfigGeneral.UseNativeBrowseDialog && hasFilePicker) - { - const u8string path = OpenSystemFileBrowser(isSave); - if (!path.empty()) - { - Select(path.c_str()); - } - return nullptr; - } - - const u8string path = GetDir(type); - - auto* w = static_cast(WindowBringToFrontByClass(WindowClass::Loadsave)); - if (w == nullptr) - { - w = WindowCreate( - WindowClass::Loadsave, WW, WH, WF_STICK_TO_FRONT | WF_RESIZABLE | WF_AUTO_POSITION | WF_CENTRE_SCREEN, type); - } - - switch (type & 0x0E) - { - case LOADSAVETYPE_GAME: - w->widgets[WIDX_TITLE].text = isSave ? STR_FILE_DIALOG_TITLE_SAVE_GAME : STR_FILE_DIALOG_TITLE_LOAD_GAME; - break; - - case LOADSAVETYPE_LANDSCAPE: - w->widgets[WIDX_TITLE].text = isSave ? STR_FILE_DIALOG_TITLE_SAVE_LANDSCAPE : STR_FILE_DIALOG_TITLE_LOAD_LANDSCAPE; - break; - - case LOADSAVETYPE_SCENARIO: - w->widgets[WIDX_TITLE].text = STR_FILE_DIALOG_TITLE_SAVE_SCENARIO; - break; - - case LOADSAVETYPE_TRACK: - w->widgets[WIDX_TITLE].text = isSave ? STR_FILE_DIALOG_TITLE_SAVE_TRACK - : STR_FILE_DIALOG_TITLE_INSTALL_NEW_TRACK_DESIGN; - break; - - case LOADSAVETYPE_HEIGHTMAP: - Guard::Assert(!isSave, "Cannot save images through loadsave window"); - w->widgets[WIDX_TITLE].text = STR_FILE_DIALOG_TITLE_LOAD_HEIGHTMAP; - break; - - default: - Guard::Fail("Unsupported load/save type: %d", type & 0x0F); - break; - } - - return w; -} #pragma region Overwrite prompt -constexpr int32_t OVERWRITE_WW = 200; -constexpr int32_t OVERWRITE_WH = 100; + constexpr int32_t OVERWRITE_WW = 200; + constexpr int32_t OVERWRITE_WH = 100; -enum -{ - WIDX_OVERWRITE_BACKGROUND, - WIDX_OVERWRITE_TITLE, - WIDX_OVERWRITE_CLOSE, - WIDX_OVERWRITE_OVERWRITE, - WIDX_OVERWRITE_CANCEL -}; - -static Widget window_overwrite_prompt_widgets[] = { - WINDOW_SHIM_WHITE(STR_FILEBROWSER_OVERWRITE_TITLE, OVERWRITE_WW, OVERWRITE_WH), - { WindowWidgetType::Button, 0, 10, 94, OVERWRITE_WH - 20, OVERWRITE_WH - 9, STR_FILEBROWSER_OVERWRITE_TITLE, STR_NONE }, - { WindowWidgetType::Button, 0, OVERWRITE_WW - 95, OVERWRITE_WW - 11, OVERWRITE_WH - 20, OVERWRITE_WH - 9, - STR_SAVE_PROMPT_CANCEL, STR_NONE }, - WIDGETS_END, -}; - -class OverwritePromptWindow final : public Window -{ - std::string _name; - std::string _path; - -public: - OverwritePromptWindow(const std::string_view name, const std::string_view path) - : _name(name) - , _path(path) + enum { - } + WIDX_OVERWRITE_BACKGROUND, + WIDX_OVERWRITE_TITLE, + WIDX_OVERWRITE_CLOSE, + WIDX_OVERWRITE_OVERWRITE, + WIDX_OVERWRITE_CANCEL + }; - void OnOpen() override - { - widgets = window_overwrite_prompt_widgets; - colours[0] = TRANSLUCENT(COLOUR_BORDEAUX_RED); - } + static Widget window_overwrite_prompt_widgets[] = { + WINDOW_SHIM_WHITE(STR_FILEBROWSER_OVERWRITE_TITLE, OVERWRITE_WW, OVERWRITE_WH), + { WindowWidgetType::Button, 0, 10, 94, OVERWRITE_WH - 20, OVERWRITE_WH - 9, STR_FILEBROWSER_OVERWRITE_TITLE, STR_NONE }, + { WindowWidgetType::Button, 0, OVERWRITE_WW - 95, OVERWRITE_WW - 11, OVERWRITE_WH - 20, OVERWRITE_WH - 9, + STR_SAVE_PROMPT_CANCEL, STR_NONE }, + kWidgetsEnd, + }; - void OnMouseUp(WidgetIndex widgetIndex) override + class OverwritePromptWindow final : public Window { - switch (widgetIndex) + std::string _name; + std::string _path; + + public: + OverwritePromptWindow(const std::string_view name, const std::string_view path) + : _name(name) + , _path(path) { - case WIDX_OVERWRITE_OVERWRITE: - { - Select(_path.c_str()); - - // As the LoadSaveWindow::Select function can change the order of the - // windows we can't use WindowClose(w). - WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt); - break; - } - - case WIDX_OVERWRITE_CANCEL: - case WIDX_OVERWRITE_CLOSE: - Close(); - break; } - } - void OnDraw(DrawPixelInfo& dpi) override + void OnOpen() override + { + widgets = window_overwrite_prompt_widgets; + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_OVERWRITE_OVERWRITE: + { + Select(_path.c_str()); + + // As the LoadSaveWindow::Select function can change the order of the + // windows we can't use WindowClose(w). + WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt); + break; + } + + case WIDX_OVERWRITE_CANCEL: + case WIDX_OVERWRITE_CLOSE: + Close(); + break; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(_name.c_str()); + + ScreenCoordsXY stringCoords(windowPos.x + width / 2, windowPos.y + (height / 2) - 3); + DrawTextWrapped(dpi, stringCoords, width - 4, STR_FILEBROWSER_OVERWRITE_PROMPT, ft, { TextAlignment::CENTRE }); + } + }; + + static WindowBase* WindowOverwritePromptOpen(const std::string_view name, const std::string_view path) { - DrawWidgets(dpi); + WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt); - auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(_name.c_str()); - - ScreenCoordsXY stringCoords(windowPos.x + width / 2, windowPos.y + (height / 2) - 3); - DrawTextWrapped(dpi, stringCoords, width - 4, STR_FILEBROWSER_OVERWRITE_PROMPT, ft, { TextAlignment::CENTRE }); + return WindowCreate( + WindowClass::LoadsaveOverwritePrompt, OVERWRITE_WW, OVERWRITE_WH, + WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN, name, path); } -}; - -static WindowBase* WindowOverwritePromptOpen(const std::string_view name, const std::string_view path) -{ - WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt); - - return WindowCreate( - WindowClass::LoadsaveOverwritePrompt, OVERWRITE_WW, OVERWRITE_WH, WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN, - name, path); -} #pragma endregion +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Main.cpp b/src/openrct2-ui/windows/Main.cpp index 6b3d414c17..ad1a749eee 100644 --- a/src/openrct2-ui/windows/Main.cpp +++ b/src/openrct2-ui/windows/Main.cpp @@ -15,63 +15,67 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off static Widget _mainWidgets[] = { MakeWidget({0, 0}, {0, 0}, WindowWidgetType::Viewport, WindowColour::Primary, STR_VIEWPORT), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class MainWindow final : public Window -{ -public: - void OnOpen() override + class MainWindow final : public Window { - _mainWidgets[0].right = width; - _mainWidgets[0].bottom = height; - widgets = _mainWidgets; - - ViewportCreate(this, windowPos, width, height, Focus(CoordsXYZ(0x0FFF, 0x0FFF, 0))); - if (viewport != nullptr) + public: + void OnOpen() override { - SetViewportFlags(); + _mainWidgets[0].right = width; + _mainWidgets[0].bottom = height; + widgets = _mainWidgets; + + ViewportCreate(this, windowPos, width, height, Focus(CoordsXYZ(0x0FFF, 0x0FFF, 0))); + if (viewport != nullptr) + { + SetViewportFlags(); + viewport->rotation = 0; + } + gShowGridLinesRefCount = 0; + gShowLandRightsRefCount = 0; + gShowConstructionRightsRefCount = 0; + WindowFootpathResetSelectedPath(); } - gCurrentRotation = 0; - gShowGridLinesRefCount = 0; - gShowLandRightsRefCount = 0; - gShowConstructionRightsRefCount = 0; - WindowFootpathResetSelectedPath(); - } - void OnDraw(DrawPixelInfo& dpi) override + void OnDraw(DrawPixelInfo& dpi) override + { + ViewportRender(dpi, viewport, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }); + } + + private: + void SetViewportFlags() + { + viewport->flags |= VIEWPORT_FLAG_SOUND_ON; + if (gConfigGeneral.InvisibleRides) + viewport->flags |= VIEWPORT_FLAG_INVISIBLE_RIDES; + if (gConfigGeneral.InvisibleVehicles) + viewport->flags |= VIEWPORT_FLAG_INVISIBLE_VEHICLES; + if (gConfigGeneral.InvisibleTrees) + viewport->flags |= VIEWPORT_FLAG_INVISIBLE_VEGETATION; + if (gConfigGeneral.InvisibleScenery) + viewport->flags |= VIEWPORT_FLAG_INVISIBLE_SCENERY; + if (gConfigGeneral.InvisiblePaths) + viewport->flags |= VIEWPORT_FLAG_INVISIBLE_PATHS; + if (gConfigGeneral.InvisibleSupports) + viewport->flags |= VIEWPORT_FLAG_INVISIBLE_SUPPORTS; + } + }; + + /** + * Creates the main window that holds the main viewport. + * rct2: 0x0066B3E8 + */ + WindowBase* MainOpen() { - ViewportRender(dpi, viewport, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }); + return WindowCreate( + WindowClass::MainWindow, { 0, 0 }, ContextGetWidth(), ContextGetHeight(), WF_STICK_TO_BACK); } - -private: - void SetViewportFlags() - { - viewport->flags |= VIEWPORT_FLAG_SOUND_ON; - if (gConfigGeneral.InvisibleRides) - viewport->flags |= VIEWPORT_FLAG_INVISIBLE_RIDES; - if (gConfigGeneral.InvisibleVehicles) - viewport->flags |= VIEWPORT_FLAG_INVISIBLE_VEHICLES; - if (gConfigGeneral.InvisibleTrees) - viewport->flags |= VIEWPORT_FLAG_INVISIBLE_VEGETATION; - if (gConfigGeneral.InvisibleScenery) - viewport->flags |= VIEWPORT_FLAG_INVISIBLE_SCENERY; - if (gConfigGeneral.InvisiblePaths) - viewport->flags |= VIEWPORT_FLAG_INVISIBLE_PATHS; - if (gConfigGeneral.InvisibleSupports) - viewport->flags |= VIEWPORT_FLAG_INVISIBLE_SUPPORTS; - } -}; - -/** - * Creates the main window that holds the main viewport. - * rct2: 0x0066B3E8 - */ -WindowBase* WindowMainOpen() -{ - return WindowCreate(WindowClass::MainWindow, { 0, 0 }, ContextGetWidth(), ContextGetHeight(), WF_STICK_TO_BACK); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 1b245162d8..a5318e8fa0 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -39,70 +40,70 @@ #include #include -using namespace OpenRCT2; - -static constexpr uint16_t MapColour2(uint8_t colourA, uint8_t colourB) +namespace OpenRCT2::Ui::Windows { - return (colourA << 8) | colourB; -} -static constexpr uint16_t MapColour(uint8_t colour) -{ - return MapColour2(colour, colour); -} -static constexpr uint16_t MapColourUnowned(uint16_t colour) -{ - return MapColour2((colour & 0xFF00) >> 8, PALETTE_INDEX_10); -} + static constexpr uint16_t MapColour2(uint8_t colourA, uint8_t colourB) + { + return (colourA << 8) | colourB; + } + static constexpr uint16_t MapColour(uint8_t colour) + { + return MapColour2(colour, colour); + } + static constexpr uint16_t MapColourUnowned(uint16_t colour) + { + return MapColour2((colour & 0xFF00) >> 8, PALETTE_INDEX_10); + } -constexpr int32_t MAP_WINDOW_MAP_SIZE = MAXIMUM_MAP_SIZE_TECHNICAL * 2; + constexpr int32_t MAP_WINDOW_MAP_SIZE = kMaximumMapSizeTechnical * 2; -static constexpr StringId WINDOW_TITLE = STR_MAP_LABEL; -static constexpr int32_t WH = 259; -static constexpr int32_t WW = 245; + static constexpr StringId WINDOW_TITLE = STR_MAP_LABEL; + static constexpr int32_t WH = 259; + static constexpr int32_t WW = 245; -// Some functions manipulate coordinates on the map. These are the coordinates of the pixels in the -// minimap. In order to distinguish those from actual coordinates, we use a separate name. -using MapCoordsXY = TileCoordsXY; + // Some functions manipulate coordinates on the map. These are the coordinates of the pixels in the + // minimap. In order to distinguish those from actual coordinates, we use a separate name. + using MapCoordsXY = TileCoordsXY; -enum -{ - PAGE_PEEPS, - PAGE_RIDES -}; + enum + { + PAGE_PEEPS, + PAGE_RIDES + }; -enum WindowMapWidgetIdx -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_RESIZE, - WIDX_PEOPLE_TAB, - WIDX_RIDES_TAB, - WIDX_MAP, - WIDX_MAP_SIZE_SPINNER_Y, - WIDX_MAP_SIZE_SPINNER_Y_UP, - WIDX_MAP_SIZE_SPINNER_Y_DOWN, - WIDX_MAP_SIZE_LINK, - WIDX_MAP_SIZE_SPINNER_X, - WIDX_MAP_SIZE_SPINNER_X_UP, - WIDX_MAP_SIZE_SPINNER_X_DOWN, - WIDX_SET_LAND_RIGHTS, - WIDX_BUILD_PARK_ENTRANCE, - WIDX_PEOPLE_STARTING_POSITION, - WIDX_LAND_TOOL, - WIDX_LAND_TOOL_SMALLER, - WIDX_LAND_TOOL_LARGER, - WIDX_LAND_OWNED_CHECKBOX, - WIDX_CONSTRUCTION_RIGHTS_OWNED_CHECKBOX, - WIDX_LAND_SALE_CHECKBOX, - WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX, - WIDX_ROTATE_90, - WIDX_MAP_GENERATOR -}; + enum WindowMapWidgetIdx + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_RESIZE, + WIDX_PEOPLE_TAB, + WIDX_RIDES_TAB, + WIDX_MAP, + WIDX_MAP_SIZE_SPINNER_Y, + WIDX_MAP_SIZE_SPINNER_Y_UP, + WIDX_MAP_SIZE_SPINNER_Y_DOWN, + WIDX_MAP_SIZE_LINK, + WIDX_MAP_SIZE_SPINNER_X, + WIDX_MAP_SIZE_SPINNER_X_UP, + WIDX_MAP_SIZE_SPINNER_X_DOWN, + WIDX_SET_LAND_RIGHTS, + WIDX_BUILD_PARK_ENTRANCE, + WIDX_PEOPLE_STARTING_POSITION, + WIDX_LAND_TOOL, + WIDX_LAND_TOOL_SMALLER, + WIDX_LAND_TOOL_LARGER, + WIDX_LAND_OWNED_CHECKBOX, + WIDX_CONSTRUCTION_RIGHTS_OWNED_CHECKBOX, + WIDX_LAND_SALE_CHECKBOX, + WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX, + WIDX_ROTATE_90, + WIDX_MAP_GENERATOR + }; -validate_global_widx(WC_MAP, WIDX_ROTATE_90); + validate_global_widx(WC_MAP, WIDX_ROTATE_90); -// clang-format off + // clang-format off static Widget window_map_widgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget ({ 0, 43}, {245, 215}, WindowWidgetType::Resize, WindowColour::Secondary ), @@ -124,1297 +125,23 @@ static Widget window_map_widgets[] = { MakeWidget ({ 58, 197}, {174, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CONSTRUCTION_RIGHTS_SALE, STR_SET_CONSTRUCTION_RIGHTS_TO_BE_AVAILABLE_TIP), MakeWidget ({218, 45}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_OBJECTS_90 ), MakeWidget ({110, 189}, {131, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_MAPGEN_WINDOW_TITLE, STR_MAP_GENERATOR_TIP ), - WIDGETS_END, + kWidgetsEnd, }; // used in transforming viewport view coordinates to minimap coordinates // rct2: 0x00981BBC static constexpr ScreenCoordsXY MiniMapOffsets[] = { - { MAXIMUM_MAP_SIZE_TECHNICAL - 8, 0 }, - { 2 * MAXIMUM_MAP_SIZE_TECHNICAL - 8, MAXIMUM_MAP_SIZE_TECHNICAL }, - { MAXIMUM_MAP_SIZE_TECHNICAL - 8, 2 * MAXIMUM_MAP_SIZE_TECHNICAL }, - { 0 - 8, MAXIMUM_MAP_SIZE_TECHNICAL }, + { kMaximumMapSizeTechnical - 8, 0 }, + { 2 * kMaximumMapSizeTechnical - 8, kMaximumMapSizeTechnical }, + { kMaximumMapSizeTechnical - 8, 2 * kMaximumMapSizeTechnical }, + { 0 - 8, kMaximumMapSizeTechnical }, }; -// clang-format on + // clang-format on -class MapWindow final : public Window -{ - uint8_t _rotation; - -public: - MapWindow() - { - _mapImageData.resize(MAP_WINDOW_MAP_SIZE * MAP_WINDOW_MAP_SIZE); - } - - void OnOpen() override - { - widgets = window_map_widgets; - - hold_down_widgets = (1uLL << WIDX_MAP_SIZE_SPINNER_Y_UP) | (1uLL << WIDX_MAP_SIZE_SPINNER_Y_DOWN) - | (1uLL << WIDX_MAP_SIZE_SPINNER_X_UP) | (1uLL << WIDX_MAP_SIZE_SPINNER_X_DOWN) | (1uLL << WIDX_LAND_TOOL_LARGER) - | (1uLL << WIDX_LAND_TOOL_SMALLER); - - ResizeMap(); - InitScrollWidgets(); - - _rotation = GetCurrentRotation(); - - InitMap(); - gWindowSceneryRotation = 0; - CentreMapOnViewPoint(); - FootpathSelectDefault(); - - auto& gameState = GetGameState(); - _mapWidthAndHeightLinked = gameState.MapSize.x == gameState.MapSize.y; - - // Reset land rights tool size - _landRightsToolSize = 1; - } - - void OnClose() override - { - _mapImageData.clear(); - _mapImageData.shrink_to_fit(); - if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == classification - && gCurrentToolWidget.window_number == number) - { - ToolCancel(); - } - } - - void OnResize() override - { - flags |= WF_RESIZABLE; - min_width = 245; - max_width = 800; - min_height = 259; - max_height = 560; - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_SET_LAND_RIGHTS: - Invalidate(); - if (ToolSet(*this, widgetIndex, Tool::UpArrow)) - break; - _activeTool = 2; - // Prevent mountain tool size. - _landRightsToolSize = std::max(kLandToolMinimumSize, _landRightsToolSize); - ShowGridlines(); - ShowLandRights(); - ShowConstructionRights(); - break; - case WIDX_LAND_OWNED_CHECKBOX: - _activeTool ^= 2; - - if (_activeTool & 2) - _activeTool &= 0xF2; - - Invalidate(); - break; - case WIDX_LAND_SALE_CHECKBOX: - _activeTool ^= 8; - - if (_activeTool & 8) - _activeTool &= 0xF8; - - Invalidate(); - break; - case WIDX_CONSTRUCTION_RIGHTS_OWNED_CHECKBOX: - _activeTool ^= 1; - - if (_activeTool & 1) - _activeTool &= 0xF1; - - Invalidate(); - break; - case WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX: - _activeTool ^= 4; - - if (_activeTool & 4) - _activeTool &= 0xF4; - - Invalidate(); - break; - case WIDX_BUILD_PARK_ENTRANCE: - Invalidate(); - if (ToolSet(*this, widgetIndex, Tool::UpArrow)) - break; - - gParkEntranceGhostExists = false; - InputSetFlag(INPUT_FLAG_6, true); - - ShowGridlines(); - ShowLandRights(); - ShowConstructionRights(); - break; - case WIDX_ROTATE_90: - gWindowSceneryRotation = (gWindowSceneryRotation + 1) & 3; - break; - case WIDX_PEOPLE_STARTING_POSITION: - if (ToolSet(*this, widgetIndex, Tool::UpArrow)) - break; - - ShowGridlines(); - ShowLandRights(); - ShowConstructionRights(); - break; - case WIDX_LAND_TOOL: - InputLandSize(); - break; - case WIDX_MAP_SIZE_SPINNER_Y: - case WIDX_MAP_SIZE_SPINNER_X: - InputMapSize(widgetIndex); - break; - case WIDX_MAP_SIZE_LINK: - _mapWidthAndHeightLinked = !_mapWidthAndHeightLinked; - break; - case WIDX_MAP_GENERATOR: - ContextOpenWindow(WindowClass::Mapgen); - break; - default: - if (widgetIndex >= WIDX_PEOPLE_TAB && widgetIndex <= WIDX_RIDES_TAB) - { - widgetIndex -= WIDX_PEOPLE_TAB; - if (widgetIndex == selected_tab) - break; - - selected_tab = widgetIndex; - list_information_type = 0; - } - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_MAP_SIZE_SPINNER_Y_UP: - _resizeDirection = ResizeDirection::Y; - IncreaseMapSize(); - break; - case WIDX_MAP_SIZE_SPINNER_Y_DOWN: - _resizeDirection = ResizeDirection::Y; - DecreaseMapSize(); - break; - case WIDX_MAP_SIZE_SPINNER_X_UP: - _resizeDirection = ResizeDirection::X; - IncreaseMapSize(); - break; - case WIDX_MAP_SIZE_SPINNER_X_DOWN: - _resizeDirection = ResizeDirection::X; - DecreaseMapSize(); - break; - case WIDX_LAND_TOOL_SMALLER: - // Decrement land rights tool size - _landRightsToolSize = std::max(kLandToolMinimumSize, _landRightsToolSize - 1); - - Invalidate(); - break; - case WIDX_LAND_TOOL_LARGER: - // Increment land rights tool size - _landRightsToolSize = std::min(kLandToolMaximumSize, _landRightsToolSize + 1); - - Invalidate(); - break; - } - } - - void OnUpdate() override - { - if (GetCurrentRotation() != _rotation) - { - _rotation = GetCurrentRotation(); - InitMap(); - CentreMapOnViewPoint(); - } - - for (int32_t i = 0; i < 16; i++) - SetMapPixels(); - - Invalidate(); - - // Update tab animations - list_information_type++; - switch (selected_tab) - { - case PAGE_PEEPS: - if (list_information_type >= 32) - { - list_information_type = 0; - } - break; - case PAGE_RIDES: - if (list_information_type >= 64) - { - list_information_type = 0; - } - break; - } - } - - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (widgetIndex) - { - case WIDX_SET_LAND_RIGHTS: - SetLandRightsToolUpdate(screenCoords); - break; - case WIDX_BUILD_PARK_ENTRANCE: - PlaceParkEntranceToolUpdate(screenCoords); - break; - case WIDX_PEOPLE_STARTING_POSITION: - SetPeepSpawnToolUpdate(screenCoords); - break; - } - } - - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (widgetIndex) - { - case WIDX_BUILD_PARK_ENTRANCE: - PlaceParkEntranceToolDown(screenCoords); - break; - case WIDX_PEOPLE_STARTING_POSITION: - SetPeepSpawnToolDown(screenCoords); - break; - } - } - - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (widgetIndex) - { - case WIDX_SET_LAND_RIGHTS: - if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) - { - auto landSetRightsAction = LandSetRightsAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, - LandSetRightSetting::SetOwnershipWithChecks, _activeTool << 4); - GameActions::Execute(&landSetRightsAction); - } - break; - } - } - - void OnToolAbort(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_SET_LAND_RIGHTS: - Invalidate(); - HideGridlines(); - HideLandRights(); - HideConstructionRights(); - break; - case WIDX_BUILD_PARK_ENTRANCE: - ParkEntranceRemoveGhost(); - Invalidate(); - HideGridlines(); - HideLandRights(); - HideConstructionRights(); - break; - case WIDX_PEOPLE_STARTING_POSITION: - Invalidate(); - HideGridlines(); - HideLandRights(); - HideConstructionRights(); - break; - } - } - - void SetLandRightsToolUpdate(const ScreenCoordsXY& screenCoords) - { - MapInvalidateSelectionRect(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - - auto info = GetMapCoordinatesFromPos( - screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water)); - if (info.SpriteType == ViewportInteractionItem::None) - return; - - auto mapCoords = info.Loc; - - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectType = MAP_SELECT_TYPE_FULL_LAND_RIGHTS; - - int32_t landRightsToolSize = _landRightsToolSize; - if (landRightsToolSize == 0) - landRightsToolSize = 1; - - int32_t size = (landRightsToolSize * 32) - 32; - int32_t radius = (landRightsToolSize * 16) - 16; - mapCoords.x -= radius; - mapCoords.y -= radius; - mapCoords = mapCoords.ToTileStart(); - gMapSelectPositionA = mapCoords; - gMapSelectPositionB.x = mapCoords.x + size; - gMapSelectPositionB.y = mapCoords.y + size; - MapInvalidateSelectionRect(); - } - - CoordsXYZD PlaceParkEntranceGetMapPosition(const ScreenCoordsXY& screenCoords) - { - CoordsXYZD parkEntranceMapPosition{ 0, 0, 0, INVALID_DIRECTION }; - const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); - parkEntranceMapPosition = { mapCoords.x, mapCoords.y, 0, INVALID_DIRECTION }; - if (parkEntranceMapPosition.IsNull()) - return parkEntranceMapPosition; - - auto surfaceElement = MapGetSurfaceElementAt(mapCoords); - if (surfaceElement == nullptr) - { - parkEntranceMapPosition.SetNull(); - return parkEntranceMapPosition; - } - - parkEntranceMapPosition.z = surfaceElement->GetWaterHeight(); - if (parkEntranceMapPosition.z == 0) - { - parkEntranceMapPosition.z = surfaceElement->GetBaseZ(); - if ((surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) != 0) - { - parkEntranceMapPosition.z += 16; - if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) - { - parkEntranceMapPosition.z += 16; - } - } - } - parkEntranceMapPosition.direction = (gWindowSceneryRotation - GetCurrentRotation()) & 3; - return parkEntranceMapPosition; - } - - void PlaceParkEntranceToolUpdate(const ScreenCoordsXY& screenCoords) - { - MapInvalidateSelectionRect(); - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords); - if (parkEntrancePosition.IsNull()) - { - ParkEntranceRemoveGhost(); - return; - } - - int32_t sideDirection = (parkEntrancePosition.direction + 1) & 3; - gMapSelectionTiles.clear(); - gMapSelectionTiles.push_back({ parkEntrancePosition.x, parkEntrancePosition.y }); - gMapSelectionTiles.push_back({ parkEntrancePosition.x + CoordsDirectionDelta[sideDirection].x, - parkEntrancePosition.y + CoordsDirectionDelta[sideDirection].y }); - gMapSelectionTiles.push_back({ parkEntrancePosition.x - CoordsDirectionDelta[sideDirection].x, - parkEntrancePosition.y - CoordsDirectionDelta[sideDirection].y }); - - gMapSelectArrowPosition = parkEntrancePosition; - gMapSelectArrowDirection = parkEntrancePosition.direction; - - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT | MAP_SELECT_FLAG_ENABLE_ARROW; - MapInvalidateMapSelectionTiles(); - if (gParkEntranceGhostExists && parkEntrancePosition == gParkEntranceGhostPosition) - { - return; - } - - ParkEntranceRemoveGhost(); - - auto gameAction = ParkEntrancePlaceAction(parkEntrancePosition, gFootpathSelectedId); - gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST); - - auto result = GameActions::Execute(&gameAction); - if (result.Error == GameActions::Status::Ok) - { - gParkEntranceGhostPosition = parkEntrancePosition; - gParkEntranceGhostExists = true; - } - } - - void PlaceParkEntranceToolDown(const ScreenCoordsXY& screenCoords) - { - ParkEntranceRemoveGhost(); - - CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords); - if (!parkEntrancePosition.IsNull()) - { - auto gameAction = ParkEntrancePlaceAction(parkEntrancePosition, gFootpathSelectedId); - auto result = GameActions::Execute(&gameAction); - if (result.Error == GameActions::Status::Ok) - { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result.Position); - } - } - } - - void SetPeepSpawnToolUpdate(const ScreenCoordsXY& screenCoords) - { - int32_t direction; - TileElement* tileElement; - MapInvalidateSelectionRect(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement); - if (mapCoords.IsNull()) - return; - - int32_t mapZ = tileElement->GetBaseZ(); - if (tileElement->GetType() == TileElementType::Surface) - { - if ((tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) != 0) - mapZ += 16; - if (tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) - mapZ += 16; - } - - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; - gMapSelectType = MAP_SELECT_TYPE_FULL; - gMapSelectPositionA = mapCoords; - gMapSelectPositionB = mapCoords; - gMapSelectArrowPosition = CoordsXYZ{ mapCoords, mapZ }; - gMapSelectArrowDirection = DirectionReverse(direction); - MapInvalidateSelectionRect(); - } - - void SetPeepSpawnToolDown(const ScreenCoordsXY& screenCoords) - { - // Verify footpath exists at location, and retrieve coordinates - TileElement* tileElement; - int32_t direction; - auto mapCoords = FootpathGetCoordinatesFromPos(screenCoords, &direction, &tileElement); - if (mapCoords.IsNull()) - return; - - int32_t mapZ = tileElement->GetBaseZ(); - - auto gameAction = PeepSpawnPlaceAction({ mapCoords, mapZ, static_cast(direction) }); - auto result = GameActions::Execute(&gameAction); - if (result.Error == GameActions::Status::Ok) - { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result.Position); - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (text.empty()) - return; - - switch (widgetIndex) - { - case WIDX_LAND_TOOL: - { - char* end; - std::string textStr = std::string(text); - int32_t size = strtol(textStr.c_str(), &end, 10); - if (*end == '\0') - { - size = std::clamp(size, kLandToolMinimumSize, kLandToolMaximumSize); - _landRightsToolSize = size; - Invalidate(); - } - break; - } - case WIDX_MAP_SIZE_SPINNER_Y: - case WIDX_MAP_SIZE_SPINNER_X: - { - char* end; - std::string textStr = std::string(text); - int32_t size = strtol(textStr.c_str(), &end, 10); - if (*end == '\0') - { - // The practical size is 2 lower than the technical size - size += 2; - size = std::clamp(size, MINIMUM_MAP_SIZE_TECHNICAL, MAXIMUM_MAP_SIZE_TECHNICAL); - - TileCoordsXY newMapSize = GetGameState().MapSize; - if (_resizeDirection != ResizeDirection::X) - newMapSize.y = size; - if (_resizeDirection != ResizeDirection::Y) - newMapSize.x = size; - - auto mapChangeSizeAction = MapChangeSizeAction(newMapSize); - GameActions::Execute(&mapChangeSizeAction); - Invalidate(); - } - break; - } - } - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - return ScreenSize(MAP_WINDOW_MAP_SIZE, MAP_WINDOW_MAP_SIZE); - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - CoordsXY c = ScreenToMap(screenCoords); - auto mapCoords = CoordsXY{ std::clamp(c.x, 0, MAXIMUM_MAP_SIZE_BIG - 1), std::clamp(c.y, 0, MAXIMUM_MAP_SIZE_BIG - 1) }; - auto mapZ = TileElementHeight(mapCoords); - - WindowBase* mainWindow = WindowGetMain(); - if (mainWindow != nullptr) - { - WindowScrollToLocation(*mainWindow, { mapCoords, mapZ }); - } - - if (LandToolIsActive()) - { - // Set land terrain - int32_t landToolSize = std::max(1, gLandToolSize); - int32_t size = (landToolSize * 32) - 32; - int32_t radius = (landToolSize * 16) - 16; - - mapCoords = (mapCoords - CoordsXY{ radius, radius }).ToTileStart(); - MapInvalidateSelectionRect(); - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectType = MAP_SELECT_TYPE_FULL; - gMapSelectPositionA = mapCoords; - gMapSelectPositionB = mapCoords + CoordsXY{ size, size }; - MapInvalidateSelectionRect(); - - auto surfaceSetStyleAction = SurfaceSetStyleAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, - gLandToolTerrainSurface, gLandToolTerrainEdge); - GameActions::Execute(&surfaceSetStyleAction); - } - else if (WidgetIsActiveTool(*this, WIDX_SET_LAND_RIGHTS)) - { - // Set land rights - int32_t landRightsToolSize = std::max(1, _landRightsToolSize); - int32_t size = (landRightsToolSize * 32) - 32; - int32_t radius = (landRightsToolSize * 16) - 16; - mapCoords = (mapCoords - CoordsXY{ radius, radius }).ToTileStart(); - - MapInvalidateSelectionRect(); - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectType = MAP_SELECT_TYPE_FULL_LAND_RIGHTS; - gMapSelectPositionA = mapCoords; - gMapSelectPositionB = mapCoords + CoordsXY{ size, size }; - MapInvalidateSelectionRect(); - - auto landSetRightsAction = LandSetRightsAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, - LandSetRightSetting::SetOwnershipWithChecks, _activeTool << 4); - GameActions::Execute(&landSetRightsAction); - } - } - - void OnScrollMouseDrag(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - OnScrollMouseDown(scrollIndex, screenCoords); - } - - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - GfxClear(&dpi, PALETTE_INDEX_10); - - G1Element g1temp = {}; - g1temp.offset = _mapImageData.data(); - g1temp.width = MAP_WINDOW_MAP_SIZE; - g1temp.height = MAP_WINDOW_MAP_SIZE; - g1temp.x_offset = -8; - g1temp.y_offset = -8; - GfxSetG1Element(SPR_TEMP, &g1temp); - DrawingEngineInvalidateImage(SPR_TEMP); - GfxDrawSprite(dpi, ImageId(SPR_TEMP), { 0, 0 }); - - if (selected_tab == PAGE_PEEPS) - { - PaintPeepOverlay(dpi); - } - else - { - PaintTrainOverlay(dpi); - } - PaintHudRectangle(dpi); - } - - void OnPrepareDraw() override - { - // Set the pressed widgets - pressed_widgets = 0; - SetWidgetPressed(WIDX_MAP_SIZE_LINK, _mapWidthAndHeightLinked); - pressed_widgets |= (1uLL << (WIDX_PEOPLE_TAB + selected_tab)); - pressed_widgets |= (1uLL << WIDX_LAND_TOOL); - - if (_activeTool & (1 << 3)) - pressed_widgets |= (1uLL << WIDX_LAND_SALE_CHECKBOX); - - if (_activeTool & (1 << 2)) - pressed_widgets |= (1uLL << WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX); - - if (_activeTool & (1 << 1)) - pressed_widgets |= (1uLL << WIDX_LAND_OWNED_CHECKBOX); - - if (_activeTool & (1 << 0)) - pressed_widgets |= (1uLL << WIDX_CONSTRUCTION_RIGHTS_OWNED_CHECKBOX); - - // Set disabled widgets - auto& gameState = GetGameState(); - SetWidgetDisabled(WIDX_MAP_SIZE_LINK, gameState.MapSize.x != gameState.MapSize.y); - - // Resize widgets to window size - ResizeFrameWithPage(); - ResizeMap(); - - widgets[WIDX_MAP_SIZE_SPINNER_Y].top = height - 15; - widgets[WIDX_MAP_SIZE_SPINNER_Y].bottom = height - 4; - widgets[WIDX_MAP_SIZE_SPINNER_Y_UP].top = height - 14; - widgets[WIDX_MAP_SIZE_SPINNER_Y_UP].bottom = height - 5; - widgets[WIDX_MAP_SIZE_SPINNER_Y_DOWN].top = height - 14; - widgets[WIDX_MAP_SIZE_SPINNER_Y_DOWN].bottom = height - 5; - widgets[WIDX_MAP_SIZE_LINK].top = height - 15; - widgets[WIDX_MAP_SIZE_LINK].bottom = height - 4; - widgets[WIDX_MAP_SIZE_SPINNER_X].top = height - 15; - widgets[WIDX_MAP_SIZE_SPINNER_X].bottom = height - 4; - widgets[WIDX_MAP_SIZE_SPINNER_X_UP].top = height - 14; - widgets[WIDX_MAP_SIZE_SPINNER_X_UP].bottom = height - 5; - widgets[WIDX_MAP_SIZE_SPINNER_X_DOWN].top = height - 14; - widgets[WIDX_MAP_SIZE_SPINNER_X_DOWN].bottom = height - 5; - - widgets[WIDX_SET_LAND_RIGHTS].top = height - 70; - widgets[WIDX_SET_LAND_RIGHTS].bottom = height - 70 + 23; - widgets[WIDX_BUILD_PARK_ENTRANCE].top = height - 46; - widgets[WIDX_BUILD_PARK_ENTRANCE].bottom = height - 46 + 23; - widgets[WIDX_ROTATE_90].top = height - 46; - widgets[WIDX_ROTATE_90].bottom = height - 46 + 23; - widgets[WIDX_PEOPLE_STARTING_POSITION].top = height - 46; - widgets[WIDX_PEOPLE_STARTING_POSITION].bottom = height - 46 + 23; - - widgets[WIDX_LAND_TOOL].top = height - 42; - widgets[WIDX_LAND_TOOL].bottom = height - 42 + 30; - widgets[WIDX_LAND_TOOL_SMALLER].top = height - 41; - widgets[WIDX_LAND_TOOL_SMALLER].bottom = height - 41 + 15; - widgets[WIDX_LAND_TOOL_LARGER].top = height - 27; - widgets[WIDX_LAND_TOOL_LARGER].bottom = height - 27 + 15; - - widgets[WIDX_MAP_GENERATOR].top = height - 69; - widgets[WIDX_MAP_GENERATOR].bottom = height - 69 + 13; - - // Land tool mode (4 checkboxes) - int checkboxY = height - 55; - for (int32_t i = WIDX_LAND_OWNED_CHECKBOX; i <= WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX; i++) - { - widgets[i].top = checkboxY; - checkboxY += 11; - widgets[i].bottom = checkboxY; - checkboxY += 2; - } - - // Disable all scenario editor related widgets - for (int32_t i = WIDX_MAP_SIZE_SPINNER_Y; i <= WIDX_MAP_GENERATOR; i++) - { - widgets[i].type = WindowWidgetType::Empty; - } - - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) - { - // scenario editor: build park entrance selected, show rotate button - if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::Map - && gCurrentToolWidget.widget_index == WIDX_BUILD_PARK_ENTRANCE) - { - widgets[WIDX_ROTATE_90].type = WindowWidgetType::FlatBtn; - } - - // Always show set land rights button - widgets[WIDX_SET_LAND_RIGHTS].type = WindowWidgetType::FlatBtn; - - // If any tool is active - if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::Map) - { - // if not in set land rights mode: show the default scenario editor buttons - if (gCurrentToolWidget.widget_index != WIDX_SET_LAND_RIGHTS) - { - ShowDefaultScenarioEditorButtons(); - } - else - { // if in set land rights mode: show land tool buttons + modes - widgets[WIDX_LAND_TOOL].type = WindowWidgetType::ImgBtn; - widgets[WIDX_LAND_TOOL_SMALLER].type = WindowWidgetType::TrnBtn; - widgets[WIDX_LAND_TOOL_LARGER].type = WindowWidgetType::TrnBtn; - - for (int32_t i = WIDX_LAND_OWNED_CHECKBOX; i <= WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX; i++) - widgets[i].type = WindowWidgetType::Checkbox; - - widgets[WIDX_LAND_TOOL].image = ImageId(LandTool::SizeToSpriteIndex(_landRightsToolSize)); - } - } - else - { - // if no tool is active: show the default scenario editor buttons - ShowDefaultScenarioEditorButtons(); - } - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - auto screenCoords = windowPos - + ScreenCoordsXY{ window_map_widgets[WIDX_LAND_TOOL].midX(), window_map_widgets[WIDX_LAND_TOOL].midY() }; - - // Draw land tool size - if (WidgetIsActiveTool(*this, WIDX_SET_LAND_RIGHTS) && _landRightsToolSize > kLandToolMaximumSizeWithSprite) - { - auto ft = Formatter(); - ft.Add(_landRightsToolSize); - DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); - } - screenCoords.y = windowPos.y + window_map_widgets[WIDX_LAND_TOOL].bottom + 5; - - // People starting position (scenario editor only) - if (widgets[WIDX_PEOPLE_STARTING_POSITION].type != WindowWidgetType::Empty) - { - screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PEOPLE_STARTING_POSITION].left + 12, - widgets[WIDX_PEOPLE_STARTING_POSITION].top + 18 }; - GfxDrawSprite(dpi, ImageId(SPR_6410, COLOUR_BRIGHT_RED, COLOUR_LIGHT_BROWN), screenCoords); - } - - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) - { - // Render the map legend - if (selected_tab == PAGE_RIDES) - { - screenCoords = windowPos + ScreenCoordsXY{ 4, widgets[WIDX_MAP].bottom + 2 }; - - static constexpr StringId _mapLabels[] = { - STR_MAP_RIDE, STR_MAP_FOOD_STALL, STR_MAP_DRINK_STALL, STR_MAP_SOUVENIR_STALL, - STR_MAP_INFO_KIOSK, STR_MAP_FIRST_AID, STR_MAP_CASH_MACHINE, STR_MAP_TOILET, - }; - static_assert(std::size(RideKeyColours) == std::size(_mapLabels)); - - for (uint32_t i = 0; i < std::size(RideKeyColours); i++) - { - GfxFillRect( - dpi, { screenCoords + ScreenCoordsXY{ 0, 2 }, screenCoords + ScreenCoordsXY{ 6, 8 } }, - RideKeyColours[i]); - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ LIST_ROW_HEIGHT, 0 }, _mapLabels[i], {}); - screenCoords.y += LIST_ROW_HEIGHT; - if (i == 3) - { - screenCoords += { 118, -(LIST_ROW_HEIGHT * 4) }; - } - } - } - } - else if (!WidgetIsActiveTool(*this, WIDX_SET_LAND_RIGHTS)) - { - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_MAP_SIZE_SPINNER_Y].top + 1 }, STR_MAP_SIZE, {}, - { colours[1] }); - } - } - - void ResetMap() - { - InitMap(); - CentreMapOnViewPoint(); - } - -private: - void InitMap() - { - std::fill(_mapImageData.begin(), _mapImageData.end(), PALETTE_INDEX_10); - _currentLine = 0; - } - - void CentreMapOnViewPoint() - { - WindowBase* mainWindow = WindowGetMain(); - int16_t ax, bx, cx, dx; - int16_t bp, di; - - if (mainWindow == nullptr || mainWindow->viewport == nullptr) - return; - - auto offset = MiniMapOffsets[GetCurrentRotation()]; - - // calculate centre view point of viewport and transform it to minimap coordinates - - cx = ((mainWindow->viewport->view_width >> 1) + mainWindow->viewport->viewPos.x) >> 5; - dx = ((mainWindow->viewport->view_height >> 1) + mainWindow->viewport->viewPos.y) >> 4; - cx += offset.x; - dx += offset.y; - - // calculate width and height of minimap - - ax = widgets[WIDX_MAP].width() - 11; - bx = widgets[WIDX_MAP].height() - 11; - bp = ax; - di = bx; - - ax >>= 1; - bx >>= 1; - cx = std::max(cx - ax, 0); - dx = std::max(dx - bx, 0); - - bp = scrolls[0].h_right - bp; - di = scrolls[0].v_bottom - di; - - if (bp < 0 && (bp - cx) < 0) - cx = 0; - - if (di < 0 && (di - dx) < 0) - dx = 0; - - scrolls[0].h_left = cx; - scrolls[0].v_top = dx; - WidgetScrollUpdateThumbs(*this, WIDX_MAP); - } - - void IncreaseMapSize() - { - auto newMapSize = GetGameState().MapSize; - if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::Y) - newMapSize.y++; - if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::X) - newMapSize.x++; - - auto increaseMapSizeAction = MapChangeSizeAction(newMapSize); - GameActions::Execute(&increaseMapSizeAction); - } - - void DecreaseMapSize() - { - auto newMapSize = GetGameState().MapSize; - if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::Y) - newMapSize.y--; - if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::X) - newMapSize.x--; - - auto decreaseMapSizeAction = MapChangeSizeAction(newMapSize); - GameActions::Execute(&decreaseMapSizeAction); - } - - void SetMapPixels() - { - int32_t x = 0, y = 0, dx = 0, dy = 0; - - int32_t pos = (_currentLine * (MAP_WINDOW_MAP_SIZE - 1)) + MAXIMUM_MAP_SIZE_TECHNICAL - 1; - auto destinationPosition = ScreenCoordsXY{ pos % MAP_WINDOW_MAP_SIZE, pos / MAP_WINDOW_MAP_SIZE }; - auto destination = _mapImageData.data() + (destinationPosition.y * MAP_WINDOW_MAP_SIZE) + destinationPosition.x; - switch (GetCurrentRotation()) - { - case 0: - x = _currentLine * COORDS_XY_STEP; - y = 0; - dx = 0; - dy = COORDS_XY_STEP; - break; - case 1: - x = MAXIMUM_TILE_START_XY; - y = _currentLine * COORDS_XY_STEP; - dx = -COORDS_XY_STEP; - dy = 0; - break; - case 2: - x = MAXIMUM_MAP_SIZE_BIG - ((_currentLine + 1) * COORDS_XY_STEP); - y = MAXIMUM_TILE_START_XY; - dx = 0; - dy = -COORDS_XY_STEP; - break; - case 3: - x = 0; - y = MAXIMUM_MAP_SIZE_BIG - ((_currentLine + 1) * COORDS_XY_STEP); - dx = COORDS_XY_STEP; - dy = 0; - break; - } - - for (int32_t i = 0; i < MAXIMUM_MAP_SIZE_TECHNICAL; i++) - { - if (!MapIsEdge({ x, y })) - { - uint16_t colour = 0; - switch (selected_tab) - { - case PAGE_PEEPS: - colour = GetPixelColourPeep({ x, y }); - break; - case PAGE_RIDES: - colour = GetPixelColourRide({ x, y }); - break; - } - destination[0] = (colour >> 8) & 0xFF; - destination[1] = colour; - } - x += dx; - y += dy; - - destinationPosition.x++; - destinationPosition.y++; - destination = _mapImageData.data() + (destinationPosition.y * MAP_WINDOW_MAP_SIZE) + destinationPosition.x; - } - _currentLine++; - if (_currentLine >= MAXIMUM_MAP_SIZE_TECHNICAL) - _currentLine = 0; - } - - uint16_t GetPixelColourPeep(const CoordsXY& c) - { - auto* surfaceElement = MapGetSurfaceElementAt(c); - if (surfaceElement == nullptr) - return 0; - - uint16_t colour = MapColour(PALETTE_INDEX_0); - const auto* surfaceObject = surfaceElement->GetSurfaceObject(); - if (surfaceObject != nullptr) - colour = MapColour2(surfaceObject->MapColours[0], surfaceObject->MapColours[1]); - - if (surfaceElement->GetWaterHeight() > 0) - colour = WaterColour; - - if (!(surfaceElement->GetOwnership() & OWNERSHIP_OWNED)) - colour = MapColourUnowned(colour); - - const int32_t maxSupportedTileElementType = static_cast(std::size(ElementTypeAddColour)); - auto tileElement = reinterpret_cast(surfaceElement); - while (!(tileElement++)->IsLastForTile()) - { - if (tileElement->IsGhost()) - { - colour = MapColour(PALETTE_INDEX_21); - break; - } - - auto tileElementType = tileElement->GetType(); - if (EnumValue(tileElementType) >= maxSupportedTileElementType) - { - tileElementType = TileElementType::Surface; - } - colour &= ElementTypeMaskColour[EnumValue(tileElementType)]; - colour |= ElementTypeAddColour[EnumValue(tileElementType)]; - } - - return colour; - } - - uint16_t GetPixelColourRide(const CoordsXY& c) - { - uint16_t colourA = 0; // highlight colour - uint16_t colourB = MapColour(PALETTE_INDEX_13); // surface colour (dark grey) - - // as an improvement we could use first_element to show underground stuff? - TileElement* tileElement = reinterpret_cast(MapGetSurfaceElementAt(c)); - do - { - if (tileElement == nullptr) - break; - - if (tileElement->IsGhost()) - { - colourA = MapColour(PALETTE_INDEX_21); - break; - } - - switch (tileElement->GetType()) - { - case TileElementType::Surface: - if (tileElement->AsSurface()->GetWaterHeight() > 0) - // Why is this a different water colour as above (195)? - colourB = MapColour(PALETTE_INDEX_194); - if (!(tileElement->AsSurface()->GetOwnership() & OWNERSHIP_OWNED)) - colourB = MapColourUnowned(colourB); - break; - case TileElementType::Path: - colourA = MapColour(PALETTE_INDEX_14); // lighter grey - break; - case TileElementType::Entrance: - { - if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) - break; - Ride* targetRide = GetRide(tileElement->AsEntrance()->GetRideIndex()); - if (targetRide != nullptr) - { - const auto& colourKey = targetRide->GetRideTypeDescriptor().ColourKey; - colourA = RideKeyColours[static_cast(colourKey)]; - } - break; - } - case TileElementType::Track: - { - Ride* targetRide = GetRide(tileElement->AsTrack()->GetRideIndex()); - if (targetRide != nullptr) - { - const auto& colourKey = targetRide->GetRideTypeDescriptor().ColourKey; - colourA = RideKeyColours[static_cast(colourKey)]; - } - - break; - } - default: - break; - } - } while (!(tileElement++)->IsLastForTile()); - - if (colourA != 0) - return colourA; - - return colourB; - } - - void PaintPeepOverlay(DrawPixelInfo& dpi) - { - auto flashColour = GetGuestFlashColour(); - for (auto guest : EntityList()) - { - DrawMapPeepPixel(guest, flashColour, dpi); - } - flashColour = GetStaffFlashColour(); - for (auto staff : EntityList()) - { - DrawMapPeepPixel(staff, flashColour, dpi); - } - } - - void DrawMapPeepPixel(Peep* peep, const uint8_t flashColour, DrawPixelInfo& dpi) - { - if (peep->x == LOCATION_NULL) - return; - - MapCoordsXY c = TransformToMapCoords({ peep->x, peep->y }); - auto leftTop = ScreenCoordsXY{ c.x, c.y }; - auto rightBottom = leftTop; - uint8_t colour = DefaultPeepMapColour; - if (EntityGetFlashing(peep)) - { - colour = flashColour; - // If flashing then map peep pixel size is increased (by moving left top downwards) - if (flashColour != DefaultPeepMapColour) - { - leftTop.x--; - } - } - - GfxFillRect(dpi, { leftTop, rightBottom }, colour); - } - - static uint8_t GetGuestFlashColour() - { - uint8_t colour = DefaultPeepMapColour; - if ((gWindowMapFlashingFlags & MapFlashingFlags::FlashGuests) != 0) - { - colour = GuestMapColour; - if ((gWindowMapFlashingFlags & MapFlashingFlags::SwitchColour) == 0) - colour = GuestMapColourAlternate; - } - return colour; - } - - static uint8_t GetStaffFlashColour() - { - uint8_t colour = DefaultPeepMapColour; - if ((gWindowMapFlashingFlags & MapFlashingFlags::FlashStaff) != 0) - { - colour = StaffMapColour; - if ((gWindowMapFlashingFlags & MapFlashingFlags::SwitchColour) == 0) - colour = StaffMapColourAlternate; - } - return colour; - } - - void PaintTrainOverlay(DrawPixelInfo& dpi) - { - for (auto train : TrainManager::View()) - { - for (Vehicle* vehicle = train; vehicle != nullptr; vehicle = GetEntity(vehicle->next_vehicle_on_train)) - { - if (vehicle->x == LOCATION_NULL) - continue; - - MapCoordsXY c = TransformToMapCoords({ vehicle->x, vehicle->y }); - - GfxFillRect(dpi, { { c.x, c.y }, { c.x, c.y } }, PALETTE_INDEX_171); - } - } - } - - /** - * The call to GfxFillRect 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(DrawPixelInfo& dpi) - { - WindowBase* mainWindow = WindowGetMain(); - if (mainWindow == nullptr) - return; - - Viewport* mainViewport = mainWindow->viewport; - if (mainViewport == nullptr) - return; - - auto offset = MiniMapOffsets[GetCurrentRotation()]; - auto leftTop = ScreenCoordsXY{ (mainViewport->viewPos.x >> 5) + offset.x, (mainViewport->viewPos.y >> 4) + offset.y }; - auto rightBottom = ScreenCoordsXY{ ((mainViewport->viewPos.x + mainViewport->view_width) >> 5) + offset.x, - ((mainViewport->viewPos.y + mainViewport->view_height) >> 4) + offset.y }; - auto rightTop = ScreenCoordsXY{ rightBottom.x, leftTop.y }; - auto leftBottom = ScreenCoordsXY{ leftTop.x, rightBottom.y }; - - // top horizontal lines - GfxFillRect(dpi, { leftTop, leftTop + ScreenCoordsXY{ 3, 0 } }, PALETTE_INDEX_56); - GfxFillRect(dpi, { rightTop - ScreenCoordsXY{ 3, 0 }, rightTop }, PALETTE_INDEX_56); - - // left vertical lines - GfxFillRect(dpi, { leftTop, leftTop + ScreenCoordsXY{ 0, 3 } }, PALETTE_INDEX_56); - GfxFillRect(dpi, { leftBottom - ScreenCoordsXY{ 0, 3 }, leftBottom }, PALETTE_INDEX_56); - - // bottom horizontal lines - GfxFillRect(dpi, { leftBottom, leftBottom + ScreenCoordsXY{ 3, 0 } }, PALETTE_INDEX_56); - GfxFillRect(dpi, { rightBottom - ScreenCoordsXY{ 3, 0 }, rightBottom }, PALETTE_INDEX_56); - - // right vertical lines - GfxFillRect(dpi, { rightTop, rightTop + ScreenCoordsXY{ 0, 3 } }, PALETTE_INDEX_56); - GfxFillRect(dpi, { rightBottom - ScreenCoordsXY{ 0, 3 }, rightBottom }, PALETTE_INDEX_56); - } - - void DrawTabImages(DrawPixelInfo& dpi) - { - // Guest tab image (animated) - uint32_t guestTabImage = SPR_TAB_GUESTS_0; - if (selected_tab == PAGE_PEEPS) - guestTabImage += list_information_type / 4; - - GfxDrawSprite( - dpi, ImageId(guestTabImage), - windowPos + ScreenCoordsXY{ widgets[WIDX_PEOPLE_TAB].left, widgets[WIDX_PEOPLE_TAB].top }); - - // Ride/stall tab image (animated) - uint32_t rideTabImage = SPR_TAB_RIDE_0; - if (selected_tab == PAGE_RIDES) - rideTabImage += list_information_type / 4; - - GfxDrawSprite( - dpi, ImageId(rideTabImage), - windowPos + ScreenCoordsXY{ widgets[WIDX_RIDES_TAB].left, widgets[WIDX_RIDES_TAB].top }); - } - - void ShowDefaultScenarioEditorButtons() - { - widgets[WIDX_BUILD_PARK_ENTRANCE].type = WindowWidgetType::FlatBtn; - widgets[WIDX_PEOPLE_STARTING_POSITION].type = WindowWidgetType::FlatBtn; - widgets[WIDX_MAP_SIZE_SPINNER_Y].type = WindowWidgetType::Spinner; - widgets[WIDX_MAP_SIZE_SPINNER_Y_UP].type = WindowWidgetType::Button; - widgets[WIDX_MAP_SIZE_SPINNER_Y_DOWN].type = WindowWidgetType::Button; - widgets[WIDX_MAP_SIZE_LINK].type = WindowWidgetType::FlatBtn; - widgets[WIDX_MAP_SIZE_SPINNER_X].type = WindowWidgetType::Spinner; - widgets[WIDX_MAP_SIZE_SPINNER_X_UP].type = WindowWidgetType::Button; - widgets[WIDX_MAP_SIZE_SPINNER_X_DOWN].type = WindowWidgetType::Button; - - // Only show this in the scenario editor, even when in sandbox mode. - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) - widgets[WIDX_MAP_GENERATOR].type = WindowWidgetType::Button; - - // Push width (Y) and height (X) to the common formatter arguments for the map size spinners to use - auto& gameState = GetGameState(); - auto ft = Formatter::Common(); - ft.Add(gameState.MapSize.y - 2); - ft.Add(gameState.MapSize.x - 2); - } - - void InputLandSize() - { - Formatter ft; - ft.Add(kLandToolMinimumSize); - ft.Add(kLandToolMaximumSize); - TextInputOpen(WIDX_LAND_TOOL, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); - } - - void InputMapSize(WidgetIndex callingWidget) - { - if (IsWidgetPressed(WIDX_MAP_SIZE_LINK)) - _resizeDirection = ResizeDirection::Both; - else - _resizeDirection = (callingWidget == WIDX_MAP_SIZE_SPINNER_Y) ? ResizeDirection::Y : ResizeDirection::X; - - Formatter ft; - ft.Add(MINIMUM_MAP_SIZE_PRACTICAL); - ft.Add(MAXIMUM_MAP_SIZE_PRACTICAL); - TextInputOpen(callingWidget, STR_MAP_SIZE_2, STR_ENTER_MAP_SIZE, ft, STR_NONE, STR_NONE, 4); - } - - CoordsXY ScreenToMap(ScreenCoordsXY screenCoords) - { - screenCoords.x = ((screenCoords.x + 8) - MAXIMUM_MAP_SIZE_TECHNICAL) / 2; - screenCoords.y = ((screenCoords.y + 8)) / 2; - auto location = TileCoordsXY(screenCoords.y - screenCoords.x, screenCoords.x + screenCoords.y).ToCoordsXY(); - - switch (GetCurrentRotation()) - { - case 0: - return location; - case 1: - return { MAXIMUM_MAP_SIZE_BIG - 1 - location.y, location.x }; - case 2: - return { MAXIMUM_MAP_SIZE_BIG - 1 - location.x, MAXIMUM_MAP_SIZE_BIG - 1 - location.y }; - case 3: - return { location.y, MAXIMUM_MAP_SIZE_BIG - 1 - location.x }; - } - - return { 0, 0 }; // unreachable - } - - MapCoordsXY TransformToMapCoords(CoordsXY c) - { - int32_t x = c.x, y = c.y; - - switch (GetCurrentRotation()) - { - case 3: - std::swap(x, y); - x = MAXIMUM_MAP_SIZE_BIG - 1 - x; - break; - case 2: - x = MAXIMUM_MAP_SIZE_BIG - 1 - x; - y = MAXIMUM_MAP_SIZE_BIG - 1 - y; - break; - case 1: - std::swap(x, y); - y = MAXIMUM_MAP_SIZE_BIG - 1 - y; - break; - case 0: - break; - } - x /= 32; - y /= 32; - - return { -x + y + MAXIMUM_MAP_SIZE_TECHNICAL - 8, x + y - 8 }; - } - - void ResizeMap() - { - widgets[WIDX_MAP].right = width - 4; - - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) - widgets[WIDX_MAP].bottom = height - 1 - 72; - else if (selected_tab == PAGE_RIDES) - widgets[WIDX_MAP].bottom = height - 1 - (4 * LIST_ROW_HEIGHT + 4); - else - widgets[WIDX_MAP].bottom = height - 1 - 14; - } - - uint8_t _activeTool; - uint32_t _currentLine; - uint16_t _landRightsToolSize; - std::vector _mapImageData; - bool _mapWidthAndHeightLinked{ true }; - enum class ResizeDirection - { - Both, - X, - Y, - } _resizeDirection{ ResizeDirection::Both }; + static constexpr StringId MapLabels[] = { + STR_MAP_RIDE, STR_MAP_FOOD_STALL, STR_MAP_DRINK_STALL, STR_MAP_SOUVENIR_STALL, + STR_MAP_INFO_KIOSK, STR_MAP_FIRST_AID, STR_MAP_CASH_MACHINE, STR_MAP_TOILET, + }; static constexpr uint16_t RideKeyColours[] = { MapColour(PALETTE_INDEX_61), // COLOUR_KEY_RIDE @@ -1456,34 +183,1346 @@ private: MapColour(PALETTE_INDEX_99), // TILE_ELEMENT_TYPE_LARGE_SCENERY MapColour(PALETTE_INDEX_0), // TILE_ELEMENT_TYPE_BANNER }; -}; -WindowBase* WindowMapOpen() -{ - try + class MapWindow final : public Window { - WindowBase* w = WindowFocusOrCreate(WindowClass::Map, 245, 259, WF_10); - w->selected_tab = 0; - w->list_information_type = 0; - return w; - } - catch (const std::bad_alloc&) - { - return nullptr; - } -} + uint8_t _rotation; + uint8_t _activeTool; + uint32_t _currentLine; + uint16_t _landRightsToolSize; + int32_t _firstColumnWidth; + std::vector _mapImageData; + bool _mapWidthAndHeightLinked{ true }; + bool _recalculateScrollbars = false; + enum class ResizeDirection + { + Both, + X, + Y, + } _resizeDirection{ ResizeDirection::Both }; -void WindowMapReset() -{ - WindowBase* w; + public: + MapWindow() + { + _mapImageData.resize(MAP_WINDOW_MAP_SIZE * MAP_WINDOW_MAP_SIZE); + } - // Check if window is even opened - w = WindowBringToFrontByClass(WindowClass::Map); - if (w == nullptr) + void OnOpen() override + { + widgets = window_map_widgets; + + hold_down_widgets = (1uLL << WIDX_MAP_SIZE_SPINNER_Y_UP) | (1uLL << WIDX_MAP_SIZE_SPINNER_Y_DOWN) + | (1uLL << WIDX_MAP_SIZE_SPINNER_X_UP) | (1uLL << WIDX_MAP_SIZE_SPINNER_X_DOWN) + | (1uLL << WIDX_LAND_TOOL_LARGER) | (1uLL << WIDX_LAND_TOOL_SMALLER); + + flags |= WF_RESIZABLE; + min_width = WW; + max_width = 800; + min_height = WH; + max_height = 560; + + ResizeMap(); + InitScrollWidgets(); + CalculateTextLayout(); + + _rotation = GetCurrentRotation(); + + InitMap(); + gWindowSceneryRotation = 0; + CentreMapOnViewPoint(); + FootpathSelectDefault(); + + auto& gameState = GetGameState(); + _mapWidthAndHeightLinked = gameState.MapSize.x == gameState.MapSize.y; + + // Reset land rights tool size + _landRightsToolSize = 1; + } + + void OnClose() override + { + _mapImageData.clear(); + _mapImageData.shrink_to_fit(); + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == classification + && gCurrentToolWidget.window_number == number) + { + ToolCancel(); + } + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_SET_LAND_RIGHTS: + Invalidate(); + if (ToolSet(*this, widgetIndex, Tool::UpArrow)) + break; + _activeTool = 2; + // Prevent mountain tool size. + _landRightsToolSize = std::max(kLandToolMinimumSize, _landRightsToolSize); + ShowGridlines(); + ShowLandRights(); + ShowConstructionRights(); + break; + case WIDX_LAND_OWNED_CHECKBOX: + _activeTool ^= 2; + + if (_activeTool & 2) + _activeTool &= 0xF2; + + Invalidate(); + break; + case WIDX_LAND_SALE_CHECKBOX: + _activeTool ^= 8; + + if (_activeTool & 8) + _activeTool &= 0xF8; + + Invalidate(); + break; + case WIDX_CONSTRUCTION_RIGHTS_OWNED_CHECKBOX: + _activeTool ^= 1; + + if (_activeTool & 1) + _activeTool &= 0xF1; + + Invalidate(); + break; + case WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX: + _activeTool ^= 4; + + if (_activeTool & 4) + _activeTool &= 0xF4; + + Invalidate(); + break; + case WIDX_BUILD_PARK_ENTRANCE: + Invalidate(); + if (ToolSet(*this, widgetIndex, Tool::UpArrow)) + break; + + gParkEntranceGhostExists = false; + InputSetFlag(INPUT_FLAG_6, true); + + ShowGridlines(); + ShowLandRights(); + ShowConstructionRights(); + break; + case WIDX_ROTATE_90: + gWindowSceneryRotation = (gWindowSceneryRotation + 1) & 3; + break; + case WIDX_PEOPLE_STARTING_POSITION: + if (ToolSet(*this, widgetIndex, Tool::UpArrow)) + break; + + ShowGridlines(); + ShowLandRights(); + ShowConstructionRights(); + break; + case WIDX_LAND_TOOL: + InputLandSize(); + break; + case WIDX_MAP_SIZE_SPINNER_Y: + case WIDX_MAP_SIZE_SPINNER_X: + InputMapSize(widgetIndex); + break; + case WIDX_MAP_SIZE_LINK: + _mapWidthAndHeightLinked = !_mapWidthAndHeightLinked; + break; + case WIDX_MAP_GENERATOR: + ContextOpenWindow(WindowClass::Mapgen); + break; + default: + if (widgetIndex >= WIDX_PEOPLE_TAB && widgetIndex <= WIDX_RIDES_TAB) + { + widgetIndex -= WIDX_PEOPLE_TAB; + if (widgetIndex == selected_tab) + break; + + selected_tab = widgetIndex; + list_information_type = 0; + _recalculateScrollbars = true; + } + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_MAP_SIZE_SPINNER_Y_UP: + _resizeDirection = ResizeDirection::Y; + IncreaseMapSize(); + break; + case WIDX_MAP_SIZE_SPINNER_Y_DOWN: + _resizeDirection = ResizeDirection::Y; + DecreaseMapSize(); + break; + case WIDX_MAP_SIZE_SPINNER_X_UP: + _resizeDirection = ResizeDirection::X; + IncreaseMapSize(); + break; + case WIDX_MAP_SIZE_SPINNER_X_DOWN: + _resizeDirection = ResizeDirection::X; + DecreaseMapSize(); + break; + case WIDX_LAND_TOOL_SMALLER: + // Decrement land rights tool size + _landRightsToolSize = std::max(kLandToolMinimumSize, _landRightsToolSize - 1); + + Invalidate(); + break; + case WIDX_LAND_TOOL_LARGER: + // Increment land rights tool size + _landRightsToolSize = std::min(kLandToolMaximumSize, _landRightsToolSize + 1); + + Invalidate(); + break; + } + } + + void OnUpdate() override + { + if (GetCurrentRotation() != _rotation) + { + _rotation = GetCurrentRotation(); + InitMap(); + CentreMapOnViewPoint(); + } + + for (int32_t i = 0; i < 16; i++) + SetMapPixels(); + + Invalidate(); + + // Update tab animations + list_information_type++; + switch (selected_tab) + { + case PAGE_PEEPS: + if (list_information_type >= 32) + { + list_information_type = 0; + } + break; + case PAGE_RIDES: + if (list_information_type >= 64) + { + list_information_type = 0; + } + break; + } + } + + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + switch (widgetIndex) + { + case WIDX_SET_LAND_RIGHTS: + SetLandRightsToolUpdate(screenCoords); + break; + case WIDX_BUILD_PARK_ENTRANCE: + PlaceParkEntranceToolUpdate(screenCoords); + break; + case WIDX_PEOPLE_STARTING_POSITION: + SetPeepSpawnToolUpdate(screenCoords); + break; + } + } + + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + switch (widgetIndex) + { + case WIDX_BUILD_PARK_ENTRANCE: + PlaceParkEntranceToolDown(screenCoords); + break; + case WIDX_PEOPLE_STARTING_POSITION: + SetPeepSpawnToolDown(screenCoords); + break; + } + } + + void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + switch (widgetIndex) + { + case WIDX_SET_LAND_RIGHTS: + if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) + { + auto landSetRightsAction = LandSetRightsAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + LandSetRightSetting::SetOwnershipWithChecks, _activeTool << 4); + GameActions::Execute(&landSetRightsAction); + } + break; + } + } + + void OnToolAbort(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_SET_LAND_RIGHTS: + Invalidate(); + HideGridlines(); + HideLandRights(); + HideConstructionRights(); + break; + case WIDX_BUILD_PARK_ENTRANCE: + ParkEntranceRemoveGhost(); + Invalidate(); + HideGridlines(); + HideLandRights(); + HideConstructionRights(); + break; + case WIDX_PEOPLE_STARTING_POSITION: + Invalidate(); + HideGridlines(); + HideLandRights(); + HideConstructionRights(); + break; + } + } + + void SetLandRightsToolUpdate(const ScreenCoordsXY& screenCoords) + { + MapInvalidateSelectionRect(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + + auto info = GetMapCoordinatesFromPos( + screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water)); + if (info.SpriteType == ViewportInteractionItem::None) + return; + + auto mapCoords = info.Loc; + + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectType = MAP_SELECT_TYPE_FULL_LAND_RIGHTS; + + int32_t landRightsToolSize = _landRightsToolSize; + if (landRightsToolSize == 0) + landRightsToolSize = 1; + + int32_t size = (landRightsToolSize * 32) - 32; + int32_t radius = (landRightsToolSize * 16) - 16; + mapCoords.x -= radius; + mapCoords.y -= radius; + mapCoords = mapCoords.ToTileStart(); + gMapSelectPositionA = mapCoords; + gMapSelectPositionB.x = mapCoords.x + size; + gMapSelectPositionB.y = mapCoords.y + size; + MapInvalidateSelectionRect(); + } + + CoordsXYZD PlaceParkEntranceGetMapPosition(const ScreenCoordsXY& screenCoords) + { + CoordsXYZD parkEntranceMapPosition{ 0, 0, 0, INVALID_DIRECTION }; + const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); + parkEntranceMapPosition = { mapCoords.x, mapCoords.y, 0, INVALID_DIRECTION }; + if (parkEntranceMapPosition.IsNull()) + return parkEntranceMapPosition; + + auto surfaceElement = MapGetSurfaceElementAt(mapCoords); + if (surfaceElement == nullptr) + { + parkEntranceMapPosition.SetNull(); + return parkEntranceMapPosition; + } + + parkEntranceMapPosition.z = surfaceElement->GetWaterHeight(); + if (parkEntranceMapPosition.z == 0) + { + parkEntranceMapPosition.z = surfaceElement->GetBaseZ(); + if ((surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) != 0) + { + parkEntranceMapPosition.z += 16; + if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) + { + parkEntranceMapPosition.z += 16; + } + } + } + parkEntranceMapPosition.direction = (gWindowSceneryRotation - GetCurrentRotation()) & 3; + return parkEntranceMapPosition; + } + + void PlaceParkEntranceToolUpdate(const ScreenCoordsXY& screenCoords) + { + MapInvalidateSelectionRect(); + MapInvalidateMapSelectionTiles(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords); + if (parkEntrancePosition.IsNull()) + { + ParkEntranceRemoveGhost(); + return; + } + + int32_t sideDirection = (parkEntrancePosition.direction + 1) & 3; + gMapSelectionTiles.clear(); + gMapSelectionTiles.push_back({ parkEntrancePosition.x, parkEntrancePosition.y }); + gMapSelectionTiles.push_back({ parkEntrancePosition.x + CoordsDirectionDelta[sideDirection].x, + parkEntrancePosition.y + CoordsDirectionDelta[sideDirection].y }); + gMapSelectionTiles.push_back({ parkEntrancePosition.x - CoordsDirectionDelta[sideDirection].x, + parkEntrancePosition.y - CoordsDirectionDelta[sideDirection].y }); + + gMapSelectArrowPosition = parkEntrancePosition; + gMapSelectArrowDirection = parkEntrancePosition.direction; + + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT | MAP_SELECT_FLAG_ENABLE_ARROW; + MapInvalidateMapSelectionTiles(); + if (gParkEntranceGhostExists && parkEntrancePosition == gParkEntranceGhostPosition) + { + return; + } + + ParkEntranceRemoveGhost(); + + auto gameAction = ParkEntrancePlaceAction(parkEntrancePosition, gFootpathSelectedId); + gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST); + + auto result = GameActions::Execute(&gameAction); + if (result.Error == GameActions::Status::Ok) + { + gParkEntranceGhostPosition = parkEntrancePosition; + gParkEntranceGhostExists = true; + } + } + + void PlaceParkEntranceToolDown(const ScreenCoordsXY& screenCoords) + { + ParkEntranceRemoveGhost(); + + CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords); + if (!parkEntrancePosition.IsNull()) + { + auto gameAction = ParkEntrancePlaceAction(parkEntrancePosition, gFootpathSelectedId); + auto result = GameActions::Execute(&gameAction); + if (result.Error == GameActions::Status::Ok) + { + Audio::Play3D(Audio::SoundId::PlaceItem, result.Position); + } + } + } + + void SetPeepSpawnToolUpdate(const ScreenCoordsXY& screenCoords) + { + int32_t direction; + TileElement* tileElement; + MapInvalidateSelectionRect(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement); + if (mapCoords.IsNull()) + return; + + int32_t mapZ = tileElement->GetBaseZ(); + if (tileElement->GetType() == TileElementType::Surface) + { + if ((tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) != 0) + mapZ += 16; + if (tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) + mapZ += 16; + } + + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; + gMapSelectType = MAP_SELECT_TYPE_FULL; + gMapSelectPositionA = mapCoords; + gMapSelectPositionB = mapCoords; + gMapSelectArrowPosition = CoordsXYZ{ mapCoords, mapZ }; + gMapSelectArrowDirection = DirectionReverse(direction); + MapInvalidateSelectionRect(); + } + + void SetPeepSpawnToolDown(const ScreenCoordsXY& screenCoords) + { + // Verify footpath exists at location, and retrieve coordinates + TileElement* tileElement; + int32_t direction; + auto mapCoords = FootpathGetCoordinatesFromPos(screenCoords, &direction, &tileElement); + if (mapCoords.IsNull()) + return; + + int32_t mapZ = tileElement->GetBaseZ(); + + auto gameAction = PeepSpawnPlaceAction({ mapCoords, mapZ, static_cast(direction) }); + auto result = GameActions::Execute(&gameAction); + if (result.Error == GameActions::Status::Ok) + { + Audio::Play3D(Audio::SoundId::PlaceItem, result.Position); + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (text.empty()) + return; + + switch (widgetIndex) + { + case WIDX_LAND_TOOL: + { + char* end; + std::string textStr = std::string(text); + int32_t size = strtol(textStr.c_str(), &end, 10); + if (*end == '\0') + { + size = std::clamp(size, kLandToolMinimumSize, kLandToolMaximumSize); + _landRightsToolSize = size; + Invalidate(); + } + break; + } + case WIDX_MAP_SIZE_SPINNER_Y: + case WIDX_MAP_SIZE_SPINNER_X: + { + char* end; + std::string textStr = std::string(text); + int32_t size = strtol(textStr.c_str(), &end, 10); + if (*end == '\0') + { + // The practical size is 2 lower than the technical size + size += 2; + size = std::clamp( + size, static_cast(kMinimumMapSizeTechnical), static_cast(kMaximumMapSizeTechnical)); + + TileCoordsXY newMapSize = GetGameState().MapSize; + if (_resizeDirection != ResizeDirection::X) + newMapSize.y = size; + if (_resizeDirection != ResizeDirection::Y) + newMapSize.x = size; + + auto mapChangeSizeAction = MapChangeSizeAction(newMapSize); + GameActions::Execute(&mapChangeSizeAction); + Invalidate(); + } + break; + } + } + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + return ScreenSize(MAP_WINDOW_MAP_SIZE, MAP_WINDOW_MAP_SIZE); + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + CoordsXY c = ScreenToMap(screenCoords); + auto mapCoords = CoordsXY{ std::clamp(c.x, 0, MAXIMUM_MAP_SIZE_BIG - 1), + std::clamp(c.y, 0, MAXIMUM_MAP_SIZE_BIG - 1) }; + auto mapZ = TileElementHeight(mapCoords); + + WindowBase* mainWindow = WindowGetMain(); + if (mainWindow != nullptr) + { + WindowScrollToLocation(*mainWindow, { mapCoords, mapZ }); + } + + if (LandToolIsActive()) + { + // Set land terrain + int32_t landToolSize = std::max(1, gLandToolSize); + int32_t size = (landToolSize * 32) - 32; + int32_t radius = (landToolSize * 16) - 16; + + mapCoords = (mapCoords - CoordsXY{ radius, radius }).ToTileStart(); + MapInvalidateSelectionRect(); + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectType = MAP_SELECT_TYPE_FULL; + gMapSelectPositionA = mapCoords; + gMapSelectPositionB = mapCoords + CoordsXY{ size, size }; + MapInvalidateSelectionRect(); + + auto surfaceSetStyleAction = SurfaceSetStyleAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + gLandToolTerrainSurface, gLandToolTerrainEdge); + GameActions::Execute(&surfaceSetStyleAction); + } + else if (WidgetIsActiveTool(*this, WIDX_SET_LAND_RIGHTS)) + { + // Set land rights + int32_t landRightsToolSize = std::max(1, _landRightsToolSize); + int32_t size = (landRightsToolSize * 32) - 32; + int32_t radius = (landRightsToolSize * 16) - 16; + mapCoords = (mapCoords - CoordsXY{ radius, radius }).ToTileStart(); + + MapInvalidateSelectionRect(); + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectType = MAP_SELECT_TYPE_FULL_LAND_RIGHTS; + gMapSelectPositionA = mapCoords; + gMapSelectPositionB = mapCoords + CoordsXY{ size, size }; + MapInvalidateSelectionRect(); + + auto landSetRightsAction = LandSetRightsAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + LandSetRightSetting::SetOwnershipWithChecks, _activeTool << 4); + GameActions::Execute(&landSetRightsAction); + } + } + + void OnScrollMouseDrag(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + OnScrollMouseDown(scrollIndex, screenCoords); + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + GfxClear(dpi, PALETTE_INDEX_10); + + G1Element g1temp = {}; + g1temp.offset = _mapImageData.data(); + g1temp.width = MAP_WINDOW_MAP_SIZE; + g1temp.height = MAP_WINDOW_MAP_SIZE; + g1temp.x_offset = -8; + g1temp.y_offset = -8; + GfxSetG1Element(SPR_TEMP, &g1temp); + DrawingEngineInvalidateImage(SPR_TEMP); + GfxDrawSprite(dpi, ImageId(SPR_TEMP), { 0, 0 }); + + if (selected_tab == PAGE_PEEPS) + { + PaintPeepOverlay(dpi); + } + else + { + PaintTrainOverlay(dpi); + } + PaintHudRectangle(dpi); + } + + void OnPrepareDraw() override + { + // Set the pressed widgets + pressed_widgets = 0; + SetWidgetPressed(WIDX_MAP_SIZE_LINK, _mapWidthAndHeightLinked); + pressed_widgets |= (1uLL << (WIDX_PEOPLE_TAB + selected_tab)); + pressed_widgets |= (1uLL << WIDX_LAND_TOOL); + + if (_activeTool & (1 << 3)) + pressed_widgets |= (1uLL << WIDX_LAND_SALE_CHECKBOX); + + if (_activeTool & (1 << 2)) + pressed_widgets |= (1uLL << WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX); + + if (_activeTool & (1 << 1)) + pressed_widgets |= (1uLL << WIDX_LAND_OWNED_CHECKBOX); + + if (_activeTool & (1 << 0)) + pressed_widgets |= (1uLL << WIDX_CONSTRUCTION_RIGHTS_OWNED_CHECKBOX); + + // Set disabled widgets + auto& gameState = GetGameState(); + SetWidgetDisabled(WIDX_MAP_SIZE_LINK, gameState.MapSize.x != gameState.MapSize.y); + + // Resize widgets to window size + ResizeFrameWithPage(); + ResizeMap(); + + widgets[WIDX_MAP_SIZE_SPINNER_Y].top = height - 15; + widgets[WIDX_MAP_SIZE_SPINNER_Y].bottom = height - 4; + widgets[WIDX_MAP_SIZE_SPINNER_Y_UP].top = height - 14; + widgets[WIDX_MAP_SIZE_SPINNER_Y_UP].bottom = height - 5; + widgets[WIDX_MAP_SIZE_SPINNER_Y_DOWN].top = height - 14; + widgets[WIDX_MAP_SIZE_SPINNER_Y_DOWN].bottom = height - 5; + widgets[WIDX_MAP_SIZE_LINK].top = height - 15; + widgets[WIDX_MAP_SIZE_LINK].bottom = height - 4; + widgets[WIDX_MAP_SIZE_SPINNER_X].top = height - 15; + widgets[WIDX_MAP_SIZE_SPINNER_X].bottom = height - 4; + widgets[WIDX_MAP_SIZE_SPINNER_X_UP].top = height - 14; + widgets[WIDX_MAP_SIZE_SPINNER_X_UP].bottom = height - 5; + widgets[WIDX_MAP_SIZE_SPINNER_X_DOWN].top = height - 14; + widgets[WIDX_MAP_SIZE_SPINNER_X_DOWN].bottom = height - 5; + + widgets[WIDX_SET_LAND_RIGHTS].top = height - 70; + widgets[WIDX_SET_LAND_RIGHTS].bottom = height - 70 + 23; + widgets[WIDX_BUILD_PARK_ENTRANCE].top = height - 46; + widgets[WIDX_BUILD_PARK_ENTRANCE].bottom = height - 46 + 23; + widgets[WIDX_ROTATE_90].top = height - 46; + widgets[WIDX_ROTATE_90].bottom = height - 46 + 23; + widgets[WIDX_PEOPLE_STARTING_POSITION].top = height - 46; + widgets[WIDX_PEOPLE_STARTING_POSITION].bottom = height - 46 + 23; + + widgets[WIDX_LAND_TOOL].top = height - 42; + widgets[WIDX_LAND_TOOL].bottom = height - 42 + 30; + widgets[WIDX_LAND_TOOL_SMALLER].top = height - 41; + widgets[WIDX_LAND_TOOL_SMALLER].bottom = height - 41 + 15; + widgets[WIDX_LAND_TOOL_LARGER].top = height - 27; + widgets[WIDX_LAND_TOOL_LARGER].bottom = height - 27 + 15; + + widgets[WIDX_MAP_GENERATOR].top = height - 69; + widgets[WIDX_MAP_GENERATOR].bottom = height - 69 + 13; + + // Land tool mode (4 checkboxes) + int checkboxY = height - 55; + for (int32_t i = WIDX_LAND_OWNED_CHECKBOX; i <= WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX; i++) + { + widgets[i].top = checkboxY; + checkboxY += 11; + widgets[i].bottom = checkboxY; + checkboxY += 2; + } + + // Disable all scenario editor related widgets + for (int32_t i = WIDX_MAP_SIZE_SPINNER_Y; i <= WIDX_MAP_GENERATOR; i++) + { + widgets[i].type = WindowWidgetType::Empty; + } + + if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.SandboxMode) + { + // scenario editor: build park entrance selected, show rotate button + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::Map + && gCurrentToolWidget.widget_index == WIDX_BUILD_PARK_ENTRANCE) + { + widgets[WIDX_ROTATE_90].type = WindowWidgetType::FlatBtn; + } + + // Always show set land rights button + widgets[WIDX_SET_LAND_RIGHTS].type = WindowWidgetType::FlatBtn; + + // If any tool is active + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::Map) + { + // if not in set land rights mode: show the default scenario editor buttons + if (gCurrentToolWidget.widget_index != WIDX_SET_LAND_RIGHTS) + { + ShowDefaultScenarioEditorButtons(); + } + else + { // if in set land rights mode: show land tool buttons + modes + widgets[WIDX_LAND_TOOL].type = WindowWidgetType::ImgBtn; + widgets[WIDX_LAND_TOOL_SMALLER].type = WindowWidgetType::TrnBtn; + widgets[WIDX_LAND_TOOL_LARGER].type = WindowWidgetType::TrnBtn; + + for (int32_t i = WIDX_LAND_OWNED_CHECKBOX; i <= WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX; i++) + widgets[i].type = WindowWidgetType::Checkbox; + + widgets[WIDX_LAND_TOOL].image = ImageId(LandTool::SizeToSpriteIndex(_landRightsToolSize)); + } + } + else + { + // if no tool is active: show the default scenario editor buttons + ShowDefaultScenarioEditorButtons(); + } + } + if (_recalculateScrollbars) + { + WidgetScrollUpdateThumbs(*this, WIDX_MAP); + _recalculateScrollbars = false; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + auto screenCoords = windowPos + + ScreenCoordsXY{ window_map_widgets[WIDX_LAND_TOOL].midX(), window_map_widgets[WIDX_LAND_TOOL].midY() }; + + // Draw land tool size + if (WidgetIsActiveTool(*this, WIDX_SET_LAND_RIGHTS) && _landRightsToolSize > kLandToolMaximumSizeWithSprite) + { + auto ft = Formatter(); + ft.Add(_landRightsToolSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + } + screenCoords.y = windowPos.y + window_map_widgets[WIDX_LAND_TOOL].bottom + 5; + + // People starting position (scenario editor only) + if (widgets[WIDX_PEOPLE_STARTING_POSITION].type != WindowWidgetType::Empty) + { + screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PEOPLE_STARTING_POSITION].left + 12, + widgets[WIDX_PEOPLE_STARTING_POSITION].top + 18 }; + GfxDrawSprite(dpi, ImageId(SPR_6410, COLOUR_BRIGHT_RED, COLOUR_LIGHT_BROWN), screenCoords); + } + + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) + { + // Render the map legend + if (selected_tab == PAGE_RIDES) + { + screenCoords = windowPos + ScreenCoordsXY{ 4, widgets[WIDX_MAP].bottom + 2 }; + + static_assert(std::size(RideKeyColours) == std::size(MapLabels)); + + for (uint32_t i = 0; i < std::size(RideKeyColours); i++) + { + GfxFillRect( + dpi, { screenCoords + ScreenCoordsXY{ 0, 2 }, screenCoords + ScreenCoordsXY{ 6, 8 } }, + RideKeyColours[i]); + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ LIST_ROW_HEIGHT, 0 }, MapLabels[i], {}); + screenCoords.y += LIST_ROW_HEIGHT; + if (i == 3) + { + screenCoords += { _firstColumnWidth, -(LIST_ROW_HEIGHT * 4) }; + } + } + } + } + else if (!WidgetIsActiveTool(*this, WIDX_SET_LAND_RIGHTS)) + { + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_MAP_SIZE_SPINNER_Y].top + 1 }, STR_MAP_SIZE, {}, + { colours[1] }); + } + } + + void OnLanguageChange() override + { + CalculateTextLayout(); + } + + void ResetMap() + { + InitMap(); + CentreMapOnViewPoint(); + } + + private: + void InitMap() + { + std::fill(_mapImageData.begin(), _mapImageData.end(), PALETTE_INDEX_10); + _currentLine = 0; + } + + void CentreMapOnViewPoint() + { + WindowBase* mainWindow = WindowGetMain(); + int16_t ax, bx, cx, dx; + int16_t bp, di; + + if (mainWindow == nullptr || mainWindow->viewport == nullptr) + return; + + auto offset = MiniMapOffsets[GetCurrentRotation()]; + + // calculate centre view point of viewport and transform it to minimap coordinates + + cx = ((mainWindow->viewport->view_width >> 1) + mainWindow->viewport->viewPos.x) >> 5; + dx = ((mainWindow->viewport->view_height >> 1) + mainWindow->viewport->viewPos.y) >> 4; + cx += offset.x; + dx += offset.y; + + // calculate width and height of minimap + + ax = widgets[WIDX_MAP].width() - 11; + bx = widgets[WIDX_MAP].height() - 11; + bp = ax; + di = bx; + + ax >>= 1; + bx >>= 1; + cx = std::max(cx - ax, 0); + dx = std::max(dx - bx, 0); + + bp = scrolls[0].h_right - bp; + di = scrolls[0].v_bottom - di; + + if (bp < 0 && (bp - cx) < 0) + cx = 0; + + if (di < 0 && (di - dx) < 0) + dx = 0; + + scrolls[0].h_left = cx; + scrolls[0].v_top = dx; + WidgetScrollUpdateThumbs(*this, WIDX_MAP); + } + + void IncreaseMapSize() + { + auto newMapSize = GetGameState().MapSize; + if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::Y) + newMapSize.y++; + if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::X) + newMapSize.x++; + + auto increaseMapSizeAction = MapChangeSizeAction(newMapSize); + GameActions::Execute(&increaseMapSizeAction); + } + + void DecreaseMapSize() + { + auto newMapSize = GetGameState().MapSize; + if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::Y) + newMapSize.y--; + if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::X) + newMapSize.x--; + + auto decreaseMapSizeAction = MapChangeSizeAction(newMapSize); + GameActions::Execute(&decreaseMapSizeAction); + } + + void SetMapPixels() + { + int32_t x = 0, y = 0, dx = 0, dy = 0; + + int32_t pos = (_currentLine * (MAP_WINDOW_MAP_SIZE - 1)) + kMaximumMapSizeTechnical - 1; + auto destinationPosition = ScreenCoordsXY{ pos % MAP_WINDOW_MAP_SIZE, pos / MAP_WINDOW_MAP_SIZE }; + auto destination = _mapImageData.data() + (destinationPosition.y * MAP_WINDOW_MAP_SIZE) + destinationPosition.x; + switch (GetCurrentRotation()) + { + case 0: + x = _currentLine * COORDS_XY_STEP; + y = 0; + dx = 0; + dy = COORDS_XY_STEP; + break; + case 1: + x = MAXIMUM_TILE_START_XY; + y = _currentLine * COORDS_XY_STEP; + dx = -COORDS_XY_STEP; + dy = 0; + break; + case 2: + x = MAXIMUM_MAP_SIZE_BIG - ((_currentLine + 1) * COORDS_XY_STEP); + y = MAXIMUM_TILE_START_XY; + dx = 0; + dy = -COORDS_XY_STEP; + break; + case 3: + x = 0; + y = MAXIMUM_MAP_SIZE_BIG - ((_currentLine + 1) * COORDS_XY_STEP); + dx = COORDS_XY_STEP; + dy = 0; + break; + } + + for (int32_t i = 0; i < kMaximumMapSizeTechnical; i++) + { + if (!MapIsEdge({ x, y })) + { + uint16_t colour = 0; + switch (selected_tab) + { + case PAGE_PEEPS: + colour = GetPixelColourPeep({ x, y }); + break; + case PAGE_RIDES: + colour = GetPixelColourRide({ x, y }); + break; + } + destination[0] = (colour >> 8) & 0xFF; + destination[1] = colour; + } + x += dx; + y += dy; + + destinationPosition.x++; + destinationPosition.y++; + destination = _mapImageData.data() + (destinationPosition.y * MAP_WINDOW_MAP_SIZE) + destinationPosition.x; + } + _currentLine++; + if (_currentLine >= kMaximumMapSizeTechnical) + _currentLine = 0; + } + + uint16_t GetPixelColourPeep(const CoordsXY& c) + { + auto* surfaceElement = MapGetSurfaceElementAt(c); + if (surfaceElement == nullptr) + return 0; + + uint16_t colour = MapColour(PALETTE_INDEX_0); + const auto* surfaceObject = surfaceElement->GetSurfaceObject(); + if (surfaceObject != nullptr) + colour = MapColour2(surfaceObject->MapColours[0], surfaceObject->MapColours[1]); + + if (surfaceElement->GetWaterHeight() > 0) + colour = WaterColour; + + if (!(surfaceElement->GetOwnership() & OWNERSHIP_OWNED)) + colour = MapColourUnowned(colour); + + const int32_t maxSupportedTileElementType = static_cast(std::size(ElementTypeAddColour)); + auto tileElement = reinterpret_cast(surfaceElement); + while (!(tileElement++)->IsLastForTile()) + { + if (tileElement->IsGhost()) + { + colour = MapColour(PALETTE_INDEX_21); + break; + } + + auto tileElementType = tileElement->GetType(); + if (EnumValue(tileElementType) >= maxSupportedTileElementType) + { + tileElementType = TileElementType::Surface; + } + colour &= ElementTypeMaskColour[EnumValue(tileElementType)]; + colour |= ElementTypeAddColour[EnumValue(tileElementType)]; + } + + return colour; + } + + uint16_t GetPixelColourRide(const CoordsXY& c) + { + uint16_t colourA = 0; // highlight colour + uint16_t colourB = MapColour(PALETTE_INDEX_13); // surface colour (dark grey) + + // as an improvement we could use first_element to show underground stuff? + TileElement* tileElement = reinterpret_cast(MapGetSurfaceElementAt(c)); + do + { + if (tileElement == nullptr) + break; + + if (tileElement->IsGhost()) + { + colourA = MapColour(PALETTE_INDEX_21); + break; + } + + switch (tileElement->GetType()) + { + case TileElementType::Surface: + if (tileElement->AsSurface()->GetWaterHeight() > 0) + // Why is this a different water colour as above (195)? + colourB = MapColour(PALETTE_INDEX_194); + if (!(tileElement->AsSurface()->GetOwnership() & OWNERSHIP_OWNED)) + colourB = MapColourUnowned(colourB); + break; + case TileElementType::Path: + colourA = MapColour(PALETTE_INDEX_14); // lighter grey + break; + case TileElementType::Entrance: + { + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) + break; + Ride* targetRide = GetRide(tileElement->AsEntrance()->GetRideIndex()); + if (targetRide != nullptr) + { + const auto& colourKey = targetRide->GetRideTypeDescriptor().ColourKey; + colourA = RideKeyColours[EnumValue(colourKey)]; + } + break; + } + case TileElementType::Track: + { + Ride* targetRide = GetRide(tileElement->AsTrack()->GetRideIndex()); + if (targetRide != nullptr) + { + const auto& colourKey = targetRide->GetRideTypeDescriptor().ColourKey; + colourA = RideKeyColours[EnumValue(colourKey)]; + } + + break; + } + default: + break; + } + } while (!(tileElement++)->IsLastForTile()); + + if (colourA != 0) + return colourA; + + return colourB; + } + + void PaintPeepOverlay(DrawPixelInfo& dpi) + { + auto flashColour = GetGuestFlashColour(); + for (auto guest : EntityList()) + { + DrawMapPeepPixel(guest, flashColour, dpi); + } + flashColour = GetStaffFlashColour(); + for (auto staff : EntityList()) + { + DrawMapPeepPixel(staff, flashColour, dpi); + } + } + + void DrawMapPeepPixel(Peep* peep, const uint8_t flashColour, DrawPixelInfo& dpi) + { + if (peep->x == LOCATION_NULL) + return; + + MapCoordsXY c = TransformToMapCoords({ peep->x, peep->y }); + auto leftTop = ScreenCoordsXY{ c.x, c.y }; + auto rightBottom = leftTop; + uint8_t colour = DefaultPeepMapColour; + if (EntityGetFlashing(peep)) + { + colour = flashColour; + // If flashing then map peep pixel size is increased (by moving left top downwards) + if (flashColour != DefaultPeepMapColour) + { + leftTop.x--; + } + } + + GfxFillRect(dpi, { leftTop, rightBottom }, colour); + } + + static uint8_t GetGuestFlashColour() + { + uint8_t colour = DefaultPeepMapColour; + if ((gWindowMapFlashingFlags & MapFlashingFlags::FlashGuests) != 0) + { + colour = GuestMapColour; + if ((gWindowMapFlashingFlags & MapFlashingFlags::SwitchColour) == 0) + colour = GuestMapColourAlternate; + } + return colour; + } + + static uint8_t GetStaffFlashColour() + { + uint8_t colour = DefaultPeepMapColour; + if ((gWindowMapFlashingFlags & MapFlashingFlags::FlashStaff) != 0) + { + colour = StaffMapColour; + if ((gWindowMapFlashingFlags & MapFlashingFlags::SwitchColour) == 0) + colour = StaffMapColourAlternate; + } + return colour; + } + + void PaintTrainOverlay(DrawPixelInfo& dpi) + { + for (auto train : TrainManager::View()) + { + for (Vehicle* vehicle = train; vehicle != nullptr; vehicle = GetEntity(vehicle->next_vehicle_on_train)) + { + if (vehicle->x == LOCATION_NULL) + continue; + + MapCoordsXY c = TransformToMapCoords({ vehicle->x, vehicle->y }); + + GfxFillRect(dpi, { { c.x, c.y }, { c.x, c.y } }, PALETTE_INDEX_171); + } + } + } + + /** + * The call to GfxFillRect 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(DrawPixelInfo& dpi) + { + WindowBase* mainWindow = WindowGetMain(); + if (mainWindow == nullptr) + return; + + Viewport* mainViewport = mainWindow->viewport; + if (mainViewport == nullptr) + return; + + auto offset = MiniMapOffsets[GetCurrentRotation()]; + auto leftTop = ScreenCoordsXY{ (mainViewport->viewPos.x >> 5) + offset.x, + (mainViewport->viewPos.y >> 4) + offset.y }; + auto rightBottom = ScreenCoordsXY{ ((mainViewport->viewPos.x + mainViewport->view_width) >> 5) + offset.x, + ((mainViewport->viewPos.y + mainViewport->view_height) >> 4) + offset.y }; + auto rightTop = ScreenCoordsXY{ rightBottom.x, leftTop.y }; + auto leftBottom = ScreenCoordsXY{ leftTop.x, rightBottom.y }; + + // top horizontal lines + GfxFillRect(dpi, { leftTop, leftTop + ScreenCoordsXY{ 3, 0 } }, PALETTE_INDEX_56); + GfxFillRect(dpi, { rightTop - ScreenCoordsXY{ 3, 0 }, rightTop }, PALETTE_INDEX_56); + + // left vertical lines + GfxFillRect(dpi, { leftTop, leftTop + ScreenCoordsXY{ 0, 3 } }, PALETTE_INDEX_56); + GfxFillRect(dpi, { leftBottom - ScreenCoordsXY{ 0, 3 }, leftBottom }, PALETTE_INDEX_56); + + // bottom horizontal lines + GfxFillRect(dpi, { leftBottom, leftBottom + ScreenCoordsXY{ 3, 0 } }, PALETTE_INDEX_56); + GfxFillRect(dpi, { rightBottom - ScreenCoordsXY{ 3, 0 }, rightBottom }, PALETTE_INDEX_56); + + // right vertical lines + GfxFillRect(dpi, { rightTop, rightTop + ScreenCoordsXY{ 0, 3 } }, PALETTE_INDEX_56); + GfxFillRect(dpi, { rightBottom - ScreenCoordsXY{ 0, 3 }, rightBottom }, PALETTE_INDEX_56); + } + + void DrawTabImages(DrawPixelInfo& dpi) + { + // Guest tab image (animated) + uint32_t guestTabImage = SPR_TAB_GUESTS_0; + if (selected_tab == PAGE_PEEPS) + guestTabImage += list_information_type / 4; + + GfxDrawSprite( + dpi, ImageId(guestTabImage), + windowPos + ScreenCoordsXY{ widgets[WIDX_PEOPLE_TAB].left, widgets[WIDX_PEOPLE_TAB].top }); + + // Ride/stall tab image (animated) + uint32_t rideTabImage = SPR_TAB_RIDE_0; + if (selected_tab == PAGE_RIDES) + rideTabImage += list_information_type / 4; + + GfxDrawSprite( + dpi, ImageId(rideTabImage), + windowPos + ScreenCoordsXY{ widgets[WIDX_RIDES_TAB].left, widgets[WIDX_RIDES_TAB].top }); + } + + void ShowDefaultScenarioEditorButtons() + { + widgets[WIDX_BUILD_PARK_ENTRANCE].type = WindowWidgetType::FlatBtn; + widgets[WIDX_PEOPLE_STARTING_POSITION].type = WindowWidgetType::FlatBtn; + widgets[WIDX_MAP_SIZE_SPINNER_Y].type = WindowWidgetType::Spinner; + widgets[WIDX_MAP_SIZE_SPINNER_Y_UP].type = WindowWidgetType::Button; + widgets[WIDX_MAP_SIZE_SPINNER_Y_DOWN].type = WindowWidgetType::Button; + widgets[WIDX_MAP_SIZE_LINK].type = WindowWidgetType::FlatBtn; + widgets[WIDX_MAP_SIZE_SPINNER_X].type = WindowWidgetType::Spinner; + widgets[WIDX_MAP_SIZE_SPINNER_X_UP].type = WindowWidgetType::Button; + widgets[WIDX_MAP_SIZE_SPINNER_X_DOWN].type = WindowWidgetType::Button; + + // Only show this in the scenario editor, even when in sandbox mode. + if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + widgets[WIDX_MAP_GENERATOR].type = WindowWidgetType::Button; + + // Push width (Y) and height (X) to the common formatter arguments for the map size spinners to use + auto& gameState = GetGameState(); + auto ft = Formatter::Common(); + ft.Add(gameState.MapSize.y - 2); + ft.Add(gameState.MapSize.x - 2); + } + + void InputLandSize() + { + Formatter ft; + ft.Add(kLandToolMinimumSize); + ft.Add(kLandToolMaximumSize); + TextInputOpen(WIDX_LAND_TOOL, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); + } + + void InputMapSize(WidgetIndex callingWidget) + { + if (IsWidgetPressed(WIDX_MAP_SIZE_LINK)) + _resizeDirection = ResizeDirection::Both; + else + _resizeDirection = (callingWidget == WIDX_MAP_SIZE_SPINNER_Y) ? ResizeDirection::Y : ResizeDirection::X; + + Formatter ft; + ft.Add(kMinimumMapSizePractical); + ft.Add(kMaximumMapSizePractical); + TextInputOpen(callingWidget, STR_MAP_SIZE_2, STR_ENTER_MAP_SIZE, ft, STR_NONE, STR_NONE, 4); + } + + CoordsXY ScreenToMap(ScreenCoordsXY screenCoords) + { + screenCoords.x = ((screenCoords.x + 8) - kMaximumMapSizeTechnical) / 2; + screenCoords.y = ((screenCoords.y + 8)) / 2; + auto location = TileCoordsXY(screenCoords.y - screenCoords.x, screenCoords.x + screenCoords.y).ToCoordsXY(); + + switch (GetCurrentRotation()) + { + case 0: + return location; + case 1: + return { MAXIMUM_MAP_SIZE_BIG - 1 - location.y, location.x }; + case 2: + return { MAXIMUM_MAP_SIZE_BIG - 1 - location.x, MAXIMUM_MAP_SIZE_BIG - 1 - location.y }; + case 3: + return { location.y, MAXIMUM_MAP_SIZE_BIG - 1 - location.x }; + } + + return { 0, 0 }; // unreachable + } + + MapCoordsXY TransformToMapCoords(CoordsXY c) + { + int32_t x = c.x, y = c.y; + + switch (GetCurrentRotation()) + { + case 3: + std::swap(x, y); + x = MAXIMUM_MAP_SIZE_BIG - 1 - x; + break; + case 2: + x = MAXIMUM_MAP_SIZE_BIG - 1 - x; + y = MAXIMUM_MAP_SIZE_BIG - 1 - y; + break; + case 1: + std::swap(x, y); + y = MAXIMUM_MAP_SIZE_BIG - 1 - y; + break; + case 0: + break; + } + x /= 32; + y /= 32; + + return { -x + y + kMaximumMapSizeTechnical - 8, x + y - 8 }; + } + + void ResizeMap() + { + widgets[WIDX_MAP].right = width - 4; + + if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.SandboxMode) + widgets[WIDX_MAP].bottom = height - 1 - 72; + else if (selected_tab == PAGE_RIDES) + widgets[WIDX_MAP].bottom = height - 1 - (4 * LIST_ROW_HEIGHT + 4); + else + widgets[WIDX_MAP].bottom = height - 1 - 14; + } + + void CalculateTextLayout() + { + int32_t textOffset = 4 + LIST_ROW_HEIGHT; + _firstColumnWidth = 118; + for (uint32_t i = 0; i < 4; i++) + { + const auto* labelStr = LanguageGetString(MapLabels[i]); + _firstColumnWidth = std::max(textOffset + GfxGetStringWidth(labelStr, FontStyle::Medium), _firstColumnWidth); + } + + textOffset += _firstColumnWidth + 4; + min_width = WW; + for (uint32_t i = 4; i < std::size(MapLabels); i++) + { + const auto* labelStr = LanguageGetString(MapLabels[i]); + min_width = std::max( + static_cast(textOffset + GfxGetStringWidth(labelStr, FontStyle::Medium)), min_width); + } + width = std::max(min_width, width); + _recalculateScrollbars = true; + } + }; + + WindowBase* MapOpen() { - return; + try + { + WindowBase* w = WindowFocusOrCreate(WindowClass::Map, 245, 259, WF_10); + w->selected_tab = 0; + w->list_information_type = 0; + return w; + } + catch (const std::bad_alloc&) + { + return nullptr; + } } - auto* mapWindow = static_cast(w); - mapWindow->ResetMap(); -} + void WindowMapReset() + { + WindowBase* w; + + // Check if window is even opened + w = WindowBringToFrontByClass(WindowClass::Map); + if (w == nullptr) + { + return; + } + + auto* mapWindow = static_cast(w); + mapWindow->ResetMap(); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index 2945a9fad2..0f8b55182b 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -25,105 +25,105 @@ #include #include -using namespace OpenRCT2; - -enum +namespace OpenRCT2::Ui::Windows { - WINDOW_MAPGEN_PAGE_BASE, - WINDOW_MAPGEN_PAGE_RANDOM, - WINDOW_MAPGEN_PAGE_SIMPLEX, - WINDOW_MAPGEN_PAGE_HEIGHTMAP, - WINDOW_MAPGEN_PAGE_COUNT -}; + enum + { + WINDOW_MAPGEN_PAGE_BASE, + WINDOW_MAPGEN_PAGE_RANDOM, + WINDOW_MAPGEN_PAGE_SIMPLEX, + WINDOW_MAPGEN_PAGE_HEIGHTMAP, + WINDOW_MAPGEN_PAGE_COUNT + }; -enum -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_PAGE_BACKGROUND, - WIDX_TAB_1, - WIDX_TAB_2, - WIDX_TAB_3, - WIDX_TAB_4, + enum + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_PAGE_BACKGROUND, + WIDX_TAB_1, + WIDX_TAB_2, + WIDX_TAB_3, + WIDX_TAB_4, - TAB_BEGIN, + TAB_BEGIN, - WIDX_MAP_GENERATE = TAB_BEGIN, - WIDX_MAP_SIZE_Y, - WIDX_MAP_SIZE_Y_UP, - WIDX_MAP_SIZE_Y_DOWN, - WIDX_MAP_SIZE_LINK, - WIDX_MAP_SIZE_X, - WIDX_MAP_SIZE_X_UP, - WIDX_MAP_SIZE_X_DOWN, - WIDX_BASE_HEIGHT, - WIDX_BASE_HEIGHT_UP, - WIDX_BASE_HEIGHT_DOWN, - WIDX_WATER_LEVEL, - WIDX_WATER_LEVEL_UP, - WIDX_WATER_LEVEL_DOWN, - WIDX_FLOOR_TEXTURE, - WIDX_WALL_TEXTURE, + WIDX_MAP_GENERATE = TAB_BEGIN, + WIDX_MAP_SIZE_Y, + WIDX_MAP_SIZE_Y_UP, + WIDX_MAP_SIZE_Y_DOWN, + WIDX_MAP_SIZE_LINK, + WIDX_MAP_SIZE_X, + WIDX_MAP_SIZE_X_UP, + WIDX_MAP_SIZE_X_DOWN, + WIDX_BASE_HEIGHT, + WIDX_BASE_HEIGHT_UP, + WIDX_BASE_HEIGHT_DOWN, + WIDX_WATER_LEVEL, + WIDX_WATER_LEVEL_UP, + WIDX_WATER_LEVEL_DOWN, + WIDX_FLOOR_TEXTURE, + WIDX_WALL_TEXTURE, - WIDX_RANDOM_GENERATE = TAB_BEGIN, - WIDX_RANDOM_TERRAIN, - WIDX_RANDOM_PLACE_TREES, + WIDX_RANDOM_GENERATE = TAB_BEGIN, + WIDX_RANDOM_TERRAIN, + WIDX_RANDOM_PLACE_TREES, - WIDX_SIMPLEX_GENERATE = TAB_BEGIN, - WIDX_SIMPLEX_LABEL, - WIDX_SIMPLEX_LOW, - WIDX_SIMPLEX_LOW_UP, - WIDX_SIMPLEX_LOW_DOWN, - WIDX_SIMPLEX_HIGH, - WIDX_SIMPLEX_HIGH_UP, - WIDX_SIMPLEX_HIGH_DOWN, - WIDX_SIMPLEX_BASE_FREQ, - WIDX_SIMPLEX_BASE_FREQ_UP, - WIDX_SIMPLEX_BASE_FREQ_DOWN, - WIDX_SIMPLEX_OCTAVES, - WIDX_SIMPLEX_OCTAVES_UP, - WIDX_SIMPLEX_OCTAVES_DOWN, - WIDX_SIMPLEX_MAP_SIZE_Y, - WIDX_SIMPLEX_MAP_SIZE_Y_UP, - WIDX_SIMPLEX_MAP_SIZE_Y_DOWN, - WIDX_SIMPLEX_MAP_SIZE_LINK, - WIDX_SIMPLEX_MAP_SIZE_X, - WIDX_SIMPLEX_MAP_SIZE_X_UP, - WIDX_SIMPLEX_MAP_SIZE_X_DOWN, - WIDX_SIMPLEX_WATER_LEVEL, - WIDX_SIMPLEX_WATER_LEVEL_UP, - WIDX_SIMPLEX_WATER_LEVEL_DOWN, - WIDX_SIMPLEX_RANDOM_TERRAIN_CHECKBOX, - WIDX_SIMPLEX_FLOOR_TEXTURE, - WIDX_SIMPLEX_WALL_TEXTURE, - WIDX_SIMPLEX_PLACE_TREES_CHECKBOX, + WIDX_SIMPLEX_GENERATE = TAB_BEGIN, + WIDX_SIMPLEX_LABEL, + WIDX_SIMPLEX_LOW, + WIDX_SIMPLEX_LOW_UP, + WIDX_SIMPLEX_LOW_DOWN, + WIDX_SIMPLEX_HIGH, + WIDX_SIMPLEX_HIGH_UP, + WIDX_SIMPLEX_HIGH_DOWN, + WIDX_SIMPLEX_BASE_FREQ, + WIDX_SIMPLEX_BASE_FREQ_UP, + WIDX_SIMPLEX_BASE_FREQ_DOWN, + WIDX_SIMPLEX_OCTAVES, + WIDX_SIMPLEX_OCTAVES_UP, + WIDX_SIMPLEX_OCTAVES_DOWN, + WIDX_SIMPLEX_MAP_SIZE_Y, + WIDX_SIMPLEX_MAP_SIZE_Y_UP, + WIDX_SIMPLEX_MAP_SIZE_Y_DOWN, + WIDX_SIMPLEX_MAP_SIZE_LINK, + WIDX_SIMPLEX_MAP_SIZE_X, + WIDX_SIMPLEX_MAP_SIZE_X_UP, + WIDX_SIMPLEX_MAP_SIZE_X_DOWN, + WIDX_SIMPLEX_WATER_LEVEL, + WIDX_SIMPLEX_WATER_LEVEL_UP, + WIDX_SIMPLEX_WATER_LEVEL_DOWN, + WIDX_SIMPLEX_RANDOM_TERRAIN_CHECKBOX, + WIDX_SIMPLEX_FLOOR_TEXTURE, + WIDX_SIMPLEX_WALL_TEXTURE, + WIDX_SIMPLEX_PLACE_TREES_CHECKBOX, - WIDX_HEIGHTMAP_SELECT = TAB_BEGIN, - WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, - WIDX_HEIGHTMAP_STRENGTH, - WIDX_HEIGHTMAP_STRENGTH_UP, - WIDX_HEIGHTMAP_STRENGTH_DOWN, - WIDX_HEIGHTMAP_NORMALIZE, - WIDX_HEIGHTMAP_SMOOTH_TILES, - WIDX_HEIGHTMAP_LOW, - WIDX_HEIGHTMAP_LOW_UP, - WIDX_HEIGHTMAP_LOW_DOWN, - WIDX_HEIGHTMAP_HIGH, - WIDX_HEIGHTMAP_HIGH_UP, - WIDX_HEIGHTMAP_HIGH_DOWN, - WIDX_HEIGHTMAP_WATER_LEVEL, - WIDX_HEIGHTMAP_WATER_LEVEL_UP, - WIDX_HEIGHTMAP_WATER_LEVEL_DOWN, -}; + WIDX_HEIGHTMAP_SELECT = TAB_BEGIN, + WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, + WIDX_HEIGHTMAP_STRENGTH, + WIDX_HEIGHTMAP_STRENGTH_UP, + WIDX_HEIGHTMAP_STRENGTH_DOWN, + WIDX_HEIGHTMAP_NORMALIZE, + WIDX_HEIGHTMAP_SMOOTH_TILES, + WIDX_HEIGHTMAP_LOW, + WIDX_HEIGHTMAP_LOW_UP, + WIDX_HEIGHTMAP_LOW_DOWN, + WIDX_HEIGHTMAP_HIGH, + WIDX_HEIGHTMAP_HIGH_UP, + WIDX_HEIGHTMAP_HIGH_DOWN, + WIDX_HEIGHTMAP_WATER_LEVEL, + WIDX_HEIGHTMAP_WATER_LEVEL_UP, + WIDX_HEIGHTMAP_WATER_LEVEL_DOWN, + }; #pragma region Widgets -static constexpr StringId WINDOW_TITLE = STR_MAPGEN_WINDOW_TITLE; -static constexpr int32_t WW = 250; -static constexpr int32_t WH = 273; + static constexpr StringId WINDOW_TITLE = STR_MAPGEN_WINDOW_TITLE; + static constexpr int32_t WW = 250; + static constexpr int32_t WH = 273; -// clang-format off + // clang-format off #define SHARED_WIDGETS \ WINDOW_SHIM(WINDOW_TITLE, WW, WH), /* WIDX_BACKGROUND, WIDX_TITLE, WIDX_CLOSE */ \ MakeWidget({ 0, 43}, {WW, 229}, WindowWidgetType::Resize, WindowColour::Secondary), /* WIDX_PAGE_BACKGROUND */ \ @@ -142,7 +142,7 @@ static Widget MapWidgets[] = { MakeSpinnerWidgets({104, 88}, {95, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets MakeWidget ({104, 106}, {47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_BASE_LAND_TIP ), MakeWidget ({151, 106}, {47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_VERTICAL_LAND_TIP ), - WIDGETS_END, + kWidgetsEnd, }; static Widget RandomWidgets[] = { @@ -150,7 +150,7 @@ static Widget RandomWidgets[] = { MakeWidget({155, 255}, { 90, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_MAPGEN_ACTION_GENERATE ), MakeWidget({ 4, 52}, {195, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_OPTION_RANDOM_TERRAIN), MakeWidget({ 4, 70}, {195, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_OPTION_PLACE_TREES ), - WIDGETS_END, + kWidgetsEnd, }; static Widget SimplexWidgets[] = { @@ -169,7 +169,7 @@ static Widget SimplexWidgets[] = { MakeWidget ({102, 202}, { 47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_BASE_LAND_TIP ), // WIDX_SIMPLEX_FLOOR_TEXTURE MakeWidget ({150, 202}, { 47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_VERTICAL_LAND_TIP ), // WIDX_SIMPLEX_WALL_TEXTURE MakeWidget ({104, 239}, { 95, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary ), // WIDX_SIMPLEX_PLACE_TREES_CHECKBOX - WIDGETS_END, + kWidgetsEnd, }; static Widget HeightmapWidgets[] = { @@ -182,22 +182,22 @@ static Widget HeightmapWidgets[] = { MakeSpinnerWidgets({104, 124}, { 95, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // WIDX_HEIGHTMAP_LOW{,_UP,_DOWN} MakeSpinnerWidgets({104, 142}, { 95, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // WIDX_HEIGHTMAP_HIGH{,_UP,_DOWN} MakeSpinnerWidgets({104, 160}, { 95, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // WIDX_HEIGHTMAP_WATER_LEVEL{,_UP,_DOWN} - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -static Widget* PageWidgets[WINDOW_MAPGEN_PAGE_COUNT] = { - MapWidgets, - RandomWidgets, - SimplexWidgets, - HeightmapWidgets, -}; + static Widget* PageWidgets[WINDOW_MAPGEN_PAGE_COUNT] = { + MapWidgets, + RandomWidgets, + SimplexWidgets, + HeightmapWidgets, + }; #pragma endregion #pragma region Widget flags -// clang-format off + // clang-format off static uint64_t PageDisabledWidgets[WINDOW_MAPGEN_PAGE_COUNT] = { 0, @@ -265,1126 +265,1143 @@ static uint64_t PressedWidgets[WINDOW_MAPGEN_PAGE_COUNT] = { 0, (1uLL << WIDX_HEIGHTMAP_SMOOTH_TILES) }; -// clang-format on + // clang-format on #pragma endregion -static constexpr int32_t TabAnimationDivisor[WINDOW_MAPGEN_PAGE_COUNT] = { - 1, - 1, - 1, - 1, -}; -static constexpr int32_t TabAnimationFrames[WINDOW_MAPGEN_PAGE_COUNT] = { - 1, - 1, - 1, - 1, -}; -static constexpr int32_t TabAnimationLoops[WINDOW_MAPGEN_PAGE_COUNT] = { - 16, - 16, - 16, - 0, -}; -// clang-format on + static constexpr int32_t TabAnimationDivisor[WINDOW_MAPGEN_PAGE_COUNT] = { + 1, + 1, + 1, + 1, + }; + static constexpr int32_t TabAnimationFrames[WINDOW_MAPGEN_PAGE_COUNT] = { + 1, + 1, + 1, + 1, + }; + static constexpr int32_t TabAnimationLoops[WINDOW_MAPGEN_PAGE_COUNT] = { + 16, + 16, + 16, + 0, + }; + // clang-format on -constexpr int32_t BASESIZE_MIN = 0; -constexpr int32_t BASESIZE_MAX = 60; -constexpr int32_t WATERLEVEL_MIN = 0; -constexpr int32_t WATERLEVEL_MAX = 54; -constexpr int32_t MAX_SMOOTH_ITERATIONS = 20; + constexpr int32_t BASESIZE_MIN = 0; + constexpr int32_t BASESIZE_MAX = 60; + constexpr int32_t WATERLEVEL_MIN = 0; + constexpr int32_t WATERLEVEL_MAX = 54; + constexpr int32_t MAX_SMOOTH_ITERATIONS = 20; -enum class ResizeDirection -{ - Both, - X, - Y, -}; - -static void HeightmapLoadsaveCallback(int32_t result, const utf8* path); - -class MapGenWindow final : public Window -{ -private: - TileCoordsXY _mapSize{ 150, 150 }; - ResizeDirection _resizeDirection{ ResizeDirection::Both }; - bool _mapWidthAndHeightLinked{ true }; - int32_t _baseHeight = 12; - int32_t _waterLevel = 6; - int32_t _floorTexture = 0; - int32_t _wallTexture = 0; - bool _randomTerrain = true; - int32_t _placeTrees = 1; - - int32_t _simplex_low = 6; - int32_t _simplex_high = 10; - int32_t _simplex_base_freq = 60; - int32_t _simplex_octaves = 4; - - bool _heightmapLoaded = false; - bool _heightmapSmoothMap = false; - int32_t _heightmapSmoothStrength = 1; - bool _heightmapNormalize = false; - bool _heightmapSmoothTiles = true; - int32_t _heightmapLow = 2; - int32_t _heightmapHigh = 70; - - void SetPage(int32_t newPage) + enum class ResizeDirection { - page = newPage; - frame_no = 0; - RemoveViewport(); + Both, + X, + Y, + }; - hold_down_widgets = HoldDownWidgets[newPage]; - widgets = PageWidgets[newPage]; - disabled_widgets = PageDisabledWidgets[newPage]; - pressed_widgets = PressedWidgets[newPage]; + static void HeightmapLoadsaveCallback(int32_t result, const utf8* path); - // Enable heightmap widgets if one is loaded - if (newPage == WINDOW_MAPGEN_PAGE_HEIGHTMAP && _heightmapLoaded) + class MapGenWindow final : public Window + { + private: + TileCoordsXY _mapSize{ 150, 150 }; + ResizeDirection _resizeDirection{ ResizeDirection::Both }; + bool _mapWidthAndHeightLinked{ true }; + int32_t _baseHeight = 12; + int32_t _waterLevel = 6; + int32_t _floorTexture = 0; + int32_t _wallTexture = 0; + bool _randomTerrain = true; + int32_t _placeTrees = 1; + + int32_t _simplex_low = 6; + int32_t _simplex_high = 10; + int32_t _simplex_base_freq = 60; + int32_t _simplex_octaves = 4; + + bool _heightmapLoaded = false; + bool _heightmapSmoothMap = false; + int32_t _heightmapSmoothStrength = 1; + bool _heightmapNormalize = false; + bool _heightmapSmoothTiles = true; + int32_t _heightmapLow = 2; + int32_t _heightmapHigh = 70; + + void SetPage(int32_t newPage) { - SetWidgetEnabled(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH, _heightmapSmoothMap); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_UP, _heightmapSmoothMap); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_DOWN, _heightmapSmoothMap); - SetWidgetEnabled(WIDX_HEIGHTMAP_NORMALIZE, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_SMOOTH_TILES, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_HIGH, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_HIGH_UP, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_HIGH_DOWN, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_LOW, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_LOW_UP, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_LOW_DOWN, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_WATER_LEVEL, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_WATER_LEVEL_UP, true); - SetWidgetEnabled(WIDX_HEIGHTMAP_WATER_LEVEL_DOWN, true); - } + page = newPage; + frame_no = 0; + RemoveViewport(); - InitScrollWidgets(); - Invalidate(); - } + hold_down_widgets = HoldDownWidgets[newPage]; + widgets = PageWidgets[newPage]; + disabled_widgets = PageDisabledWidgets[newPage]; + pressed_widgets = PressedWidgets[newPage]; - void SetPressedTab() - { - int32_t i; - for (i = 0; i < WINDOW_MAPGEN_PAGE_COUNT; i++) - pressed_widgets &= ~(1 << (WIDX_TAB_1 + i)); - pressed_widgets |= 1LL << (WIDX_TAB_1 + page); - } - - void DrawTabImage(DrawPixelInfo& dpi, int32_t newPage, int32_t spriteIndex) - { - WidgetIndex widgetIndex = WIDX_TAB_1 + newPage; - - if (!WidgetIsDisabled(*this, widgetIndex)) - { - if (page == newPage) + // Enable heightmap widgets if one is loaded + if (newPage == WINDOW_MAPGEN_PAGE_HEIGHTMAP && _heightmapLoaded) { - int32_t frame = frame_no / TabAnimationDivisor[page]; - spriteIndex += (frame % TabAnimationFrames[page]); + SetWidgetEnabled(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH, _heightmapSmoothMap); + SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_UP, _heightmapSmoothMap); + SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_DOWN, _heightmapSmoothMap); + SetWidgetEnabled(WIDX_HEIGHTMAP_NORMALIZE, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_SMOOTH_TILES, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_HIGH, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_HIGH_UP, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_HIGH_DOWN, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_LOW, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_LOW_UP, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_LOW_DOWN, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_WATER_LEVEL, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_WATER_LEVEL_UP, true); + SetWidgetEnabled(WIDX_HEIGHTMAP_WATER_LEVEL_DOWN, true); } - GfxDrawSprite( - dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); + InitScrollWidgets(); + Invalidate(); } - } - void DrawTabImages(DrawPixelInfo& dpi) - { - DrawTabImage(dpi, WINDOW_MAPGEN_PAGE_BASE, SPR_G2_TAB_LAND); - DrawTabImage(dpi, WINDOW_MAPGEN_PAGE_RANDOM, SPR_G2_TAB_TREE); - DrawTabImage(dpi, WINDOW_MAPGEN_PAGE_SIMPLEX, SPR_G2_TAB_PENCIL); - DrawTabImage(dpi, WINDOW_MAPGEN_PAGE_HEIGHTMAP, SPR_TAB_GRAPH_0); - } - - void ChangeMapSize(int32_t sizeOffset) - { - if (_mapWidthAndHeightLinked) - _resizeDirection = ResizeDirection::Both; - - if (_resizeDirection != ResizeDirection::X) - _mapSize.y = std::clamp(_mapSize.y + sizeOffset, MINIMUM_MAP_SIZE_TECHNICAL, MAXIMUM_MAP_SIZE_TECHNICAL); - if (_resizeDirection != ResizeDirection::Y) - _mapSize.x = std::clamp(_mapSize.x + sizeOffset, MINIMUM_MAP_SIZE_TECHNICAL, MAXIMUM_MAP_SIZE_TECHNICAL); - } - - void InputMapSize(WidgetIndex callingWidget, int32_t currentValue) - { - Formatter ft; - ft.Add(MINIMUM_MAP_SIZE_PRACTICAL); - ft.Add(MAXIMUM_MAP_SIZE_PRACTICAL); - - // Practical map size is 2 lower than the technical map size - currentValue -= 2; - WindowTextInputOpen(this, callingWidget, STR_MAP_SIZE_2, STR_ENTER_MAP_SIZE, ft, STR_FORMAT_INTEGER, currentValue, 4); - } - - void SharedMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void SetPressedTab() { - case WIDX_CLOSE: - Close(); - break; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - SetPage(widgetIndex - WIDX_TAB_1); - break; + int32_t i; + for (i = 0; i < WINDOW_MAPGEN_PAGE_COUNT; i++) + pressed_widgets &= ~(1 << (WIDX_TAB_1 + i)); + pressed_widgets |= 1LL << (WIDX_TAB_1 + page); + } + + void DrawTabImage(DrawPixelInfo& dpi, int32_t newPage, int32_t spriteIndex) + { + WidgetIndex widgetIndex = WIDX_TAB_1 + newPage; + + if (!WidgetIsDisabled(*this, widgetIndex)) + { + if (page == newPage) + { + int32_t frame = frame_no / TabAnimationDivisor[page]; + spriteIndex += (frame % TabAnimationFrames[page]); + } + + GfxDrawSprite( + dpi, ImageId(spriteIndex), + windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); + } + } + + void DrawTabImages(DrawPixelInfo& dpi) + { + DrawTabImage(dpi, WINDOW_MAPGEN_PAGE_BASE, SPR_G2_TAB_LAND); + DrawTabImage(dpi, WINDOW_MAPGEN_PAGE_RANDOM, SPR_G2_TAB_TREE); + DrawTabImage(dpi, WINDOW_MAPGEN_PAGE_SIMPLEX, SPR_G2_TAB_PENCIL); + DrawTabImage(dpi, WINDOW_MAPGEN_PAGE_HEIGHTMAP, SPR_TAB_GRAPH_0); + } + + void ChangeMapSize(int32_t sizeOffset) + { + if (_mapWidthAndHeightLinked) + _resizeDirection = ResizeDirection::Both; + + if (_resizeDirection != ResizeDirection::X) + _mapSize.y = std::clamp( + _mapSize.y + sizeOffset, static_cast(kMinimumMapSizeTechnical), + static_cast(kMaximumMapSizeTechnical)); + if (_resizeDirection != ResizeDirection::Y) + _mapSize.x = std::clamp( + _mapSize.x + sizeOffset, static_cast(kMinimumMapSizeTechnical), + static_cast(kMaximumMapSizeTechnical)); + } + + void InputMapSize(WidgetIndex callingWidget, int32_t currentValue) + { + Formatter ft; + ft.Add(kMinimumMapSizePractical); + ft.Add(kMaximumMapSizePractical); + + // Practical map size is 2 lower than the technical map size + currentValue -= 2; + WindowTextInputOpen( + this, callingWidget, STR_MAP_SIZE_2, STR_ENTER_MAP_SIZE, ft, STR_FORMAT_INTEGER, currentValue, 4); + } + + void SharedMouseUp(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + SetPage(widgetIndex - WIDX_TAB_1); + break; + } } - } #pragma region Base page - void BaseMouseUp(WidgetIndex widgetIndex) - { - SharedMouseUp(widgetIndex); - - MapGenSettings mapgenSettings; - Formatter ft; - switch (widgetIndex) + void BaseMouseUp(WidgetIndex widgetIndex) { - case WIDX_MAP_GENERATE: - mapgenSettings.mapSize = _mapSize; - mapgenSettings.height = _baseHeight + 2; - mapgenSettings.water_level = _waterLevel + 2; - mapgenSettings.floor = _floorTexture; - mapgenSettings.wall = _wallTexture; + SharedMouseUp(widgetIndex); - MapGenGenerateBlank(&mapgenSettings); - GfxInvalidateScreen(); - break; - case WIDX_MAP_SIZE_Y: - _resizeDirection = ResizeDirection::Y; - InputMapSize(WIDX_MAP_SIZE_Y, _mapSize.y); - break; - case WIDX_MAP_SIZE_X: - _resizeDirection = ResizeDirection::X; - InputMapSize(WIDX_MAP_SIZE_X, _mapSize.x); - break; - case WIDX_MAP_SIZE_LINK: - _mapWidthAndHeightLinked = !_mapWidthAndHeightLinked; - break; - case WIDX_BASE_HEIGHT: - ft.Add((BASESIZE_MIN - 12) / 2); - ft.Add((BASESIZE_MAX - 12) / 2); - WindowTextInputOpen( - this, WIDX_BASE_HEIGHT, STR_BASE_HEIGHT, STR_ENTER_BASE_HEIGHT, ft, STR_FORMAT_INTEGER, - (_baseHeight - 12) / 2, 3); - break; - case WIDX_WATER_LEVEL: - ft.Add((WATERLEVEL_MIN - 12) / 2); - ft.Add((WATERLEVEL_MAX - 12) / 2); - WindowTextInputOpen( - this, WIDX_WATER_LEVEL, STR_WATER_LEVEL, STR_ENTER_WATER_LEVEL, ft, STR_FORMAT_INTEGER, - (_waterLevel - 12) / 2, 3); - break; - } - } - - void BaseMouseDown(WidgetIndex widgetIndex, Widget* widget) - { - switch (widgetIndex) - { - case WIDX_MAP_SIZE_Y_UP: - _resizeDirection = ResizeDirection::Y; - ChangeMapSize(+1); - Invalidate(); - break; - case WIDX_MAP_SIZE_Y_DOWN: - _resizeDirection = ResizeDirection::Y; - ChangeMapSize(-1); - Invalidate(); - break; - case WIDX_MAP_SIZE_X_UP: - _resizeDirection = ResizeDirection::X; - ChangeMapSize(+1); - Invalidate(); - break; - case WIDX_MAP_SIZE_X_DOWN: - _resizeDirection = ResizeDirection::X; - ChangeMapSize(-1); - Invalidate(); - break; - case WIDX_BASE_HEIGHT_UP: - _baseHeight = std::min(_baseHeight + 2, BASESIZE_MAX); - Invalidate(); - break; - case WIDX_BASE_HEIGHT_DOWN: - _baseHeight = std::max(_baseHeight - 2, BASESIZE_MIN); - Invalidate(); - break; - case WIDX_WATER_LEVEL_UP: - _waterLevel = std::min(_waterLevel + 2, WATERLEVEL_MAX); - Invalidate(); - break; - case WIDX_WATER_LEVEL_DOWN: - _waterLevel = std::max(_waterLevel - 2, WATERLEVEL_MIN); - Invalidate(); - break; - case WIDX_FLOOR_TEXTURE: - LandTool::ShowSurfaceStyleDropdown(this, widget, _floorTexture); - break; - case WIDX_WALL_TEXTURE: - LandTool::ShowEdgeStyleDropdown(this, widget, _wallTexture); - break; - } - } - - void BaseDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - int32_t type; - - switch (widgetIndex) - { - case WIDX_FLOOR_TEXTURE: - if (dropdownIndex == -1) - dropdownIndex = gDropdownHighlightedIndex; - - type = (dropdownIndex == -1) ? _floorTexture : dropdownIndex; - - if (gLandToolTerrainSurface == type) - { - gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL; - } - else - { - gLandToolTerrainSurface = type; - _floorTexture = type; - } - Invalidate(); - break; - case WIDX_WALL_TEXTURE: - if (dropdownIndex == -1) - dropdownIndex = gDropdownHighlightedIndex; - - type = (dropdownIndex == -1) ? _wallTexture : dropdownIndex; - - if (gLandToolTerrainEdge == type) - { - gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL; - } - else - { - gLandToolTerrainEdge = type; - _wallTexture = type; - } - Invalidate(); - break; - } - } - - void BaseUpdate() - { - // Tab animation - if (++frame_no >= TabAnimationLoops[page]) - frame_no = 0; - InvalidateWidget(WIDX_TAB_1); - } - - void TextInput(WidgetIndex widgetIndex, std::string_view text) - { - int32_t value; - char* end; - - const auto strText = u8string(text); - value = strtol(strText.c_str(), &end, 10); - - if (*end != '\0') - { - return; - } - - switch (widgetIndex) - { - case WIDX_MAP_SIZE_Y: - case WIDX_MAP_SIZE_X: - case WIDX_SIMPLEX_MAP_SIZE_Y: - case WIDX_SIMPLEX_MAP_SIZE_X: - // The practical size is 2 lower than the technical size - value += 2; - if (_resizeDirection == ResizeDirection::Y || _mapWidthAndHeightLinked) - _mapSize.y = value; - if (_resizeDirection == ResizeDirection::X || _mapWidthAndHeightLinked) - _mapSize.x = value; - break; - case WIDX_BASE_HEIGHT: - _baseHeight = std::clamp((value * 2) + 12, BASESIZE_MIN, BASESIZE_MAX); - break; - case WIDX_WATER_LEVEL: - _waterLevel = std::clamp((value * 2) + 12, WATERLEVEL_MIN, WATERLEVEL_MAX); - break; - } - - Invalidate(); - } - - void BasePrepareDraw() - { - if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_BASE]) - { - widgets = PageWidgets[WINDOW_MAPGEN_PAGE_BASE]; - InitScrollWidgets(); - } - - // Only allow linking the map size when X and Y are the same - SetWidgetPressed(WIDX_MAP_SIZE_LINK, _mapWidthAndHeightLinked); - SetWidgetDisabled(WIDX_MAP_SIZE_LINK, _mapSize.x != _mapSize.y); - - SetPressedTab(); - - // Push width (Y) and height (X) to the common formatter arguments for the map size spinners to use - auto ft = Formatter::Common(); - ft.Add(_mapSize.y - 2); - ft.Add(_mapSize.x - 2); - } - - void DrawDropdownButton(DrawPixelInfo& dpi, WidgetIndex widgetIndex, ImageId image) - { - const auto& widget = widgets[widgetIndex]; - ScreenCoordsXY pos = { windowPos.x + widget.left, windowPos.y + widget.top }; - if (IsWidgetDisabled(widgetIndex)) - { - // Draw greyed out (light border bottom right shadow) - auto colour = colours[widget.colour]; - colour = ColourMapA[NOT_TRANSLUCENT(colour)].lighter; - GfxDrawSpriteSolid(&dpi, image, pos + ScreenCoordsXY{ 1, 1 }, colour); - - // Draw greyed out (dark) - colour = colours[widget.colour]; - colour = ColourMapA[NOT_TRANSLUCENT(colour)].mid_light; - GfxDrawSpriteSolid(&dpi, image, pos, colour); - } - else - { - GfxDrawSprite(dpi, image, pos); - } - } - - void DrawDropdownButtons(DrawPixelInfo& dpi, WidgetIndex floorWidgetIndex, WidgetIndex edgeWidgetIndex) - { - auto& objManager = GetContext()->GetObjectManager(); - const auto surfaceObj = static_cast( - objManager.GetLoadedObject(ObjectType::TerrainSurface, _floorTexture)); - ImageId surfaceImage; - if (surfaceObj != nullptr) - { - surfaceImage = ImageId(surfaceObj->IconImageId); - if (surfaceObj->Colour != 255) + MapGenSettings mapgenSettings; + Formatter ft; + switch (widgetIndex) { - surfaceImage = surfaceImage.WithPrimary(surfaceObj->Colour); + case WIDX_MAP_GENERATE: + mapgenSettings.mapSize = _mapSize; + mapgenSettings.height = _baseHeight + 2; + mapgenSettings.water_level = _waterLevel + 2; + mapgenSettings.floor = _floorTexture; + mapgenSettings.wall = _wallTexture; + + MapGenGenerateBlank(&mapgenSettings); + GfxInvalidateScreen(); + break; + case WIDX_MAP_SIZE_Y: + _resizeDirection = ResizeDirection::Y; + InputMapSize(WIDX_MAP_SIZE_Y, _mapSize.y); + break; + case WIDX_MAP_SIZE_X: + _resizeDirection = ResizeDirection::X; + InputMapSize(WIDX_MAP_SIZE_X, _mapSize.x); + break; + case WIDX_MAP_SIZE_LINK: + _mapWidthAndHeightLinked = !_mapWidthAndHeightLinked; + break; + case WIDX_BASE_HEIGHT: + ft.Add((BASESIZE_MIN - 12) / 2); + ft.Add((BASESIZE_MAX - 12) / 2); + WindowTextInputOpen( + this, WIDX_BASE_HEIGHT, STR_BASE_HEIGHT, STR_ENTER_BASE_HEIGHT, ft, STR_FORMAT_INTEGER, + (_baseHeight - 12) / 2, 3); + break; + case WIDX_WATER_LEVEL: + ft.Add((WATERLEVEL_MIN - 12) / 2); + ft.Add((WATERLEVEL_MAX - 12) / 2); + WindowTextInputOpen( + this, WIDX_WATER_LEVEL, STR_WATER_LEVEL, STR_ENTER_WATER_LEVEL, ft, STR_FORMAT_INTEGER, + (_waterLevel - 12) / 2, 3); + break; } } - ImageId edgeImage; - const auto edgeObj = static_cast(objManager.GetLoadedObject(ObjectType::TerrainEdge, _wallTexture)); - if (edgeObj != nullptr) + void BaseMouseDown(WidgetIndex widgetIndex, Widget* widget) { - edgeImage = ImageId(edgeObj->IconImageId); + switch (widgetIndex) + { + case WIDX_MAP_SIZE_Y_UP: + _resizeDirection = ResizeDirection::Y; + ChangeMapSize(+1); + Invalidate(); + break; + case WIDX_MAP_SIZE_Y_DOWN: + _resizeDirection = ResizeDirection::Y; + ChangeMapSize(-1); + Invalidate(); + break; + case WIDX_MAP_SIZE_X_UP: + _resizeDirection = ResizeDirection::X; + ChangeMapSize(+1); + Invalidate(); + break; + case WIDX_MAP_SIZE_X_DOWN: + _resizeDirection = ResizeDirection::X; + ChangeMapSize(-1); + Invalidate(); + break; + case WIDX_BASE_HEIGHT_UP: + _baseHeight = std::min(_baseHeight + 2, BASESIZE_MAX); + Invalidate(); + break; + case WIDX_BASE_HEIGHT_DOWN: + _baseHeight = std::max(_baseHeight - 2, BASESIZE_MIN); + Invalidate(); + break; + case WIDX_WATER_LEVEL_UP: + _waterLevel = std::min(_waterLevel + 2, WATERLEVEL_MAX); + Invalidate(); + break; + case WIDX_WATER_LEVEL_DOWN: + _waterLevel = std::max(_waterLevel - 2, WATERLEVEL_MIN); + Invalidate(); + break; + case WIDX_FLOOR_TEXTURE: + LandTool::ShowSurfaceStyleDropdown(this, widget, _floorTexture); + break; + case WIDX_WALL_TEXTURE: + LandTool::ShowEdgeStyleDropdown(this, widget, _wallTexture); + break; + } } - DrawDropdownButton(dpi, floorWidgetIndex, surfaceImage); - DrawDropdownButton(dpi, edgeWidgetIndex, edgeImage); - } + void BaseDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + int32_t type; - void BaseDraw(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - DrawDropdownButtons(dpi, WIDX_FLOOR_TEXTURE, WIDX_WALL_TEXTURE); + switch (widgetIndex) + { + case WIDX_FLOOR_TEXTURE: + if (dropdownIndex == -1) + dropdownIndex = gDropdownHighlightedIndex; - const auto textColour = colours[1]; + type = (dropdownIndex == -1) ? _floorTexture : dropdownIndex; - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_MAP_SIZE_Y].top + 1 }, STR_MAP_SIZE, {}, { textColour }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_BASE_HEIGHT].top + 1 }, STR_BASE_HEIGHT_LABEL, {}, { textColour }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_WATER_LEVEL].top + 1 }, STR_WATER_LEVEL_LABEL, {}, { textColour }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_FLOOR_TEXTURE].top + 1 }, STR_TERRAIN_LABEL, {}, { textColour }); + if (gLandToolTerrainSurface == type) + { + gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL; + } + else + { + gLandToolTerrainSurface = type; + _floorTexture = type; + } + Invalidate(); + break; + case WIDX_WALL_TEXTURE: + if (dropdownIndex == -1) + dropdownIndex = gDropdownHighlightedIndex; - auto ft = Formatter(); - ft.Add((_baseHeight - 12) / 2); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_BASE_HEIGHT].left + 1, widgets[WIDX_BASE_HEIGHT].top + 1 }, - STR_COMMA16, ft, { colours[1] }); + type = (dropdownIndex == -1) ? _wallTexture : dropdownIndex; - ft = Formatter(); - ft.Add((_waterLevel - 12) / 2); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_WATER_LEVEL].left + 1, widgets[WIDX_WATER_LEVEL].top + 1 }, - STR_COMMA16, ft, { colours[1] }); - } + if (gLandToolTerrainEdge == type) + { + gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL; + } + else + { + gLandToolTerrainEdge = type; + _wallTexture = type; + } + Invalidate(); + break; + } + } + + void BaseUpdate() + { + // Tab animation + if (++frame_no >= TabAnimationLoops[page]) + frame_no = 0; + InvalidateWidget(WIDX_TAB_1); + } + + void TextInput(WidgetIndex widgetIndex, std::string_view text) + { + int32_t value; + char* end; + + const auto strText = u8string(text); + value = strtol(strText.c_str(), &end, 10); + + if (*end != '\0') + { + return; + } + + switch (widgetIndex) + { + case WIDX_MAP_SIZE_Y: + case WIDX_MAP_SIZE_X: + case WIDX_SIMPLEX_MAP_SIZE_Y: + case WIDX_SIMPLEX_MAP_SIZE_X: + // The practical size is 2 lower than the technical size + value += 2; + if (_resizeDirection == ResizeDirection::Y || _mapWidthAndHeightLinked) + _mapSize.y = value; + if (_resizeDirection == ResizeDirection::X || _mapWidthAndHeightLinked) + _mapSize.x = value; + break; + case WIDX_BASE_HEIGHT: + _baseHeight = std::clamp((value * 2) + 12, BASESIZE_MIN, BASESIZE_MAX); + break; + case WIDX_WATER_LEVEL: + _waterLevel = std::clamp((value * 2) + 12, WATERLEVEL_MIN, WATERLEVEL_MAX); + break; + } + + Invalidate(); + } + + void BasePrepareDraw() + { + if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_BASE]) + { + widgets = PageWidgets[WINDOW_MAPGEN_PAGE_BASE]; + InitScrollWidgets(); + } + + // Only allow linking the map size when X and Y are the same + SetWidgetPressed(WIDX_MAP_SIZE_LINK, _mapWidthAndHeightLinked); + SetWidgetDisabled(WIDX_MAP_SIZE_LINK, _mapSize.x != _mapSize.y); + + SetPressedTab(); + + // Push width (Y) and height (X) to the common formatter arguments for the map size spinners to use + auto ft = Formatter::Common(); + ft.Add(_mapSize.y - 2); + ft.Add(_mapSize.x - 2); + } + + void DrawDropdownButton(DrawPixelInfo& dpi, WidgetIndex widgetIndex, ImageId image) + { + const auto& widget = widgets[widgetIndex]; + ScreenCoordsXY pos = { windowPos.x + widget.left, windowPos.y + widget.top }; + if (IsWidgetDisabled(widgetIndex)) + { + // Draw greyed out (light border bottom right shadow) + auto colour = colours[widget.colour]; + colour = ColourMapA[NOT_TRANSLUCENT(colour)].lighter; + GfxDrawSpriteSolid(dpi, image, pos + ScreenCoordsXY{ 1, 1 }, colour); + + // Draw greyed out (dark) + colour = colours[widget.colour]; + colour = ColourMapA[NOT_TRANSLUCENT(colour)].mid_light; + GfxDrawSpriteSolid(dpi, image, pos, colour); + } + else + { + GfxDrawSprite(dpi, image, pos); + } + } + + void DrawDropdownButtons(DrawPixelInfo& dpi, WidgetIndex floorWidgetIndex, WidgetIndex edgeWidgetIndex) + { + auto& objManager = GetContext()->GetObjectManager(); + const auto surfaceObj = static_cast( + objManager.GetLoadedObject(ObjectType::TerrainSurface, _floorTexture)); + ImageId surfaceImage; + if (surfaceObj != nullptr) + { + surfaceImage = ImageId(surfaceObj->IconImageId); + if (surfaceObj->Colour != 255) + { + surfaceImage = surfaceImage.WithPrimary(surfaceObj->Colour); + } + } + + ImageId edgeImage; + const auto edgeObj = static_cast( + objManager.GetLoadedObject(ObjectType::TerrainEdge, _wallTexture)); + if (edgeObj != nullptr) + { + edgeImage = ImageId(edgeObj->IconImageId); + } + + DrawDropdownButton(dpi, floorWidgetIndex, surfaceImage); + DrawDropdownButton(dpi, edgeWidgetIndex, edgeImage); + } + + void BaseDraw(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + DrawDropdownButtons(dpi, WIDX_FLOOR_TEXTURE, WIDX_WALL_TEXTURE); + + const auto textColour = colours[1]; + + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_MAP_SIZE_Y].top + 1 }, STR_MAP_SIZE, {}, { textColour }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_BASE_HEIGHT].top + 1 }, STR_BASE_HEIGHT_LABEL, {}, + { textColour }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_WATER_LEVEL].top + 1 }, STR_WATER_LEVEL_LABEL, {}, + { textColour }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_FLOOR_TEXTURE].top + 1 }, STR_TERRAIN_LABEL, {}, + { textColour }); + + auto ft = Formatter(); + ft.Add((_baseHeight - 12) / 2); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_BASE_HEIGHT].left + 1, widgets[WIDX_BASE_HEIGHT].top + 1 }, + STR_COMMA16, ft, { colours[1] }); + + ft = Formatter(); + ft.Add((_waterLevel - 12) / 2); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_WATER_LEVEL].left + 1, widgets[WIDX_WATER_LEVEL].top + 1 }, + STR_COMMA16, ft, { colours[1] }); + } #pragma endregion #pragma region Random page - void RandomMouseUp(WidgetIndex widgetIndex) - { - SharedMouseUp(widgetIndex); - - MapGenSettings mapgenSettings; - - switch (widgetIndex) + void RandomMouseUp(WidgetIndex widgetIndex) { - case WIDX_RANDOM_GENERATE: - mapgenSettings.mapSize = _mapSize; - mapgenSettings.height = _baseHeight + 2; - mapgenSettings.water_level = _waterLevel + 2; - mapgenSettings.floor = _randomTerrain ? -1 : _floorTexture; - mapgenSettings.wall = _randomTerrain ? -1 : _wallTexture; - mapgenSettings.trees = _placeTrees; + SharedMouseUp(widgetIndex); - mapgenSettings.simplex_low = UtilRand() % 4; - mapgenSettings.simplex_high = 12 + (UtilRand() % (32 - 12)); - mapgenSettings.simplex_base_freq = 1.75f; - mapgenSettings.simplex_octaves = 6; + MapGenSettings mapgenSettings; - MapGenGenerate(&mapgenSettings); - GfxInvalidateScreen(); - break; - case WIDX_RANDOM_TERRAIN: - _randomTerrain = !_randomTerrain; - break; - case WIDX_RANDOM_PLACE_TREES: - _placeTrees ^= 1; - break; - } - } + switch (widgetIndex) + { + case WIDX_RANDOM_GENERATE: + mapgenSettings.mapSize = _mapSize; + mapgenSettings.height = _baseHeight + 2; + mapgenSettings.water_level = _waterLevel + 2; + mapgenSettings.floor = _randomTerrain ? -1 : _floorTexture; + mapgenSettings.wall = _randomTerrain ? -1 : _wallTexture; + mapgenSettings.trees = _placeTrees; - void RandomUpdate() - { - // Tab animation - if (++frame_no >= TabAnimationLoops[page]) - frame_no = 0; - InvalidateWidget(WIDX_TAB_2); - } + mapgenSettings.simplex_low = UtilRand() % 4; + mapgenSettings.simplex_high = 12 + (UtilRand() % (32 - 12)); + mapgenSettings.simplex_base_freq = 1.75f; + mapgenSettings.simplex_octaves = 6; - void RandomPrepareDraw() - { - if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_RANDOM]) - { - widgets = PageWidgets[WINDOW_MAPGEN_PAGE_RANDOM]; - InitScrollWidgets(); + MapGenGenerate(&mapgenSettings); + GfxInvalidateScreen(); + break; + case WIDX_RANDOM_TERRAIN: + _randomTerrain = !_randomTerrain; + break; + case WIDX_RANDOM_PLACE_TREES: + _placeTrees ^= 1; + break; + } } - pressed_widgets = 0; - if (_randomTerrain) - pressed_widgets |= 1uLL << WIDX_RANDOM_TERRAIN; - if (_placeTrees) - pressed_widgets |= 1uLL << WIDX_RANDOM_PLACE_TREES; + void RandomUpdate() + { + // Tab animation + if (++frame_no >= TabAnimationLoops[page]) + frame_no = 0; + InvalidateWidget(WIDX_TAB_2); + } - SetPressedTab(); - } + void RandomPrepareDraw() + { + if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_RANDOM]) + { + widgets = PageWidgets[WINDOW_MAPGEN_PAGE_RANDOM]; + InitScrollWidgets(); + } - void RandomDraw(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - } + pressed_widgets = 0; + if (_randomTerrain) + pressed_widgets |= 1uLL << WIDX_RANDOM_TERRAIN; + if (_placeTrees) + pressed_widgets |= 1uLL << WIDX_RANDOM_PLACE_TREES; + + SetPressedTab(); + } + + void RandomDraw(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + } #pragma endregion #pragma region Simplex page - void SimplexMouseUp(WidgetIndex widgetIndex) - { - SharedMouseUp(widgetIndex); - - MapGenSettings mapgenSettings; - - switch (widgetIndex) + void SimplexMouseUp(WidgetIndex widgetIndex) { - case WIDX_SIMPLEX_MAP_SIZE_Y: - _resizeDirection = ResizeDirection::Y; - InputMapSize(WIDX_SIMPLEX_MAP_SIZE_Y, _mapSize.y); - break; - case WIDX_SIMPLEX_MAP_SIZE_X: - _resizeDirection = ResizeDirection::X; - InputMapSize(WIDX_SIMPLEX_MAP_SIZE_X, _mapSize.x); - break; - case WIDX_SIMPLEX_MAP_SIZE_LINK: - _mapWidthAndHeightLinked = !_mapWidthAndHeightLinked; - break; - case WIDX_SIMPLEX_GENERATE: - mapgenSettings.mapSize = _mapSize; + SharedMouseUp(widgetIndex); - mapgenSettings.height = _baseHeight; - mapgenSettings.water_level = _waterLevel + kMinimumWaterHeight; - mapgenSettings.floor = _randomTerrain ? -1 : _floorTexture; - mapgenSettings.wall = _randomTerrain ? -1 : _wallTexture; - mapgenSettings.trees = _placeTrees; + MapGenSettings mapgenSettings; - mapgenSettings.simplex_low = _simplex_low; - mapgenSettings.simplex_high = _simplex_high; - mapgenSettings.simplex_base_freq = (static_cast(_simplex_base_freq)) / 100.00f; - mapgenSettings.simplex_octaves = _simplex_octaves; + switch (widgetIndex) + { + case WIDX_SIMPLEX_MAP_SIZE_Y: + _resizeDirection = ResizeDirection::Y; + InputMapSize(WIDX_SIMPLEX_MAP_SIZE_Y, _mapSize.y); + break; + case WIDX_SIMPLEX_MAP_SIZE_X: + _resizeDirection = ResizeDirection::X; + InputMapSize(WIDX_SIMPLEX_MAP_SIZE_X, _mapSize.x); + break; + case WIDX_SIMPLEX_MAP_SIZE_LINK: + _mapWidthAndHeightLinked = !_mapWidthAndHeightLinked; + break; + case WIDX_SIMPLEX_GENERATE: + mapgenSettings.mapSize = _mapSize; - MapGenGenerate(&mapgenSettings); - GfxInvalidateScreen(); - break; - } - } + mapgenSettings.height = _baseHeight; + mapgenSettings.water_level = _waterLevel + kMinimumWaterHeight; + mapgenSettings.floor = _randomTerrain ? -1 : _floorTexture; + mapgenSettings.wall = _randomTerrain ? -1 : _wallTexture; + mapgenSettings.trees = _placeTrees; - void SimplexMouseDown(WidgetIndex widgetIndex, Widget* widget) - { - switch (widgetIndex) - { - case WIDX_SIMPLEX_LOW_UP: - _simplex_low = std::min(_simplex_low + 1, 24); - Invalidate(); - break; - case WIDX_SIMPLEX_LOW_DOWN: - _simplex_low = std::max(_simplex_low - 1, 0); - Invalidate(); - break; - case WIDX_SIMPLEX_HIGH_UP: - _simplex_high = std::min(_simplex_high + 1, 36); - Invalidate(); - break; - case WIDX_SIMPLEX_HIGH_DOWN: - _simplex_high = std::max(_simplex_high - 1, 0); - Invalidate(); - break; - case WIDX_SIMPLEX_BASE_FREQ_UP: - _simplex_base_freq = std::min(_simplex_base_freq + 5, 1000); - Invalidate(); - break; - case WIDX_SIMPLEX_BASE_FREQ_DOWN: - _simplex_base_freq = std::max(_simplex_base_freq - 5, 0); - Invalidate(); - break; - case WIDX_SIMPLEX_OCTAVES_UP: - _simplex_octaves = std::min(_simplex_octaves + 1, 10); - Invalidate(); - break; - case WIDX_SIMPLEX_OCTAVES_DOWN: - _simplex_octaves = std::max(_simplex_octaves - 1, 1); - Invalidate(); - break; - case WIDX_SIMPLEX_MAP_SIZE_Y_UP: - _resizeDirection = ResizeDirection::Y; - ChangeMapSize(+1); - Invalidate(); - break; - case WIDX_SIMPLEX_MAP_SIZE_Y_DOWN: - _resizeDirection = ResizeDirection::Y; - ChangeMapSize(-1); - Invalidate(); - break; - case WIDX_SIMPLEX_MAP_SIZE_X_UP: - _resizeDirection = ResizeDirection::X; - ChangeMapSize(+1); - Invalidate(); - break; - case WIDX_SIMPLEX_MAP_SIZE_X_DOWN: - _resizeDirection = ResizeDirection::X; - ChangeMapSize(-1); - Invalidate(); - break; - case WIDX_SIMPLEX_WATER_LEVEL_UP: - _waterLevel = std::min(_waterLevel + kMinimumWaterHeight, kMinimumWaterHeight + kMaximumWaterHeight); - Invalidate(); - break; - case WIDX_SIMPLEX_WATER_LEVEL_DOWN: - _waterLevel = std::max(_waterLevel - kMinimumWaterHeight, 0); - Invalidate(); - break; - case WIDX_SIMPLEX_RANDOM_TERRAIN_CHECKBOX: - _randomTerrain = !_randomTerrain; - Invalidate(); - break; - case WIDX_SIMPLEX_FLOOR_TEXTURE: - LandTool::ShowSurfaceStyleDropdown(this, widget, _floorTexture); - break; - case WIDX_SIMPLEX_WALL_TEXTURE: - LandTool::ShowEdgeStyleDropdown(this, widget, _wallTexture); - break; - case WIDX_SIMPLEX_PLACE_TREES_CHECKBOX: - _placeTrees ^= 1; - Invalidate(); - break; - } - } + mapgenSettings.simplex_low = _simplex_low; + mapgenSettings.simplex_high = _simplex_high; + mapgenSettings.simplex_base_freq = (static_cast(_simplex_base_freq)) / 100.00f; + mapgenSettings.simplex_octaves = _simplex_octaves; - void SimplexDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - int32_t type; - - switch (widgetIndex) - { - case WIDX_SIMPLEX_FLOOR_TEXTURE: - if (dropdownIndex == -1) - dropdownIndex = gDropdownHighlightedIndex; - - type = (dropdownIndex == -1) ? _floorTexture : dropdownIndex; - - if (gLandToolTerrainSurface == type) - { - gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL; - } - else - { - gLandToolTerrainSurface = type; - _floorTexture = type; - } - Invalidate(); - break; - case WIDX_SIMPLEX_WALL_TEXTURE: - if (dropdownIndex == -1) - dropdownIndex = gDropdownHighlightedIndex; - - type = (dropdownIndex == -1) ? _wallTexture : dropdownIndex; - - if (gLandToolTerrainEdge == type) - { - gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL; - } - else - { - gLandToolTerrainEdge = type; - _wallTexture = type; - } - Invalidate(); - break; - } - } - - void SimplexUpdate() - { - // Tab animation - if (++frame_no >= TabAnimationLoops[page]) - frame_no = 0; - InvalidateWidget(WIDX_TAB_3); - } - - void SimplexPrepareDraw() - { - if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_SIMPLEX]) - { - widgets = PageWidgets[WINDOW_MAPGEN_PAGE_SIMPLEX]; - InitScrollWidgets(); + MapGenGenerate(&mapgenSettings); + GfxInvalidateScreen(); + break; + } } - // Only allow linking the map size when X and Y are the same - SetWidgetPressed(WIDX_SIMPLEX_MAP_SIZE_LINK, _mapWidthAndHeightLinked); - SetWidgetDisabled(WIDX_SIMPLEX_MAP_SIZE_LINK, _mapSize.x != _mapSize.y); - - SetCheckboxValue(WIDX_SIMPLEX_RANDOM_TERRAIN_CHECKBOX, _randomTerrain != 0); - SetCheckboxValue(WIDX_SIMPLEX_PLACE_TREES_CHECKBOX, _placeTrees != 0); - - // Only allow floor and wall texture options if random terrain is disabled - if (!_randomTerrain) + void SimplexMouseDown(WidgetIndex widgetIndex, Widget* widget) { - SetWidgetEnabled(WIDX_SIMPLEX_FLOOR_TEXTURE, true); - SetWidgetEnabled(WIDX_SIMPLEX_WALL_TEXTURE, true); - } - else - { - SetWidgetEnabled(WIDX_SIMPLEX_FLOOR_TEXTURE, false); - SetWidgetEnabled(WIDX_SIMPLEX_WALL_TEXTURE, false); + switch (widgetIndex) + { + case WIDX_SIMPLEX_LOW_UP: + _simplex_low = std::min(_simplex_low + 1, 24); + Invalidate(); + break; + case WIDX_SIMPLEX_LOW_DOWN: + _simplex_low = std::max(_simplex_low - 1, 0); + Invalidate(); + break; + case WIDX_SIMPLEX_HIGH_UP: + _simplex_high = std::min(_simplex_high + 1, 36); + Invalidate(); + break; + case WIDX_SIMPLEX_HIGH_DOWN: + _simplex_high = std::max(_simplex_high - 1, 0); + Invalidate(); + break; + case WIDX_SIMPLEX_BASE_FREQ_UP: + _simplex_base_freq = std::min(_simplex_base_freq + 5, 1000); + Invalidate(); + break; + case WIDX_SIMPLEX_BASE_FREQ_DOWN: + _simplex_base_freq = std::max(_simplex_base_freq - 5, 0); + Invalidate(); + break; + case WIDX_SIMPLEX_OCTAVES_UP: + _simplex_octaves = std::min(_simplex_octaves + 1, 10); + Invalidate(); + break; + case WIDX_SIMPLEX_OCTAVES_DOWN: + _simplex_octaves = std::max(_simplex_octaves - 1, 1); + Invalidate(); + break; + case WIDX_SIMPLEX_MAP_SIZE_Y_UP: + _resizeDirection = ResizeDirection::Y; + ChangeMapSize(+1); + Invalidate(); + break; + case WIDX_SIMPLEX_MAP_SIZE_Y_DOWN: + _resizeDirection = ResizeDirection::Y; + ChangeMapSize(-1); + Invalidate(); + break; + case WIDX_SIMPLEX_MAP_SIZE_X_UP: + _resizeDirection = ResizeDirection::X; + ChangeMapSize(+1); + Invalidate(); + break; + case WIDX_SIMPLEX_MAP_SIZE_X_DOWN: + _resizeDirection = ResizeDirection::X; + ChangeMapSize(-1); + Invalidate(); + break; + case WIDX_SIMPLEX_WATER_LEVEL_UP: + _waterLevel = std::min(_waterLevel + kMinimumWaterHeight, kMinimumWaterHeight + kMaximumWaterHeight); + Invalidate(); + break; + case WIDX_SIMPLEX_WATER_LEVEL_DOWN: + _waterLevel = std::max(_waterLevel - kMinimumWaterHeight, 0); + Invalidate(); + break; + case WIDX_SIMPLEX_RANDOM_TERRAIN_CHECKBOX: + _randomTerrain = !_randomTerrain; + Invalidate(); + break; + case WIDX_SIMPLEX_FLOOR_TEXTURE: + LandTool::ShowSurfaceStyleDropdown(this, widget, _floorTexture); + break; + case WIDX_SIMPLEX_WALL_TEXTURE: + LandTool::ShowEdgeStyleDropdown(this, widget, _wallTexture); + break; + case WIDX_SIMPLEX_PLACE_TREES_CHECKBOX: + _placeTrees ^= 1; + Invalidate(); + break; + } } - SetPressedTab(); + void SimplexDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + int32_t type; - // Push width (Y) and height (X) to the common formatter arguments for the map size spinners to use - auto ft = Formatter::Common(); - ft.Add(_mapSize.y - 2); - ft.Add(_mapSize.x - 2); - } + switch (widgetIndex) + { + case WIDX_SIMPLEX_FLOOR_TEXTURE: + if (dropdownIndex == -1) + dropdownIndex = gDropdownHighlightedIndex; - void SimplexDraw(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - DrawDropdownButtons(dpi, WIDX_SIMPLEX_FLOOR_TEXTURE, WIDX_SIMPLEX_WALL_TEXTURE); + type = (dropdownIndex == -1) ? _floorTexture : dropdownIndex; - const uint8_t textColour = colours[1]; + if (gLandToolTerrainSurface == type) + { + gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL; + } + else + { + gLandToolTerrainSurface = type; + _floorTexture = type; + } + Invalidate(); + break; + case WIDX_SIMPLEX_WALL_TEXTURE: + if (dropdownIndex == -1) + dropdownIndex = gDropdownHighlightedIndex; - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_LOW].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_LOW_, {}, - { textColour }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_HIGH].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_HIGH, {}, - { textColour }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_BASE_FREQ].top + 1 }, - STR_MAPGEN_SIMPLEX_NOISE_BASE_FREQUENCY, {}, { textColour }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_OCTAVES].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_OCTAVES, {}, - { textColour }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_MAP_SIZE_Y].top + 1 }, STR_MAP_SIZE, {}, { textColour }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_WATER_LEVEL].top + 1 }, STR_WATER_LEVEL_LABEL, {}, - { textColour }); + type = (dropdownIndex == -1) ? _wallTexture : dropdownIndex; - auto ft = Formatter(); - ft.Add(_simplex_low); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_SIMPLEX_LOW].left + 1, widgets[WIDX_SIMPLEX_LOW].top + 1 }, - STR_COMMA16, ft, { textColour }); - ft = Formatter(); - ft.Add(_simplex_high); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_SIMPLEX_HIGH].left + 1, widgets[WIDX_SIMPLEX_HIGH].top + 1 }, - STR_COMMA16, ft, { textColour }); - ft = Formatter(); - ft.Add(_simplex_base_freq); - DrawTextBasic( - dpi, - windowPos + ScreenCoordsXY{ widgets[WIDX_SIMPLEX_BASE_FREQ].left + 1, widgets[WIDX_SIMPLEX_BASE_FREQ].top + 1 }, - STR_WINDOW_COLOUR_2_COMMA2DP32, ft, { textColour }); - ft = Formatter(); - ft.Add(_simplex_octaves); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_SIMPLEX_OCTAVES].left + 1, widgets[WIDX_SIMPLEX_OCTAVES].top + 1 }, - STR_COMMA16, ft, { textColour }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_RANDOM_TERRAIN_CHECKBOX].top + 1 }, STR_TERRAIN_LABEL, {}, - { textColour }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_PLACE_TREES_CHECKBOX].top + 1 }, - STR_MAPGEN_OPTION_PLACE_TREES, {}, { textColour }); + if (gLandToolTerrainEdge == type) + { + gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL; + } + else + { + gLandToolTerrainEdge = type; + _wallTexture = type; + } + Invalidate(); + break; + } + } - ft = Formatter(); - ft.Add((_waterLevel - 12) / 2); - DrawTextBasic( - dpi, - windowPos + ScreenCoordsXY{ widgets[WIDX_SIMPLEX_WATER_LEVEL].left + 1, widgets[WIDX_SIMPLEX_WATER_LEVEL].top + 1 }, - STR_COMMA16, ft, { textColour }); - } + void SimplexUpdate() + { + // Tab animation + if (++frame_no >= TabAnimationLoops[page]) + frame_no = 0; + InvalidateWidget(WIDX_TAB_3); + } + + void SimplexPrepareDraw() + { + if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_SIMPLEX]) + { + widgets = PageWidgets[WINDOW_MAPGEN_PAGE_SIMPLEX]; + InitScrollWidgets(); + } + + // Only allow linking the map size when X and Y are the same + SetWidgetPressed(WIDX_SIMPLEX_MAP_SIZE_LINK, _mapWidthAndHeightLinked); + SetWidgetDisabled(WIDX_SIMPLEX_MAP_SIZE_LINK, _mapSize.x != _mapSize.y); + + SetCheckboxValue(WIDX_SIMPLEX_RANDOM_TERRAIN_CHECKBOX, _randomTerrain != 0); + SetCheckboxValue(WIDX_SIMPLEX_PLACE_TREES_CHECKBOX, _placeTrees != 0); + + // Only allow floor and wall texture options if random terrain is disabled + if (!_randomTerrain) + { + SetWidgetEnabled(WIDX_SIMPLEX_FLOOR_TEXTURE, true); + SetWidgetEnabled(WIDX_SIMPLEX_WALL_TEXTURE, true); + } + else + { + SetWidgetEnabled(WIDX_SIMPLEX_FLOOR_TEXTURE, false); + SetWidgetEnabled(WIDX_SIMPLEX_WALL_TEXTURE, false); + } + + SetPressedTab(); + + // Push width (Y) and height (X) to the common formatter arguments for the map size spinners to use + auto ft = Formatter::Common(); + ft.Add(_mapSize.y - 2); + ft.Add(_mapSize.x - 2); + } + + void SimplexDraw(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + DrawDropdownButtons(dpi, WIDX_SIMPLEX_FLOOR_TEXTURE, WIDX_SIMPLEX_WALL_TEXTURE); + + const uint8_t textColour = colours[1]; + + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_LOW].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_LOW_, {}, + { textColour }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_HIGH].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_HIGH, {}, + { textColour }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_BASE_FREQ].top + 1 }, + STR_MAPGEN_SIMPLEX_NOISE_BASE_FREQUENCY, {}, { textColour }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_OCTAVES].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_OCTAVES, + {}, { textColour }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_MAP_SIZE_Y].top + 1 }, STR_MAP_SIZE, {}, + { textColour }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_WATER_LEVEL].top + 1 }, STR_WATER_LEVEL_LABEL, {}, + { textColour }); + + auto ft = Formatter(); + ft.Add(_simplex_low); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_SIMPLEX_LOW].left + 1, widgets[WIDX_SIMPLEX_LOW].top + 1 }, + STR_COMMA16, ft, { textColour }); + ft = Formatter(); + ft.Add(_simplex_high); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_SIMPLEX_HIGH].left + 1, widgets[WIDX_SIMPLEX_HIGH].top + 1 }, + STR_COMMA16, ft, { textColour }); + ft = Formatter(); + ft.Add(_simplex_base_freq); + DrawTextBasic( + dpi, + windowPos + ScreenCoordsXY{ widgets[WIDX_SIMPLEX_BASE_FREQ].left + 1, widgets[WIDX_SIMPLEX_BASE_FREQ].top + 1 }, + STR_WINDOW_COLOUR_2_COMMA2DP32, ft, { textColour }); + ft = Formatter(); + ft.Add(_simplex_octaves); + DrawTextBasic( + dpi, + windowPos + ScreenCoordsXY{ widgets[WIDX_SIMPLEX_OCTAVES].left + 1, widgets[WIDX_SIMPLEX_OCTAVES].top + 1 }, + STR_COMMA16, ft, { textColour }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_RANDOM_TERRAIN_CHECKBOX].top + 1 }, STR_TERRAIN_LABEL, + {}, { textColour }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_SIMPLEX_PLACE_TREES_CHECKBOX].top + 1 }, + STR_MAPGEN_OPTION_PLACE_TREES, {}, { textColour }); + + ft = Formatter(); + ft.Add((_waterLevel - 12) / 2); + DrawTextBasic( + dpi, + windowPos + + ScreenCoordsXY{ widgets[WIDX_SIMPLEX_WATER_LEVEL].left + 1, widgets[WIDX_SIMPLEX_WATER_LEVEL].top + 1 }, + STR_COMMA16, ft, { textColour }); + } #pragma endregion #pragma region Heightmap page - void HeightmapMouseDown(WidgetIndex widgetIndex, Widget* widget) - { - switch (widgetIndex) + void HeightmapMouseDown(WidgetIndex widgetIndex, Widget* widget) { - case WIDX_HEIGHTMAP_STRENGTH_UP: - _heightmapSmoothStrength = std::min(_heightmapSmoothStrength + 1, MAX_SMOOTH_ITERATIONS); - InvalidateWidget(WIDX_HEIGHTMAP_STRENGTH); - break; - case WIDX_HEIGHTMAP_STRENGTH_DOWN: - _heightmapSmoothStrength = std::max(_heightmapSmoothStrength - 1, 1); - InvalidateWidget(WIDX_HEIGHTMAP_STRENGTH); - break; - case WIDX_HEIGHTMAP_LOW_UP: - _heightmapLow = std::min(_heightmapLow + 1, 142 - 1); - _heightmapHigh = std::max(_heightmapHigh, _heightmapLow + 1); - InvalidateWidget(WIDX_HEIGHTMAP_LOW); - break; - case WIDX_HEIGHTMAP_LOW_DOWN: - _heightmapLow = std::max(_heightmapLow - 1, 2); - InvalidateWidget(WIDX_HEIGHTMAP_LOW); - break; - case WIDX_HEIGHTMAP_HIGH_UP: - _heightmapHigh = std::min(_heightmapHigh + 1, 142); - InvalidateWidget(WIDX_HEIGHTMAP_HIGH); - break; - case WIDX_HEIGHTMAP_HIGH_DOWN: - _heightmapHigh = std::max(_heightmapHigh - 1, 2 + 1); - _heightmapLow = std::min(_heightmapLow, _heightmapHigh - 1); - InvalidateWidget(WIDX_HEIGHTMAP_HIGH); - break; - case WIDX_HEIGHTMAP_WATER_LEVEL_UP: - _waterLevel = std::min(_waterLevel + kMinimumWaterHeight, kMinimumWaterHeight + kMaximumWaterHeight); - InvalidateWidget(WIDX_HEIGHTMAP_WATER_LEVEL); - break; - case WIDX_HEIGHTMAP_WATER_LEVEL_DOWN: - _waterLevel = std::max(_waterLevel - kMinimumWaterHeight, 0); - InvalidateWidget(WIDX_HEIGHTMAP_WATER_LEVEL); - break; - } - } - - void HeightmapGenerateMap() - { - MapGenSettings mapgenSettings; - mapgenSettings.water_level = _waterLevel; - mapgenSettings.smooth = _heightmapSmoothTiles; - mapgenSettings.smooth_height_map = _heightmapSmoothMap; - mapgenSettings.smooth_strength = _heightmapSmoothStrength; - mapgenSettings.normalize_height = _heightmapNormalize; - mapgenSettings.simplex_low = _heightmapLow; - mapgenSettings.simplex_high = _heightmapHigh; - MapGenGenerateFromHeightmap(&mapgenSettings); - GfxInvalidateScreen(); - } - - void HeightmapMouseUp(WidgetIndex widgetIndex) - { - SharedMouseUp(widgetIndex); - - switch (widgetIndex) - { - case WIDX_CLOSE: - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - return; // Only widgets that change a setting need to regenerate the map - - // Page widgets - case WIDX_HEIGHTMAP_SELECT: + switch (widgetIndex) { - auto intent = Intent(WindowClass::Loadsave); - intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP); - intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(HeightmapLoadsaveCallback)); - ContextOpenIntent(&intent); - return; + case WIDX_HEIGHTMAP_STRENGTH_UP: + _heightmapSmoothStrength = std::min(_heightmapSmoothStrength + 1, MAX_SMOOTH_ITERATIONS); + InvalidateWidget(WIDX_HEIGHTMAP_STRENGTH); + break; + case WIDX_HEIGHTMAP_STRENGTH_DOWN: + _heightmapSmoothStrength = std::max(_heightmapSmoothStrength - 1, 1); + InvalidateWidget(WIDX_HEIGHTMAP_STRENGTH); + break; + case WIDX_HEIGHTMAP_LOW_UP: + _heightmapLow = std::min(_heightmapLow + 1, 142 - 1); + _heightmapHigh = std::max(_heightmapHigh, _heightmapLow + 1); + InvalidateWidget(WIDX_HEIGHTMAP_LOW); + break; + case WIDX_HEIGHTMAP_LOW_DOWN: + _heightmapLow = std::max(_heightmapLow - 1, 2); + InvalidateWidget(WIDX_HEIGHTMAP_LOW); + break; + case WIDX_HEIGHTMAP_HIGH_UP: + _heightmapHigh = std::min(_heightmapHigh + 1, 142); + InvalidateWidget(WIDX_HEIGHTMAP_HIGH); + break; + case WIDX_HEIGHTMAP_HIGH_DOWN: + _heightmapHigh = std::max(_heightmapHigh - 1, 2 + 1); + _heightmapLow = std::min(_heightmapLow, _heightmapHigh - 1); + InvalidateWidget(WIDX_HEIGHTMAP_HIGH); + break; + case WIDX_HEIGHTMAP_WATER_LEVEL_UP: + _waterLevel = std::min(_waterLevel + kMinimumWaterHeight, kMinimumWaterHeight + kMaximumWaterHeight); + InvalidateWidget(WIDX_HEIGHTMAP_WATER_LEVEL); + break; + case WIDX_HEIGHTMAP_WATER_LEVEL_DOWN: + _waterLevel = std::max(_waterLevel - kMinimumWaterHeight, 0); + InvalidateWidget(WIDX_HEIGHTMAP_WATER_LEVEL); + break; } - case WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP: - _heightmapSmoothMap = !_heightmapSmoothMap; - SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, _heightmapSmoothMap); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH, _heightmapSmoothMap); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_UP, _heightmapSmoothMap); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_DOWN, _heightmapSmoothMap); - InvalidateWidget(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP); - InvalidateWidget(WIDX_HEIGHTMAP_STRENGTH); - break; - case WIDX_HEIGHTMAP_NORMALIZE: - _heightmapNormalize = !_heightmapNormalize; - SetCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _heightmapNormalize); - InvalidateWidget(WIDX_HEIGHTMAP_NORMALIZE); - break; - case WIDX_HEIGHTMAP_SMOOTH_TILES: - _heightmapSmoothTiles = !_heightmapSmoothTiles; - SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_TILES, _heightmapSmoothTiles); - InvalidateWidget(WIDX_HEIGHTMAP_SMOOTH_TILES); - break; } - // Always regenerate the map after one of the page widgets has been changed - HeightmapGenerateMap(); - } - - void HeightmapPrepareDraw() - { - if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_HEIGHTMAP]) + void HeightmapGenerateMap() { - widgets = PageWidgets[WINDOW_MAPGEN_PAGE_HEIGHTMAP]; - InitScrollWidgets(); + MapGenSettings mapgenSettings; + mapgenSettings.water_level = _waterLevel; + mapgenSettings.smooth = _heightmapSmoothTiles; + mapgenSettings.smooth_height_map = _heightmapSmoothMap; + mapgenSettings.smooth_strength = _heightmapSmoothStrength; + mapgenSettings.normalize_height = _heightmapNormalize; + mapgenSettings.simplex_low = _heightmapLow; + mapgenSettings.simplex_high = _heightmapHigh; + MapGenGenerateFromHeightmap(&mapgenSettings); + GfxInvalidateScreen(); } - SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, _heightmapSmoothMap); - SetCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _heightmapNormalize); - SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_TILES, _heightmapSmoothTiles); + void HeightmapMouseUp(WidgetIndex widgetIndex) + { + SharedMouseUp(widgetIndex); - SetPressedTab(); - } + switch (widgetIndex) + { + case WIDX_CLOSE: + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + return; // Only widgets that change a setting need to regenerate the map - void HeightmapDraw(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); + // Page widgets + case WIDX_HEIGHTMAP_SELECT: + { + auto intent = Intent(WindowClass::Loadsave); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP); + intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(HeightmapLoadsaveCallback)); + ContextOpenIntent(&intent); + return; + } + case WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP: + _heightmapSmoothMap = !_heightmapSmoothMap; + SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, _heightmapSmoothMap); + SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH, _heightmapSmoothMap); + SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_UP, _heightmapSmoothMap); + SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_DOWN, _heightmapSmoothMap); + InvalidateWidget(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP); + InvalidateWidget(WIDX_HEIGHTMAP_STRENGTH); + break; + case WIDX_HEIGHTMAP_NORMALIZE: + _heightmapNormalize = !_heightmapNormalize; + SetCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _heightmapNormalize); + InvalidateWidget(WIDX_HEIGHTMAP_NORMALIZE); + break; + case WIDX_HEIGHTMAP_SMOOTH_TILES: + _heightmapSmoothTiles = !_heightmapSmoothTiles; + SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_TILES, _heightmapSmoothTiles); + InvalidateWidget(WIDX_HEIGHTMAP_SMOOTH_TILES); + break; + } - const colour_t enabledColour = colours[1]; - const colour_t disabledColour = enabledColour | COLOUR_FLAG_INSET; + // Always regenerate the map after one of the page widgets has been changed + HeightmapGenerateMap(); + } - // Smooth strength label and value - const colour_t strengthColour = _heightmapSmoothMap ? enabledColour : disabledColour; - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_HEIGHTMAP_STRENGTH].top + 1 }, STR_MAPGEN_SMOOTH_STRENGTH, {}, - { strengthColour }); + void HeightmapPrepareDraw() + { + if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_HEIGHTMAP]) + { + widgets = PageWidgets[WINDOW_MAPGEN_PAGE_HEIGHTMAP]; + InitScrollWidgets(); + } - auto ft = Formatter(); - ft.Add(_heightmapSmoothStrength); - DrawTextBasic( - dpi, - windowPos + ScreenCoordsXY{ widgets[WIDX_HEIGHTMAP_STRENGTH].left + 1, widgets[WIDX_HEIGHTMAP_STRENGTH].top + 1 }, - STR_COMMA16, ft, { strengthColour }); + SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, _heightmapSmoothMap); + SetCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _heightmapNormalize); + SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_TILES, _heightmapSmoothTiles); - // Low label and value - const colour_t labelColour = _heightmapLoaded ? enabledColour : disabledColour; - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_HEIGHTMAP_LOW].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_LOW_, {}, - { labelColour }); + SetPressedTab(); + } - ft = Formatter(); - ft.Add(_heightmapLow); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_HEIGHTMAP_LOW].left + 1, widgets[WIDX_HEIGHTMAP_LOW].top + 1 }, - STR_COMMA16, ft, { labelColour }); + void HeightmapDraw(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); - // High label and value - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_HEIGHTMAP_HIGH].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_HIGH, {}, - { labelColour }); + const colour_t enabledColour = colours[1]; + const colour_t disabledColour = enabledColour | COLOUR_FLAG_INSET; - ft = Formatter(); - ft.Add(_heightmapHigh); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_HEIGHTMAP_HIGH].left + 1, widgets[WIDX_HEIGHTMAP_HIGH].top + 1 }, - STR_COMMA16, ft, { labelColour }); + // Smooth strength label and value + const colour_t strengthColour = _heightmapSmoothMap ? enabledColour : disabledColour; + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_HEIGHTMAP_STRENGTH].top + 1 }, STR_MAPGEN_SMOOTH_STRENGTH, {}, + { strengthColour }); - // Water level label and value - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_HEIGHTMAP_WATER_LEVEL].top + 1 }, STR_WATER_LEVEL_LABEL, {}, - { labelColour }); + auto ft = Formatter(); + ft.Add(_heightmapSmoothStrength); + DrawTextBasic( + dpi, + windowPos + + ScreenCoordsXY{ widgets[WIDX_HEIGHTMAP_STRENGTH].left + 1, widgets[WIDX_HEIGHTMAP_STRENGTH].top + 1 }, + STR_COMMA16, ft, { strengthColour }); - ft = Formatter(); - ft.Add(_waterLevel); - DrawTextBasic( - dpi, - windowPos - + ScreenCoordsXY{ widgets[WIDX_HEIGHTMAP_WATER_LEVEL].left + 1, widgets[WIDX_HEIGHTMAP_WATER_LEVEL].top + 1 }, - STR_COMMA16, ft, { labelColour }); - } + // Low label and value + const colour_t labelColour = _heightmapLoaded ? enabledColour : disabledColour; + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_HEIGHTMAP_LOW].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_LOW_, {}, + { labelColour }); + + ft = Formatter(); + ft.Add(_heightmapLow); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_HEIGHTMAP_LOW].left + 1, widgets[WIDX_HEIGHTMAP_LOW].top + 1 }, + STR_COMMA16, ft, { labelColour }); + + // High label and value + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_HEIGHTMAP_HIGH].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_HIGH, {}, + { labelColour }); + + ft = Formatter(); + ft.Add(_heightmapHigh); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_HEIGHTMAP_HIGH].left + 1, widgets[WIDX_HEIGHTMAP_HIGH].top + 1 }, + STR_COMMA16, ft, { labelColour }); + + // Water level label and value + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 5, widgets[WIDX_HEIGHTMAP_WATER_LEVEL].top + 1 }, STR_WATER_LEVEL_LABEL, {}, + { labelColour }); + + ft = Formatter(); + ft.Add(_waterLevel); + DrawTextBasic( + dpi, + windowPos + + ScreenCoordsXY{ widgets[WIDX_HEIGHTMAP_WATER_LEVEL].left + 1, + widgets[WIDX_HEIGHTMAP_WATER_LEVEL].top + 1 }, + STR_COMMA16, ft, { labelColour }); + } #pragma endregion -public: - void OnOpen() override - { - number = 0; - frame_no = 0; - - page = WINDOW_MAPGEN_PAGE_BASE; - Invalidate(); - widgets = PageWidgets[WINDOW_MAPGEN_PAGE_BASE]; - hold_down_widgets = HoldDownWidgets[WINDOW_MAPGEN_PAGE_BASE]; - pressed_widgets = PressedWidgets[WINDOW_MAPGEN_PAGE_BASE]; - disabled_widgets = PageDisabledWidgets[WINDOW_MAPGEN_PAGE_BASE]; - InitScrollWidgets(); - - _heightmapLoaded = false; - } - - void OnClose() override - { - MapGenUnloadHeightmap(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (page) + public: + void OnOpen() override { - case WINDOW_MAPGEN_PAGE_BASE: - return BaseMouseUp(widgetIndex); - case WINDOW_MAPGEN_PAGE_RANDOM: - return RandomMouseUp(widgetIndex); - case WINDOW_MAPGEN_PAGE_SIMPLEX: - return SimplexMouseUp(widgetIndex); - case WINDOW_MAPGEN_PAGE_HEIGHTMAP: - return HeightmapMouseUp(widgetIndex); + number = 0; + frame_no = 0; + + page = WINDOW_MAPGEN_PAGE_BASE; + Invalidate(); + widgets = PageWidgets[WINDOW_MAPGEN_PAGE_BASE]; + hold_down_widgets = HoldDownWidgets[WINDOW_MAPGEN_PAGE_BASE]; + pressed_widgets = PressedWidgets[WINDOW_MAPGEN_PAGE_BASE]; + disabled_widgets = PageDisabledWidgets[WINDOW_MAPGEN_PAGE_BASE]; + InitScrollWidgets(); + + _heightmapLoaded = false; } - } - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (page) + void OnClose() override { - case WINDOW_MAPGEN_PAGE_BASE: - return BaseMouseDown(widgetIndex, &widgets[widgetIndex]); - case WINDOW_MAPGEN_PAGE_SIMPLEX: - return SimplexMouseDown(widgetIndex, &widgets[widgetIndex]); - case WINDOW_MAPGEN_PAGE_HEIGHTMAP: - return HeightmapMouseDown(widgetIndex, &widgets[widgetIndex]); + MapGenUnloadHeightmap(); } - } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - switch (page) + void OnMouseUp(WidgetIndex widgetIndex) override { - case WINDOW_MAPGEN_PAGE_BASE: - return BaseDropdown(widgetIndex, selectedIndex); - case WINDOW_MAPGEN_PAGE_SIMPLEX: - return SimplexDropdown(widgetIndex, selectedIndex); - } - } - - void OnUpdate() override - { - switch (page) - { - case WINDOW_MAPGEN_PAGE_BASE: - return BaseUpdate(); - case WINDOW_MAPGEN_PAGE_RANDOM: - return RandomUpdate(); - case WINDOW_MAPGEN_PAGE_SIMPLEX: - return SimplexUpdate(); - } - } - - void OnPrepareDraw() override - { - switch (page) - { - case WINDOW_MAPGEN_PAGE_BASE: - return BasePrepareDraw(); - case WINDOW_MAPGEN_PAGE_RANDOM: - return RandomPrepareDraw(); - case WINDOW_MAPGEN_PAGE_SIMPLEX: - return SimplexPrepareDraw(); - case WINDOW_MAPGEN_PAGE_HEIGHTMAP: - return HeightmapPrepareDraw(); - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - switch (page) - { - case WINDOW_MAPGEN_PAGE_BASE: - return BaseDraw(dpi); - case WINDOW_MAPGEN_PAGE_RANDOM: - return RandomDraw(dpi); - case WINDOW_MAPGEN_PAGE_SIMPLEX: - return SimplexDraw(dpi); - case WINDOW_MAPGEN_PAGE_HEIGHTMAP: - return HeightmapDraw(dpi); - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - switch (page) - { - case WINDOW_MAPGEN_PAGE_BASE: - return TextInput(widgetIndex, text); - case WINDOW_MAPGEN_PAGE_SIMPLEX: - return TextInput(widgetIndex, text); - } - } - - void AfterLoadingHeightMap(int32_t result, const utf8* path) - { - if (result == MODAL_RESULT_OK) - { - if (!MapGenLoadHeightmap(path)) + switch (page) { - // TODO: Display error popup - return; + case WINDOW_MAPGEN_PAGE_BASE: + return BaseMouseUp(widgetIndex); + case WINDOW_MAPGEN_PAGE_RANDOM: + return RandomMouseUp(widgetIndex); + case WINDOW_MAPGEN_PAGE_SIMPLEX: + return SimplexMouseUp(widgetIndex); + case WINDOW_MAPGEN_PAGE_HEIGHTMAP: + return HeightmapMouseUp(widgetIndex); } - - // The window needs to be open while using the map - _heightmapLoaded = true; - SetPage(WINDOW_MAPGEN_PAGE_HEIGHTMAP); - - HeightmapGenerateMap(); } - } - void OnResize() override + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (page) + { + case WINDOW_MAPGEN_PAGE_BASE: + return BaseMouseDown(widgetIndex, &widgets[widgetIndex]); + case WINDOW_MAPGEN_PAGE_SIMPLEX: + return SimplexMouseDown(widgetIndex, &widgets[widgetIndex]); + case WINDOW_MAPGEN_PAGE_HEIGHTMAP: + return HeightmapMouseDown(widgetIndex, &widgets[widgetIndex]); + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + switch (page) + { + case WINDOW_MAPGEN_PAGE_BASE: + return BaseDropdown(widgetIndex, selectedIndex); + case WINDOW_MAPGEN_PAGE_SIMPLEX: + return SimplexDropdown(widgetIndex, selectedIndex); + } + } + + void OnUpdate() override + { + switch (page) + { + case WINDOW_MAPGEN_PAGE_BASE: + return BaseUpdate(); + case WINDOW_MAPGEN_PAGE_RANDOM: + return RandomUpdate(); + case WINDOW_MAPGEN_PAGE_SIMPLEX: + return SimplexUpdate(); + } + } + + void OnPrepareDraw() override + { + switch (page) + { + case WINDOW_MAPGEN_PAGE_BASE: + return BasePrepareDraw(); + case WINDOW_MAPGEN_PAGE_RANDOM: + return RandomPrepareDraw(); + case WINDOW_MAPGEN_PAGE_SIMPLEX: + return SimplexPrepareDraw(); + case WINDOW_MAPGEN_PAGE_HEIGHTMAP: + return HeightmapPrepareDraw(); + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + switch (page) + { + case WINDOW_MAPGEN_PAGE_BASE: + return BaseDraw(dpi); + case WINDOW_MAPGEN_PAGE_RANDOM: + return RandomDraw(dpi); + case WINDOW_MAPGEN_PAGE_SIMPLEX: + return SimplexDraw(dpi); + case WINDOW_MAPGEN_PAGE_HEIGHTMAP: + return HeightmapDraw(dpi); + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + switch (page) + { + case WINDOW_MAPGEN_PAGE_BASE: + return TextInput(widgetIndex, text); + case WINDOW_MAPGEN_PAGE_SIMPLEX: + return TextInput(widgetIndex, text); + } + } + + void AfterLoadingHeightMap(int32_t result, const utf8* path) + { + if (result == MODAL_RESULT_OK) + { + if (!MapGenLoadHeightmap(path)) + { + // TODO: Display error popup + return; + } + + // The window needs to be open while using the map + _heightmapLoaded = true; + SetPage(WINDOW_MAPGEN_PAGE_HEIGHTMAP); + + HeightmapGenerateMap(); + } + } + + void OnResize() override + { + ResizeFrameWithPage(); + } + }; + + WindowBase* MapgenOpen() { - ResizeFrameWithPage(); + return WindowFocusOrCreate(WindowClass::Mapgen, WW, WH, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN); } -}; -WindowBase* WindowMapgenOpen() -{ - return WindowFocusOrCreate(WindowClass::Mapgen, WW, WH, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN); -} - -static void HeightmapLoadsaveCallback(int32_t result, const utf8* path) -{ - auto* w = static_cast(WindowMapgenOpen()); - w->AfterLoadingHeightMap(result, path); -} + static void HeightmapLoadsaveCallback(int32_t result, const utf8* path) + { + auto* w = static_cast(MapgenOpen()); + w->AfterLoadingHeightMap(result, path); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp index 3cfdb68c5a..331df333f8 100644 --- a/src/openrct2-ui/windows/MapTooltip.cpp +++ b/src/openrct2-ui/windows/MapTooltip.cpp @@ -17,114 +17,117 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off static Widget window_map_tooltip_widgets[] = { MakeWidget({0, 0}, {200, 30}, WindowWidgetType::ImgBtn, WindowColour::Primary), - WIDGETS_END, + kWidgetsEnd, }; // clang-format on #define MAP_TOOLTIP_ARGS -static ScreenCoordsXY _lastCursor; -static int32_t _cursorHoldDuration; + static ScreenCoordsXY _lastCursor; + static int32_t _cursorHoldDuration; -static void WindowMapTooltipOpen(); + static void WindowMapTooltipOpen(); -static Formatter _mapTooltipArgs; + static Formatter _mapTooltipArgs; -class MapTooltip final : public Window -{ -public: - void OnOpen() override + class MapTooltip final : public Window { - widgets = window_map_tooltip_widgets; - } - - void OnUpdate() override - { - Invalidate(); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - StringId stringId; - std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId)); - if (stringId == STR_NONE) + public: + void OnOpen() override { + widgets = window_map_tooltip_widgets; + } + + void OnUpdate() override + { + Invalidate(); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + StringId stringId; + std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId)); + if (stringId == STR_NONE) + { + return; + } + + auto stringCoords = windowPos + ScreenCoordsXY{ width / 2, height / 2 }; + DrawTextWrapped(dpi, stringCoords, width, STR_MAP_TOOLTIP_STRINGID, _mapTooltipArgs, { TextAlignment::CENTRE }); + } + }; + + void SetMapTooltip(Formatter& ft) + { + _mapTooltipArgs = ft; + } + + const Formatter& GetMapTooltip() + { + return _mapTooltipArgs; + } + + void WindowMapTooltipUpdateVisibility() + { + if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) + { + // The map tooltip is drawn by the bottom toolbar + WindowInvalidateByClass(WindowClass::BottomToolbar); return; } - auto stringCoords = windowPos + ScreenCoordsXY{ width / 2, height / 2 }; - DrawTextWrapped(dpi, stringCoords, width, STR_MAP_TOOLTIP_STRINGID, _mapTooltipArgs, { TextAlignment::CENTRE }); + const CursorState* state = ContextGetCursorState(); + auto cursor = state->position; + auto cursorChange = cursor - _lastCursor; + + // Check for cursor movement + _cursorHoldDuration++; + if (abs(cursorChange.x) > 5 || abs(cursorChange.y) > 5 || (InputTestFlag(INPUT_FLAG_5)) + || InputGetState() == InputState::ViewportRight) + _cursorHoldDuration = 0; + + _lastCursor = cursor; + + // Show or hide tooltip + StringId stringId; + std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId)); + + if (_cursorHoldDuration < 25 || stringId == STR_NONE + || InputTestPlaceObjectModifier( + static_cast(PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z)) + || WindowFindByClass(WindowClass::Error) != nullptr) + { + WindowCloseByClass(WindowClass::MapTooltip); + } + else + { + WindowMapTooltipOpen(); + } } -}; -void SetMapTooltip(Formatter& ft) -{ - _mapTooltipArgs = ft; -} - -const Formatter& GetMapTooltip() -{ - return _mapTooltipArgs; -} - -void WindowMapTooltipUpdateVisibility() -{ - if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) + static void WindowMapTooltipOpen() { - // The map tooltip is drawn by the bottom toolbar - WindowInvalidateByClass(WindowClass::BottomToolbar); - return; + constexpr int32_t width = 200; + constexpr int32_t height = 44; + const CursorState* state = ContextGetCursorState(); + auto pos = state->position + ScreenCoordsXY{ -width / 2, 15 }; + + if (auto w = WindowFindByClass(WindowClass::MapTooltip)) + { + w->Invalidate(); + w->windowPos = pos; + w->width = width; + w->height = height; + } + else + { + w = WindowCreate( + WindowClass::MapTooltip, pos, width, height, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); + } } - - const CursorState* state = ContextGetCursorState(); - auto cursor = state->position; - auto cursorChange = cursor - _lastCursor; - - // Check for cursor movement - _cursorHoldDuration++; - if (abs(cursorChange.x) > 5 || abs(cursorChange.y) > 5 || (InputTestFlag(INPUT_FLAG_5)) - || InputGetState() == InputState::ViewportRight) - _cursorHoldDuration = 0; - - _lastCursor = cursor; - - // Show or hide tooltip - StringId stringId; - std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId)); - - if (_cursorHoldDuration < 25 || stringId == STR_NONE - || InputTestPlaceObjectModifier( - static_cast(PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z)) - || WindowFindByClass(WindowClass::Error) != nullptr) - { - WindowCloseByClass(WindowClass::MapTooltip); - } - else - { - WindowMapTooltipOpen(); - } -} - -static void WindowMapTooltipOpen() -{ - constexpr int32_t width = 200; - constexpr int32_t height = 44; - const CursorState* state = ContextGetCursorState(); - auto pos = state->position + ScreenCoordsXY{ -width / 2, 15 }; - - if (auto w = WindowFindByClass(WindowClass::MapTooltip)) - { - w->Invalidate(); - w->windowPos = pos; - w->width = width; - w->height = height; - } - else - { - w = WindowCreate( - WindowClass::MapTooltip, pos, width, height, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); - } -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 527df8e5ad..8e230d3d74 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -26,13 +26,15 @@ #include #include +namespace OpenRCT2::Ui::Windows +{ #pragma region Widgets -static constexpr StringId WINDOW_TITLE = STR_RIDE_CONSTRUCTION_WINDOW_TITLE; -static constexpr int32_t WH = 200; -static constexpr int32_t WW = 166; + static constexpr StringId WINDOW_TITLE = STR_RIDE_CONSTRUCTION_WINDOW_TITLE; + static constexpr int32_t WH = 200; + static constexpr int32_t WW = 166; -// clang-format off + // clang-format off enum { WIDX_BACKGROUND, WIDX_TITLE, @@ -87,393 +89,395 @@ static Widget window_maze_construction_widgets[] = { MakeWidget({87, 178}, { 70, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_CONSTRUCTION_EXIT, STR_RIDE_CONSTRUCTION_EXIT_TIP ), MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary ), MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary ), - WIDGETS_END, + kWidgetsEnd, }; #pragma endregion -// clang-format on + // clang-format on -class MazeConstructionWindow final : public Window -{ -public: - void OnOpen() override + class MazeConstructionWindow final : public Window { - widgets = window_maze_construction_widgets; - WindowInitScrollWidgets(*this); - rideId = _currentRideIndex; - ShowGridlines(); - } - - void OnClose() override - { - RideConstructionInvalidateCurrentTrack(); - ViewportSetVisibility(ViewportVisibility::Default); - - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - - // In order to cancel the yellow arrow correctly the - // selection tool should be cancelled. - ToolCancel(); - - HideGridlines(); - - auto currentRide = GetRide(_currentRideIndex); - if (currentRide != nullptr) + public: + void OnOpen() override { - if (currentRide->overall_view.IsNull()) - { - auto gameAction = RideDemolishAction(currentRide->id, RIDE_MODIFY_DEMOLISH); - gameAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); - GameActions::Execute(&gameAction); - } - else - { - auto intent = Intent(WindowClass::Ride); - intent.PutExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); - ContextOpenIntent(&intent); - } - } - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_MAZE_ENTRANCE: - case WIDX_MAZE_EXIT: - WindowMazeConstructionEntranceMouseup(widgetIndex); - break; - case WIDX_MAZE_DIRECTION_NW: - case WIDX_MAZE_DIRECTION_NE: - case WIDX_MAZE_DIRECTION_SE: - case WIDX_MAZE_DIRECTION_SW: - WindowMazeConstructionConstruct(((widgetIndex - WIDX_MAZE_DIRECTION_NW) - GetCurrentRotation()) & 3); - break; - } - } - - void OnResize() override - { - ResizeFrameWithPage(); - uint64_t disabledWidgets = 0; - if (_rideConstructionState == RideConstructionState::Place) - { - disabledWidgets - |= ((1uLL << WIDX_MAZE_BUILD_MODE) | (1uLL << WIDX_MAZE_MOVE_MODE) | (1uLL << WIDX_MAZE_FILL_MODE) - | (1uLL << WIDX_MAZE_DIRECTION_NW) | (1uLL << WIDX_MAZE_DIRECTION_NE) | (1uLL << WIDX_MAZE_DIRECTION_SW) - | (1uLL << WIDX_MAZE_DIRECTION_SE)); - } - else if (_rideConstructionState == RideConstructionState::EntranceExit) - { - disabledWidgets = (1uLL << WIDX_MAZE_DIRECTION_NW) | (1uLL << WIDX_MAZE_DIRECTION_NE) - | (1uLL << WIDX_MAZE_DIRECTION_SW) | (1uLL << WIDX_MAZE_DIRECTION_SE); + widgets = window_maze_construction_widgets; + WindowInitScrollWidgets(*this); + rideId = _currentRideIndex; + ShowGridlines(); } - // Set and invalidate the changed widgets - uint64_t currentDisabledWidgets = disabled_widgets; - if (currentDisabledWidgets == disabledWidgets) - return; - - for (WidgetIndex i = 0; i < 64; i++) + void OnClose() override { - if ((disabledWidgets & (1uLL << i)) != (currentDisabledWidgets & (1uLL << i))) - { - WidgetInvalidate(*this, i); - } - } - disabled_widgets = disabledWidgets; - } + RideConstructionInvalidateCurrentTrack(); + ViewportSetVisibility(ViewportVisibility::Default); - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_MAZE_BUILD_MODE: - WindowMazeConstructionBuildModeMousedown(RideConstructionState::MazeBuild); - break; - case WIDX_MAZE_MOVE_MODE: - WindowMazeConstructionBuildModeMousedown(RideConstructionState::MazeMove); - break; - case WIDX_MAZE_FILL_MODE: - WindowMazeConstructionBuildModeMousedown(RideConstructionState::MazeFill); - break; - } - } + MapInvalidateMapSelectionTiles(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - void OnUpdate() override - { - auto currentRide = GetRide(_currentRideIndex); - if (currentRide == nullptr || currentRide->status != RideStatus::Closed) - { - Close(); - return; - } - - switch (_rideConstructionState) - { - case RideConstructionState::Place: - if (!WidgetIsActiveTool(*this, WIDX_MAZE_DIRECTION_GROUPBOX)) - { - Close(); - return; - } - break; - case RideConstructionState::EntranceExit: - if (!WidgetIsActiveTool(*this, WIDX_MAZE_ENTRANCE) && !WidgetIsActiveTool(*this, WIDX_MAZE_EXIT)) - { - _rideConstructionState = gRideEntranceExitPlacePreviousRideConstructionState; - WindowMazeConstructionUpdatePressedWidgets(); - } - break; - default: - break; - } - - switch (_rideConstructionState) - { - case RideConstructionState::Front: - case RideConstructionState::Back: - case RideConstructionState::Selected: - if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) - && gCurrentToolWidget.window_classification == WindowClass::RideConstruction) - { - ToolCancel(); - } - break; - default: - break; - } - UpdateGhostTrackAndArrow(); - } - - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (widgetIndex) - { - case WIDX_MAZE_DIRECTION_GROUPBOX: - RideConstructionToolupdateConstruct(screenCoords); - break; - case WIDX_MAZE_ENTRANCE: - case WIDX_MAZE_EXIT: - RideConstructionToolupdateEntranceExit(screenCoords); - break; - } - } - - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (widgetIndex) - { - case WIDX_MAZE_DIRECTION_GROUPBOX: - RideConstructionTooldownConstruct(screenCoords); - break; - case WIDX_MAZE_ENTRANCE: - case WIDX_MAZE_EXIT: - WindowMazeConstructionEntranceTooldown(screenCoords); - break; - } - } - - void OnPrepareDraw() override - { - auto currentRide = GetRide(_currentRideIndex); - auto ft = Formatter::Common(); - if (currentRide != nullptr) - { - ft.Increment(4); - currentRide->FormatNameTo(ft); - } - else - { - ft.Increment(4); - ft.Add(STR_NONE); - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - } - -private: - void WindowMazeConstructionEntranceMouseup(WidgetIndex widgetIndex) - { - if (ToolSet(*this, widgetIndex, Tool::Crosshair)) - return; - - gRideEntranceExitPlaceType = widgetIndex == WIDX_MAZE_ENTRANCE ? ENTRANCE_TYPE_RIDE_ENTRANCE : ENTRANCE_TYPE_RIDE_EXIT; - gRideEntranceExitPlaceRideIndex = rideId; - gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); - InputSetFlag(INPUT_FLAG_6, true); - - RideConstructionInvalidateCurrentTrack(); - - if (_rideConstructionState != RideConstructionState::EntranceExit) - { - gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; - } - _rideConstructionState = RideConstructionState::EntranceExit; - - WindowMazeConstructionUpdatePressedWidgets(); - } - - void WindowMazeConstructionBuildModeMousedown(RideConstructionState rideConstructionState) - { - if (_rideConstructionState == RideConstructionState::EntranceExit) - { + // In order to cancel the yellow arrow correctly the + // selection tool should be cancelled. ToolCancel(); + + HideGridlines(); + + auto currentRide = GetRide(_currentRideIndex); + if (currentRide != nullptr) + { + if (currentRide->overall_view.IsNull()) + { + auto gameAction = RideDemolishAction(currentRide->id, RIDE_MODIFY_DEMOLISH); + gameAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); + GameActions::Execute(&gameAction); + } + else + { + auto intent = Intent(WindowClass::Ride); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); + ContextOpenIntent(&intent); + } + } } - _rideConstructionState = rideConstructionState; - WindowMazeConstructionUpdatePressedWidgets(); - } - void WindowMazeConstructionEntranceTooldown(const ScreenCoordsXY& screenCoords) - { - RideConstructionInvalidateCurrentTrack(); + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_MAZE_ENTRANCE: + case WIDX_MAZE_EXIT: + WindowMazeConstructionEntranceMouseup(widgetIndex); + break; + case WIDX_MAZE_DIRECTION_NW: + case WIDX_MAZE_DIRECTION_NE: + case WIDX_MAZE_DIRECTION_SE: + case WIDX_MAZE_DIRECTION_SW: + WindowMazeConstructionConstruct(((widgetIndex - WIDX_MAZE_DIRECTION_NW) - GetCurrentRotation()) & 3); + break; + } + } - MapInvalidateSelectionRect(); + void OnResize() override + { + ResizeFrameWithPage(); + uint64_t disabledWidgets = 0; + if (_rideConstructionState == RideConstructionState::Place) + { + disabledWidgets + |= ((1uLL << WIDX_MAZE_BUILD_MODE) | (1uLL << WIDX_MAZE_MOVE_MODE) | (1uLL << WIDX_MAZE_FILL_MODE) + | (1uLL << WIDX_MAZE_DIRECTION_NW) | (1uLL << WIDX_MAZE_DIRECTION_NE) | (1uLL << WIDX_MAZE_DIRECTION_SW) + | (1uLL << WIDX_MAZE_DIRECTION_SE)); + } + else if (_rideConstructionState == RideConstructionState::EntranceExit) + { + disabledWidgets = (1uLL << WIDX_MAZE_DIRECTION_NW) | (1uLL << WIDX_MAZE_DIRECTION_NE) + | (1uLL << WIDX_MAZE_DIRECTION_SW) | (1uLL << WIDX_MAZE_DIRECTION_SE); + } - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - - CoordsXYZD entranceOrExitCoords = RideGetEntranceOrExitPositionFromScreenPosition(screenCoords); - if (entranceOrExitCoords.IsNull()) - return; - - if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) - return; - - RideId rideIndex = gRideEntranceExitPlaceRideIndex; - - auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction( - entranceOrExitCoords, DirectionReverse(entranceOrExitCoords.direction), rideIndex, - gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT); - - rideEntranceExitPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) + // Set and invalidate the changed widgets + uint64_t currentDisabledWidgets = disabled_widgets; + if (currentDisabledWidgets == disabledWidgets) return; - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); + for (WidgetIndex i = 0; i < 64; i++) + { + if ((disabledWidgets & (1uLL << i)) != (currentDisabledWidgets & (1uLL << i))) + { + WidgetInvalidate(*this, i); + } + } + disabled_widgets = disabledWidgets; + } - auto currentRide = GetRide(rideIndex); - if (currentRide != nullptr && RideAreAllPossibleEntrancesAndExitsBuilt(*currentRide).Successful) + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_MAZE_BUILD_MODE: + WindowMazeConstructionBuildModeMousedown(RideConstructionState::MazeBuild); + break; + case WIDX_MAZE_MOVE_MODE: + WindowMazeConstructionBuildModeMousedown(RideConstructionState::MazeMove); + break; + case WIDX_MAZE_FILL_MODE: + WindowMazeConstructionBuildModeMousedown(RideConstructionState::MazeFill); + break; + } + } + + void OnUpdate() override + { + auto currentRide = GetRide(_currentRideIndex); + if (currentRide == nullptr || currentRide->status != RideStatus::Closed) + { + Close(); + return; + } + + switch (_rideConstructionState) + { + case RideConstructionState::Place: + if (!WidgetIsActiveTool(*this, WIDX_MAZE_DIRECTION_GROUPBOX)) + { + Close(); + return; + } + break; + case RideConstructionState::EntranceExit: + if (!WidgetIsActiveTool(*this, WIDX_MAZE_ENTRANCE) && !WidgetIsActiveTool(*this, WIDX_MAZE_EXIT)) + { + _rideConstructionState = gRideEntranceExitPlacePreviousRideConstructionState; + WindowMazeConstructionUpdatePressedWidgets(); + } + break; + default: + break; + } + + switch (_rideConstructionState) + { + case RideConstructionState::Front: + case RideConstructionState::Back: + case RideConstructionState::Selected: + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) + && gCurrentToolWidget.window_classification == WindowClass::RideConstruction) + { + ToolCancel(); + } + break; + default: + break; + } + UpdateGhostTrackAndArrow(); + } + + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + switch (widgetIndex) + { + case WIDX_MAZE_DIRECTION_GROUPBOX: + RideConstructionToolupdateConstruct(screenCoords); + break; + case WIDX_MAZE_ENTRANCE: + case WIDX_MAZE_EXIT: + RideConstructionToolupdateEntranceExit(screenCoords); + break; + } + } + + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + switch (widgetIndex) + { + case WIDX_MAZE_DIRECTION_GROUPBOX: + RideConstructionTooldownConstruct(screenCoords); + break; + case WIDX_MAZE_ENTRANCE: + case WIDX_MAZE_EXIT: + WindowMazeConstructionEntranceTooldown(screenCoords); + break; + } + } + + void OnPrepareDraw() override + { + auto currentRide = GetRide(_currentRideIndex); + auto ft = Formatter::Common(); + if (currentRide != nullptr) + { + ft.Increment(4); + currentRide->FormatNameTo(ft); + } + else + { + ft.Increment(4); + ft.Add(STR_NONE); + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + } + + private: + void WindowMazeConstructionEntranceMouseup(WidgetIndex widgetIndex) + { + if (ToolSet(*this, widgetIndex, Tool::Crosshair)) + return; + + gRideEntranceExitPlaceType = widgetIndex == WIDX_MAZE_ENTRANCE ? ENTRANCE_TYPE_RIDE_ENTRANCE + : ENTRANCE_TYPE_RIDE_EXIT; + gRideEntranceExitPlaceRideIndex = rideId; + gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); + InputSetFlag(INPUT_FLAG_6, true); + + RideConstructionInvalidateCurrentTrack(); + + if (_rideConstructionState != RideConstructionState::EntranceExit) + { + gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; + } + _rideConstructionState = RideConstructionState::EntranceExit; + + WindowMazeConstructionUpdatePressedWidgets(); + } + + void WindowMazeConstructionBuildModeMousedown(RideConstructionState rideConstructionState) + { + if (_rideConstructionState == RideConstructionState::EntranceExit) { ToolCancel(); - if (!currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) - WindowCloseByClass(WindowClass::RideConstruction); } - else - { - gRideEntranceExitPlaceType = gRideEntranceExitPlaceType ^ 1; - WindowInvalidateByClass(WindowClass::RideConstruction); - gCurrentToolWidget.widget_index = (gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_ENTRANCE) - ? WIDX_MAZE_ENTRANCE - : WIDX_MAZE_EXIT; + _rideConstructionState = rideConstructionState; + WindowMazeConstructionUpdatePressedWidgets(); + } - WindowMazeConstructionUpdatePressedWidgets(); + void WindowMazeConstructionEntranceTooldown(const ScreenCoordsXY& screenCoords) + { + RideConstructionInvalidateCurrentTrack(); + + MapInvalidateSelectionRect(); + + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + + CoordsXYZD entranceOrExitCoords = RideGetEntranceOrExitPositionFromScreenPosition(screenCoords); + if (entranceOrExitCoords.IsNull()) + return; + + if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) + return; + + RideId rideIndex = gRideEntranceExitPlaceRideIndex; + + auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction( + entranceOrExitCoords, DirectionReverse(entranceOrExitCoords.direction), rideIndex, + gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT); + + rideEntranceExitPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) + return; + + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); + + auto currentRide = GetRide(rideIndex); + if (currentRide != nullptr && RideAreAllPossibleEntrancesAndExitsBuilt(*currentRide).Successful) + { + ToolCancel(); + if (!currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) + WindowCloseByClass(WindowClass::RideConstruction); + } + else + { + gRideEntranceExitPlaceType = gRideEntranceExitPlaceType ^ 1; + WindowInvalidateByClass(WindowClass::RideConstruction); + gCurrentToolWidget.widget_index = (gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_ENTRANCE) + ? WIDX_MAZE_ENTRANCE + : WIDX_MAZE_EXIT; + + WindowMazeConstructionUpdatePressedWidgets(); + } + }); + auto res = GameActions::Execute(&rideEntranceExitPlaceAction); + } + + void WindowMazeConstructionConstruct(int32_t direction) + { + int32_t x, y, z, actionFlags = 0, mode; + + _currentTrackSelectionFlags = 0; + _rideConstructionNextArrowPulse = 0; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + RideConstructionInvalidateCurrentTrack(); + + x = _currentTrackBegin.x + (CoordsDirectionDelta[direction].x / 2); + y = _currentTrackBegin.y + (CoordsDirectionDelta[direction].y / 2); + z = _currentTrackBegin.z; + switch (_rideConstructionState) + { + case RideConstructionState::MazeBuild: + mode = GC_SET_MAZE_TRACK_BUILD; + break; + case RideConstructionState::MazeMove: + mode = GC_SET_MAZE_TRACK_MOVE; + actionFlags = GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED; + break; + default: + case RideConstructionState::MazeFill: + mode = GC_SET_MAZE_TRACK_FILL; + break; } - }); - auto res = GameActions::Execute(&rideEntranceExitPlaceAction); + + const auto loc = CoordsXYZD{ x, y, z, static_cast(direction) }; + auto action = MazeSetTrackAction(loc, false, _currentRideIndex, mode); + action.SetFlags(actionFlags); + const auto res = GameActions::Execute(&action); + if (res.Error != GameActions::Status::Ok) + { + return; + } + + _currentTrackBegin.x = x; + _currentTrackBegin.y = y; + if (_rideConstructionState != RideConstructionState::MazeMove) + { + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, { x, y, z }); + } + } + }; + + WindowBase* MazeConstructionOpen() + { + return WindowFocusOrCreate( + WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE); } - void WindowMazeConstructionConstruct(int32_t direction) + void WindowMazeConstructionUpdatePressedWidgets() { - int32_t x, y, z, actionFlags = 0, mode; + WindowBase* w; - _currentTrackSelectionFlags = 0; - _rideConstructionNextArrowPulse = 0; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - RideConstructionInvalidateCurrentTrack(); + w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr) + return; + + uint64_t pressedWidgets = w->pressed_widgets; + + // Unpress all the mode buttons + pressedWidgets &= ~EnumToFlag(WIDX_MAZE_BUILD_MODE); + pressedWidgets &= ~EnumToFlag(WIDX_MAZE_MOVE_MODE); + pressedWidgets &= ~EnumToFlag(WIDX_MAZE_FILL_MODE); + pressedWidgets &= ~EnumToFlag(WIDX_MAZE_ENTRANCE); + pressedWidgets &= ~EnumToFlag(WIDX_MAZE_EXIT); - x = _currentTrackBegin.x + (CoordsDirectionDelta[direction].x / 2); - y = _currentTrackBegin.y + (CoordsDirectionDelta[direction].y / 2); - z = _currentTrackBegin.z; switch (_rideConstructionState) { + case RideConstructionState::EntranceExit: + if (gCurrentToolWidget.widget_index == WIDX_MAZE_ENTRANCE) + { + pressedWidgets |= EnumToFlag(WIDX_MAZE_ENTRANCE); + } + else + { + pressedWidgets |= EnumToFlag(WIDX_MAZE_EXIT); + } + break; case RideConstructionState::MazeBuild: - mode = GC_SET_MAZE_TRACK_BUILD; + pressedWidgets |= EnumToFlag(WIDX_MAZE_BUILD_MODE); break; case RideConstructionState::MazeMove: - mode = GC_SET_MAZE_TRACK_MOVE; - actionFlags = GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED; + pressedWidgets |= EnumToFlag(WIDX_MAZE_MOVE_MODE); + break; + case RideConstructionState::MazeFill: + pressedWidgets |= EnumToFlag(WIDX_MAZE_FILL_MODE); break; default: - case RideConstructionState::MazeFill: - mode = GC_SET_MAZE_TRACK_FILL; break; } - const auto loc = CoordsXYZD{ x, y, z, static_cast(direction) }; - auto action = MazeSetTrackAction(loc, false, _currentRideIndex, mode); - action.SetFlags(actionFlags); - const auto res = GameActions::Execute(&action); - if (res.Error != GameActions::Status::Ok) - { - return; - } - - _currentTrackBegin.x = x; - _currentTrackBegin.y = y; - if (_rideConstructionState != RideConstructionState::MazeMove) - { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, { x, y, z }); - } + w->pressed_widgets = pressedWidgets; + w->Invalidate(); } -}; - -WindowBase* WindowMazeConstructionOpen() -{ - return WindowFocusOrCreate( - WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE); -} - -void WindowMazeConstructionUpdatePressedWidgets() -{ - WindowBase* w; - - w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr) - return; - - uint64_t pressedWidgets = w->pressed_widgets; - - // Unpress all the mode buttons - pressedWidgets &= ~EnumToFlag(WIDX_MAZE_BUILD_MODE); - pressedWidgets &= ~EnumToFlag(WIDX_MAZE_MOVE_MODE); - pressedWidgets &= ~EnumToFlag(WIDX_MAZE_FILL_MODE); - pressedWidgets &= ~EnumToFlag(WIDX_MAZE_ENTRANCE); - pressedWidgets &= ~EnumToFlag(WIDX_MAZE_EXIT); - - switch (_rideConstructionState) - { - case RideConstructionState::EntranceExit: - if (gCurrentToolWidget.widget_index == WIDX_MAZE_ENTRANCE) - { - pressedWidgets |= EnumToFlag(WIDX_MAZE_ENTRANCE); - } - else - { - pressedWidgets |= EnumToFlag(WIDX_MAZE_EXIT); - } - break; - case RideConstructionState::MazeBuild: - pressedWidgets |= EnumToFlag(WIDX_MAZE_BUILD_MODE); - break; - case RideConstructionState::MazeMove: - pressedWidgets |= EnumToFlag(WIDX_MAZE_MOVE_MODE); - break; - case RideConstructionState::MazeFill: - pressedWidgets |= EnumToFlag(WIDX_MAZE_FILL_MODE); - break; - default: - break; - } - - w->pressed_widgets = pressedWidgets; - w->Invalidate(); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 420aea93d1..6978e8fc9f 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -20,7 +20,9 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum { WINDOW_MULTIPLAYER_PAGE_INFORMATION, WINDOW_MULTIPLAYER_PAGE_PLAYERS, @@ -70,7 +72,7 @@ enum WindowMultiplayerWidgetIdx { static Widget window_multiplayer_information_widgets[] = { MAIN_MULTIPLAYER_WIDGETS, - WIDGETS_END, + kWidgetsEnd, }; static Widget window_multiplayer_players_widgets[] = { @@ -80,7 +82,7 @@ static Widget window_multiplayer_players_widgets[] = { MakeWidget({259, 46}, {100, 15}, WindowWidgetType::TableHeader, WindowColour::Primary , STR_LAST_ACTION), // Player name MakeWidget({359, 46}, { 42, 15}, WindowWidgetType::TableHeader, WindowColour::Primary , STR_PING ), // Player name MakeWidget({ 3, 60}, {334, 177}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), // list - WIDGETS_END, + kWidgetsEnd, }; static Widget window_multiplayer_groups_widgets[] = { @@ -93,7 +95,7 @@ static Widget window_multiplayer_groups_widgets[] = { MakeWidget({ 72, 80}, {175, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // selected group MakeWidget({236, 81}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH), MakeWidget({ 3, 94}, {314, 207}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), // permissions list - WIDGETS_END, + kWidgetsEnd, }; static Widget window_multiplayer_options_widgets[] = { @@ -101,7 +103,7 @@ static Widget window_multiplayer_options_widgets[] = { MakeWidget({3, 50}, {295, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_LOG_CHAT, STR_LOG_CHAT_TIP ), MakeWidget({3, 64}, {295, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_LOG_SERVER_ACTIONS, STR_LOG_SERVER_ACTIONS_TIP ), MakeWidget({3, 78}, {295, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ALLOW_KNOWN_KEYS_ONLY, STR_ALLOW_KNOWN_KEYS_ONLY_TIP), - WIDGETS_END, + kWidgetsEnd, }; static Widget *window_multiplayer_page_widgets[] = { @@ -118,831 +120,834 @@ static constexpr StringId WindowMultiplayerPageTitles[] = { STR_MULTIPLAYER_OPTIONS_TITLE, }; -// clang-format on + // clang-format on -static constexpr int32_t window_multiplayer_animation_divisor[] = { - 4, - 4, - 2, - 2, -}; -static constexpr int32_t window_multiplayer_animation_frames[] = { - 8, - 8, - 7, - 4, -}; + static constexpr int32_t window_multiplayer_animation_divisor[] = { + 4, + 4, + 2, + 2, + }; + static constexpr int32_t window_multiplayer_animation_frames[] = { + 8, + 8, + 7, + 4, + }; -static bool IsServerPlayerInvisible() -{ - return NetworkIsServerPlayerInvisible() && !gConfigGeneral.DebuggingTools; -} - -class MultiplayerWindow final : public Window -{ -private: - std::optional _windowInformationSize; - uint8_t _selectedGroup{ 0 }; - -private: - void ResetPressedWidgets(); - - void InformationPaint(DrawPixelInfo& dpi); - void PlayersPaint(DrawPixelInfo& dpi); - void GroupsPaint(DrawPixelInfo& dpi); - - void DrawTabImage(DrawPixelInfo& dpi, int32_t page_number, int32_t spriteIndex); - void DrawTabImages(DrawPixelInfo& dpi); - - void PlayersScrollPaint(int32_t scrollIndex, DrawPixelInfo& dpi) const; - void GroupsScrollPaint(int32_t scrollIndex, DrawPixelInfo& dpi) const; - - void ShowGroupDropdown(WidgetIndex widgetIndex); - ScreenCoordsXY InformationGetSize(); - -public: - void OnOpen() override; - - void SetPage(int32_t page_number); - - void OnMouseUp(WidgetIndex widgetIndex) override; - void OnResize() override; - void OnUpdate() override; - void OnPrepareDraw() override; - void OnDraw(DrawPixelInfo& dpi) override; - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override; - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override; - void OnMouseDown(WidgetIndex widgetIndex) override; - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override; - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override; - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override; - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override; -}; - -WindowBase* WindowMultiplayerOpen() -{ - // Check if window is already open - WindowBase* window = WindowBringToFrontByClass(WindowClass::Multiplayer); - if (window == nullptr) + static bool IsServerPlayerInvisible() { - window = WindowCreate(WindowClass::Multiplayer, 320, 144, WF_10 | WF_RESIZABLE | WF_AUTO_POSITION); + return NetworkIsServerPlayerInvisible() && !gConfigGeneral.DebuggingTools; } - return window; -} - -void MultiplayerWindow::OnOpen() -{ - SetPage(WINDOW_MULTIPLAYER_PAGE_INFORMATION); -} - -void MultiplayerWindow::SetPage(int32_t page_number) -{ - _windowInformationSize.reset(); - - page = page_number; - frame_no = 0; - no_list_items = 0; - selected_list_item = -1; - - hold_down_widgets = 0; - pressed_widgets = 0; - widgets = window_multiplayer_page_widgets[page]; - widgets[WIDX_TITLE].text = WindowMultiplayerPageTitles[page]; - - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); - InitScrollWidgets(); - Invalidate(); -} - -void MultiplayerWindow::OnMouseUp(WidgetIndex widgetIndex) -{ - switch (widgetIndex) + class MultiplayerWindow final : public Window { - case WIDX_CLOSE: - Close(); - break; - case WIDX_TAB1: - case WIDX_TAB2: - case WIDX_TAB3: - case WIDX_TAB4: - if (page != widgetIndex - WIDX_TAB1) - { - SetPage(widgetIndex - WIDX_TAB1); - } - break; - } - switch (page) + private: + std::optional _windowInformationSize; + uint8_t _selectedGroup{ 0 }; + + private: + void ResetPressedWidgets(); + + void InformationPaint(DrawPixelInfo& dpi); + void PlayersPaint(DrawPixelInfo& dpi); + void GroupsPaint(DrawPixelInfo& dpi); + + void DrawTabImage(DrawPixelInfo& dpi, int32_t page_number, int32_t spriteIndex); + void DrawTabImages(DrawPixelInfo& dpi); + + void PlayersScrollPaint(int32_t scrollIndex, DrawPixelInfo& dpi) const; + void GroupsScrollPaint(int32_t scrollIndex, DrawPixelInfo& dpi) const; + + void ShowGroupDropdown(WidgetIndex widgetIndex); + ScreenCoordsXY InformationGetSize(); + + public: + void OnOpen() override; + + void SetPage(int32_t page_number); + + void OnMouseUp(WidgetIndex widgetIndex) override; + void OnResize() override; + void OnUpdate() override; + void OnPrepareDraw() override; + void OnDraw(DrawPixelInfo& dpi) override; + + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override; + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override; + void OnMouseDown(WidgetIndex widgetIndex) override; + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override; + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override; + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override; + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override; + }; + + WindowBase* MultiplayerOpen() { - case WINDOW_MULTIPLAYER_PAGE_GROUPS: + // Check if window is already open + WindowBase* window = WindowBringToFrontByClass(WindowClass::Multiplayer); + if (window == nullptr) { - switch (widgetIndex) - { - case WIDX_ADD_GROUP: + window = WindowCreate( + WindowClass::Multiplayer, 320, 144, WF_10 | WF_RESIZABLE | WF_AUTO_POSITION); + } + + return window; + } + + void MultiplayerWindow::OnOpen() + { + SetPage(WINDOW_MULTIPLAYER_PAGE_INFORMATION); + } + + void MultiplayerWindow::SetPage(int32_t page_number) + { + _windowInformationSize.reset(); + + page = page_number; + frame_no = 0; + no_list_items = 0; + selected_list_item = -1; + + hold_down_widgets = 0; + pressed_widgets = 0; + widgets = window_multiplayer_page_widgets[page]; + widgets[WIDX_TITLE].text = WindowMultiplayerPageTitles[page]; + + OnResize(); + OnPrepareDraw(); + InitScrollWidgets(); + Invalidate(); + } + + void MultiplayerWindow::OnMouseUp(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_TAB1: + case WIDX_TAB2: + case WIDX_TAB3: + case WIDX_TAB4: + if (page != widgetIndex - WIDX_TAB1) { - auto networkModifyGroup = NetworkModifyGroupAction(ModifyGroupType::AddGroup); - GameActions::Execute(&networkModifyGroup); - break; + SetPage(widgetIndex - WIDX_TAB1); } - case WIDX_REMOVE_GROUP: + break; + } + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + switch (widgetIndex) { - auto networkModifyGroup = NetworkModifyGroupAction(ModifyGroupType::RemoveGroup, _selectedGroup); - GameActions::Execute(&networkModifyGroup); - break; + case WIDX_ADD_GROUP: + { + auto networkModifyGroup = NetworkModifyGroupAction(ModifyGroupType::AddGroup); + GameActions::Execute(&networkModifyGroup); + break; + } + case WIDX_REMOVE_GROUP: + { + auto networkModifyGroup = NetworkModifyGroupAction(ModifyGroupType::RemoveGroup, _selectedGroup); + GameActions::Execute(&networkModifyGroup); + break; + } + case WIDX_RENAME_GROUP: + { + int32_t groupIndex = NetworkGetGroupIndex(_selectedGroup); + const utf8* groupName = NetworkGetGroupName(groupIndex); + WindowTextInputRawOpen( + this, widgetIndex, STR_GROUP_NAME, STR_ENTER_NEW_NAME_FOR_THIS_GROUP, {}, groupName, 32); + break; + } } - case WIDX_RENAME_GROUP: + break; + } + case WINDOW_MULTIPLAYER_PAGE_OPTIONS: + { + switch (widgetIndex) { - int32_t groupIndex = NetworkGetGroupIndex(_selectedGroup); - const utf8* groupName = NetworkGetGroupName(groupIndex); - WindowTextInputRawOpen( - this, widgetIndex, STR_GROUP_NAME, STR_ENTER_NEW_NAME_FOR_THIS_GROUP, {}, groupName, 32); - break; + case WIDX_LOG_CHAT_CHECKBOX: + gConfigNetwork.LogChat = !gConfigNetwork.LogChat; + ConfigSaveDefault(); + break; + case WIDX_LOG_SERVER_ACTIONS_CHECKBOX: + gConfigNetwork.LogServerActions = !gConfigNetwork.LogServerActions; + ConfigSaveDefault(); + break; + case WIDX_KNOWN_KEYS_ONLY_CHECKBOX: + gConfigNetwork.KnownKeysOnly = !gConfigNetwork.KnownKeysOnly; + ConfigSaveDefault(); + break; } + break; } - break; } - case WINDOW_MULTIPLAYER_PAGE_OPTIONS: + } + + ScreenCoordsXY MultiplayerWindow::InformationGetSize() + { + assert(!_windowInformationSize.has_value()); + + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + + // Base dimensions. + const int32_t baseWidth = 450; + int32_t baseHeight = 55; + + // Server name is displayed word-wrapped, so figure out how high it will be. { - switch (widgetIndex) + int32_t numLines; + GfxWrapString(NetworkGetServerName(), baseWidth, FontStyle::Medium, nullptr, &numLines); + baseHeight += (numLines + 1) * lineHeight + (LIST_ROW_HEIGHT / 2); + } + + // Likewise, for the optional server description -- which can be a little longer. + const auto& descString = NetworkGetServerDescription(); + if (!descString.empty()) + { + int32_t numLines; + GfxWrapString(descString, baseWidth, FontStyle::Medium, nullptr, &numLines); + baseHeight += (numLines + 1) * lineHeight + (LIST_ROW_HEIGHT / 2); + } + + // Finally, account for provider info, if present. + { + const auto& providerName = NetworkGetServerProviderName(); + if (!providerName.empty()) + baseHeight += LIST_ROW_HEIGHT; + + const auto& providerEmail = NetworkGetServerProviderEmail(); + if (!providerEmail.empty()) + baseHeight += LIST_ROW_HEIGHT; + + const auto& providerWebsite = NetworkGetServerProviderWebsite(); + if (!providerWebsite.empty()) + baseHeight += LIST_ROW_HEIGHT; + } + + // TODO: Are these casts still neccessary? + _windowInformationSize = { static_cast(baseWidth), static_cast(baseHeight) }; + return _windowInformationSize.value(); + } + + void MultiplayerWindow::OnResize() + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_INFORMATION: { - case WIDX_LOG_CHAT_CHECKBOX: - gConfigNetwork.LogChat = !gConfigNetwork.LogChat; - ConfigSaveDefault(); - break; - case WIDX_LOG_SERVER_ACTIONS_CHECKBOX: - gConfigNetwork.LogServerActions = !gConfigNetwork.LogServerActions; - ConfigSaveDefault(); - break; - case WIDX_KNOWN_KEYS_ONLY_CHECKBOX: - gConfigNetwork.KnownKeysOnly = !gConfigNetwork.KnownKeysOnly; - ConfigSaveDefault(); - break; + auto size = _windowInformationSize ? _windowInformationSize.value() : InformationGetSize(); + WindowSetResize(*this, size.x, size.y, size.x, size.y); + break; } - break; - } - } -} - -ScreenCoordsXY MultiplayerWindow::InformationGetSize() -{ - assert(!_windowInformationSize.has_value()); - - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); - - // Base dimensions. - const int32_t baseWidth = 450; - int32_t baseHeight = 55; - - // Server name is displayed word-wrapped, so figure out how high it will be. - { - int32_t numLines; - GfxWrapString(NetworkGetServerName(), baseWidth, FontStyle::Medium, nullptr, &numLines); - baseHeight += (numLines + 1) * lineHeight + (LIST_ROW_HEIGHT / 2); - } - - // Likewise, for the optional server description -- which can be a little longer. - const auto& descString = NetworkGetServerDescription(); - if (!descString.empty()) - { - int32_t numLines; - GfxWrapString(descString, baseWidth, FontStyle::Medium, nullptr, &numLines); - baseHeight += (numLines + 1) * lineHeight + (LIST_ROW_HEIGHT / 2); - } - - // Finally, account for provider info, if present. - { - const auto& providerName = NetworkGetServerProviderName(); - if (!providerName.empty()) - baseHeight += LIST_ROW_HEIGHT; - - const auto& providerEmail = NetworkGetServerProviderEmail(); - if (!providerEmail.empty()) - baseHeight += LIST_ROW_HEIGHT; - - const auto& providerWebsite = NetworkGetServerProviderWebsite(); - if (!providerWebsite.empty()) - baseHeight += LIST_ROW_HEIGHT; - } - - // TODO: Are these casts still neccessary? - _windowInformationSize = { static_cast(baseWidth), static_cast(baseHeight) }; - return _windowInformationSize.value(); -} - -void MultiplayerWindow::OnResize() -{ - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_INFORMATION: - { - auto size = _windowInformationSize ? _windowInformationSize.value() : InformationGetSize(); - WindowSetResize(*this, size.x, size.y, size.x, size.y); - break; - } - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - { - WindowSetResize(*this, 420, 124, 500, 450); - - no_list_items = (IsServerPlayerInvisible() ? NetworkGetNumVisiblePlayers() : NetworkGetNumPlayers()); - - widgets[WIDX_HEADER_PING].right = width - 5; - - selected_list_item = -1; - Invalidate(); - break; - } - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - WindowSetResize(*this, 320, 200, 320, 500); - - no_list_items = NetworkGetNumActions(); - - selected_list_item = -1; - Invalidate(); - break; - } - case WINDOW_MULTIPLAYER_PAGE_OPTIONS: - { - WindowSetResize(*this, 300, 100, 300, 100); - break; - } - } -} - -void MultiplayerWindow::OnUpdate() -{ - frame_no++; - InvalidateWidget(WIDX_TAB1 + page); -} - -void MultiplayerWindow::ResetPressedWidgets() -{ - for (int32_t i = WIDX_TAB1; i <= WIDX_TAB4; i++) - { - SetWidgetPressed(i, false); - } -} - -void MultiplayerWindow::OnPrepareDraw() -{ - ResetPressedWidgets(); - SetWidgetPressed(WIDX_TAB1 + page, true); - ResizeFrameWithPage(); - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_INFORMATION: - { - WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); - break; - } - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - { - window_multiplayer_players_widgets[WIDX_LIST].right = width - 4; - window_multiplayer_players_widgets[WIDX_LIST].bottom = height - 0x0F; - WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); - break; - } - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - window_multiplayer_groups_widgets[WIDX_PERMISSIONS_LIST].right = width - 4; - window_multiplayer_groups_widgets[WIDX_PERMISSIONS_LIST].bottom = height - 0x0F; - WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); - - // select other group if one is removed - while (NetworkGetGroupIndex(_selectedGroup) == -1 && _selectedGroup > 0) + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: { - _selectedGroup--; - } - break; - } - case WINDOW_MULTIPLAYER_PAGE_OPTIONS: - { - WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); + WindowSetResize(*this, 420, 124, 500, 450); - if (NetworkGetMode() == NETWORK_MODE_CLIENT) - { - widgets[WIDX_KNOWN_KEYS_ONLY_CHECKBOX].type = WindowWidgetType::Empty; - } + no_list_items = (IsServerPlayerInvisible() ? NetworkGetNumVisiblePlayers() : NetworkGetNumPlayers()); - SetCheckboxValue(WIDX_LOG_CHAT_CHECKBOX, gConfigNetwork.LogChat); - SetCheckboxValue(WIDX_LOG_SERVER_ACTIONS_CHECKBOX, gConfigNetwork.LogServerActions); - SetCheckboxValue(WIDX_KNOWN_KEYS_ONLY_CHECKBOX, gConfigNetwork.KnownKeysOnly); - break; - } - } -} + widgets[WIDX_HEADER_PING].right = width - 5; -void MultiplayerWindow::OnDraw(DrawPixelInfo& dpi) -{ - DrawWidgets(dpi); - DrawTabImages(dpi); - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_INFORMATION: - { - InformationPaint(dpi); - break; - } - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - { - PlayersPaint(dpi); - break; - } - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - GroupsPaint(dpi); - break; - } - } -} - -void MultiplayerWindow::OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) -{ - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - if (selectedIndex == -1) - { - return; - } - - switch (widgetIndex) - { - case WIDX_DEFAULT_GROUP_DROPDOWN: - { - auto networkModifyGroup = NetworkModifyGroupAction( - ModifyGroupType::SetDefault, NetworkGetGroupID(selectedIndex)); - GameActions::Execute(&networkModifyGroup); - break; - } - case WIDX_SELECTED_GROUP_DROPDOWN: - { - _selectedGroup = NetworkGetGroupID(selectedIndex); - break; - } - } - Invalidate(); - break; - } - } -} - -void MultiplayerWindow::OnTextInput(WidgetIndex widgetIndex, std::string_view text) -{ - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - if (widgetIndex != WIDX_RENAME_GROUP) - return; - - if (text.empty()) - return; - - auto networkModifyGroup = NetworkModifyGroupAction(ModifyGroupType::SetName, _selectedGroup, std::string(text)); - GameActions::Execute(&networkModifyGroup); - break; - } - } -} - -void MultiplayerWindow::ShowGroupDropdown(WidgetIndex widgetIndex) -{ - auto widget = &widgets[widgetIndex]; - Widget* dropdownWidget = widget - 1; - auto numItems = NetworkGetNumGroups(); - - WindowDropdownShowTextCustomWidth( - windowPos + ScreenCoordsXY{ dropdownWidget->left, dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], 0, 0, - numItems, widget->right - dropdownWidget->left); - - for (auto i = 0; i < NetworkGetNumGroups(); i++) - { - gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItems[i].Args = reinterpret_cast(NetworkGetGroupName(i)); - } - if (widget == &window_multiplayer_groups_widgets[WIDX_DEFAULT_GROUP_DROPDOWN]) - { - Dropdown::SetChecked(NetworkGetGroupIndex(NetworkGetDefaultGroup()), true); - } - else if (widget == &window_multiplayer_groups_widgets[WIDX_SELECTED_GROUP_DROPDOWN]) - { - Dropdown::SetChecked(NetworkGetGroupIndex(_selectedGroup), true); - } -} - -void MultiplayerWindow::OnMouseDown(WidgetIndex widgetIndex) -{ - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - switch (widgetIndex) - { - case WIDX_DEFAULT_GROUP_DROPDOWN: - case WIDX_SELECTED_GROUP_DROPDOWN: - ShowGroupDropdown(widgetIndex); - break; - } - break; - } - } -} - -ScreenSize MultiplayerWindow::OnScrollGetSize(int32_t scrollIndex) -{ - ScreenSize screenSize{}; - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - { - if (selected_list_item != -1) - { selected_list_item = -1; Invalidate(); + break; } - - screenSize = { 0, NetworkGetNumPlayers() * SCROLLABLE_ROW_HEIGHT }; - int32_t i = screenSize.height - window_multiplayer_players_widgets[WIDX_LIST].bottom - + window_multiplayer_players_widgets[WIDX_LIST].top + 21; - if (i < 0) - i = 0; - if (i < scrolls[0].v_top) + case WINDOW_MULTIPLAYER_PAGE_GROUPS: { - scrolls[0].v_top = i; - Invalidate(); - } - break; - } + WindowSetResize(*this, 320, 200, 320, 500); + + no_list_items = NetworkGetNumActions(); - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - if (selected_list_item != -1) - { selected_list_item = -1; Invalidate(); + break; } - - screenSize = { 0, NetworkGetNumActions() * SCROLLABLE_ROW_HEIGHT }; - int32_t i = screenSize.height - window_multiplayer_groups_widgets[WIDX_LIST].bottom - + window_multiplayer_groups_widgets[WIDX_LIST].top + 21; - if (i < 0) - i = 0; - if (i < scrolls[0].v_top) + case WINDOW_MULTIPLAYER_PAGE_OPTIONS: { - scrolls[0].v_top = i; - Invalidate(); + WindowSetResize(*this, 300, 100, 300, 100); + break; } - break; } } - return screenSize; -} -void MultiplayerWindow::OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) -{ - switch (page) + void MultiplayerWindow::OnUpdate() { - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + frame_no++; + InvalidateWidget(WIDX_TAB1 + page); + } + + void MultiplayerWindow::ResetPressedWidgets() + { + for (int32_t i = WIDX_TAB1; i <= WIDX_TAB4; i++) { - int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - if (index >= no_list_items) - return; - - selected_list_item = index; - Invalidate(); - - int32_t player = (IsServerPlayerInvisible() ? index + 1 : index); - WindowPlayerOpen(NetworkGetPlayerID(player)); - break; - } - - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - if (index >= no_list_items) - return; - - selected_list_item = index; - Invalidate(); - - auto networkModifyGroup = NetworkModifyGroupAction( - ModifyGroupType::SetPermissions, _selectedGroup, "", index, PermissionState::Toggle); - GameActions::Execute(&networkModifyGroup); - break; + SetWidgetPressed(i, false); } } -} -void MultiplayerWindow::OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) -{ - switch (page) + void MultiplayerWindow::OnPrepareDraw() { - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - case WINDOW_MULTIPLAYER_PAGE_GROUPS: + ResetPressedWidgets(); + SetWidgetPressed(WIDX_TAB1 + page, true); + ResizeFrameWithPage(); + switch (page) { - int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - if (index >= no_list_items) - return; + case WINDOW_MULTIPLAYER_PAGE_INFORMATION: + { + WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); + break; + } + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + { + window_multiplayer_players_widgets[WIDX_LIST].right = width - 4; + window_multiplayer_players_widgets[WIDX_LIST].bottom = height - 0x0F; + WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); + break; + } + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + window_multiplayer_groups_widgets[WIDX_PERMISSIONS_LIST].right = width - 4; + window_multiplayer_groups_widgets[WIDX_PERMISSIONS_LIST].bottom = height - 0x0F; + WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); - selected_list_item = index; - Invalidate(); - break; + // select other group if one is removed + while (NetworkGetGroupIndex(_selectedGroup) == -1 && _selectedGroup > 0) + { + _selectedGroup--; + } + break; + } + case WINDOW_MULTIPLAYER_PAGE_OPTIONS: + { + WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); + + if (NetworkGetMode() == NETWORK_MODE_CLIENT) + { + widgets[WIDX_KNOWN_KEYS_ONLY_CHECKBOX].type = WindowWidgetType::Empty; + } + + SetCheckboxValue(WIDX_LOG_CHAT_CHECKBOX, gConfigNetwork.LogChat); + SetCheckboxValue(WIDX_LOG_SERVER_ACTIONS_CHECKBOX, gConfigNetwork.LogServerActions); + SetCheckboxValue(WIDX_KNOWN_KEYS_ONLY_CHECKBOX, gConfigNetwork.KnownKeysOnly); + break; + } } } -} -void MultiplayerWindow::OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) -{ - switch (page) + void MultiplayerWindow::OnDraw(DrawPixelInfo& dpi) { - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - PlayersScrollPaint(scrollIndex, dpi); - break; - - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - GroupsScrollPaint(scrollIndex, dpi); - break; - } -} - -void MultiplayerWindow::InformationPaint(DrawPixelInfo& dpi) -{ - DrawPixelInfo clippedDPI; - if (ClipDrawPixelInfo(clippedDPI, dpi, windowPos, width, height)) - { - auto screenCoords = ScreenCoordsXY{ 3, 50 }; - int32_t newWidth = width - 6; - - const auto& name = NetworkGetServerName(); + DrawWidgets(dpi); + DrawTabImages(dpi); + switch (page) { - auto ft = Formatter(); - ft.Add(name.c_str()); - screenCoords.y += DrawTextWrapped(clippedDPI, screenCoords, newWidth, STR_STRING, ft, { colours[1] }); - screenCoords.y += LIST_ROW_HEIGHT / 2; - } - - const auto& description = NetworkGetServerDescription(); - if (!description.empty()) - { - auto ft = Formatter(); - ft.Add(description.c_str()); - screenCoords.y += DrawTextWrapped(clippedDPI, screenCoords, newWidth, STR_STRING, ft, { colours[1] }); - screenCoords.y += LIST_ROW_HEIGHT / 2; - } - - const auto& providerName = NetworkGetServerProviderName(); - if (!providerName.empty()) - { - auto ft = Formatter(); - ft.Add(providerName.c_str()); - DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_NAME, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - const auto& providerEmail = NetworkGetServerProviderEmail(); - if (!providerEmail.empty()) - { - auto ft = Formatter(); - ft.Add(providerEmail.c_str()); - DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_EMAIL, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - const auto& providerWebsite = NetworkGetServerProviderWebsite(); - if (!providerWebsite.empty()) - { - auto ft = Formatter(); - ft.Add(providerWebsite.c_str()); - DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_WEBSITE, ft); + case WINDOW_MULTIPLAYER_PAGE_INFORMATION: + { + InformationPaint(dpi); + break; + } + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + { + PlayersPaint(dpi); + break; + } + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + GroupsPaint(dpi); + break; + } } } -} -void MultiplayerWindow::PlayersPaint(DrawPixelInfo& dpi) -{ - // Number of players - StringId stringId = no_list_items == 1 ? STR_MULTIPLAYER_PLAYER_COUNT : STR_MULTIPLAYER_PLAYER_COUNT_PLURAL; - auto screenCoords = windowPos + ScreenCoordsXY{ 4, widgets[WIDX_LIST].bottom + 2 }; - auto ft = Formatter(); - ft.Add(no_list_items); - DrawTextBasic(dpi, screenCoords, stringId, ft, { colours[2] }); -} - -void MultiplayerWindow::PlayersScrollPaint(int32_t scrollIndex, DrawPixelInfo& dpi) const -{ - ScreenCoordsXY screenCoords; - screenCoords.y = 0; - - const int32_t firstPlayerInList = (IsServerPlayerInvisible() ? 1 : 0); - int32_t listPosition = 0; - - for (int32_t player = firstPlayerInList; player < NetworkGetNumPlayers(); player++) + void MultiplayerWindow::OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) { - if (screenCoords.y > dpi.y + dpi.height) + switch (page) { - break; + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + if (selectedIndex == -1) + { + return; + } + + switch (widgetIndex) + { + case WIDX_DEFAULT_GROUP_DROPDOWN: + { + auto networkModifyGroup = NetworkModifyGroupAction( + ModifyGroupType::SetDefault, NetworkGetGroupID(selectedIndex)); + GameActions::Execute(&networkModifyGroup); + break; + } + case WIDX_SELECTED_GROUP_DROPDOWN: + { + _selectedGroup = NetworkGetGroupID(selectedIndex); + break; + } + } + Invalidate(); + break; + } + } + } + + void MultiplayerWindow::OnTextInput(WidgetIndex widgetIndex, std::string_view text) + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + if (widgetIndex != WIDX_RENAME_GROUP) + return; + + if (text.empty()) + return; + + auto networkModifyGroup = NetworkModifyGroupAction(ModifyGroupType::SetName, _selectedGroup, std::string(text)); + GameActions::Execute(&networkModifyGroup); + break; + } + } + } + + void MultiplayerWindow::ShowGroupDropdown(WidgetIndex widgetIndex) + { + auto widget = &widgets[widgetIndex]; + Widget* dropdownWidget = widget - 1; + auto numItems = NetworkGetNumGroups(); + + WindowDropdownShowTextCustomWidth( + windowPos + ScreenCoordsXY{ dropdownWidget->left, dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], + 0, 0, numItems, widget->right - dropdownWidget->left); + + for (auto i = 0; i < NetworkGetNumGroups(); i++) + { + gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; + gDropdownItems[i].Args = reinterpret_cast(NetworkGetGroupName(i)); + } + if (widget == &window_multiplayer_groups_widgets[WIDX_DEFAULT_GROUP_DROPDOWN]) + { + Dropdown::SetChecked(NetworkGetGroupIndex(NetworkGetDefaultGroup()), true); + } + else if (widget == &window_multiplayer_groups_widgets[WIDX_SELECTED_GROUP_DROPDOWN]) + { + Dropdown::SetChecked(NetworkGetGroupIndex(_selectedGroup), true); + } + } + + void MultiplayerWindow::OnMouseDown(WidgetIndex widgetIndex) + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + switch (widgetIndex) + { + case WIDX_DEFAULT_GROUP_DROPDOWN: + case WIDX_SELECTED_GROUP_DROPDOWN: + ShowGroupDropdown(widgetIndex); + break; + } + break; + } + } + } + + ScreenSize MultiplayerWindow::OnScrollGetSize(int32_t scrollIndex) + { + ScreenSize screenSize{}; + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + { + if (selected_list_item != -1) + { + selected_list_item = -1; + Invalidate(); + } + + screenSize = { 0, NetworkGetNumPlayers() * SCROLLABLE_ROW_HEIGHT }; + int32_t i = screenSize.height - window_multiplayer_players_widgets[WIDX_LIST].bottom + + window_multiplayer_players_widgets[WIDX_LIST].top + 21; + if (i < 0) + i = 0; + if (i < scrolls[0].v_top) + { + scrolls[0].v_top = i; + Invalidate(); + } + break; + } + + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + if (selected_list_item != -1) + { + selected_list_item = -1; + Invalidate(); + } + + screenSize = { 0, NetworkGetNumActions() * SCROLLABLE_ROW_HEIGHT }; + int32_t i = screenSize.height - window_multiplayer_groups_widgets[WIDX_LIST].bottom + + window_multiplayer_groups_widgets[WIDX_LIST].top + 21; + if (i < 0) + i = 0; + if (i < scrolls[0].v_top) + { + scrolls[0].v_top = i; + Invalidate(); + } + break; + } + } + return screenSize; + } + + void MultiplayerWindow::OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + { + int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + if (index >= no_list_items) + return; + + selected_list_item = index; + Invalidate(); + + int32_t player = (IsServerPlayerInvisible() ? index + 1 : index); + PlayerOpen(NetworkGetPlayerID(player)); + break; + } + + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + if (index >= no_list_items) + return; + + selected_list_item = index; + Invalidate(); + + auto networkModifyGroup = NetworkModifyGroupAction( + ModifyGroupType::SetPermissions, _selectedGroup, "", index, PermissionState::Toggle); + GameActions::Execute(&networkModifyGroup); + break; + } + } + } + + void MultiplayerWindow::OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + if (index >= no_list_items) + return; + + selected_list_item = index; + Invalidate(); + break; + } + } + } + + void MultiplayerWindow::OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + PlayersScrollPaint(scrollIndex, dpi); + break; + + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + GroupsScrollPaint(scrollIndex, dpi); + break; + } + } + + void MultiplayerWindow::InformationPaint(DrawPixelInfo& dpi) + { + DrawPixelInfo clippedDPI; + if (ClipDrawPixelInfo(clippedDPI, dpi, windowPos, width, height)) + { + auto screenCoords = ScreenCoordsXY{ 3, 50 }; + int32_t newWidth = width - 6; + + const auto& name = NetworkGetServerName(); + { + auto ft = Formatter(); + ft.Add(name.c_str()); + screenCoords.y += DrawTextWrapped(clippedDPI, screenCoords, newWidth, STR_STRING, ft, { colours[1] }); + screenCoords.y += LIST_ROW_HEIGHT / 2; + } + + const auto& description = NetworkGetServerDescription(); + if (!description.empty()) + { + auto ft = Formatter(); + ft.Add(description.c_str()); + screenCoords.y += DrawTextWrapped(clippedDPI, screenCoords, newWidth, STR_STRING, ft, { colours[1] }); + screenCoords.y += LIST_ROW_HEIGHT / 2; + } + + const auto& providerName = NetworkGetServerProviderName(); + if (!providerName.empty()) + { + auto ft = Formatter(); + ft.Add(providerName.c_str()); + DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_NAME, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + + const auto& providerEmail = NetworkGetServerProviderEmail(); + if (!providerEmail.empty()) + { + auto ft = Formatter(); + ft.Add(providerEmail.c_str()); + DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_EMAIL, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + + const auto& providerWebsite = NetworkGetServerProviderWebsite(); + if (!providerWebsite.empty()) + { + auto ft = Formatter(); + ft.Add(providerWebsite.c_str()); + DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_WEBSITE, ft); + } + } + } + + void MultiplayerWindow::PlayersPaint(DrawPixelInfo& dpi) + { + // Number of players + StringId stringId = no_list_items == 1 ? STR_MULTIPLAYER_PLAYER_COUNT : STR_MULTIPLAYER_PLAYER_COUNT_PLURAL; + auto screenCoords = windowPos + ScreenCoordsXY{ 4, widgets[WIDX_LIST].bottom + 2 }; + auto ft = Formatter(); + ft.Add(no_list_items); + DrawTextBasic(dpi, screenCoords, stringId, ft, { colours[2] }); + } + + void MultiplayerWindow::PlayersScrollPaint(int32_t scrollIndex, DrawPixelInfo& dpi) const + { + ScreenCoordsXY screenCoords; + screenCoords.y = 0; + + const int32_t firstPlayerInList = (IsServerPlayerInvisible() ? 1 : 0); + int32_t listPosition = 0; + + for (int32_t player = firstPlayerInList; player < NetworkGetNumPlayers(); player++) + { + if (screenCoords.y > dpi.y + dpi.height) + { + break; + } + + if (screenCoords.y + SCROLLABLE_ROW_HEIGHT + 1 >= dpi.y) + { + thread_local std::string _buffer; + _buffer.reserve(512); + _buffer.clear(); + + // Draw player name + colour_t colour = COLOUR_BLACK; + if (listPosition == selected_list_item) + { + GfxFilterRect( + dpi, { 0, screenCoords.y, 800, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 }, + FilterPaletteID::PaletteDarken1); + _buffer += NetworkGetPlayerName(player); + colour = colours[2]; + } + else + { + if (NetworkGetPlayerFlags(player) & NETWORK_PLAYER_FLAG_ISSERVER) + { + _buffer += "{BABYBLUE}"; + } + else + { + _buffer += "{BLACK}"; + } + _buffer += NetworkGetPlayerName(player); + } + screenCoords.x = 0; + GfxClipString(_buffer.data(), 230, FontStyle::Medium); + GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour }); + + // Draw group name + _buffer.resize(0); + int32_t group = NetworkGetGroupIndex(NetworkGetPlayerGroup(player)); + if (group != -1) + { + _buffer += "{BLACK}"; + screenCoords.x = 173; + _buffer += NetworkGetGroupName(group); + GfxClipString(_buffer.data(), 80, FontStyle::Medium); + GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour }); + } + + // Draw last action + int32_t action = NetworkGetPlayerLastAction(player, 2000); + auto ft = Formatter(); + if (action != -999) + { + ft.Add(NetworkGetActionNameStringID(action)); + } + else + { + ft.Add(STR_ACTION_NA); + } + DrawTextEllipsised(dpi, { 256, screenCoords.y }, 100, STR_BLACK_STRING, ft); + + // Draw ping + _buffer.resize(0); + int32_t ping = NetworkGetPlayerPing(player); + if (ping <= 100) + { + _buffer += "{GREEN}"; + } + else if (ping <= 250) + { + _buffer += "{YELLOW}"; + } + else + { + _buffer += "{RED}"; + } + + char pingBuffer[64]{}; + snprintf(pingBuffer, sizeof(pingBuffer), "%d ms", ping); + _buffer += pingBuffer; + + screenCoords.x = 356; + GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour }); + } + screenCoords.y += SCROLLABLE_ROW_HEIGHT; + listPosition++; + } + } + + void MultiplayerWindow::GroupsPaint(DrawPixelInfo& dpi) + { + thread_local std::string _buffer; + + Widget* widget = &window_multiplayer_groups_widgets[WIDX_DEFAULT_GROUP]; + int32_t group = NetworkGetGroupIndex(NetworkGetDefaultGroup()); + if (group != -1) + { + _buffer.assign("{WINDOW_COLOUR_2}"); + _buffer += NetworkGetGroupName(group); + + auto ft = Formatter(); + ft.Add(_buffer.c_str()); + DrawTextEllipsised( + dpi, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, + { TextAlignment::CENTRE }); } - if (screenCoords.y + SCROLLABLE_ROW_HEIGHT + 1 >= dpi.y) - { - thread_local std::string _buffer; - _buffer.reserve(512); - _buffer.clear(); + auto screenPos = windowPos + + ScreenCoordsXY{ window_multiplayer_groups_widgets[WIDX_CONTENT_PANEL].left + 4, + window_multiplayer_groups_widgets[WIDX_CONTENT_PANEL].top + 4 }; - // Draw player name - colour_t colour = COLOUR_BLACK; - if (listPosition == selected_list_item) + DrawTextBasic(dpi, screenPos, STR_DEFAULT_GROUP, {}, { colours[2] }); + + screenPos.y += 20; + + GfxFillRectInset( + dpi, { screenPos - ScreenCoordsXY{ 0, 6 }, screenPos + ScreenCoordsXY{ 310, -5 } }, colours[1], + INSET_RECT_FLAG_BORDER_INSET); + + widget = &window_multiplayer_groups_widgets[WIDX_SELECTED_GROUP]; + group = NetworkGetGroupIndex(_selectedGroup); + if (group != -1) + { + _buffer.assign("{WINDOW_COLOUR_2}"); + _buffer += NetworkGetGroupName(group); + auto ft = Formatter(); + ft.Add(_buffer.c_str()); + DrawTextEllipsised( + dpi, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, + { TextAlignment::CENTRE }); + } + } + + void MultiplayerWindow::GroupsScrollPaint(int32_t scrollIndex, DrawPixelInfo& dpi) const + { + auto screenCoords = ScreenCoordsXY{ 0, 0 }; + + auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; + GfxFillRect( + dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width - 1, dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); + + for (int32_t i = 0; i < NetworkGetNumActions(); i++) + { + if (i == selected_list_item) { GfxFilterRect( dpi, { 0, screenCoords.y, 800, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1); - _buffer += NetworkGetPlayerName(player); - colour = colours[2]; } - else + if (screenCoords.y > dpi.y + dpi.height) { - if (NetworkGetPlayerFlags(player) & NETWORK_PLAYER_FLAG_ISSERVER) + break; + } + + if (screenCoords.y + SCROLLABLE_ROW_HEIGHT + 1 >= dpi.y) + { + int32_t groupindex = NetworkGetGroupIndex(_selectedGroup); + if (groupindex != -1) { - _buffer += "{BABYBLUE}"; + if (NetworkCanPerformAction(groupindex, static_cast(i))) + { + screenCoords.x = 0; + GfxDrawString(dpi, screenCoords, u8"{WINDOW_COLOUR_2}✓", {}); + } } - else + + // Draw action name + auto ft = Formatter(); + ft.Add(NetworkGetActionNameStringID(i)); + DrawTextBasic(dpi, { 10, screenCoords.y }, STR_WINDOW_COLOUR_2_STRINGID, ft); + } + screenCoords.y += SCROLLABLE_ROW_HEIGHT; + } + } + + void MultiplayerWindow::DrawTabImage(DrawPixelInfo& dpi, int32_t page_number, int32_t spriteIndex) + { + WidgetIndex widgetIndex = WIDX_TAB1 + page_number; + + if (!IsWidgetDisabled(widgetIndex)) + { + if (page == page_number) + { + int32_t numFrames = window_multiplayer_animation_frames[page]; + if (numFrames > 1) { - _buffer += "{BLACK}"; - } - _buffer += NetworkGetPlayerName(player); - } - screenCoords.x = 0; - GfxClipString(_buffer.data(), 230, FontStyle::Medium); - GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour }); - - // Draw group name - _buffer.resize(0); - int32_t group = NetworkGetGroupIndex(NetworkGetPlayerGroup(player)); - if (group != -1) - { - _buffer += "{BLACK}"; - screenCoords.x = 173; - _buffer += NetworkGetGroupName(group); - GfxClipString(_buffer.data(), 80, FontStyle::Medium); - GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour }); - } - - // Draw last action - int32_t action = NetworkGetPlayerLastAction(player, 2000); - auto ft = Formatter(); - if (action != -999) - { - ft.Add(NetworkGetActionNameStringID(action)); - } - else - { - ft.Add(STR_ACTION_NA); - } - DrawTextEllipsised(dpi, { 256, screenCoords.y }, 100, STR_BLACK_STRING, ft); - - // Draw ping - _buffer.resize(0); - int32_t ping = NetworkGetPlayerPing(player); - if (ping <= 100) - { - _buffer += "{GREEN}"; - } - else if (ping <= 250) - { - _buffer += "{YELLOW}"; - } - else - { - _buffer += "{RED}"; - } - - char pingBuffer[64]{}; - snprintf(pingBuffer, sizeof(pingBuffer), "%d ms", ping); - _buffer += pingBuffer; - - screenCoords.x = 356; - GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour }); - } - screenCoords.y += SCROLLABLE_ROW_HEIGHT; - listPosition++; - } -} - -void MultiplayerWindow::GroupsPaint(DrawPixelInfo& dpi) -{ - thread_local std::string _buffer; - - Widget* widget = &window_multiplayer_groups_widgets[WIDX_DEFAULT_GROUP]; - int32_t group = NetworkGetGroupIndex(NetworkGetDefaultGroup()); - if (group != -1) - { - _buffer.assign("{WINDOW_COLOUR_2}"); - _buffer += NetworkGetGroupName(group); - - auto ft = Formatter(); - ft.Add(_buffer.c_str()); - DrawTextEllipsised( - dpi, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); - } - - auto screenPos = windowPos - + ScreenCoordsXY{ window_multiplayer_groups_widgets[WIDX_CONTENT_PANEL].left + 4, - window_multiplayer_groups_widgets[WIDX_CONTENT_PANEL].top + 4 }; - - DrawTextBasic(dpi, screenPos, STR_DEFAULT_GROUP, {}, { colours[2] }); - - screenPos.y += 20; - - GfxFillRectInset( - dpi, { screenPos - ScreenCoordsXY{ 0, 6 }, screenPos + ScreenCoordsXY{ 310, -5 } }, colours[1], - INSET_RECT_FLAG_BORDER_INSET); - - widget = &window_multiplayer_groups_widgets[WIDX_SELECTED_GROUP]; - group = NetworkGetGroupIndex(_selectedGroup); - if (group != -1) - { - _buffer.assign("{WINDOW_COLOUR_2}"); - _buffer += NetworkGetGroupName(group); - auto ft = Formatter(); - ft.Add(_buffer.c_str()); - DrawTextEllipsised( - dpi, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); - } -} - -void MultiplayerWindow::GroupsScrollPaint(int32_t scrollIndex, DrawPixelInfo& dpi) const -{ - auto screenCoords = ScreenCoordsXY{ 0, 0 }; - - auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; - GfxFillRect( - dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width - 1, dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); - - for (int32_t i = 0; i < NetworkGetNumActions(); i++) - { - if (i == selected_list_item) - { - GfxFilterRect( - dpi, { 0, screenCoords.y, 800, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1); - } - if (screenCoords.y > dpi.y + dpi.height) - { - break; - } - - if (screenCoords.y + SCROLLABLE_ROW_HEIGHT + 1 >= dpi.y) - { - int32_t groupindex = NetworkGetGroupIndex(_selectedGroup); - if (groupindex != -1) - { - if (NetworkCanPerformAction(groupindex, static_cast(i))) - { - screenCoords.x = 0; - GfxDrawString(dpi, screenCoords, u8"{WINDOW_COLOUR_2}✓", {}); + int32_t frame = frame_no / window_multiplayer_animation_divisor[page]; + spriteIndex += (frame % numFrames); } } - // Draw action name - auto ft = Formatter(); - ft.Add(NetworkGetActionNameStringID(i)); - DrawTextBasic(dpi, { 10, screenCoords.y }, STR_WINDOW_COLOUR_2_STRINGID, ft); + GfxDrawSprite( + dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); } - screenCoords.y += SCROLLABLE_ROW_HEIGHT; } -} -void MultiplayerWindow::DrawTabImage(DrawPixelInfo& dpi, int32_t page_number, int32_t spriteIndex) -{ - WidgetIndex widgetIndex = WIDX_TAB1 + page_number; - - if (!IsWidgetDisabled(widgetIndex)) + void MultiplayerWindow::DrawTabImages(DrawPixelInfo& dpi) { - if (page == page_number) - { - int32_t numFrames = window_multiplayer_animation_frames[page]; - if (numFrames > 1) - { - int32_t frame = frame_no / window_multiplayer_animation_divisor[page]; - spriteIndex += (frame % numFrames); - } - } - - GfxDrawSprite( - dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); + DrawTabImage(dpi, WINDOW_MULTIPLAYER_PAGE_INFORMATION, SPR_TAB_KIOSKS_AND_FACILITIES_0); + DrawTabImage(dpi, WINDOW_MULTIPLAYER_PAGE_PLAYERS, SPR_TAB_GUESTS_0); + DrawTabImage(dpi, WINDOW_MULTIPLAYER_PAGE_GROUPS, SPR_TAB_STAFF_OPTIONS_0); + DrawTabImage(dpi, WINDOW_MULTIPLAYER_PAGE_OPTIONS, SPR_TAB_GEARS_0); } -} - -void MultiplayerWindow::DrawTabImages(DrawPixelInfo& dpi) -{ - DrawTabImage(dpi, WINDOW_MULTIPLAYER_PAGE_INFORMATION, SPR_TAB_KIOSKS_AND_FACILITIES_0); - DrawTabImage(dpi, WINDOW_MULTIPLAYER_PAGE_PLAYERS, SPR_TAB_GUESTS_0); - DrawTabImage(dpi, WINDOW_MULTIPLAYER_PAGE_GROUPS, SPR_TAB_STAFF_OPTIONS_0); - DrawTabImage(dpi, WINDOW_MULTIPLAYER_PAGE_OPTIONS, SPR_TAB_GEARS_0); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp index d93fc5edc8..248371af3c 100644 --- a/src/openrct2-ui/windows/NetworkStatus.cpp +++ b/src/openrct2-ui/windows/NetworkStatus.cpp @@ -14,7 +14,9 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum WindowNetworkStatusWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -26,136 +28,137 @@ static Widget window_network_status_widgets[] = { MakeWidget({ 0, 0}, {441, 91}, WindowWidgetType::Frame, WindowColour::Primary ), // panel / background MakeWidget({ 1, 1}, {438, 14}, WindowWidgetType::Caption, WindowColour::Primary, STR_NONE, STR_WINDOW_TITLE_TIP), // title bar MakeWidget({427, 2}, { 11, 12}, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP), // close x button - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on -class NetworkStatusWindow final : public Window -{ -public: - void OnOpen() override + // clang-format on + class NetworkStatusWindow final : public Window { - widgets = window_network_status_widgets; - WindowInitScrollWidgets(*this); - - frame_no = 0; - min_width = 320; - min_height = 90; - max_width = min_width; - max_height = min_height; - - page = 0; - list_information_type = 0; - } - - void OnClose() override - { - if (_onClose != nullptr) + public: + void OnOpen() override { - _onClose(); - } - } + widgets = window_network_status_widgets; + WindowInitScrollWidgets(*this); - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + frame_no = 0; + min_width = 320; + min_height = 90; + max_width = min_width; + max_height = min_height; + + page = 0; + list_information_type = 0; + } + + void OnClose() override { - case WIDX_CLOSE: - Close(); - break; + if (_onClose != nullptr) + { + _onClose(); + } } - } - void OnUpdate() override - { - InvalidateWidget(WIDX_BACKGROUND); - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - _password.clear(); - switch (widgetIndex) + void OnMouseUp(WidgetIndex widgetIndex) override { - case WIDX_PASSWORD: - _password = text; - break; + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + } } - if (text.empty()) + + void OnUpdate() override { - NetworkShutdownClient(); + InvalidateWidget(WIDX_BACKGROUND); } - else + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override { - NetworkSendPassword(_password); + _password.clear(); + switch (widgetIndex) + { + case WIDX_PASSWORD: + _password = text; + break; + } + if (text.empty()) + { + NetworkShutdownClient(); + } + else + { + NetworkSendPassword(_password); + } } - } - void OnPrepareDraw() override + void OnPrepareDraw() override + { + ResizeFrame(); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + WindowDrawWidgets(*this, dpi); + thread_local std::string _buffer; + _buffer.assign("{BLACK}"); + _buffer += _windowNetworkStatusText; + GfxClipString(_buffer.data(), widgets[WIDX_BACKGROUND].right - 50, FontStyle::Medium); + ScreenCoordsXY screenCoords(windowPos.x + (width / 2), windowPos.y + (height / 2)); + screenCoords.x -= GfxGetStringWidth(_buffer, FontStyle::Medium) / 2; + GfxDrawString(dpi, screenCoords, _buffer.c_str()); + } + + void SetCloseCallBack(close_callback onClose) + { + _onClose = onClose; + } + + void SetWindowNetworkStatusText(const std::string& text) + { + _windowNetworkStatusText = text; + } + + void SetPassword(char* password) + { + _password = password; + } + + private: + close_callback _onClose = nullptr; + std::string _windowNetworkStatusText; + std::string _password; + }; + + WindowBase* NetworkStatusOpen(const std::string& text, close_callback onClose) { - ResizeFrame(); + auto window = WindowFocusOrCreate( + WindowClass::NetworkStatus, 420, 90, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN); + window->SetCloseCallBack(onClose); + window->SetWindowNetworkStatusText(text); + return window; } - void OnDraw(DrawPixelInfo& dpi) override + // force close + void WindowNetworkStatusClose() { - WindowDrawWidgets(*this, dpi); - thread_local std::string _buffer; - _buffer.assign("{BLACK}"); - _buffer += _windowNetworkStatusText; - GfxClipString(_buffer.data(), widgets[WIDX_BACKGROUND].right - 50, FontStyle::Medium); - ScreenCoordsXY screenCoords(windowPos.x + (width / 2), windowPos.y + (height / 2)); - screenCoords.x -= GfxGetStringWidth(_buffer, FontStyle::Medium) / 2; - GfxDrawString(dpi, screenCoords, _buffer.c_str()); + auto window = WindowFindByClass(WindowClass::NetworkStatus); + if (window == nullptr) + { + return; + } + auto networkWindow = static_cast(window); + networkWindow->SetCloseCallBack(nullptr); + networkWindow->Close(); } - void SetCloseCallBack(close_callback onClose) + WindowBase* NetworkStatusOpenPassword() { - _onClose = onClose; + auto window = WindowFocusOrCreate( + WindowClass::NetworkStatus, 420, 90, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN); + char password[33]{}; + WindowTextInputRawOpen(window, WIDX_PASSWORD, STR_PASSWORD_REQUIRED, STR_PASSWORD_REQUIRED_DESC, {}, password, 32); + window->SetPassword(password); + return window; } - - void SetWindowNetworkStatusText(const std::string& text) - { - _windowNetworkStatusText = text; - } - - void SetPassword(char* password) - { - _password = password; - } - -private: - close_callback _onClose = nullptr; - std::string _windowNetworkStatusText; - std::string _password; -}; - -WindowBase* WindowNetworkStatusOpen(const std::string& text, close_callback onClose) -{ - auto window = WindowFocusOrCreate( - WindowClass::NetworkStatus, 420, 90, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN); - window->SetCloseCallBack(onClose); - window->SetWindowNetworkStatusText(text); - return window; -} - -// force close -void WindowNetworkStatusClose() -{ - auto window = WindowFindByClass(WindowClass::NetworkStatus); - if (window == nullptr) - { - return; - } - auto networkWindow = static_cast(window); - networkWindow->SetCloseCallBack(nullptr); - networkWindow->Close(); -} - -WindowBase* WindowNetworkStatusOpenPassword() -{ - auto window = WindowFocusOrCreate( - WindowClass::NetworkStatus, 420, 90, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN); - char password[33]{}; - WindowTextInputRawOpen(window, WIDX_PASSWORD, STR_PASSWORD_REQUIRED, STR_PASSWORD_REQUIRED_DESC, {}, password, 32); - window->SetPassword(password); - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/NewCampaign.cpp b/src/openrct2-ui/windows/NewCampaign.cpp index 295885fbfb..7fe8428455 100644 --- a/src/openrct2-ui/windows/NewCampaign.cpp +++ b/src/openrct2-ui/windows/NewCampaign.cpp @@ -21,15 +21,15 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_NONE; + static constexpr int32_t WH = 109; + static constexpr int32_t WW = 350; -static constexpr StringId WINDOW_TITLE = STR_NONE; -static constexpr int32_t WH = 109; -static constexpr int32_t WW = 350; + constexpr uint16_t SELECTED_ITEM_UNDEFINED = 0xFFFF; -constexpr uint16_t SELECTED_ITEM_UNDEFINED = 0xFFFF; - -// clang-format off + // clang-format off enum WindowNewCampaignWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -52,161 +52,191 @@ static Widget window_new_campaign_widgets[] = { MakeWidget ({ 14, 41}, {126, 14}, WindowWidgetType::Label, WindowColour::Primary, STR_LENGTH_OF_TIME ), // weeks label MakeSpinnerWidgets({120, 41}, {100, 14}, WindowWidgetType::Spinner, WindowColour::Primary, STR_EMPTY ), // weeks (3 widgets) MakeWidget ({ 14, 89}, {322, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_MARKETING_START_THIS_MARKETING_CAMPAIGN), // start button - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class NewCampaignWindow final : public Window -{ -private: - std::vector RideList; - std::vector ShopItems; - struct CampaignVariables + class NewCampaignWindow final : public Window { - int16_t campaign_type; - int16_t no_weeks; // 0x482 - union + private: + std::vector RideList; + std::vector ShopItems; + struct CampaignVariables { - ::RideId RideId; - ObjectEntryIndex ShopItemId; - }; - } Campaign; - - static bool RideValueCompare(const RideId& a, const RideId& b) - { - auto valueA = 0; - auto rideA = GetRide(a); - if (rideA != nullptr) - valueA = rideA->value; - - auto valueB = 0; - auto rideB = GetRide(b); - if (rideB != nullptr) - valueB = rideB->value; - - return (valueB - valueA) < 0; - } - - static int32_t RideNameCompare(const RideId& a, const RideId& b) - { - std::string rideAName = ""; - auto rideA = GetRide(a); - if (rideA != nullptr) - rideAName = rideA->GetName(); - - std::string rideBName = ""; - auto rideB = GetRide(b); - if (rideB != nullptr) - rideBName = rideB->GetName(); - - return StrLogicalCmp(rideAName.c_str(), rideBName.c_str()) < 0; - } - - /** - * - * rct2: 0x0069E320 - */ - void GetShopItems() - { - BitSet items = {}; - for (auto& curRide : GetRideManager()) - { - auto rideEntry = curRide.GetRideEntry(); - if (rideEntry != nullptr) + int16_t campaign_type; + int16_t no_weeks; // 0x482 + union { - for (const auto itemType : rideEntry->shop_item) + ::RideId RideId; + ObjectEntryIndex ShopItemId; + }; + } Campaign; + + static bool RideValueCompare(const RideId& a, const RideId& b) + { + auto valueA = 0; + auto rideA = GetRide(a); + if (rideA != nullptr) + valueA = rideA->value; + + auto valueB = 0; + auto rideB = GetRide(b); + if (rideB != nullptr) + valueB = rideB->value; + + return (valueB - valueA) < 0; + } + + static int32_t RideNameCompare(const RideId& a, const RideId& b) + { + std::string rideAName = ""; + auto rideA = GetRide(a); + if (rideA != nullptr) + rideAName = rideA->GetName(); + + std::string rideBName = ""; + auto rideB = GetRide(b); + if (rideB != nullptr) + rideBName = rideB->GetName(); + + return StrLogicalCmp(rideAName.c_str(), rideBName.c_str()) < 0; + } + + /** + * + * rct2: 0x0069E320 + */ + void GetShopItems() + { + BitSet items = {}; + for (auto& curRide : GetRideManager()) + { + auto rideEntry = curRide.GetRideEntry(); + if (rideEntry != nullptr) { - if (itemType != ShopItem::None && GetShopItemDescriptor(itemType).IsFoodOrDrink()) + for (const auto itemType : rideEntry->shop_item) { - items[EnumValue(itemType)] = true; + if (itemType != ShopItem::None && GetShopItemDescriptor(itemType).IsFoodOrDrink()) + { + items[EnumValue(itemType)] = true; + } } } } - } - ShopItems.clear(); - for (auto i = 0; i < EnumValue(ShopItem::Count); i++) - { - if (items[i]) + ShopItems.clear(); + for (auto i = 0; i < EnumValue(ShopItem::Count); i++) { - ShopItems.push_back(ShopItem(i)); - } - } - } - -public: - void RefreshRides() - { - // Get all applicable rides - RideList.clear(); - for (const auto& curRide : GetRideManager()) - { - if (curRide.status == RideStatus::Open) - { - if (!curRide.GetRideTypeDescriptor().HasFlag( - RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY | RIDE_TYPE_FLAG_SELLS_FOOD | RIDE_TYPE_FLAG_SELLS_DRINKS - | RIDE_TYPE_FLAG_IS_TOILET)) + if (items[i]) { - RideList.push_back(curRide.id); + ShopItems.push_back(ShopItem(i)); } } } - if (RideList.size() > Dropdown::ItemsMaxSize) + public: + void RefreshRides() { - std::sort(RideList.begin(), RideList.end(), RideValueCompare); - RideList.resize(Dropdown::ItemsMaxSize); + // Get all applicable rides + RideList.clear(); + for (const auto& curRide : GetRideManager()) + { + if (curRide.status == RideStatus::Open) + { + if (!curRide.GetRideTypeDescriptor().HasFlag( + RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY | RIDE_TYPE_FLAG_SELLS_FOOD | RIDE_TYPE_FLAG_SELLS_DRINKS + | RIDE_TYPE_FLAG_IS_TOILET)) + { + RideList.push_back(curRide.id); + } + } + } + + if (RideList.size() > Dropdown::ItemsMaxSize) + { + std::sort(RideList.begin(), RideList.end(), RideValueCompare); + RideList.resize(Dropdown::ItemsMaxSize); + } + + // Sort rides by name + std::sort(RideList.begin(), RideList.end(), RideNameCompare); } - // Sort rides by name - std::sort(RideList.begin(), RideList.end(), RideNameCompare); - } - - void OnOpen() override - { - widgets = window_new_campaign_widgets; - hold_down_widgets = (1uLL << WIDX_WEEKS_INCREASE_BUTTON) | (1uLL << WIDX_WEEKS_DECREASE_BUTTON); - WindowInitScrollWidgets(*this); - } - - void SetCampaign(int16_t campaignType) - { - widgets[WIDX_TITLE].text = MarketingCampaignNames[campaignType][0]; - - // Campaign type - Campaign.campaign_type = campaignType; - - // Number of weeks - Campaign.no_weeks = 2; - - // Currently selected ride - Campaign.RideId = RideId::GetNull(); - - RefreshRides(); - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - Widget* widget = &widgets[widgetIndex]; - Widget* dropdownWidget; - - switch (widgetIndex) + void OnOpen() override { - case WIDX_RIDE_DROPDOWN_BUTTON: - dropdownWidget = widget - 1; + widgets = window_new_campaign_widgets; + hold_down_widgets = (1uLL << WIDX_WEEKS_INCREASE_BUTTON) | (1uLL << WIDX_WEEKS_DECREASE_BUTTON); + WindowInitScrollWidgets(*this); + } - if (Campaign.campaign_type == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE) - { - GetShopItems(); - if (!ShopItems.empty()) + void SetCampaign(int16_t campaignType) + { + widgets[WIDX_TITLE].text = MarketingCampaignNames[campaignType][0]; + + // Campaign type + Campaign.campaign_type = campaignType; + + // Number of weeks + Campaign.no_weeks = 2; + + // Currently selected ride + Campaign.RideId = RideId::GetNull(); + + RefreshRides(); + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + Widget* widget = &widgets[widgetIndex]; + Widget* dropdownWidget; + + switch (widgetIndex) + { + case WIDX_RIDE_DROPDOWN_BUTTON: + dropdownWidget = widget - 1; + + if (Campaign.campaign_type == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE) + { + GetShopItems(); + if (!ShopItems.empty()) + { + int32_t numItems = 0; + int32_t maxSize = std::min(Dropdown::ItemsMaxSize, static_cast(ShopItems.size())); + for (int32_t i = 0; i < maxSize; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = GetShopItemDescriptor(ShopItems[i]).Naming.Plural; + numItems++; + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, + dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, numItems, + dropdownWidget->width() - 3); + } + } + else { int32_t numItems = 0; - int32_t maxSize = std::min(Dropdown::ItemsMaxSize, static_cast(ShopItems.size())); - for (int32_t i = 0; i < maxSize; i++) + for (auto rideIndex : RideList) { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = GetShopItemDescriptor(ShopItems[i]).Naming.Plural; - numItems++; + auto curRide = GetRide(rideIndex); + if (curRide != nullptr) + { + // HACK until dropdown items have longer argument buffers + gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; + Formatter ft(reinterpret_cast(&gDropdownItems[numItems].Args)); + if (curRide->custom_name.empty()) + { + curRide->FormatNameTo(ft); + } + else + { + gDropdownItems[numItems].Format = STR_OPTIONS_DROPDOWN_ITEM; + ft.Add(curRide->custom_name.c_str()); + } + numItems++; + } } WindowDropdownShowTextCustomWidth( @@ -214,207 +244,179 @@ public: dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 3); } - } - else - { - int32_t numItems = 0; - for (auto rideIndex : RideList) - { - auto curRide = GetRide(rideIndex); - if (curRide != nullptr) - { - // HACK until dropdown items have longer argument buffers - gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; - Formatter ft(reinterpret_cast(&gDropdownItems[numItems].Args)); - if (curRide->custom_name.empty()) - { - curRide->FormatNameTo(ft); - } - else - { - gDropdownItems[numItems].Format = STR_OPTIONS_DROPDOWN_ITEM; - ft.Add(curRide->custom_name.c_str()); - } - numItems++; - } - } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 3); - } - break; - // In RCT2, the maximum was 6 weeks - case WIDX_WEEKS_INCREASE_BUTTON: - Campaign.no_weeks = std::min(Campaign.no_weeks + 1, 12); - Invalidate(); - break; - case WIDX_WEEKS_DECREASE_BUTTON: - Campaign.no_weeks = std::max(Campaign.no_weeks - 1, 2); - Invalidate(); - break; - } - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_START_BUTTON: - { - auto gameAction = ParkMarketingAction( - Campaign.campaign_type, Campaign.RideId.ToUnderlying(), Campaign.no_weeks); - gameAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { - if (result->Error == GameActions::Status::Ok) - { - WindowCloseByClass(WindowClass::NewCampaign); - } - }); - GameActions::Execute(&gameAction); - break; + break; + // In RCT2, the maximum was 6 weeks + case WIDX_WEEKS_INCREASE_BUTTON: + Campaign.no_weeks = std::min(Campaign.no_weeks + 1, 12); + Invalidate(); + break; + case WIDX_WEEKS_DECREASE_BUTTON: + Campaign.no_weeks = std::max(Campaign.no_weeks - 1, 2); + Invalidate(); + break; } } - } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - if (widgetIndex != WIDX_RIDE_DROPDOWN_BUTTON) - return; - - if (dropdownIndex < 0) - return; - - if (Campaign.campaign_type == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE) + void OnMouseUp(WidgetIndex widgetIndex) override { - if (static_cast(dropdownIndex) >= ShopItems.size()) - return; - - Campaign.ShopItemId = EnumValue(ShopItems[dropdownIndex]); - } - else - { - if (static_cast(dropdownIndex) >= RideList.size()) - return; - - Campaign.RideId = RideList[dropdownIndex]; - } - - Invalidate(); - } - - void OnPrepareDraw() override - { - widgets[WIDX_RIDE_LABEL].type = WindowWidgetType::Empty; - widgets[WIDX_RIDE_DROPDOWN].type = WindowWidgetType::Empty; - widgets[WIDX_RIDE_DROPDOWN_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_RIDE_DROPDOWN].text = STR_MARKETING_NOT_SELECTED; - switch (Campaign.campaign_type) - { - case ADVERTISING_CAMPAIGN_RIDE_FREE: - case ADVERTISING_CAMPAIGN_RIDE: - widgets[WIDX_RIDE_LABEL].type = WindowWidgetType::Label; - widgets[WIDX_RIDE_DROPDOWN].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_RIDE_DROPDOWN_BUTTON].type = WindowWidgetType::Button; - widgets[WIDX_RIDE_LABEL].text = STR_MARKETING_RIDE; - if (Campaign.RideId != RideId::GetNull()) + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_START_BUTTON: { - auto curRide = GetRide(Campaign.RideId); - if (curRide != nullptr) + auto gameAction = ParkMarketingAction( + Campaign.campaign_type, Campaign.RideId.ToUnderlying(), Campaign.no_weeks); + gameAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { + if (result->Error == GameActions::Status::Ok) + { + WindowCloseByClass(WindowClass::NewCampaign); + } + }); + GameActions::Execute(&gameAction); + break; + } + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + { + if (widgetIndex != WIDX_RIDE_DROPDOWN_BUTTON) + return; + + if (dropdownIndex < 0) + return; + + if (Campaign.campaign_type == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE) + { + if (static_cast(dropdownIndex) >= ShopItems.size()) + return; + + Campaign.ShopItemId = EnumValue(ShopItems[dropdownIndex]); + } + else + { + if (static_cast(dropdownIndex) >= RideList.size()) + return; + + Campaign.RideId = RideList[dropdownIndex]; + } + + Invalidate(); + } + + void OnPrepareDraw() override + { + widgets[WIDX_RIDE_LABEL].type = WindowWidgetType::Empty; + widgets[WIDX_RIDE_DROPDOWN].type = WindowWidgetType::Empty; + widgets[WIDX_RIDE_DROPDOWN_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_RIDE_DROPDOWN].text = STR_MARKETING_NOT_SELECTED; + switch (Campaign.campaign_type) + { + case ADVERTISING_CAMPAIGN_RIDE_FREE: + case ADVERTISING_CAMPAIGN_RIDE: + widgets[WIDX_RIDE_LABEL].type = WindowWidgetType::Label; + widgets[WIDX_RIDE_DROPDOWN].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_RIDE_DROPDOWN_BUTTON].type = WindowWidgetType::Button; + widgets[WIDX_RIDE_LABEL].text = STR_MARKETING_RIDE; + if (Campaign.RideId != RideId::GetNull()) { - widgets[WIDX_RIDE_DROPDOWN].text = STR_STRINGID; + auto curRide = GetRide(Campaign.RideId); + if (curRide != nullptr) + { + widgets[WIDX_RIDE_DROPDOWN].text = STR_STRINGID; - auto ft = Formatter::Common(); - curRide->FormatNameTo(ft); + auto ft = Formatter::Common(); + curRide->FormatNameTo(ft); + } } - } - break; - case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE: - widgets[WIDX_RIDE_LABEL].type = WindowWidgetType::Label; - widgets[WIDX_RIDE_DROPDOWN].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_RIDE_DROPDOWN_BUTTON].type = WindowWidgetType::Button; - widgets[WIDX_RIDE_LABEL].text = STR_MARKETING_ITEM; - if (Campaign.ShopItemId != SELECTED_ITEM_UNDEFINED) - { - widgets[WIDX_RIDE_DROPDOWN].text = GetShopItemDescriptor(ShopItem(Campaign.ShopItemId)).Naming.Plural; - } - break; + break; + case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE: + widgets[WIDX_RIDE_LABEL].type = WindowWidgetType::Label; + widgets[WIDX_RIDE_DROPDOWN].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_RIDE_DROPDOWN_BUTTON].type = WindowWidgetType::Button; + widgets[WIDX_RIDE_LABEL].text = STR_MARKETING_ITEM; + if (Campaign.ShopItemId != SELECTED_ITEM_UNDEFINED) + { + widgets[WIDX_RIDE_DROPDOWN].text = GetShopItemDescriptor(ShopItem(Campaign.ShopItemId)).Naming.Plural; + } + break; + } + + // Set current number of weeks spinner (moved to paint due to required parameter) + widgets[WIDX_WEEKS_SPINNER].text = STR_NONE; + + // Enable / disable start button based on ride dropdown + WidgetSetDisabled(*this, WIDX_START_BUTTON, false); + if (widgets[WIDX_RIDE_DROPDOWN].type == WindowWidgetType::DropdownMenu && Campaign.RideId == RideId::GetNull()) + WidgetSetDisabled(*this, WIDX_START_BUTTON, true); } - // Set current number of weeks spinner (moved to paint due to required parameter) - widgets[WIDX_WEEKS_SPINNER].text = STR_NONE; + void OnDraw(DrawPixelInfo& dpi) override + { + ScreenCoordsXY screenCoords{}; - // Enable / disable start button based on ride dropdown - WidgetSetDisabled(*this, WIDX_START_BUTTON, false); - if (widgets[WIDX_RIDE_DROPDOWN].type == WindowWidgetType::DropdownMenu && Campaign.RideId == RideId::GetNull()) - WidgetSetDisabled(*this, WIDX_START_BUTTON, true); - } + DrawWidgets(dpi); - void OnDraw(DrawPixelInfo& dpi) override + // Number of weeks + Widget* spinnerWidget = &widgets[WIDX_WEEKS_SPINNER]; + auto ft = Formatter(); + ft.Add(Campaign.no_weeks); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ spinnerWidget->left + 1, spinnerWidget->top }, + Campaign.no_weeks == 1 ? STR_MARKETING_1_WEEK : STR_X_WEEKS, ft, { colours[0] }); + + screenCoords = windowPos + ScreenCoordsXY{ 14, 60 }; + + // Price per week + ft = Formatter(); + ft.Add(AdvertisingCampaignPricePerWeek[Campaign.campaign_type]); + DrawTextBasic(dpi, screenCoords, STR_MARKETING_COST_PER_WEEK, ft); + screenCoords.y += 13; + + // Total price + ft = Formatter(); + ft.Add(AdvertisingCampaignPricePerWeek[Campaign.campaign_type] * Campaign.no_weeks); + DrawTextBasic(dpi, screenCoords, STR_MARKETING_TOTAL_COST, ft); + } + + void OnResize() override + { + ResizeFrame(); + } + + int16_t GetCampaignType() const + { + return Campaign.campaign_type; + } + }; + + WindowBase* NewCampaignOpen(int16_t campaignType) { - ScreenCoordsXY screenCoords{}; + auto w = static_cast(WindowBringToFrontByClass(WindowClass::NewCampaign)); + if (w != nullptr) + { + if (w->GetCampaignType() == campaignType) + return w; - DrawWidgets(dpi); + WindowClose(*w); + } - // Number of weeks - Widget* spinnerWidget = &widgets[WIDX_WEEKS_SPINNER]; - auto ft = Formatter(); - ft.Add(Campaign.no_weeks); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ spinnerWidget->left + 1, spinnerWidget->top }, - Campaign.no_weeks == 1 ? STR_MARKETING_1_WEEK : STR_X_WEEKS, ft, { colours[0] }); - - screenCoords = windowPos + ScreenCoordsXY{ 14, 60 }; - - // Price per week - ft = Formatter(); - ft.Add(AdvertisingCampaignPricePerWeek[Campaign.campaign_type]); - DrawTextBasic(dpi, screenCoords, STR_MARKETING_COST_PER_WEEK, ft); - screenCoords.y += 13; - - // Total price - ft = Formatter(); - ft.Add(AdvertisingCampaignPricePerWeek[Campaign.campaign_type] * Campaign.no_weeks); - DrawTextBasic(dpi, screenCoords, STR_MARKETING_TOTAL_COST, ft); + w = WindowCreate(WindowClass::NewCampaign, WW, WH, 0); + if (w != nullptr) + { + w->SetCampaign(campaignType); + } + return w; } - void OnResize() override + void WindowCampaignRefreshRides() { - ResizeFrame(); + auto w = static_cast(WindowFindByClass(WindowClass::NewCampaign)); + if (w != nullptr) + { + w->RefreshRides(); + } } - - int16_t GetCampaignType() const - { - return Campaign.campaign_type; - } -}; - -WindowBase* WindowNewCampaignOpen(int16_t campaignType) -{ - auto w = static_cast(WindowBringToFrontByClass(WindowClass::NewCampaign)); - if (w != nullptr) - { - if (w->GetCampaignType() == campaignType) - return w; - - WindowClose(*w); - } - - w = WindowCreate(WindowClass::NewCampaign, WW, WH, 0); - if (w != nullptr) - { - w->SetCampaign(campaignType); - } - return w; -} - -void WindowCampaignRefreshRides() -{ - auto w = static_cast(WindowFindByClass(WindowClass::NewCampaign)); - if (w != nullptr) - { - w->RefreshRides(); - } -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index b72282669d..2f43010cff 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -39,172 +39,173 @@ #include #include -using namespace OpenRCT2; using namespace OpenRCT2::TrackMetaData; - -static constexpr StringId WindowTitle = STR_NONE; -static constexpr int32_t WindowHeight = 382; -static constexpr int32_t WindowWidth = 601; -static constexpr int32_t RideListItemsMax = 384; -static constexpr int32_t RideTabCount = 6; -static constexpr int32_t GroupByTrackTypeWidth = 172; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WindowTitle = STR_NONE; + static constexpr int32_t WindowHeight = 382; + static constexpr int32_t WindowWidth = 601; + static constexpr int32_t RideListItemsMax = 384; + static constexpr int32_t RideTabCount = 6; + static constexpr int32_t GroupByTrackTypeWidth = 172; #pragma region Ride type view order -/** - * The order of ride types shown in the new ride window so that the order stays consistent across games and rides of the same - * type are kept together. - */ -static constexpr ride_type_t RideTypeViewOrder[] = { - // Transport rides - RIDE_TYPE_MINIATURE_RAILWAY, - RIDE_TYPE_MONORAIL, - RIDE_TYPE_SUSPENDED_MONORAIL, - RIDE_TYPE_CHAIRLIFT, - RIDE_TYPE_LIFT, + /** + * The order of ride types shown in the new ride window so that the order stays consistent across games and rides of the + * same type are kept together. + */ + static constexpr ride_type_t RideTypeViewOrder[] = { + // Transport rides + RIDE_TYPE_MINIATURE_RAILWAY, + RIDE_TYPE_MONORAIL, + RIDE_TYPE_SUSPENDED_MONORAIL, + RIDE_TYPE_CHAIRLIFT, + RIDE_TYPE_LIFT, - // Roller Coasters - RIDE_TYPE_SIDE_FRICTION_ROLLER_COASTER, - RIDE_TYPE_VIRGINIA_REEL, - RIDE_TYPE_REVERSER_ROLLER_COASTER, - RIDE_TYPE_CLASSIC_WOODEN_ROLLER_COASTER, - RIDE_TYPE_WOODEN_ROLLER_COASTER, - RIDE_TYPE_WOODEN_WILD_MOUSE, - RIDE_TYPE_STEEL_WILD_MOUSE, - RIDE_TYPE_SPINNING_WILD_MOUSE, - RIDE_TYPE_INVERTED_HAIRPIN_COASTER, - RIDE_TYPE_JUNIOR_ROLLER_COASTER, - RIDE_TYPE_CLASSIC_MINI_ROLLER_COASTER, - RIDE_TYPE_MINI_ROLLER_COASTER, - RIDE_TYPE_SPIRAL_ROLLER_COASTER, - RIDE_TYPE_MINE_TRAIN_COASTER, - RIDE_TYPE_LOOPING_ROLLER_COASTER, - RIDE_TYPE_STAND_UP_ROLLER_COASTER, - RIDE_TYPE_CORKSCREW_ROLLER_COASTER, - RIDE_TYPE_HYPERCOASTER, - RIDE_TYPE_LIM_LAUNCHED_ROLLER_COASTER, - RIDE_TYPE_TWISTER_ROLLER_COASTER, - RIDE_TYPE_HYPER_TWISTER, - RIDE_TYPE_GIGA_COASTER, - RIDE_TYPE_SUSPENDED_SWINGING_COASTER, - RIDE_TYPE_COMPACT_INVERTED_COASTER, - RIDE_TYPE_INVERTED_ROLLER_COASTER, - RIDE_TYPE_INVERTED_IMPULSE_COASTER, - RIDE_TYPE_MINI_SUSPENDED_COASTER, - RIDE_TYPE_STEEPLECHASE, - RIDE_TYPE_BOBSLEIGH_COASTER, - RIDE_TYPE_MINE_RIDE, - RIDE_TYPE_HEARTLINE_TWISTER_COASTER, - RIDE_TYPE_LAY_DOWN_ROLLER_COASTER, - RIDE_TYPE_FLYING_ROLLER_COASTER, - RIDE_TYPE_MULTI_DIMENSION_ROLLER_COASTER, - RIDE_TYPE_REVERSE_FREEFALL_COASTER, - RIDE_TYPE_VERTICAL_DROP_ROLLER_COASTER, - RIDE_TYPE_AIR_POWERED_VERTICAL_COASTER, - RIDE_TYPE_HYBRID_COASTER, - RIDE_TYPE_SINGLE_RAIL_ROLLER_COASTER, - RIDE_TYPE_ALPINE_COASTER, + // Roller Coasters + RIDE_TYPE_SIDE_FRICTION_ROLLER_COASTER, + RIDE_TYPE_VIRGINIA_REEL, + RIDE_TYPE_REVERSER_ROLLER_COASTER, + RIDE_TYPE_CLASSIC_WOODEN_ROLLER_COASTER, + RIDE_TYPE_WOODEN_ROLLER_COASTER, + RIDE_TYPE_WOODEN_WILD_MOUSE, + RIDE_TYPE_STEEL_WILD_MOUSE, + RIDE_TYPE_SPINNING_WILD_MOUSE, + RIDE_TYPE_INVERTED_HAIRPIN_COASTER, + RIDE_TYPE_JUNIOR_ROLLER_COASTER, + RIDE_TYPE_CLASSIC_MINI_ROLLER_COASTER, + RIDE_TYPE_MINI_ROLLER_COASTER, + RIDE_TYPE_SPIRAL_ROLLER_COASTER, + RIDE_TYPE_MINE_TRAIN_COASTER, + RIDE_TYPE_LOOPING_ROLLER_COASTER, + RIDE_TYPE_STAND_UP_ROLLER_COASTER, + RIDE_TYPE_CLASSIC_STAND_UP_ROLLER_COASTER, + RIDE_TYPE_CORKSCREW_ROLLER_COASTER, + RIDE_TYPE_HYPERCOASTER, + RIDE_TYPE_LIM_LAUNCHED_ROLLER_COASTER, + RIDE_TYPE_TWISTER_ROLLER_COASTER, + RIDE_TYPE_HYPER_TWISTER, + RIDE_TYPE_GIGA_COASTER, + RIDE_TYPE_SUSPENDED_SWINGING_COASTER, + RIDE_TYPE_COMPACT_INVERTED_COASTER, + RIDE_TYPE_INVERTED_ROLLER_COASTER, + RIDE_TYPE_INVERTED_IMPULSE_COASTER, + RIDE_TYPE_MINI_SUSPENDED_COASTER, + RIDE_TYPE_STEEPLECHASE, + RIDE_TYPE_BOBSLEIGH_COASTER, + RIDE_TYPE_MINE_RIDE, + RIDE_TYPE_HEARTLINE_TWISTER_COASTER, + RIDE_TYPE_LAY_DOWN_ROLLER_COASTER, + RIDE_TYPE_FLYING_ROLLER_COASTER, + RIDE_TYPE_MULTI_DIMENSION_ROLLER_COASTER, + RIDE_TYPE_REVERSE_FREEFALL_COASTER, + RIDE_TYPE_VERTICAL_DROP_ROLLER_COASTER, + RIDE_TYPE_AIR_POWERED_VERTICAL_COASTER, + RIDE_TYPE_HYBRID_COASTER, + RIDE_TYPE_SINGLE_RAIL_ROLLER_COASTER, + RIDE_TYPE_ALPINE_COASTER, - // Gentle rides - RIDE_TYPE_MONORAIL_CYCLES, - RIDE_TYPE_CROOKED_HOUSE, - RIDE_TYPE_HAUNTED_HOUSE, - RIDE_TYPE_FERRIS_WHEEL, - RIDE_TYPE_MAZE, - RIDE_TYPE_MERRY_GO_ROUND, - RIDE_TYPE_MINI_GOLF, - RIDE_TYPE_OBSERVATION_TOWER, - RIDE_TYPE_CAR_RIDE, - RIDE_TYPE_MONSTER_TRUCKS, - RIDE_TYPE_MINI_HELICOPTERS, - RIDE_TYPE_SPIRAL_SLIDE, - RIDE_TYPE_DODGEMS, - RIDE_TYPE_SPACE_RINGS, - RIDE_TYPE_CIRCUS, - RIDE_TYPE_GHOST_TRAIN, - RIDE_TYPE_FLYING_SAUCERS, + // Gentle rides + RIDE_TYPE_MONORAIL_CYCLES, + RIDE_TYPE_CROOKED_HOUSE, + RIDE_TYPE_HAUNTED_HOUSE, + RIDE_TYPE_FERRIS_WHEEL, + RIDE_TYPE_MAZE, + RIDE_TYPE_MERRY_GO_ROUND, + RIDE_TYPE_MINI_GOLF, + RIDE_TYPE_OBSERVATION_TOWER, + RIDE_TYPE_CAR_RIDE, + RIDE_TYPE_MONSTER_TRUCKS, + RIDE_TYPE_MINI_HELICOPTERS, + RIDE_TYPE_SPIRAL_SLIDE, + RIDE_TYPE_DODGEMS, + RIDE_TYPE_SPACE_RINGS, + RIDE_TYPE_CIRCUS, + RIDE_TYPE_GHOST_TRAIN, + RIDE_TYPE_FLYING_SAUCERS, - // Thrill rides - RIDE_TYPE_TWIST, - RIDE_TYPE_MAGIC_CARPET, - RIDE_TYPE_LAUNCHED_FREEFALL, - RIDE_TYPE_SWINGING_SHIP, - RIDE_TYPE_GO_KARTS, - RIDE_TYPE_SWINGING_INVERTER_SHIP, - RIDE_TYPE_MOTION_SIMULATOR, - RIDE_TYPE_3D_CINEMA, - RIDE_TYPE_TOP_SPIN, - RIDE_TYPE_ROTO_DROP, - RIDE_TYPE_ENTERPRISE, + // Thrill rides + RIDE_TYPE_TWIST, + RIDE_TYPE_MAGIC_CARPET, + RIDE_TYPE_LAUNCHED_FREEFALL, + RIDE_TYPE_SWINGING_SHIP, + RIDE_TYPE_GO_KARTS, + RIDE_TYPE_SWINGING_INVERTER_SHIP, + RIDE_TYPE_MOTION_SIMULATOR, + RIDE_TYPE_3D_CINEMA, + RIDE_TYPE_TOP_SPIN, + RIDE_TYPE_ROTO_DROP, + RIDE_TYPE_ENTERPRISE, - // Water rides - RIDE_TYPE_DINGHY_SLIDE, - RIDE_TYPE_LOG_FLUME, - RIDE_TYPE_RIVER_RAPIDS, - RIDE_TYPE_SPLASH_BOATS, - RIDE_TYPE_SUBMARINE_RIDE, - RIDE_TYPE_BOAT_HIRE, - RIDE_TYPE_RIVER_RAFTS, - RIDE_TYPE_WATER_COASTER, + // Water rides + RIDE_TYPE_DINGHY_SLIDE, + RIDE_TYPE_LOG_FLUME, + RIDE_TYPE_RIVER_RAPIDS, + RIDE_TYPE_SPLASH_BOATS, + RIDE_TYPE_SUBMARINE_RIDE, + RIDE_TYPE_BOAT_HIRE, + RIDE_TYPE_RIVER_RAFTS, + RIDE_TYPE_WATER_COASTER, - // Shops / stalls - RIDE_TYPE_FOOD_STALL, - RIDE_TYPE_1D, - RIDE_TYPE_DRINK_STALL, - RIDE_TYPE_1F, - RIDE_TYPE_SHOP, - RIDE_TYPE_22, - RIDE_TYPE_INFORMATION_KIOSK, - RIDE_TYPE_FIRST_AID, - RIDE_TYPE_CASH_MACHINE, - RIDE_TYPE_TOILETS, -}; + // Shops / stalls + RIDE_TYPE_FOOD_STALL, + RIDE_TYPE_1D, + RIDE_TYPE_DRINK_STALL, + RIDE_TYPE_1F, + RIDE_TYPE_SHOP, + RIDE_TYPE_22, + RIDE_TYPE_INFORMATION_KIOSK, + RIDE_TYPE_FIRST_AID, + RIDE_TYPE_CASH_MACHINE, + RIDE_TYPE_TOILETS, + }; #pragma endregion -enum NewRideTabId -{ - TRANSPORT_TAB, - GENTLE_TAB, - ROLLER_COASTER_TAB, - THRILL_TAB, - WATER_TAB, - SHOP_TAB, - RESEARCH_TAB, - TAB_COUNT, -}; + enum NewRideTabId + { + TRANSPORT_TAB, + GENTLE_TAB, + ROLLER_COASTER_TAB, + THRILL_TAB, + WATER_TAB, + SHOP_TAB, + RESEARCH_TAB, + TAB_COUNT, + }; #pragma region Widgets -enum -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_PAGE_BACKGROUND, - WIDX_TAB_1, - WIDX_TAB_2, - WIDX_TAB_3, - WIDX_TAB_4, - WIDX_TAB_5, - WIDX_TAB_6, - WIDX_TAB_7, - WIDX_RIDE_LIST, + enum + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_PAGE_BACKGROUND, + WIDX_TAB_1, + WIDX_TAB_2, + WIDX_TAB_3, + WIDX_TAB_4, + WIDX_TAB_5, + WIDX_TAB_6, + WIDX_TAB_7, + WIDX_RIDE_LIST, - WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP, - WIDX_LAST_DEVELOPMENT_GROUP, - WIDX_LAST_DEVELOPMENT_BUTTON, - WIDX_RESEARCH_FUNDING_BUTTON, + WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP, + WIDX_LAST_DEVELOPMENT_GROUP, + WIDX_LAST_DEVELOPMENT_BUTTON, + WIDX_RESEARCH_FUNDING_BUTTON, - WIDX_FILTER_TEXT_BOX, - WIDX_FILTER_CLEAR_BUTTON, - WIDX_GROUP_BY_TRACK_TYPE, -}; + WIDX_FILTER_TEXT_BOX, + WIDX_FILTER_CLEAR_BUTTON, + WIDX_GROUP_BY_TRACK_TYPE, + }; -static constexpr ScreenCoordsXY GroupByTrackTypeOrigin{ WindowWidth - 8 - GroupByTrackTypeWidth, 47 }; -static constexpr ScreenSize GroupTrackTypeSize{ GroupByTrackTypeWidth, 14 }; + static constexpr ScreenCoordsXY GroupByTrackTypeOrigin{ WindowWidth - 8 - GroupByTrackTypeWidth, 47 }; + static constexpr ScreenSize GroupTrackTypeSize{ GroupByTrackTypeWidth, 14 }; -// clang-format off + // clang-format off static Widget window_new_ride_widgets[] = { WINDOW_SHIM(WindowTitle, WindowWidth, WindowHeight), MakeWidget({ 0, 43}, {601, 339}, WindowWidgetType::Resize, WindowColour::Secondary ), @@ -223,865 +224,865 @@ static Widget window_new_ride_widgets[] = { MakeWidget({ 4, 46}, {211, 14}, WindowWidgetType::TextBox, WindowColour::Secondary ), MakeWidget({218, 46}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_OBJECT_SEARCH_CLEAR ), MakeWidget(GroupByTrackTypeOrigin, GroupTrackTypeSize, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_GROUP_BY_TRACK_TYPE, STR_GROUP_BY_TRACK_TYPE_TIP ), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on #pragma endregion -static constexpr StringId RideTitles[] = { - STR_NEW_TRANSPORT_RIDES, // TRANSPORT_TAB - STR_NEW_GENTLE_RIDES, // GENTLE_TAB - STR_NEW_ROLLER_COASTERS, // ROLLER_COASTER_TAB - STR_NEW_THRILL_RIDES, // THRILL_TAB - STR_NEW_WATER_RIDES, // WATER_TAB - STR_NEW_SHOPS_STALLS, // SHOP_TAB - STR_RESEARCH_AND_DEVELOPMENT, // RESEARCH_TAB -}; -static_assert(std::size(RideTitles) == TAB_COUNT); + static constexpr StringId RideTitles[] = { + STR_NEW_TRANSPORT_RIDES, // TRANSPORT_TAB + STR_NEW_GENTLE_RIDES, // GENTLE_TAB + STR_NEW_ROLLER_COASTERS, // ROLLER_COASTER_TAB + STR_NEW_THRILL_RIDES, // THRILL_TAB + STR_NEW_WATER_RIDES, // WATER_TAB + STR_NEW_SHOPS_STALLS, // SHOP_TAB + STR_RESEARCH_AND_DEVELOPMENT, // RESEARCH_TAB + }; + static_assert(std::size(RideTitles) == TAB_COUNT); -static constexpr int32_t TabAnimationLoops[] = { - 20, // TRANSPORT_TAB - 32, // GENTLE_TAB - 10, // ROLLER_COASTER_TAB - 72, // THRILL_TAB - 24, // WATER_TAB - 28, // SHOP_TAB - 16, // RESEARCH_TAB -}; -static_assert(std::size(TabAnimationLoops) == TAB_COUNT); + static constexpr int32_t TabAnimationLoops[] = { + 20, // TRANSPORT_TAB + 32, // GENTLE_TAB + 10, // ROLLER_COASTER_TAB + 72, // THRILL_TAB + 24, // WATER_TAB + 28, // SHOP_TAB + 16, // RESEARCH_TAB + }; + static_assert(std::size(TabAnimationLoops) == TAB_COUNT); -static constexpr int32_t TabAnimationDivisor[] = { - 4, // TRANSPORT_TAB - 8, // GENTLE_TAB - 2, // ROLLER_COASTER_TAB - 4, // THRILL_TAB - 4, // WATER_TAB - 4, // SHOP_TAB - 2, // RESEARCH_TAB -}; -static_assert(std::size(TabAnimationDivisor) == TAB_COUNT); + static constexpr int32_t TabAnimationDivisor[] = { + 4, // TRANSPORT_TAB + 8, // GENTLE_TAB + 2, // ROLLER_COASTER_TAB + 4, // THRILL_TAB + 4, // WATER_TAB + 4, // SHOP_TAB + 2, // RESEARCH_TAB + }; + static_assert(std::size(TabAnimationDivisor) == TAB_COUNT); -static constexpr int32_t ThrillRidesTabAnimationSequence[] = { - 5, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, -}; + static constexpr int32_t ThrillRidesTabAnimationSequence[] = { + 5, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, + }; -class NewRideWindow final : public Window -{ -private: - static NewRideTabId _currentTab; - static uint_fast16_t _windowNewRideTabScroll[RideTabCount]; - u8string _filter; - u8string _vehicleAvailability{}; - RideSelection _lastTrackDesignCountRideType{}; - int32_t _lastTrackDesignCount{}; - RideSelection _windowNewRideListItems[RideListItemsMax]{}; - struct NewRideVariables + class NewRideWindow final : public Window { - RideSelection SelectedRide; - RideSelection HighlightedRide; - uint16_t SelectedRideCountdown; - } _newRideVars{}; - -public: - static void SetOpeningPage(NewRideTabId tab) - { - _currentTab = tab; - } - - static void ResetTabScrolls() - { - std::fill_n(NewRideWindow::_windowNewRideTabScroll, RideTabCount, 0); - } - - void OnOpen() override - { - widgets = window_new_ride_widgets; - PopulateRideList(); - InitScrollWidgets(); - _filter.clear(); - - frame_no = 0; - _newRideVars.SelectedRide = { RIDE_TYPE_NULL, OBJECT_ENTRY_INDEX_NULL }; - _lastTrackDesignCountRideType.Type = RIDE_TYPE_NULL; - _lastTrackDesignCountRideType.EntryIndex = OBJECT_ENTRY_INDEX_NULL; - - width = 1; - RefreshWidgetSizing(); - - if (_currentTab < RESEARCH_TAB) + private: + static NewRideTabId _currentTab; + static uint_fast16_t _windowNewRideTabScroll[RideTabCount]; + u8string _filter; + u8string _vehicleAvailability{}; + RideSelection _lastTrackDesignCountRideType{}; + int32_t _lastTrackDesignCount{}; + RideSelection _windowNewRideListItems[RideListItemsMax]{}; + struct NewRideVariables { - SetPage(_currentTab); - RestoreScrollPositionForCurrentTab(); + RideSelection SelectedRide; + RideSelection HighlightedRide; + uint16_t SelectedRideCountdown; + } _newRideVars{}; + + public: + static void SetOpeningPage(NewRideTabId tab) + { + _currentTab = tab; } - } + + static void ResetTabScrolls() + { + std::fill_n(NewRideWindow::_windowNewRideTabScroll, RideTabCount, 0); + } + + void OnOpen() override + { + widgets = window_new_ride_widgets; + PopulateRideList(); + InitScrollWidgets(); + _filter.clear(); - void OnUpdate() override - { - frame_no++; - if (frame_no >= TabAnimationLoops[_currentTab]) frame_no = 0; + _newRideVars.SelectedRide = { RIDE_TYPE_NULL, OBJECT_ENTRY_INDEX_NULL }; + _lastTrackDesignCountRideType.Type = RIDE_TYPE_NULL; + _lastTrackDesignCountRideType.EntryIndex = OBJECT_ENTRY_INDEX_NULL; - WidgetInvalidate(*this, WIDX_TAB_1 + static_cast(_currentTab)); + width = 1; + RefreshWidgetSizing(); - if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) - { - WindowUpdateTextboxCaret(); - WidgetInvalidate(*this, WIDX_FILTER_TEXT_BOX); - } - - if (_newRideVars.SelectedRide.Type != RIDE_TYPE_NULL && _newRideVars.SelectedRideCountdown-- == 0) - { - RideSelect(); - } - - PopulateRideList(); - - if (_currentTab < RESEARCH_TAB) - { - _windowNewRideTabScroll[_currentTab] = scrolls[0].v_top; - - // Remove highlight when mouse leaves rides list - if (!WidgetIsHighlighted(*this, WIDX_RIDE_LIST)) + if (_currentTab < RESEARCH_TAB) { - _newRideVars.HighlightedRide = { RIDE_TYPE_NULL, OBJECT_ENTRY_INDEX_NULL }; - WidgetInvalidate(*this, WIDX_RIDE_LIST); - } - } - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_LAST_DEVELOPMENT_BUTTON: - WindowResearchDevelopmentMouseUp(widgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); - break; - case WIDX_RESEARCH_FUNDING_BUTTON: - ContextOpenWindowView(WV_FINANCES_RESEARCH); - break; - case WIDX_GROUP_BY_TRACK_TYPE: - gConfigInterface.ListRideVehiclesSeparately = !gConfigInterface.ListRideVehiclesSeparately; - ConfigSaveDefault(); SetPage(_currentTab); - break; - case WIDX_FILTER_TEXT_BOX: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _filter.data(), TEXT_INPUT_SIZE); - break; - case WIDX_FILTER_CLEAR_BUTTON: - _filter.clear(); - scrolls->v_top = 0; - Invalidate(); - break; - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - if (widgetIndex >= WIDX_TAB_1 && widgetIndex <= WIDX_TAB_7) - { - SetPage(widgetIndex - WIDX_TAB_1); - } - } - - void OnPrepareDraw() override - { - SetPressedTab(); - - if (!gConfigInterface.ListRideVehiclesSeparately) - pressed_widgets |= (1LL << WIDX_GROUP_BY_TRACK_TYPE); - else - pressed_widgets &= ~(1LL << WIDX_GROUP_BY_TRACK_TYPE); - - widgets[WIDX_TITLE].text = RideTitles[_currentTab]; - widgets[WIDX_TAB_7].type = WindowWidgetType::Tab; - widgets[WIDX_FILTER_TEXT_BOX].string = _filter.data(); - - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) - widgets[WIDX_TAB_7].type = WindowWidgetType::Empty; - - if (_currentTab == RESEARCH_TAB) - { - WindowResearchDevelopmentPrepareDraw(this, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); - } - - const auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); - auto string = ls.GetString(STR_GROUP_BY_TRACK_TYPE); - auto strWidth = GfxGetStringWidth(string, FontStyle::Medium); - auto localizedGroupByTrackTypeWidth = strWidth + 14; - widgets[WIDX_GROUP_BY_TRACK_TYPE].left = width - 8 - localizedGroupByTrackTypeWidth; - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - if (_currentTab != RESEARCH_TAB) - { - RideSelection item = _newRideVars.HighlightedRide; - if (item.Type != RIDE_TYPE_NULL || item.EntryIndex != OBJECT_ENTRY_INDEX_NULL) - DrawRideInformation(dpi, item, windowPos + ScreenCoordsXY{ 3, height - 64 }, width - 6); - } - else - { - WindowResearchDevelopmentDraw(this, dpi, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); - } - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - RideSelection* listItem = _windowNewRideListItems; - - int32_t count = 0; - while (listItem->Type != RIDE_TYPE_NULL || listItem->EntryIndex != OBJECT_ENTRY_INDEX_NULL) - { - count++; - listItem++; - } - return { widgets[WIDX_RIDE_LIST].width(), ((count + 4) / 5) * 116 }; - } - - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - RideSelection item = ScrollGetRideListItemAt(screenCoords); - if (_newRideVars.HighlightedRide == item) - { - return; - } - - _newRideVars.HighlightedRide = item; - Invalidate(); - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - RideSelection item = ScrollGetRideListItemAt(screenCoords); - if (item.Type == RIDE_TYPE_NULL && item.EntryIndex == OBJECT_ENTRY_INDEX_NULL) - { - return; - } - - _newRideVars.SelectedRide = item; - - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); - _newRideVars.SelectedRideCountdown = 8; - Invalidate(); - } - - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - if (_currentTab == RESEARCH_TAB) - { - return; - } - - GfxClear(&dpi, ColourMapA[colours[1]].mid_light); - - ScreenCoordsXY coords{ 1, 1 }; - RideSelection* listItem = _windowNewRideListItems; - while (listItem->Type != RIDE_TYPE_NULL || listItem->EntryIndex != OBJECT_ENTRY_INDEX_NULL) - { - // Draw flat button rectangle - int32_t buttonFlags = 0; - if (_newRideVars.SelectedRide == *listItem) - buttonFlags |= INSET_RECT_FLAG_BORDER_INSET; - if (_newRideVars.HighlightedRide == *listItem || buttonFlags != 0) - GfxFillRectInset( - dpi, { coords, coords + ScreenCoordsXY{ 115, 115 } }, colours[1], - INSET_RECT_FLAG_FILL_MID_LIGHT | buttonFlags); - - // Draw ride image with feathered border - auto mask = ImageId(SPR_NEW_RIDE_MASK); - auto rideImage = ImageId(GetRideImage(*listItem)); - GfxDrawSpriteRawMasked(&dpi, coords + ScreenCoordsXY{ 2, 2 }, mask, rideImage); - - // Next position - coords.x += 116; - if (coords.x >= 116 * 5 + 1) - { - coords.x = 1; - coords.y += 116; - } - - // Next item - listItem++; - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (widgetIndex != WIDX_FILTER_TEXT_BOX) - return; - - if (text == _filter) - return; - - _filter.assign(text); - - scrolls->v_top = 0; - Invalidate(); - } - - void SetPage(int tab) - { - if (tab >= TRANSPORT_TAB && tab < TAB_COUNT) - { - SetPage(static_cast(tab)); - } - } - - void SetPage(NewRideTabId tab) - { - _currentTab = tab; - frame_no = 0; - _newRideVars.HighlightedRide = { RIDE_TYPE_NULL, OBJECT_ENTRY_INDEX_NULL }; - _newRideVars.SelectedRideCountdown = std::numeric_limits::max(); - PopulateRideList(); - RefreshWidgetSizing(); - Invalidate(); - - if (tab < RESEARCH_TAB) - { - RestoreScrollPositionForCurrentTab(); - } - } - -private: - void RideSelect() - { - RideSelection item = _newRideVars.SelectedRide; - if (item.Type == RIDE_TYPE_NULL) - { - return; - } - - Close(); - WindowCloseConstructionWindows(); - - auto count = GetNumTrackDesigns(item); - if (count > 0) - { - auto intent = Intent(WindowClass::TrackDesignList); - intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, item.Type); - intent.PutExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, item.EntryIndex); - ContextOpenIntent(&intent); - return; - } - - RideConstructNew(item); - } - - int32_t GetNumTrackDesigns(RideSelection item) - { - // Cache the result - if (item.Type == _lastTrackDesignCountRideType.Type && item.EntryIndex == _lastTrackDesignCountRideType.EntryIndex) - { - return _lastTrackDesignCount; - } - - std::string entryName; - - if (item.Type < 0x80) - { - if (GetRideTypeDescriptor(item.Type).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) - { - entryName = GetRideEntryName(item.EntryIndex); + RestoreScrollPositionForCurrentTab(); } } - auto repo = OpenRCT2::GetContext()->GetTrackDesignRepository(); - _lastTrackDesignCount = static_cast(repo->GetCountForObjectEntry(item.Type, entryName)); - _lastTrackDesignCountRideType = item; - return _lastTrackDesignCount; - } - - void UpdateVehicleAvailability(ObjectEntryIndex rideType) - { - _vehicleAvailability.clear(); - if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) + void OnUpdate() override { - return; - } + frame_no++; + if (frame_no >= TabAnimationLoops[_currentTab]) + frame_no = 0; - auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); - auto& rideEntries = objManager.GetAllRideEntries(rideType); - auto isFirst = true; - for (auto rideEntryIndex : rideEntries) - { - auto currentRideEntry = GetRideEntryByIndex(rideEntryIndex); + WidgetInvalidate(*this, WIDX_TAB_1 + static_cast(_currentTab)); - // Skip if vehicle type is not invented yet - if (!RideEntryIsInvented(rideEntryIndex) && !gCheatsIgnoreResearchStatus) + if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) { - continue; + WindowUpdateTextboxCaret(); + WidgetInvalidate(*this, WIDX_FILTER_TEXT_BOX); } - // Append comma if not the first iteration - if (!isFirst) + if (_newRideVars.SelectedRide.Type != RIDE_TYPE_NULL && _newRideVars.SelectedRideCountdown-- == 0) { - _vehicleAvailability += u8", "; + RideSelect(); } - // Append vehicle name - auto vehicleName = LanguageGetString(currentRideEntry->naming.Name); - _vehicleAvailability += vehicleName; + PopulateRideList(); - isFirst = false; - } - } - - ImageIndex GetRideImage(RideSelection rideSelection) - { - auto& objMgr = OpenRCT2::GetContext()->GetObjectManager(); - auto obj = static_cast(objMgr.GetLoadedObject(ObjectType::Ride, rideSelection.EntryIndex)); - return obj == nullptr ? ImageIndexUndefined : obj->GetPreviewImage(rideSelection.Type); - } - - void PopulateRideList() - { - uint8_t currentCategory = _currentTab; - RideSelection* nextListItem = _windowNewRideListItems; - RideSelection* listEnd = _windowNewRideListItems + RideListItemsMax; - - // For each ride type in the view order list - for (int32_t i = 0; i < static_cast(std::size(RideTypeViewOrder)); i++) - { - auto rideType = RideTypeViewOrder[i]; - if (rideType == RIDE_TYPE_NULL) - continue; - - if (GetRideTypeDescriptor(rideType).Category != currentCategory) - continue; - - nextListItem = IterateOverRideType(rideType, nextListItem, listEnd); - } - - nextListItem->Type = RIDE_TYPE_NULL; - nextListItem->EntryIndex = OBJECT_ENTRY_INDEX_NULL; - } - - RideSelection* IterateOverRideType(ride_type_t rideType, RideSelection* nextListItem, RideSelection* listEnd) - { - bool buttonForRideTypeCreated = false; - bool allowDrawingOverLastButton = false; - - uint8_t highestVehiclePriority = 0; - - // For each ride entry for this ride type - auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); - auto& rideEntries = objManager.GetAllRideEntries(rideType); - for (auto rideEntryIndex : rideEntries) - { - // Skip if vehicle type is not invented yet - if (!RideEntryIsInvented(rideEntryIndex) && !gCheatsIgnoreResearchStatus) - continue; - - // Ride entries - const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex); - - // Skip if the vehicle isn't the preferred vehicle for this generic track type - if (!gConfigInterface.ListRideVehiclesSeparately - && !GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY) - && highestVehiclePriority > rideEntry->BuildMenuPriority) + if (_currentTab < RESEARCH_TAB) { - continue; - } + _windowNewRideTabScroll[_currentTab] = scrolls[0].v_top; - if (!IsFiltered(*rideEntry)) - { - continue; - } - - highestVehiclePriority = rideEntry->BuildMenuPriority; - - // Determines how and where to draw a button for this ride type/vehicle. - if (gConfigInterface.ListRideVehiclesSeparately - || GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) - { - // Separate, draw apart - allowDrawingOverLastButton = false; - - if (nextListItem >= listEnd) - continue; - - nextListItem->Type = rideType; - nextListItem->EntryIndex = rideEntryIndex; - nextListItem++; - } - else if (!buttonForRideTypeCreated) - { - // Non-separate, draw-apart - buttonForRideTypeCreated = true; - allowDrawingOverLastButton = true; - - if (nextListItem >= listEnd) - continue; - - nextListItem->Type = rideType; - nextListItem->EntryIndex = rideEntryIndex; - nextListItem++; - } - else if (allowDrawingOverLastButton) - { - // Non-separate, draw over previous - if (rideType == rideEntry->ride_type[0]) + // Remove highlight when mouse leaves rides list + if (!WidgetIsHighlighted(*this, WIDX_RIDE_LIST)) { - nextListItem--; - nextListItem->Type = rideType; - nextListItem->EntryIndex = rideEntryIndex; - nextListItem++; + _newRideVars.HighlightedRide = { RIDE_TYPE_NULL, OBJECT_ENTRY_INDEX_NULL }; + WidgetInvalidate(*this, WIDX_RIDE_LIST); } } } - return nextListItem; - } - - bool IsFiltered(const RideObjectEntry& rideEntry) - { - if (_filter.empty()) - return true; - - return IsFilterInRideType(rideEntry) || IsFilterInRideName(rideEntry) || IsFilterInIdentifier(rideEntry) - || IsFilterInAuthors(rideEntry) || IsFilterInFilename(rideEntry); - } - - bool IsFilterInRideType(const RideObjectEntry& rideEntry) - { - auto rideTypeName = GetRideNaming(rideEntry.ride_type[0], rideEntry).Name; - return String::Contains(u8string_view(LanguageGetString(rideTypeName)), _filter, true); - } - - bool IsFilterInRideName(const RideObjectEntry& rideEntry) - { - auto rideName = rideEntry.naming.Name; - return String::Contains(u8string_view(LanguageGetString(rideName)), _filter, true); - } - - bool IsFilterInAuthors(const RideObjectEntry& rideEntry) - { - auto rideObject = static_cast(rideEntry.obj); - auto authors = rideObject->GetAuthors(); - - for (auto author : authors) - if (String::Contains(author, _filter, true)) - return true; - - return false; - } - - bool IsFilterInIdentifier(const RideObjectEntry& rideEntry) - { - auto rideObject = static_cast(rideEntry.obj); - auto objectName = rideObject->GetObjectEntry().GetName(); - - return String::Contains(objectName, _filter, true); - } - - bool IsFilterInFilename(const RideObjectEntry& rideEntry) - { - auto rideObject = static_cast(rideEntry.obj); - auto repoItem = ObjectRepositoryFindObjectByEntry(&(rideObject->GetObjectEntry())); - - return String::Contains(repoItem->Path, _filter, true); - } - - void SetPressedTab() - { - int32_t i{}; - for (i = 0; i < TAB_COUNT; i++) + void OnMouseUp(WidgetIndex widgetIndex) override { - pressed_widgets &= ~(1 << (WIDX_TAB_1 + i)); - } - pressed_widgets |= 1LL << (WIDX_TAB_1 + static_cast(_currentTab)); - } - - void RefreshWidgetSizing() - { - int32_t newWidth{}, newHeight{}; - - if (_currentTab < SHOP_TAB) - { - disabled_widgets &= ~(1 << WIDX_GROUP_BY_TRACK_TYPE); - } - else - { - disabled_widgets |= 1LL << WIDX_GROUP_BY_TRACK_TYPE; - } - - // Show or hide unrelated widgets - - if (_currentTab < RESEARCH_TAB) - { - widgets[WIDX_GROUP_BY_TRACK_TYPE].type = WindowWidgetType::Checkbox; - } - else - { - widgets[WIDX_GROUP_BY_TRACK_TYPE].type = WindowWidgetType::Empty; - } - - if (_currentTab != RESEARCH_TAB) - { - widgets[WIDX_RIDE_LIST].type = WindowWidgetType::Scroll; - widgets[WIDX_FILTER_TEXT_BOX].type = WindowWidgetType::TextBox; - widgets[WIDX_FILTER_CLEAR_BUTTON].type = WindowWidgetType::Button; - widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP].type = WindowWidgetType::Empty; - widgets[WIDX_LAST_DEVELOPMENT_GROUP].type = WindowWidgetType::Empty; - widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::Empty; - - newWidth = WindowWidth; - newHeight = WindowHeight; - } - else - { - widgets[WIDX_RIDE_LIST].type = WindowWidgetType::Empty; - widgets[WIDX_FILTER_TEXT_BOX].type = WindowWidgetType::Empty; - widgets[WIDX_FILTER_CLEAR_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP].type = WindowWidgetType::Groupbox; - widgets[WIDX_LAST_DEVELOPMENT_GROUP].type = WindowWidgetType::Groupbox; - widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WindowWidgetType::FlatBtn; - if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) - widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::FlatBtn; - - newWidth = 300; - newHeight = 196; - } - - // Handle new window size - if (width != newWidth || height != newHeight) - { - Invalidate(); - - // Resize widgets to new window size - width = newWidth; - height = newHeight; - ResizeFrameWithPage(); - widgets[WIDX_GROUP_BY_TRACK_TYPE].left = newWidth - 8 - GroupByTrackTypeWidth; - widgets[WIDX_GROUP_BY_TRACK_TYPE].right = newWidth - 8; - - Invalidate(); - } - - InitScrollWidgets(); - } - - RideSelection ScrollGetRideListItemAt(const ScreenCoordsXY& screenCoords) - { - RideSelection result; - result.Type = RIDE_TYPE_NULL; - result.EntryIndex = OBJECT_ENTRY_INDEX_NULL; - - if (screenCoords.x <= 0 || screenCoords.y <= 0) - return result; - - int32_t column = screenCoords.x / 116; - int32_t row = screenCoords.y / 116; - if (column >= 5) - return result; - - int32_t index = column + (row * 5); - - RideSelection* listItem = _windowNewRideListItems; - while (listItem->Type != RIDE_TYPE_NULL || listItem->EntryIndex != OBJECT_ENTRY_INDEX_NULL) - { - if (index-- == 0) + switch (widgetIndex) { - return *listItem; + case WIDX_CLOSE: + Close(); + break; + case WIDX_LAST_DEVELOPMENT_BUTTON: + WindowResearchDevelopmentMouseUp(widgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); + break; + case WIDX_RESEARCH_FUNDING_BUTTON: + ContextOpenWindowView(WV_FINANCES_RESEARCH); + break; + case WIDX_GROUP_BY_TRACK_TYPE: + gConfigInterface.ListRideVehiclesSeparately = !gConfigInterface.ListRideVehiclesSeparately; + ConfigSaveDefault(); + SetPage(_currentTab); + break; + case WIDX_FILTER_TEXT_BOX: + WindowStartTextbox(*this, widgetIndex, STR_STRING, _filter.data(), TEXT_INPUT_SIZE); + break; + case WIDX_FILTER_CLEAR_BUTTON: + _filter.clear(); + scrolls->v_top = 0; + Invalidate(); + break; } - listItem++; } - return result; - } - - void RestoreScrollPositionForCurrentTab() - { - assert(static_cast(_currentTab) < std::size(_windowNewRideTabScroll)); - auto& currentTabScroll = _windowNewRideTabScroll[_currentTab]; - - // Get maximum scroll height - int32_t scrollWidth = 0; - int32_t scrollHeight = 0; - WindowGetScrollSize(this, 0, &scrollWidth, &scrollHeight); - const Widget& listWidget = widgets[WIDX_RIDE_LIST]; - const int32_t listWidgetHeight = listWidget.bottom - listWidget.top - 1; - - // Ensure the current tab scroll is within range - currentTabScroll = std::min(currentTabScroll, std::max(0, scrollHeight - listWidgetHeight)); - - scrolls[0].v_top = currentTabScroll; - WidgetScrollUpdateThumbs(*this, WIDX_RIDE_LIST); - } - - void DrawRideInformation(DrawPixelInfo& dpi, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth) - { - const auto* rideEntry = GetRideEntryByIndex(item.EntryIndex); - RideNaming rideNaming = GetRideNaming(item.Type, *rideEntry); - auto ft = Formatter(); - - UpdateVehicleAvailability(item.Type); - - // Ride name and description - ft.Add(rideNaming.Name); - ft.Add(rideNaming.Description); - DrawTextWrapped(dpi, screenPos, textWidth, STR_NEW_RIDE_NAME_AND_DESCRIPTION, ft); - - if (!_vehicleAvailability.empty()) + void OnMouseDown(WidgetIndex widgetIndex) override { - if (gConfigInterface.ListRideVehiclesSeparately) + if (widgetIndex >= WIDX_TAB_1 && widgetIndex <= WIDX_TAB_7) { - ft = Formatter(); - ft.Add(rideEntry->naming.Name); - DrawTextEllipsised(dpi, screenPos + ScreenCoordsXY{ 0, 39 }, WindowWidth - 2, STR_NEW_RIDE_VEHICLE_NAME, ft); + SetPage(widgetIndex - WIDX_TAB_1); + } + } + + void OnPrepareDraw() override + { + SetPressedTab(); + + if (!gConfigInterface.ListRideVehiclesSeparately) + pressed_widgets |= (1LL << WIDX_GROUP_BY_TRACK_TYPE); + else + pressed_widgets &= ~(1LL << WIDX_GROUP_BY_TRACK_TYPE); + + widgets[WIDX_TITLE].text = RideTitles[_currentTab]; + widgets[WIDX_TAB_7].type = WindowWidgetType::Tab; + widgets[WIDX_FILTER_TEXT_BOX].string = _filter.data(); + + if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + widgets[WIDX_TAB_7].type = WindowWidgetType::Empty; + + if (_currentTab == RESEARCH_TAB) + { + WindowResearchDevelopmentPrepareDraw(this, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); + } + + const auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); + auto string = ls.GetString(STR_GROUP_BY_TRACK_TYPE); + auto strWidth = GfxGetStringWidth(string, FontStyle::Medium); + auto localizedGroupByTrackTypeWidth = strWidth + 14; + widgets[WIDX_GROUP_BY_TRACK_TYPE].left = width - 8 - localizedGroupByTrackTypeWidth; + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + if (_currentTab != RESEARCH_TAB) + { + RideSelection item = _newRideVars.HighlightedRide; + if (item.Type != RIDE_TYPE_NULL || item.EntryIndex != OBJECT_ENTRY_INDEX_NULL) + DrawRideInformation(dpi, item, windowPos + ScreenCoordsXY{ 3, height - 64 }, width - 6); } else { - ft = Formatter(); - ft.Add(_vehicleAvailability.c_str()); - DrawTextEllipsised(dpi, screenPos + ScreenCoordsXY{ 0, 39 }, WindowWidth - 2, STR_AVAILABLE_VEHICLES, ft); + WindowResearchDevelopmentDraw(this, dpi, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); } } - auto count = GetNumTrackDesigns(item); - auto designCountStringId = GetDesignsAvailableStringId(count); - ft = Formatter(); - ft.Add(count); - DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ 0, 51 }, designCountStringId, ft); - - // Price - if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + ScreenSize OnScrollGetSize(int32_t scrollIndex) override { - // Get price of ride - int32_t startPieceId = GetRideTypeDescriptor(item.Type).StartTrackPiece; - money64 price = GetRideTypeDescriptor(item.Type).BuildCosts.TrackPrice; - const auto& ted = GetTrackElementDescriptor(startPieceId); - price *= ted.PriceModifier; - price = (price >> 16) * GetRideTypeDescriptor(item.Type).BuildCosts.PriceEstimateMultiplier; + RideSelection* listItem = _windowNewRideListItems; - // - StringId stringId = STR_NEW_RIDE_COST; - if (GetRideTypeDescriptor(item.Type).HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) - stringId = STR_NEW_RIDE_COST_FROM; + int32_t count = 0; + while (listItem->Type != RIDE_TYPE_NULL || listItem->EntryIndex != OBJECT_ENTRY_INDEX_NULL) + { + count++; + listItem++; + } + return { widgets[WIDX_RIDE_LIST].width(), ((count + 4) / 5) * 116 }; + } + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + RideSelection item = ScrollGetRideListItemAt(screenCoords); + if (_newRideVars.HighlightedRide == item) + { + return; + } + + _newRideVars.HighlightedRide = item; + Invalidate(); + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + RideSelection item = ScrollGetRideListItemAt(screenCoords); + if (item.Type == RIDE_TYPE_NULL && item.EntryIndex == OBJECT_ENTRY_INDEX_NULL) + { + return; + } + + _newRideVars.SelectedRide = item; + + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); + _newRideVars.SelectedRideCountdown = 8; + Invalidate(); + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + if (_currentTab == RESEARCH_TAB) + { + return; + } + + GfxClear(dpi, ColourMapA[colours[1]].mid_light); + + ScreenCoordsXY coords{ 1, 1 }; + RideSelection* listItem = _windowNewRideListItems; + while (listItem->Type != RIDE_TYPE_NULL || listItem->EntryIndex != OBJECT_ENTRY_INDEX_NULL) + { + // Draw flat button rectangle + int32_t buttonFlags = 0; + if (_newRideVars.SelectedRide == *listItem) + buttonFlags |= INSET_RECT_FLAG_BORDER_INSET; + if (_newRideVars.HighlightedRide == *listItem || buttonFlags != 0) + GfxFillRectInset( + dpi, { coords, coords + ScreenCoordsXY{ 115, 115 } }, colours[1], + INSET_RECT_FLAG_FILL_MID_LIGHT | buttonFlags); + + // Draw ride image with feathered border + auto mask = ImageId(SPR_NEW_RIDE_MASK); + auto rideImage = ImageId(GetRideImage(*listItem)); + GfxDrawSpriteRawMasked(dpi, coords + ScreenCoordsXY{ 2, 2 }, mask, rideImage); + + // Next position + coords.x += 116; + if (coords.x >= 116 * 5 + 1) + { + coords.x = 1; + coords.y += 116; + } + + // Next item + listItem++; + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (widgetIndex != WIDX_FILTER_TEXT_BOX) + return; + + if (text == _filter) + return; + + _filter.assign(text); + + scrolls->v_top = 0; + Invalidate(); + } + + void SetPage(int tab) + { + if (tab >= TRANSPORT_TAB && tab < TAB_COUNT) + { + SetPage(static_cast(tab)); + } + } + + void SetPage(NewRideTabId tab) + { + _currentTab = tab; + frame_no = 0; + _newRideVars.HighlightedRide = { RIDE_TYPE_NULL, OBJECT_ENTRY_INDEX_NULL }; + _newRideVars.SelectedRideCountdown = std::numeric_limits::max(); + PopulateRideList(); + RefreshWidgetSizing(); + Invalidate(); + + if (tab < RESEARCH_TAB) + { + RestoreScrollPositionForCurrentTab(); + } + } + + private: + void RideSelect() + { + RideSelection item = _newRideVars.SelectedRide; + if (item.Type == RIDE_TYPE_NULL) + { + return; + } + + Close(); + WindowCloseConstructionWindows(); + + auto count = GetNumTrackDesigns(item); + if (count > 0) + { + auto intent = Intent(WindowClass::TrackDesignList); + intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, item.Type); + intent.PutExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, item.EntryIndex); + ContextOpenIntent(&intent); + return; + } + + RideConstructNew(item); + } + + int32_t GetNumTrackDesigns(RideSelection item) + { + // Cache the result + if (item.Type == _lastTrackDesignCountRideType.Type && item.EntryIndex == _lastTrackDesignCountRideType.EntryIndex) + { + return _lastTrackDesignCount; + } + + std::string entryName; + + if (item.Type < 0x80) + { + if (GetRideTypeDescriptor(item.Type).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) + { + entryName = GetRideEntryName(item.EntryIndex); + } + } + + auto repo = OpenRCT2::GetContext()->GetTrackDesignRepository(); + _lastTrackDesignCount = static_cast(repo->GetCountForObjectEntry(item.Type, entryName)); + _lastTrackDesignCountRideType = item; + return _lastTrackDesignCount; + } + + void UpdateVehicleAvailability(ObjectEntryIndex rideType) + { + _vehicleAvailability.clear(); + if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) + { + return; + } + + auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + auto& rideEntries = objManager.GetAllRideEntries(rideType); + auto isFirst = true; + for (auto rideEntryIndex : rideEntries) + { + auto currentRideEntry = GetRideEntryByIndex(rideEntryIndex); + + // Skip if vehicle type is not invented yet + if (!RideEntryIsInvented(rideEntryIndex) && !GetGameState().Cheats.IgnoreResearchStatus) + { + continue; + } + + // Append comma if not the first iteration + if (!isFirst) + { + _vehicleAvailability += u8", "; + } + + // Append vehicle name + auto vehicleName = LanguageGetString(currentRideEntry->naming.Name); + _vehicleAvailability += vehicleName; + + isFirst = false; + } + } + + ImageIndex GetRideImage(RideSelection rideSelection) + { + auto& objMgr = OpenRCT2::GetContext()->GetObjectManager(); + auto obj = static_cast(objMgr.GetLoadedObject(ObjectType::Ride, rideSelection.EntryIndex)); + return obj == nullptr ? ImageIndexUndefined : obj->GetPreviewImage(rideSelection.Type); + } + + void PopulateRideList() + { + uint8_t currentCategory = _currentTab; + RideSelection* nextListItem = _windowNewRideListItems; + RideSelection* listEnd = _windowNewRideListItems + RideListItemsMax; + + // For each ride type in the view order list + for (int32_t i = 0; i < static_cast(std::size(RideTypeViewOrder)); i++) + { + auto rideType = RideTypeViewOrder[i]; + if (rideType == RIDE_TYPE_NULL) + continue; + + if (GetRideTypeDescriptor(rideType).Category != currentCategory) + continue; + + nextListItem = IterateOverRideType(rideType, nextListItem, listEnd); + } + + nextListItem->Type = RIDE_TYPE_NULL; + nextListItem->EntryIndex = OBJECT_ENTRY_INDEX_NULL; + } + + RideSelection* IterateOverRideType(ride_type_t rideType, RideSelection* nextListItem, RideSelection* listEnd) + { + bool buttonForRideTypeCreated = false; + bool allowDrawingOverLastButton = false; + + uint8_t highestVehiclePriority = 0; + + // For each ride entry for this ride type + auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + auto& rideEntries = objManager.GetAllRideEntries(rideType); + for (auto rideEntryIndex : rideEntries) + { + // Skip if vehicle type is not invented yet + if (!RideEntryIsInvented(rideEntryIndex) && !GetGameState().Cheats.IgnoreResearchStatus) + continue; + + // Ride entries + const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex); + + // Skip if the vehicle isn't the preferred vehicle for this generic track type + if (!gConfigInterface.ListRideVehiclesSeparately + && !GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY) + && highestVehiclePriority > rideEntry->BuildMenuPriority) + { + continue; + } + + if (!IsFiltered(*rideEntry)) + { + continue; + } + + highestVehiclePriority = rideEntry->BuildMenuPriority; + + // Determines how and where to draw a button for this ride type/vehicle. + if (gConfigInterface.ListRideVehiclesSeparately + || GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) + { + // Separate, draw apart + allowDrawingOverLastButton = false; + + if (nextListItem >= listEnd) + continue; + + nextListItem->Type = rideType; + nextListItem->EntryIndex = rideEntryIndex; + nextListItem++; + } + else if (!buttonForRideTypeCreated) + { + // Non-separate, draw-apart + buttonForRideTypeCreated = true; + allowDrawingOverLastButton = true; + + if (nextListItem >= listEnd) + continue; + + nextListItem->Type = rideType; + nextListItem->EntryIndex = rideEntryIndex; + nextListItem++; + } + else if (allowDrawingOverLastButton) + { + // Non-separate, draw over previous + if (rideType == rideEntry->ride_type[0]) + { + nextListItem--; + nextListItem->Type = rideType; + nextListItem->EntryIndex = rideEntryIndex; + nextListItem++; + } + } + } + + return nextListItem; + } + + bool IsFiltered(const RideObjectEntry& rideEntry) + { + if (_filter.empty()) + return true; + + return IsFilterInRideType(rideEntry) || IsFilterInRideName(rideEntry) || IsFilterInIdentifier(rideEntry) + || IsFilterInAuthors(rideEntry) || IsFilterInFilename(rideEntry); + } + + bool IsFilterInRideType(const RideObjectEntry& rideEntry) + { + auto rideTypeName = GetRideNaming(rideEntry.ride_type[0], rideEntry).Name; + return String::Contains(u8string_view(LanguageGetString(rideTypeName)), _filter, true); + } + + bool IsFilterInRideName(const RideObjectEntry& rideEntry) + { + auto rideName = rideEntry.naming.Name; + return String::Contains(u8string_view(LanguageGetString(rideName)), _filter, true); + } + + bool IsFilterInAuthors(const RideObjectEntry& rideEntry) + { + auto rideObject = static_cast(rideEntry.obj); + auto authors = rideObject->GetAuthors(); + + for (auto author : authors) + if (String::Contains(author, _filter, true)) + return true; + + return false; + } + + bool IsFilterInIdentifier(const RideObjectEntry& rideEntry) + { + auto rideObject = static_cast(rideEntry.obj); + auto objectName = rideObject->GetObjectEntry().GetName(); + + return String::Contains(objectName, _filter, true); + } + + bool IsFilterInFilename(const RideObjectEntry& rideEntry) + { + auto rideObject = static_cast(rideEntry.obj); + auto repoItem = ObjectRepositoryFindObjectByEntry(&(rideObject->GetObjectEntry())); + + return String::Contains(repoItem->Path, _filter, true); + } + + void SetPressedTab() + { + int32_t i{}; + for (i = 0; i < TAB_COUNT; i++) + { + pressed_widgets &= ~(1 << (WIDX_TAB_1 + i)); + } + pressed_widgets |= 1LL << (WIDX_TAB_1 + static_cast(_currentTab)); + } + + void RefreshWidgetSizing() + { + int32_t newWidth{}, newHeight{}; + + if (_currentTab < SHOP_TAB) + { + disabled_widgets &= ~(1 << WIDX_GROUP_BY_TRACK_TYPE); + } + else + { + disabled_widgets |= 1LL << WIDX_GROUP_BY_TRACK_TYPE; + } + + // Show or hide unrelated widgets + + if (_currentTab < RESEARCH_TAB) + { + widgets[WIDX_GROUP_BY_TRACK_TYPE].type = WindowWidgetType::Checkbox; + } + else + { + widgets[WIDX_GROUP_BY_TRACK_TYPE].type = WindowWidgetType::Empty; + } + + if (_currentTab != RESEARCH_TAB) + { + widgets[WIDX_RIDE_LIST].type = WindowWidgetType::Scroll; + widgets[WIDX_FILTER_TEXT_BOX].type = WindowWidgetType::TextBox; + widgets[WIDX_FILTER_CLEAR_BUTTON].type = WindowWidgetType::Button; + widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP].type = WindowWidgetType::Empty; + widgets[WIDX_LAST_DEVELOPMENT_GROUP].type = WindowWidgetType::Empty; + widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::Empty; + + newWidth = WindowWidth; + newHeight = WindowHeight; + } + else + { + widgets[WIDX_RIDE_LIST].type = WindowWidgetType::Empty; + widgets[WIDX_FILTER_TEXT_BOX].type = WindowWidgetType::Empty; + widgets[WIDX_FILTER_CLEAR_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP].type = WindowWidgetType::Groupbox; + widgets[WIDX_LAST_DEVELOPMENT_GROUP].type = WindowWidgetType::Groupbox; + widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WindowWidgetType::FlatBtn; + if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::FlatBtn; + + newWidth = 300; + newHeight = 196; + } + + // Handle new window size + if (width != newWidth || height != newHeight) + { + Invalidate(); + + // Resize widgets to new window size + width = newWidth; + height = newHeight; + ResizeFrameWithPage(); + widgets[WIDX_GROUP_BY_TRACK_TYPE].left = newWidth - 8 - GroupByTrackTypeWidth; + widgets[WIDX_GROUP_BY_TRACK_TYPE].right = newWidth - 8; + + Invalidate(); + } + + InitScrollWidgets(); + } + + RideSelection ScrollGetRideListItemAt(const ScreenCoordsXY& screenCoords) + { + RideSelection result; + result.Type = RIDE_TYPE_NULL; + result.EntryIndex = OBJECT_ENTRY_INDEX_NULL; + + if (screenCoords.x <= 0 || screenCoords.y <= 0) + return result; + + int32_t column = screenCoords.x / 116; + int32_t row = screenCoords.y / 116; + if (column >= 5) + return result; + + int32_t index = column + (row * 5); + + RideSelection* listItem = _windowNewRideListItems; + while (listItem->Type != RIDE_TYPE_NULL || listItem->EntryIndex != OBJECT_ENTRY_INDEX_NULL) + { + if (index-- == 0) + { + return *listItem; + } + listItem++; + } + + return result; + } + + void RestoreScrollPositionForCurrentTab() + { + assert(static_cast(_currentTab) < std::size(_windowNewRideTabScroll)); + auto& currentTabScroll = _windowNewRideTabScroll[_currentTab]; + + // Get maximum scroll height + ScreenSize scrollSize = OnScrollGetSize(0); + const Widget& listWidget = widgets[WIDX_RIDE_LIST]; + const int32_t listWidgetHeight = listWidget.bottom - listWidget.top - 1; + + // Ensure the current tab scroll is within range + currentTabScroll = std::min(currentTabScroll, std::max(0, scrollSize.height - listWidgetHeight)); + + scrolls[0].v_top = currentTabScroll; + WidgetScrollUpdateThumbs(*this, WIDX_RIDE_LIST); + } + + void DrawRideInformation(DrawPixelInfo& dpi, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth) + { + const auto* rideEntry = GetRideEntryByIndex(item.EntryIndex); + RideNaming rideNaming = GetRideNaming(item.Type, *rideEntry); + auto ft = Formatter(); + + UpdateVehicleAvailability(item.Type); + + // Ride name and description + ft.Add(rideNaming.Name); + ft.Add(rideNaming.Description); + DrawTextWrapped(dpi, screenPos, textWidth, STR_NEW_RIDE_NAME_AND_DESCRIPTION, ft); + + if (!_vehicleAvailability.empty()) + { + if (gConfigInterface.ListRideVehiclesSeparately) + { + ft = Formatter(); + ft.Add(rideEntry->naming.Name); + DrawTextEllipsised( + dpi, screenPos + ScreenCoordsXY{ 0, 39 }, WindowWidth - 2, STR_NEW_RIDE_VEHICLE_NAME, ft); + } + else + { + ft = Formatter(); + ft.Add(_vehicleAvailability.c_str()); + DrawTextEllipsised(dpi, screenPos + ScreenCoordsXY{ 0, 39 }, WindowWidth - 2, STR_AVAILABLE_VEHICLES, ft); + } + } + + auto count = GetNumTrackDesigns(item); + auto designCountStringId = GetDesignsAvailableStringId(count); ft = Formatter(); - ft.Add(price); - DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ textWidth, 51 }, stringId, ft, { TextAlignment::RIGHT }); + ft.Add(count); + DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ 0, 51 }, designCountStringId, ft); + + // Price + if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + // Get price of ride + int32_t startPieceId = GetRideTypeDescriptor(item.Type).StartTrackPiece; + money64 price = GetRideTypeDescriptor(item.Type).BuildCosts.TrackPrice; + const auto& ted = GetTrackElementDescriptor(startPieceId); + price *= ted.PriceModifier; + price = (price >> 16) * GetRideTypeDescriptor(item.Type).BuildCosts.PriceEstimateMultiplier; + + // + StringId stringId = STR_NEW_RIDE_COST; + if (GetRideTypeDescriptor(item.Type).HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) + stringId = STR_NEW_RIDE_COST_FROM; + + ft = Formatter(); + ft.Add(price); + DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ textWidth, 51 }, stringId, ft, { TextAlignment::RIGHT }); + } } - } - void DrawTabImage(DrawPixelInfo& dpi, NewRideTabId tab, int32_t spriteIndex) - { - WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(tab); - - if (widgets[widgetIndex].type != WindowWidgetType::Empty && !WidgetIsDisabled(*this, widgetIndex)) + void DrawTabImage(DrawPixelInfo& dpi, NewRideTabId tab, int32_t spriteIndex) { - int32_t frame = 0; - if (_currentTab == tab) - frame = frame_no / TabAnimationDivisor[_currentTab]; + WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(tab); - spriteIndex += tab == THRILL_TAB ? ThrillRidesTabAnimationSequence[frame] : frame; + if (widgets[widgetIndex].type != WindowWidgetType::Empty && !WidgetIsDisabled(*this, widgetIndex)) + { + int32_t frame = 0; + if (_currentTab == tab) + frame = frame_no / TabAnimationDivisor[_currentTab]; - GfxDrawSprite( - dpi, ImageId(spriteIndex, colours[1]), - windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); + spriteIndex += tab == THRILL_TAB ? ThrillRidesTabAnimationSequence[frame] : frame; + + GfxDrawSprite( + dpi, ImageId(spriteIndex, colours[1]), + windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); + } } - } - void DrawTabImages(DrawPixelInfo& dpi) - { - DrawTabImage(dpi, TRANSPORT_TAB, SPR_TAB_RIDES_TRANSPORT_0); - DrawTabImage(dpi, GENTLE_TAB, SPR_TAB_RIDES_GENTLE_0); - DrawTabImage(dpi, ROLLER_COASTER_TAB, SPR_TAB_RIDES_ROLLER_COASTERS_0); - DrawTabImage(dpi, THRILL_TAB, SPR_TAB_RIDES_THRILL_0); - DrawTabImage(dpi, WATER_TAB, SPR_TAB_RIDES_WATER_0); - DrawTabImage(dpi, SHOP_TAB, SPR_TAB_RIDES_SHOP_0); - DrawTabImage(dpi, RESEARCH_TAB, SPR_TAB_FINANCES_RESEARCH_0); - } - - StringId GetDesignsAvailableStringId(int32_t count) - { - switch (count) + void DrawTabImages(DrawPixelInfo& dpi) { - case 0: - return STR_CUSTOM_DESIGNED_LAYOUT; - case 1: - return STR_1_DESIGN_AVAILABLE; - default: - return STR_X_DESIGNS_AVAILABLE; + DrawTabImage(dpi, TRANSPORT_TAB, SPR_TAB_RIDES_TRANSPORT_0); + DrawTabImage(dpi, GENTLE_TAB, SPR_TAB_RIDES_GENTLE_0); + DrawTabImage(dpi, ROLLER_COASTER_TAB, SPR_TAB_RIDES_ROLLER_COASTERS_0); + DrawTabImage(dpi, THRILL_TAB, SPR_TAB_RIDES_THRILL_0); + DrawTabImage(dpi, WATER_TAB, SPR_TAB_RIDES_WATER_0); + DrawTabImage(dpi, SHOP_TAB, SPR_TAB_RIDES_SHOP_0); + DrawTabImage(dpi, RESEARCH_TAB, SPR_TAB_FINANCES_RESEARCH_0); } - } -}; -NewRideTabId NewRideWindow::_currentTab{}; -uint_fast16_t NewRideWindow::_windowNewRideTabScroll[RideTabCount]{}; + StringId GetDesignsAvailableStringId(int32_t count) + { + switch (count) + { + case 0: + return STR_CUSTOM_DESIGNED_LAYOUT; + case 1: + return STR_1_DESIGN_AVAILABLE; + default: + return STR_X_DESIGNS_AVAILABLE; + } + } + }; -/** - * - * rct2: 0x006ACA58 - */ -void WindowNewRideInitVars() -{ - // If we are in the track designer, default to the Roller Coaster tab - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + NewRideTabId NewRideWindow::_currentTab{}; + uint_fast16_t NewRideWindow::_windowNewRideTabScroll[RideTabCount]{}; + + /** + * + * rct2: 0x006ACA58 + */ + void WindowNewRideInitVars() { - NewRideWindow::SetOpeningPage(ROLLER_COASTER_TAB); + // If we are in the track designer, default to the Roller Coaster tab + if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + { + NewRideWindow::SetOpeningPage(ROLLER_COASTER_TAB); + } + else + { + NewRideWindow::SetOpeningPage(TRANSPORT_TAB); + } + NewRideWindow::ResetTabScrolls(); } - else - { - NewRideWindow::SetOpeningPage(TRANSPORT_TAB); - } - NewRideWindow::ResetTabScrolls(); -} -/** - * - * rct2: 0x006B3CFF - */ -WindowBase* WindowNewRideOpen() -{ - WindowBase* window; - - window = WindowBringToFrontByClass(WindowClass::ConstructRide); - if (window) + /** + * + * rct2: 0x006B3CFF + */ + WindowBase* NewRideOpen() { + WindowBase* window; + + window = WindowBringToFrontByClass(WindowClass::ConstructRide); + if (window) + { + return window; + } + + WindowCloseByClass(WindowClass::TrackDesignList); + WindowCloseByClass(WindowClass::TrackDesignPlace); + + window = WindowCreate(WindowClass::ConstructRide, WindowWidth, WindowHeight, WF_10 | WF_AUTO_POSITION); return window; } - WindowCloseByClass(WindowClass::TrackDesignList); - WindowCloseByClass(WindowClass::TrackDesignPlace); - - window = WindowCreate(WindowClass::ConstructRide, WindowWidth, WindowHeight, WF_10 | WF_AUTO_POSITION); - return window; -} - -WindowBase* WindowNewRideOpenResearch() -{ - auto w = static_cast(WindowNewRideOpen()); - w->SetPage(RESEARCH_TAB); - return w; -} - -/** - * - * rct2: 0x006B3EBA - */ -void WindowNewRideFocus(RideSelection rideItem) -{ - auto w = static_cast(WindowFindByClass(WindowClass::ConstructRide)); - if (!w) + WindowBase* NewRideOpenResearch() { - return; + auto w = static_cast(NewRideOpen()); + w->SetPage(RESEARCH_TAB); + return w; } - const auto* rideEntry = GetRideEntryByIndex(rideItem.EntryIndex); - if (rideEntry == nullptr) - return; + /** + * + * rct2: 0x006B3EBA + */ + void WindowNewRideFocus(RideSelection rideItem) + { + auto w = static_cast(WindowFindByClass(WindowClass::ConstructRide)); + if (!w) + { + return; + } - auto rideTypeIndex = rideEntry->GetFirstNonNullRideType(); - w->SetPage(GetRideTypeDescriptor(rideTypeIndex).Category); -} + const auto* rideEntry = GetRideEntryByIndex(rideItem.EntryIndex); + if (rideEntry == nullptr) + return; + + auto rideTypeIndex = rideEntry->GetFirstNonNullRideType(); + w->SetPage(GetRideTypeDescriptor(rideTypeIndex).Category); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index d65b65fc88..de5368749a 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -22,13 +22,13 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_RECENT_MESSAGES; + static constexpr int32_t WH = 300; + static constexpr int32_t WW = 400; -static constexpr StringId WINDOW_TITLE = STR_RECENT_MESSAGES; -static constexpr int32_t WH = 300; -static constexpr int32_t WW = 400; - -// clang-format off + // clang-format off enum WindowNewsWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -42,282 +42,283 @@ static Widget window_news_widgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget({372, 18}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_TAB_GEARS_0)), // settings MakeWidget({ 4, 44}, {392, 252}, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL), // scroll - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class NewsWindow final : public Window -{ -private: - int32_t _pressedNewsItemIndex{}, _pressedButtonIndex{}, _suspendUpdateTicks{}; - static int32_t CalculateItemHeight() + class NewsWindow final : public Window { - return 4 * FontGetLineHeight(FontStyle::Small) + 2; - } - -public: - void OnOpen() override - { - widgets = window_news_widgets; - WindowInitScrollWidgets(*this); - _pressedNewsItemIndex = -1; - - int32_t w = 0, h = 0; - Widget* widget = &widgets[WIDX_SCROLL]; - WindowGetScrollSize(this, 0, &w, &h); - scrolls[0].v_top = std::max(0, h - (widget->height() - 1)); - WidgetScrollUpdateThumbs(*this, WIDX_SCROLL); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + private: + int32_t _pressedNewsItemIndex{}, _pressedButtonIndex{}, _suspendUpdateTicks{}; + static int32_t CalculateItemHeight() { - case WIDX_CLOSE: - Close(); - break; - case WIDX_SETTINGS: - ContextOpenWindow(WindowClass::NotificationOptions); - break; - } - } - - void OnUpdate() override - { - if (_pressedNewsItemIndex == -1 || --_suspendUpdateTicks != 0) - { - return; + return 4 * FontGetLineHeight(FontStyle::Small) + 2; } - Invalidate(); - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click2, 0, windowPos.x + (width / 2)); - - size_t j = _pressedNewsItemIndex; - _pressedNewsItemIndex = -1; - auto& gameState = GetGameState(); - - if (j >= gameState.NewsItems.GetArchived().size()) + public: + void OnOpen() override { - return; + widgets = window_news_widgets; + WindowInitScrollWidgets(*this); + _pressedNewsItemIndex = -1; + + Widget* widget = &widgets[WIDX_SCROLL]; + ScreenSize scrollSize = OnScrollGetSize(0); + scrolls[0].v_top = std::max(0, scrollSize.height - (widget->height() - 1)); + WidgetScrollUpdateThumbs(*this, WIDX_SCROLL); } - const auto& newsItem = gameState.NewsItems.GetArchived()[j]; - if (newsItem.HasButton()) + void OnMouseUp(WidgetIndex widgetIndex) override { - return; - } - - if (_pressedButtonIndex == 1) - { - News::OpenSubject(newsItem.Type, newsItem.Assoc); - } - else if (_pressedButtonIndex > 1) - { - static WindowBase* _mainWindow; - auto subjectLoc = News::GetSubjectLocation(newsItem.Type, newsItem.Assoc); - if (subjectLoc.has_value() && (_mainWindow = WindowGetMain()) != nullptr) + switch (widgetIndex) { - WindowScrollToLocation(*_mainWindow, subjectLoc.value()); + case WIDX_CLOSE: + Close(); + break; + case WIDX_SETTINGS: + ContextOpenWindow(WindowClass::NotificationOptions); + break; } } - } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - int32_t scrollHeight = static_cast(GetGameState().NewsItems.GetArchived().size()) * CalculateItemHeight(); - return { WW, scrollHeight }; - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - int32_t itemHeight = CalculateItemHeight(); - int32_t i = 0; - int32_t buttonIndex = 0; - auto mutableScreenCoords = screenCoords; - for (const auto& newsItem : GetGameState().NewsItems.GetArchived()) + void OnUpdate() override { - if (mutableScreenCoords.y < itemHeight) + if (_pressedNewsItemIndex == -1 || --_suspendUpdateTicks != 0) { - if (newsItem.HasButton() || mutableScreenCoords.y < 14 || mutableScreenCoords.y >= 38 - || mutableScreenCoords.x < 328) - { - buttonIndex = 0; - break; - } - if (mutableScreenCoords.x < 351 && newsItem.TypeHasSubject()) - { - buttonIndex = 1; - break; - } - if (mutableScreenCoords.x < 376 && newsItem.TypeHasLocation()) - { - buttonIndex = 2; - break; - } + return; } - mutableScreenCoords.y -= itemHeight; - i++; - } - if (buttonIndex != 0) - { - _pressedNewsItemIndex = i; - _pressedButtonIndex = buttonIndex; - _suspendUpdateTicks = 4; Invalidate(); - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); - } - } + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click2, 0, windowPos.x + (width / 2)); - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - } + size_t j = _pressedNewsItemIndex; + _pressedNewsItemIndex = -1; + auto& gameState = GetGameState(); - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - int32_t lineHeight = FontGetLineHeight(FontStyle::Small); - int32_t itemHeight = CalculateItemHeight(); - int32_t y = 0; - int32_t i = 0; - - for (const auto& newsItem : GetGameState().NewsItems.GetArchived()) - { - if (y >= dpi.y + dpi.height) - break; - if (y + itemHeight < dpi.y) + if (j >= gameState.NewsItems.GetArchived().size()) { + return; + } + + const auto& newsItem = gameState.NewsItems.GetArchived()[j]; + if (newsItem.HasButton()) + { + return; + } + + if (_pressedButtonIndex == 1) + { + News::OpenSubject(newsItem.Type, newsItem.Assoc); + } + else if (_pressedButtonIndex > 1) + { + static WindowBase* _mainWindow; + auto subjectLoc = News::GetSubjectLocation(newsItem.Type, newsItem.Assoc); + if (subjectLoc.has_value() && (_mainWindow = WindowGetMain()) != nullptr) + { + WindowScrollToLocation(*_mainWindow, subjectLoc.value()); + } + } + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + int32_t scrollHeight = static_cast(GetGameState().NewsItems.GetArchived().size()) * CalculateItemHeight(); + return { WW, scrollHeight }; + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + int32_t itemHeight = CalculateItemHeight(); + int32_t i = 0; + int32_t buttonIndex = 0; + auto mutableScreenCoords = screenCoords; + for (const auto& newsItem : GetGameState().NewsItems.GetArchived()) + { + if (mutableScreenCoords.y < itemHeight) + { + if (newsItem.HasButton() || mutableScreenCoords.y < 14 || mutableScreenCoords.y >= 38 + || mutableScreenCoords.x < 328) + { + buttonIndex = 0; + break; + } + if (mutableScreenCoords.x < 351 && newsItem.TypeHasSubject()) + { + buttonIndex = 1; + break; + } + if (mutableScreenCoords.x < 376 && newsItem.TypeHasLocation()) + { + buttonIndex = 2; + break; + } + } + mutableScreenCoords.y -= itemHeight; + i++; + } + + if (buttonIndex != 0) + { + _pressedNewsItemIndex = i; + _pressedButtonIndex = buttonIndex; + _suspendUpdateTicks = 4; + Invalidate(); + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + int32_t lineHeight = FontGetLineHeight(FontStyle::Small); + int32_t itemHeight = CalculateItemHeight(); + int32_t y = 0; + int32_t i = 0; + + for (const auto& newsItem : GetGameState().NewsItems.GetArchived()) + { + if (y >= dpi.y + dpi.height) + break; + if (y + itemHeight < dpi.y) + { + y += itemHeight; + i++; + continue; + } + + // Background + GfxFillRectInset( + dpi, { -1, y, 383, y + itemHeight - 1 }, colours[1], + (INSET_RECT_FLAG_BORDER_INSET | INSET_RECT_FLAG_FILL_GREY)); + + // Date text + { + auto ft = Formatter(); + ft.Add(DateDayNames[newsItem.Day - 1]); + ft.Add(DateGameMonthNames[DateGetMonth(newsItem.MonthYear)]); + DrawTextBasic(dpi, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::Small }); + } + // Item text + { + auto ft = Formatter(); + ft.Add(newsItem.Text.c_str()); + DrawTextWrapped(dpi, { 2, y + lineHeight }, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, ft, { FontStyle::Small }); + } + // Subject button + if ((newsItem.TypeHasSubject()) && !(newsItem.HasButton())) + { + auto screenCoords = ScreenCoordsXY{ 328, y + lineHeight + 4 }; + + int32_t press = 0; + if (_pressedNewsItemIndex != -1) + { + News::IsValidIndex(_pressedNewsItemIndex + News::ItemHistoryStart); + if (i == _pressedNewsItemIndex && _pressedButtonIndex == 1) + { + press = INSET_RECT_FLAG_BORDER_INSET; + } + } + GfxFillRectInset(dpi, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], press); + + switch (newsItem.Type) + { + case News::ItemType::Ride: + GfxDrawSprite(dpi, ImageId(SPR_RIDE), screenCoords); + break; + case News::ItemType::Peep: + case News::ItemType::PeepOnRide: + { + DrawPixelInfo cliped_dpi; + if (!ClipDrawPixelInfo(cliped_dpi, dpi, screenCoords + ScreenCoordsXY{ 1, 1 }, 22, 22)) + { + break; + } + + auto peep = TryGetEntity(EntityId::FromUnderlying(newsItem.Assoc)); + if (peep == nullptr) + { + break; + } + + auto clipCoords = ScreenCoordsXY{ 10, 19 }; + + // If normal peep set sprite to normal (no food) + // If staff set sprite to staff sprite + auto spriteType = PeepSpriteType::Normal; + auto* staff = peep->As(); + if (staff != nullptr) + { + spriteType = staff->SpriteType; + if (staff->AssignedStaffType == StaffType::Entertainer) + { + clipCoords.y += 3; + } + } + + ImageIndex imageId = GetPeepAnimation(spriteType).base_image + 1; + auto image = ImageId(imageId, peep->TshirtColour, peep->TrousersColour); + GfxDrawSprite(cliped_dpi, image, clipCoords); + break; + } + case News::ItemType::Money: + case News::ItemType::Campaign: + GfxDrawSprite(dpi, ImageId(SPR_FINANCE), screenCoords); + break; + case News::ItemType::Research: + GfxDrawSprite( + dpi, ImageId(newsItem.Assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE), screenCoords); + break; + case News::ItemType::Peeps: + GfxDrawSprite(dpi, ImageId(SPR_GUESTS), screenCoords); + break; + case News::ItemType::Award: + GfxDrawSprite(dpi, ImageId(SPR_AWARD), screenCoords); + break; + case News::ItemType::Graph: + GfxDrawSprite(dpi, ImageId(SPR_GRAPH), screenCoords); + break; + case News::ItemType::Null: + case News::ItemType::Blank: + case News::ItemType::Count: + break; + } + } + + // Location button + if ((newsItem.TypeHasLocation()) && !(newsItem.HasButton())) + { + auto screenCoords = ScreenCoordsXY{ 352, y + lineHeight + 4 }; + + int32_t press = 0; + if (_pressedNewsItemIndex != -1) + { + News::IsValidIndex(_pressedNewsItemIndex + News::ItemHistoryStart); + if (i == _pressedNewsItemIndex && _pressedButtonIndex == 2) + press = 0x20; + } + GfxFillRectInset(dpi, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], press); + GfxDrawSprite(dpi, ImageId(SPR_LOCATE), screenCoords); + } + y += itemHeight; i++; - continue; } - - // Background - GfxFillRectInset( - dpi, { -1, y, 383, y + itemHeight - 1 }, colours[1], - (INSET_RECT_FLAG_BORDER_INSET | INSET_RECT_FLAG_FILL_GREY)); - - // Date text - { - auto ft = Formatter(); - ft.Add(DateDayNames[newsItem.Day - 1]); - ft.Add(DateGameMonthNames[DateGetMonth(newsItem.MonthYear)]); - DrawTextBasic(dpi, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::Small }); - } - // Item text - { - auto ft = Formatter(); - ft.Add(newsItem.Text.c_str()); - DrawTextWrapped(dpi, { 2, y + lineHeight }, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, ft, { FontStyle::Small }); - } - // Subject button - if ((newsItem.TypeHasSubject()) && !(newsItem.HasButton())) - { - auto screenCoords = ScreenCoordsXY{ 328, y + lineHeight + 4 }; - - int32_t press = 0; - if (_pressedNewsItemIndex != -1) - { - News::IsValidIndex(_pressedNewsItemIndex + News::ItemHistoryStart); - if (i == _pressedNewsItemIndex && _pressedButtonIndex == 1) - { - press = INSET_RECT_FLAG_BORDER_INSET; - } - } - GfxFillRectInset(dpi, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], press); - - switch (newsItem.Type) - { - case News::ItemType::Ride: - GfxDrawSprite(dpi, ImageId(SPR_RIDE), screenCoords); - break; - case News::ItemType::Peep: - case News::ItemType::PeepOnRide: - { - DrawPixelInfo cliped_dpi; - if (!ClipDrawPixelInfo(cliped_dpi, dpi, screenCoords + ScreenCoordsXY{ 1, 1 }, 22, 22)) - { - break; - } - - auto peep = TryGetEntity(EntityId::FromUnderlying(newsItem.Assoc)); - if (peep == nullptr) - { - break; - } - - auto clipCoords = ScreenCoordsXY{ 10, 19 }; - - // If normal peep set sprite to normal (no food) - // If staff set sprite to staff sprite - auto spriteType = PeepSpriteType::Normal; - auto* staff = peep->As(); - if (staff != nullptr) - { - spriteType = staff->SpriteType; - if (staff->AssignedStaffType == StaffType::Entertainer) - { - clipCoords.y += 3; - } - } - - ImageIndex imageId = GetPeepAnimation(spriteType).base_image + 1; - auto image = ImageId(imageId, peep->TshirtColour, peep->TrousersColour); - GfxDrawSprite(cliped_dpi, image, clipCoords); - break; - } - case News::ItemType::Money: - case News::ItemType::Campaign: - GfxDrawSprite(dpi, ImageId(SPR_FINANCE), screenCoords); - break; - case News::ItemType::Research: - GfxDrawSprite(dpi, ImageId(newsItem.Assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE), screenCoords); - break; - case News::ItemType::Peeps: - GfxDrawSprite(dpi, ImageId(SPR_GUESTS), screenCoords); - break; - case News::ItemType::Award: - GfxDrawSprite(dpi, ImageId(SPR_AWARD), screenCoords); - break; - case News::ItemType::Graph: - GfxDrawSprite(dpi, ImageId(SPR_GRAPH), screenCoords); - break; - case News::ItemType::Null: - case News::ItemType::Blank: - case News::ItemType::Count: - break; - } - } - - // Location button - if ((newsItem.TypeHasLocation()) && !(newsItem.HasButton())) - { - auto screenCoords = ScreenCoordsXY{ 352, y + lineHeight + 4 }; - - int32_t press = 0; - if (_pressedNewsItemIndex != -1) - { - News::IsValidIndex(_pressedNewsItemIndex + News::ItemHistoryStart); - if (i == _pressedNewsItemIndex && _pressedButtonIndex == 2) - press = 0x20; - } - GfxFillRectInset(dpi, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], press); - GfxDrawSprite(dpi, ImageId(SPR_LOCATE), screenCoords); - } - - y += itemHeight; - i++; } - } - void OnResize() override + void OnResize() override + { + ResizeFrame(); + } + }; + + WindowBase* NewsOpen() { - ResizeFrame(); + return WindowFocusOrCreate(WindowClass::RecentNews, WW, WH, 0); } -}; - -WindowBase* WindowNewsOpen() -{ - return WindowFocusOrCreate(WindowClass::RecentNews, WW, WH, 0); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/NewsOptions.cpp b/src/openrct2-ui/windows/NewsOptions.cpp index c138cef81c..90613b6cd6 100644 --- a/src/openrct2-ui/windows/NewsOptions.cpp +++ b/src/openrct2-ui/windows/NewsOptions.cpp @@ -14,11 +14,13 @@ #include #include -static constexpr StringId WINDOW_TITLE = STR_NOTIFICATION_SETTINGS; -static constexpr int32_t WH = 300; -static constexpr int32_t WW = 400; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_NOTIFICATION_SETTINGS; + static constexpr int32_t WH = 300; + static constexpr int32_t WW = 400; -// clang-format off + // clang-format off enum { NOTIFICATION_CATEGORY_PARK, @@ -83,200 +85,201 @@ static Widget WindowNewsOptionsWidgets[] = { MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ), MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ), MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class NewsOptionsWindow final : public Window -{ -public: - void OnOpen() override + class NewsOptionsWindow final : public Window { - widgets = WindowNewsOptionsWidgets; - InitScrollWidgets(); - colours[0] = COLOUR_GREY; - colours[1] = COLOUR_LIGHT_BLUE; - colours[2] = COLOUR_LIGHT_BLUE; - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_CLOSE: - Close(); - break; - case WIDX_TAB_PARK: - case WIDX_TAB_RIDE: - case WIDX_TAB_GUEST: - SetPage(widgetIndex - WIDX_FIRST_TAB); - break; - default: + widgets = WindowNewsOptionsWidgets; + InitScrollWidgets(); + colours[0] = COLOUR_GREY; + colours[1] = COLOUR_LIGHT_BLUE; + colours[2] = COLOUR_LIGHT_BLUE; + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) { - int32_t checkBoxIndex = widgetIndex - WIDX_CHECKBOX_0; - if (checkBoxIndex >= 0) + case WIDX_CLOSE: + Close(); + break; + case WIDX_TAB_PARK: + case WIDX_TAB_RIDE: + case WIDX_TAB_GUEST: + SetPage(widgetIndex - WIDX_FIRST_TAB); + break; + default: { - int32_t matchIndex = 0; - for (size_t i = 0; i < std::size(NewsItemOptionDefinitions); i++) + int32_t checkBoxIndex = widgetIndex - WIDX_CHECKBOX_0; + if (checkBoxIndex >= 0) { - const NotificationDef* ndef = &NewsItemOptionDefinitions[i]; - if (ndef->category != page) - continue; - - if (matchIndex == checkBoxIndex) + int32_t matchIndex = 0; + for (size_t i = 0; i < std::size(NewsItemOptionDefinitions); i++) { - // Toggle value - bool* configValue = GetNotificationValuePtr(ndef); - *configValue = !(*configValue); + const NotificationDef* ndef = &NewsItemOptionDefinitions[i]; + if (ndef->category != page) + continue; - ConfigSaveDefault(); + if (matchIndex == checkBoxIndex) + { + // Toggle value + bool* configValue = GetNotificationValuePtr(ndef); + *configValue = !(*configValue); - InvalidateWidget(widgetIndex); - break; + ConfigSaveDefault(); + + InvalidateWidget(widgetIndex); + break; + } + matchIndex++; } - matchIndex++; + } + break; + } + } + } + + void OnUpdate() override + { + // Tab animation + frame_no++; + InvalidateWidget(WIDX_FIRST_TAB + page); + } + + void OnPrepareDraw() override + { + SetPressedTab(); + + // Set checkboxes + const auto& baseCheckBox = widgets[WIDX_CHECKBOX_0]; + int32_t y = baseCheckBox.top; + + int32_t checkboxWidgetIndex = WIDX_CHECKBOX_0; + Widget* checkboxWidget = &widgets[checkboxWidgetIndex]; + for (size_t i = 0; i < std::size(NewsItemOptionDefinitions); i++) + { + const NotificationDef* ndef = &NewsItemOptionDefinitions[i]; + if (ndef->category != page) + continue; + + checkboxWidget->type = WindowWidgetType::Checkbox; + checkboxWidget->left = baseCheckBox.left; + checkboxWidget->right = baseCheckBox.right; + checkboxWidget->top = y; + checkboxWidget->bottom = checkboxWidget->top + LIST_ROW_HEIGHT + 3; + checkboxWidget->text = ndef->caption; + + const bool* configValue = GetNotificationValuePtr(ndef); + SetCheckboxValue(checkboxWidgetIndex, *configValue); + + checkboxWidgetIndex++; + checkboxWidget++; + y += LIST_ROW_HEIGHT + 3; + } + + // Remove unused checkboxes + while (checkboxWidget->type != WindowWidgetType::Last) + { + checkboxWidget->type = WindowWidgetType::Empty; + checkboxWidgetIndex++; + checkboxWidget++; + } + + // Resize window to fit checkboxes exactly + y += 3; + + if (height != y) + { + Invalidate(); + height = y; + widgets[WIDX_BACKGROUND].bottom = y - 1; + widgets[WIDX_TAB_CONTENT_PANEL].bottom = y - 1; + Invalidate(); + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + DrawTabImages(dpi); + } + + private: + void SetPage(int32_t p) + { + if (page != p) + { + page = p; + frame_no = 0; + Invalidate(); + } + } + + void DrawTabImages(DrawPixelInfo& dpi) + { + DrawTabImage(dpi, NOTIFICATION_CATEGORY_PARK, SPR_TAB_PARK); + DrawTabImage(dpi, NOTIFICATION_CATEGORY_RIDE, SPR_TAB_RIDE_0); + DrawTabImage(dpi, NOTIFICATION_CATEGORY_GUEST, SPR_TAB_GUESTS_0); + } + + void DrawTabImage(DrawPixelInfo& dpi, int32_t p, int32_t spriteIndex) + { + WidgetIndex widgetIndex = WIDX_FIRST_TAB + p; + + if (!WidgetIsDisabled(*this, widgetIndex)) + { + if (page == p) + { + int32_t numFrames = TabAnimationFrames[page]; + if (numFrames > 1) + { + int32_t frame = frame_no / TabAnimationDivisor[page]; + spriteIndex += (frame % numFrames); } } - break; + + const auto& widget = widgets[widgetIndex]; + GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget.left, widget.top }); } } - } - void OnUpdate() override - { - // Tab animation - frame_no++; - InvalidateWidget(WIDX_FIRST_TAB + page); - } - - void OnPrepareDraw() override - { - SetPressedTab(); - - // Set checkboxes - const auto& baseCheckBox = widgets[WIDX_CHECKBOX_0]; - int32_t y = baseCheckBox.top; - - int32_t checkboxWidgetIndex = WIDX_CHECKBOX_0; - Widget* checkboxWidget = &widgets[checkboxWidgetIndex]; - for (size_t i = 0; i < std::size(NewsItemOptionDefinitions); i++) + void SetPressedTab() { - const NotificationDef* ndef = &NewsItemOptionDefinitions[i]; - if (ndef->category != page) - continue; - - checkboxWidget->type = WindowWidgetType::Checkbox; - checkboxWidget->left = baseCheckBox.left; - checkboxWidget->right = baseCheckBox.right; - checkboxWidget->top = y; - checkboxWidget->bottom = checkboxWidget->top + LIST_ROW_HEIGHT + 3; - checkboxWidget->text = ndef->caption; - - const bool* configValue = GetNotificationValuePtr(ndef); - SetCheckboxValue(checkboxWidgetIndex, *configValue); - - checkboxWidgetIndex++; - checkboxWidget++; - y += LIST_ROW_HEIGHT + 3; + for (int32_t i = 0; i < NOTIFICATION_CATEGORY_COUNT; i++) + pressed_widgets &= ~(1 << (WIDX_FIRST_TAB + i)); + pressed_widgets |= 1LL << (WIDX_FIRST_TAB + page); } - // Remove unused checkboxes - while (checkboxWidget->type != WindowWidgetType::Last) + bool* GetNotificationValuePtr(const NotificationDef* ndef) { - checkboxWidget->type = WindowWidgetType::Empty; - checkboxWidgetIndex++; - checkboxWidget++; + bool* configValue = reinterpret_cast(reinterpret_cast(&gConfigNotifications) + ndef->config_offset); + return configValue; } - // Resize window to fit checkboxes exactly - y += 3; - - if (height != y) + void OnResize() override { - Invalidate(); - height = y; - widgets[WIDX_BACKGROUND].bottom = y - 1; - widgets[WIDX_TAB_CONTENT_PANEL].bottom = y - 1; - Invalidate(); + ResizeFrameWithPage(); } - } - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabImages(dpi); - } - -private: - void SetPage(int32_t p) - { - if (page != p) - { - page = p; - frame_no = 0; - Invalidate(); - } - } - - void DrawTabImages(DrawPixelInfo& dpi) - { - DrawTabImage(dpi, NOTIFICATION_CATEGORY_PARK, SPR_TAB_PARK); - DrawTabImage(dpi, NOTIFICATION_CATEGORY_RIDE, SPR_TAB_RIDE_0); - DrawTabImage(dpi, NOTIFICATION_CATEGORY_GUEST, SPR_TAB_GUESTS_0); - } - - void DrawTabImage(DrawPixelInfo& dpi, int32_t p, int32_t spriteIndex) - { - WidgetIndex widgetIndex = WIDX_FIRST_TAB + p; - - if (!WidgetIsDisabled(*this, widgetIndex)) - { - if (page == p) - { - int32_t numFrames = TabAnimationFrames[page]; - if (numFrames > 1) - { - int32_t frame = frame_no / TabAnimationDivisor[page]; - spriteIndex += (frame % numFrames); - } - } - - const auto& widget = widgets[widgetIndex]; - GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget.left, widget.top }); - } - } - - void SetPressedTab() - { - for (int32_t i = 0; i < NOTIFICATION_CATEGORY_COUNT; i++) - pressed_widgets &= ~(1 << (WIDX_FIRST_TAB + i)); - pressed_widgets |= 1LL << (WIDX_FIRST_TAB + page); - } - - bool* GetNotificationValuePtr(const NotificationDef* ndef) - { - bool* configValue = reinterpret_cast(reinterpret_cast(&gConfigNotifications) + ndef->config_offset); - return configValue; - } - - void OnResize() override - { - ResizeFrameWithPage(); - } - - static constexpr int32_t TabAnimationDivisor[3] = { - 1, // Park - 4, // Ride - 4, // Guest + static constexpr int32_t TabAnimationDivisor[3] = { + 1, // Park + 4, // Ride + 4, // Guest + }; + static constexpr int32_t TabAnimationFrames[3] = { + 1, // Park + 16, // Ride + 8, // Guest + }; }; - static constexpr int32_t TabAnimationFrames[3] = { - 1, // Park - 16, // Ride - 8, // Guest - }; -}; -WindowBase* WindowNewsOptionsOpen() -{ - return WindowFocusOrCreate(WindowClass::NotificationOptions, WW, WH, WF_CENTRE_SCREEN); -} + WindowBase* NewsOptionsOpen() + { + return WindowFocusOrCreate(WindowClass::NotificationOptions, WW, WH, WF_CENTRE_SCREEN); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index b3ce56655a..3eca21d95e 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -27,232 +27,233 @@ #include #include #include - +namespace OpenRCT2::Ui::Windows +{ #ifndef DISABLE_HTTP -class ObjectDownloader -{ -private: - static constexpr auto OPENRCT2_API_LEGACY_OBJECT_URL = "https://api.openrct2.io/objects/legacy/"; - - struct DownloadStatusInfo + class ObjectDownloader { - std::string Name; - std::string Source; - size_t Count{}; - size_t Total{}; + private: + static constexpr auto OPENRCT2_API_LEGACY_OBJECT_URL = "https://api.openrct2.io/objects/legacy/"; - bool operator==(const DownloadStatusInfo& rhs) const + struct DownloadStatusInfo { - return Name == rhs.Name && Source == rhs.Source && Count == rhs.Count && Total == rhs.Total; + std::string Name; + std::string Source; + size_t Count{}; + size_t Total{}; + + bool operator==(const DownloadStatusInfo& rhs) const + { + return Name == rhs.Name && Source == rhs.Source && Count == rhs.Count && Total == rhs.Total; + } + bool operator!=(const DownloadStatusInfo& rhs) const + { + return !(*this == rhs); + } + }; + + std::vector _entries; + std::vector _downloadedEntries; + size_t _currentDownloadIndex{}; + std::mutex _downloadedEntriesMutex; + std::mutex _queueMutex; + bool _nextDownloadQueued{}; + + DownloadStatusInfo _lastDownloadStatusInfo; + DownloadStatusInfo _downloadStatusInfo; + std::mutex _downloadStatusInfoMutex; + std::string _lastDownloadSource; + + // TODO static due to INTENT_EXTRA_CALLBACK not allowing a std::function + inline static bool _downloadingObjects; + + public: + void Begin(const std::vector& entries) + { + _lastDownloadStatusInfo = {}; + _downloadStatusInfo = {}; + _lastDownloadSource = {}; + _entries = entries; + _currentDownloadIndex = 0; + _downloadingObjects = true; + QueueNextDownload(); } - bool operator!=(const DownloadStatusInfo& rhs) const + + bool IsDownloading() const { - return !(*this == rhs); + return _downloadingObjects; + } + + std::vector GetDownloadedEntries() + { + std::lock_guard guard(_downloadedEntriesMutex); + return _downloadedEntries; + } + + void Update() + { + std::lock_guard guard(_queueMutex); + if (_nextDownloadQueued) + { + _nextDownloadQueued = false; + NextDownload(); + } + UpdateStatusBox(); + } + + private: + void UpdateStatusBox() + { + std::lock_guard guard(_downloadStatusInfoMutex); + if (_lastDownloadStatusInfo != _downloadStatusInfo) + { + _lastDownloadStatusInfo = _downloadStatusInfo; + + if (_downloadStatusInfo == DownloadStatusInfo()) + { + ContextForceCloseWindowByClass(WindowClass::NetworkStatus); + } + else + { + char str_downloading_objects[256]{}; + Formatter ft; + if (_downloadStatusInfo.Source.empty()) + { + ft.Add(static_cast(_downloadStatusInfo.Count)); + ft.Add(static_cast(_downloadStatusInfo.Total)); + ft.Add(_downloadStatusInfo.Name.c_str()); + OpenRCT2::FormatStringLegacy( + str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS, ft.Data()); + } + else + { + ft.Add(_downloadStatusInfo.Name.c_str()); + ft.Add(_downloadStatusInfo.Source.c_str()); + ft.Add(static_cast(_downloadStatusInfo.Count)); + ft.Add(static_cast(_downloadStatusInfo.Total)); + OpenRCT2::FormatStringLegacy( + str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS_FROM, ft.Data()); + } + + auto intent = Intent(WindowClass::NetworkStatus); + intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string(str_downloading_objects)); + intent.PutExtra(INTENT_EXTRA_CALLBACK, []() -> void { _downloadingObjects = false; }); + ContextOpenIntent(&intent); + } + } + } + + void UpdateProgress(const DownloadStatusInfo& info) + { + std::lock_guard guard(_downloadStatusInfoMutex); + _downloadStatusInfo = info; + } + + void QueueNextDownload() + { + std::lock_guard guard(_queueMutex); + _nextDownloadQueued = true; + } + + void DownloadObject(const ObjectEntryDescriptor& entry, const std::string& name, const std::string& url) + { + try + { + Console::WriteLine("Downloading %s", url.c_str()); + Http::Request req; + req.method = Http::Method::GET; + req.url = url; + Http::DoAsync(req, [this, entry, name](Http::Response response) { + if (response.status == Http::Status::Ok) + { + // Check that download operation hasn't been cancelled + if (_downloadingObjects) + { + auto data = reinterpret_cast(response.body.data()); + auto dataLen = response.body.size(); + + auto& objRepo = OpenRCT2::GetContext()->GetObjectRepository(); + objRepo.AddObjectFromFile(ObjectGeneration::DAT, name, data, dataLen); + + std::lock_guard guard(_downloadedEntriesMutex); + _downloadedEntries.push_back(entry); + } + } + else + { + Console::Error::WriteLine(" Failed to download %s", name.c_str()); + } + QueueNextDownload(); + }); + } + catch (const std::exception&) + { + Console::Error::WriteLine(" Failed to download %s", name.c_str()); + QueueNextDownload(); + } + } + + void NextDownload() + { + if (!_downloadingObjects || _currentDownloadIndex >= _entries.size()) + { + // Finished... + _downloadingObjects = false; + UpdateProgress({}); + return; + } + + auto& entry = _entries[_currentDownloadIndex]; + auto name = String::Trim(std::string(entry.GetName())); + LOG_VERBOSE("Downloading object: [%s]:", name.c_str()); + _currentDownloadIndex++; + UpdateProgress({ name, _lastDownloadSource, _currentDownloadIndex, _entries.size() }); + try + { + Http::Request req; + req.method = Http::Method::GET; + req.url = OPENRCT2_API_LEGACY_OBJECT_URL + name; + Http::DoAsync(req, [this, entry, name](Http::Response response) { + if (response.status == Http::Status::Ok) + { + auto jresponse = Json::FromString(response.body); + if (jresponse.is_object()) + { + auto objName = Json::GetString(jresponse["name"]); + auto source = Json::GetString(jresponse["source"]); + auto downloadLink = Json::GetString(jresponse["download"]); + if (!downloadLink.empty()) + { + _lastDownloadSource = source; + UpdateProgress({ name, source, _currentDownloadIndex, _entries.size() }); + DownloadObject(entry, objName, downloadLink); + } + } + } + else if (response.status == Http::Status::NotFound) + { + Console::Error::WriteLine(" %s not found", name.c_str()); + QueueNextDownload(); + } + else + { + Console::Error::WriteLine( + " %s query failed (status %d)", name.c_str(), static_cast(response.status)); + QueueNextDownload(); + } + }); + } + catch (const std::exception&) + { + Console::Error::WriteLine(" Failed to query %s", name.c_str()); + } } }; - std::vector _entries; - std::vector _downloadedEntries; - size_t _currentDownloadIndex{}; - std::mutex _downloadedEntriesMutex; - std::mutex _queueMutex; - bool _nextDownloadQueued{}; - - DownloadStatusInfo _lastDownloadStatusInfo; - DownloadStatusInfo _downloadStatusInfo; - std::mutex _downloadStatusInfoMutex; - std::string _lastDownloadSource; - - // TODO static due to INTENT_EXTRA_CALLBACK not allowing a std::function - inline static bool _downloadingObjects; - -public: - void Begin(const std::vector& entries) - { - _lastDownloadStatusInfo = {}; - _downloadStatusInfo = {}; - _lastDownloadSource = {}; - _entries = entries; - _currentDownloadIndex = 0; - _downloadingObjects = true; - QueueNextDownload(); - } - - bool IsDownloading() const - { - return _downloadingObjects; - } - - std::vector GetDownloadedEntries() - { - std::lock_guard guard(_downloadedEntriesMutex); - return _downloadedEntries; - } - - void Update() - { - std::lock_guard guard(_queueMutex); - if (_nextDownloadQueued) - { - _nextDownloadQueued = false; - NextDownload(); - } - UpdateStatusBox(); - } - -private: - void UpdateStatusBox() - { - std::lock_guard guard(_downloadStatusInfoMutex); - if (_lastDownloadStatusInfo != _downloadStatusInfo) - { - _lastDownloadStatusInfo = _downloadStatusInfo; - - if (_downloadStatusInfo == DownloadStatusInfo()) - { - ContextForceCloseWindowByClass(WindowClass::NetworkStatus); - } - else - { - char str_downloading_objects[256]{}; - Formatter ft; - if (_downloadStatusInfo.Source.empty()) - { - ft.Add(static_cast(_downloadStatusInfo.Count)); - ft.Add(static_cast(_downloadStatusInfo.Total)); - ft.Add(_downloadStatusInfo.Name.c_str()); - OpenRCT2::FormatStringLegacy( - str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS, ft.Data()); - } - else - { - ft.Add(_downloadStatusInfo.Name.c_str()); - ft.Add(_downloadStatusInfo.Source.c_str()); - ft.Add(static_cast(_downloadStatusInfo.Count)); - ft.Add(static_cast(_downloadStatusInfo.Total)); - OpenRCT2::FormatStringLegacy( - str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS_FROM, ft.Data()); - } - - auto intent = Intent(WindowClass::NetworkStatus); - intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string(str_downloading_objects)); - intent.PutExtra(INTENT_EXTRA_CALLBACK, []() -> void { _downloadingObjects = false; }); - ContextOpenIntent(&intent); - } - } - } - - void UpdateProgress(const DownloadStatusInfo& info) - { - std::lock_guard guard(_downloadStatusInfoMutex); - _downloadStatusInfo = info; - } - - void QueueNextDownload() - { - std::lock_guard guard(_queueMutex); - _nextDownloadQueued = true; - } - - void DownloadObject(const ObjectEntryDescriptor& entry, const std::string& name, const std::string& url) - { - try - { - Console::WriteLine("Downloading %s", url.c_str()); - Http::Request req; - req.method = Http::Method::GET; - req.url = url; - Http::DoAsync(req, [this, entry, name](Http::Response response) { - if (response.status == Http::Status::Ok) - { - // Check that download operation hasn't been cancelled - if (_downloadingObjects) - { - auto data = reinterpret_cast(response.body.data()); - auto dataLen = response.body.size(); - - auto& objRepo = OpenRCT2::GetContext()->GetObjectRepository(); - objRepo.AddObjectFromFile(ObjectGeneration::DAT, name, data, dataLen); - - std::lock_guard guard(_downloadedEntriesMutex); - _downloadedEntries.push_back(entry); - } - } - else - { - Console::Error::WriteLine(" Failed to download %s", name.c_str()); - } - QueueNextDownload(); - }); - } - catch (const std::exception&) - { - Console::Error::WriteLine(" Failed to download %s", name.c_str()); - QueueNextDownload(); - } - } - - void NextDownload() - { - if (!_downloadingObjects || _currentDownloadIndex >= _entries.size()) - { - // Finished... - _downloadingObjects = false; - UpdateProgress({}); - return; - } - - auto& entry = _entries[_currentDownloadIndex]; - auto name = String::Trim(std::string(entry.GetName())); - LOG_VERBOSE("Downloading object: [%s]:", name.c_str()); - _currentDownloadIndex++; - UpdateProgress({ name, _lastDownloadSource, _currentDownloadIndex, _entries.size() }); - try - { - Http::Request req; - req.method = Http::Method::GET; - req.url = OPENRCT2_API_LEGACY_OBJECT_URL + name; - Http::DoAsync(req, [this, entry, name](Http::Response response) { - if (response.status == Http::Status::Ok) - { - auto jresponse = Json::FromString(response.body); - if (jresponse.is_object()) - { - auto objName = Json::GetString(jresponse["name"]); - auto source = Json::GetString(jresponse["source"]); - auto downloadLink = Json::GetString(jresponse["download"]); - if (!downloadLink.empty()) - { - _lastDownloadSource = source; - UpdateProgress({ name, source, _currentDownloadIndex, _entries.size() }); - DownloadObject(entry, objName, downloadLink); - } - } - } - else if (response.status == Http::Status::NotFound) - { - Console::Error::WriteLine(" %s not found", name.c_str()); - QueueNextDownload(); - } - else - { - Console::Error::WriteLine( - " %s query failed (status %d)", name.c_str(), static_cast(response.status)); - QueueNextDownload(); - } - }); - } - catch (const std::exception&) - { - Console::Error::WriteLine(" Failed to query %s", name.c_str()); - } - } -}; - #endif -// clang-format off + // clang-format off enum WindowObjectLoadErrorWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -285,299 +286,301 @@ static Widget window_object_load_error_widgets[] = { #ifndef DISABLE_HTTP MakeWidget({ 300, 377}, {146, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_DOWNLOAD_ALL, STR_DOWNLOAD_ALL_TIP ), // Download all button #endif - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on - -/** - * Returns an StringId that represents an RCTObjectEntry's type. - * - * Could possibly be moved out of the window file if other - * uses exist and a suitable location is found. - */ -static constexpr StringId GetStringFromObjectType(const ObjectType type) -{ - switch (type) - { - case ObjectType::Ride: - return STR_OBJECT_SELECTION_RIDE_VEHICLES_ATTRACTIONS; - case ObjectType::SmallScenery: - return STR_OBJECT_SELECTION_SMALL_SCENERY; - case ObjectType::LargeScenery: - return STR_OBJECT_SELECTION_LARGE_SCENERY; - case ObjectType::Walls: - return STR_OBJECT_SELECTION_WALLS_FENCES; - case ObjectType::Banners: - return STR_OBJECT_SELECTION_PATH_SIGNS; - case ObjectType::Paths: - return STR_OBJECT_SELECTION_FOOTPATHS; - case ObjectType::PathAdditions: - return STR_OBJECT_SELECTION_PATH_EXTRAS; - case ObjectType::SceneryGroup: - return STR_OBJECT_SELECTION_SCENERY_GROUPS; - case ObjectType::ParkEntrance: - return STR_OBJECT_SELECTION_PARK_ENTRANCE; - case ObjectType::Water: - return STR_OBJECT_SELECTION_WATER; - default: - return STR_UNKNOWN_OBJECT_TYPE; - } -} - -class ObjectLoadErrorWindow final : public WindowBase -{ -private: - std::vector _invalidEntries; - int32_t _highlightedIndex = -1; - std::string _filePath; -#ifndef DISABLE_HTTP - ObjectDownloader _objDownloader; - bool _updatedListAfterDownload{}; - - void DownloadAllObjects() - { - if (!_objDownloader.IsDownloading()) - { - _updatedListAfterDownload = false; - _objDownloader.Begin(_invalidEntries); - } - } - - void UpdateObjectList() - { - const auto entries = _objDownloader.GetDownloadedEntries(); - for (auto& de : entries) - { - _invalidEntries.erase( - std::remove_if( - _invalidEntries.begin(), _invalidEntries.end(), - [de](const ObjectEntryDescriptor& e) { return de.GetName() == e.GetName(); }), - _invalidEntries.end()); - } - no_list_items = static_cast(_invalidEntries.size()); - } -#endif + // clang-format on /** - * Returns a newline-separated string listing all object names. - * Used for placing all names on the clipboard. + * Returns an StringId that represents an RCTObjectEntry's type. + * + * Could possibly be moved out of the window file if other + * uses exist and a suitable location is found. */ - void CopyObjectNamesToClipboard() + static constexpr StringId GetStringFromObjectType(const ObjectType type) { - std::stringstream stream; - for (uint16_t i = 0; i < no_list_items; i++) + switch (type) { - const auto& entry = _invalidEntries[i]; - stream << entry.GetName(); - stream << PLATFORM_NEWLINE; + case ObjectType::Ride: + return STR_OBJECT_SELECTION_RIDE_VEHICLES_ATTRACTIONS; + case ObjectType::SmallScenery: + return STR_OBJECT_SELECTION_SMALL_SCENERY; + case ObjectType::LargeScenery: + return STR_OBJECT_SELECTION_LARGE_SCENERY; + case ObjectType::Walls: + return STR_OBJECT_SELECTION_WALLS_FENCES; + case ObjectType::Banners: + return STR_OBJECT_SELECTION_PATH_SIGNS; + case ObjectType::Paths: + return STR_OBJECT_SELECTION_FOOTPATHS; + case ObjectType::PathAdditions: + return STR_OBJECT_SELECTION_PATH_EXTRAS; + case ObjectType::SceneryGroup: + return STR_OBJECT_SELECTION_SCENERY_GROUPS; + case ObjectType::ParkEntrance: + return STR_OBJECT_SELECTION_PARK_ENTRANCE; + case ObjectType::Water: + return STR_OBJECT_SELECTION_WATER; + default: + return STR_UNKNOWN_OBJECT_TYPE; } - - const auto clip = stream.str(); - OpenRCT2::GetContext()->GetUiContext()->SetClipboardText(clip.c_str()); } - void SelectObjectFromList(const int32_t index) + class ObjectLoadErrorWindow final : public Window { - if (index < 0 || index > no_list_items) - { - selected_list_item = -1; - } - else - { - selected_list_item = index; - } - WidgetInvalidate(*this, WIDX_SCROLL); - } - -public: - void OnOpen() override - { - widgets = window_object_load_error_widgets; - - WindowInitScrollWidgets(*this); - colours[0] = COLOUR_LIGHT_BLUE; - colours[1] = COLOUR_LIGHT_BLUE; - colours[2] = COLOUR_LIGHT_BLUE; - } - - void OnClose() override - { - _invalidEntries.clear(); - _invalidEntries.shrink_to_fit(); - } - - void OnMouseUp(const WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - WindowClose(*this); - return; - case WIDX_COPY_CURRENT: - if (selected_list_item > -1 && selected_list_item < no_list_items) - { - const auto name = std::string(_invalidEntries[selected_list_item].GetName()); - OpenRCT2::GetContext()->GetUiContext()->SetClipboardText(name.c_str()); - } - break; - case WIDX_COPY_ALL: - CopyObjectNamesToClipboard(); - break; + private: + std::vector _invalidEntries; + int32_t _highlightedIndex = -1; + std::string _filePath; #ifndef DISABLE_HTTP - case WIDX_DOWNLOAD_ALL: - DownloadAllObjects(); - break; -#endif - } - } + ObjectDownloader _objDownloader; + bool _updatedListAfterDownload{}; - void OnUpdate() override - { - frame_no++; - - // Check if the mouse is hovering over the list - if (!WidgetIsHighlighted(*this, WIDX_SCROLL)) + void DownloadAllObjects() { - _highlightedIndex = -1; + if (!_objDownloader.IsDownloading()) + { + _updatedListAfterDownload = false; + _objDownloader.Begin(_invalidEntries); + } + } + + void UpdateObjectList() + { + const auto entries = _objDownloader.GetDownloadedEntries(); + for (auto& de : entries) + { + _invalidEntries.erase( + std::remove_if( + _invalidEntries.begin(), _invalidEntries.end(), + [de](const ObjectEntryDescriptor& e) { return de.GetName() == e.GetName(); }), + _invalidEntries.end()); + } + no_list_items = static_cast(_invalidEntries.size()); + } +#endif + + /** + * Returns a newline-separated string listing all object names. + * Used for placing all names on the clipboard. + */ + void CopyObjectNamesToClipboard() + { + std::stringstream stream; + for (uint16_t i = 0; i < no_list_items; i++) + { + const auto& entry = _invalidEntries[i]; + stream << entry.GetName(); + stream << PLATFORM_NEWLINE; + } + + const auto clip = stream.str(); + OpenRCT2::GetContext()->GetUiContext()->SetClipboardText(clip.c_str()); + } + + void SelectObjectFromList(const int32_t index) + { + if (index < 0 || index > no_list_items) + { + selected_list_item = -1; + } + else + { + selected_list_item = index; + } WidgetInvalidate(*this, WIDX_SCROLL); } -#ifndef DISABLE_HTTP - _objDownloader.Update(); - - // Remove downloaded objects from our invalid entry list - if (_objDownloader.IsDownloading()) + public: + void OnOpen() override { - // Don't do this too often as it isn't particularly efficient - if (frame_no % 64 == 0) + widgets = window_object_load_error_widgets; + + WindowInitScrollWidgets(*this); + colours[0] = COLOUR_LIGHT_BLUE; + colours[1] = COLOUR_LIGHT_BLUE; + colours[2] = COLOUR_LIGHT_BLUE; + } + + void OnClose() override + { + _invalidEntries.clear(); + _invalidEntries.shrink_to_fit(); + } + + void OnMouseUp(const WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + WindowClose(*this); + return; + case WIDX_COPY_CURRENT: + if (selected_list_item > -1 && selected_list_item < no_list_items) + { + const auto name = std::string(_invalidEntries[selected_list_item].GetName()); + OpenRCT2::GetContext()->GetUiContext()->SetClipboardText(name.c_str()); + } + break; + case WIDX_COPY_ALL: + CopyObjectNamesToClipboard(); + break; +#ifndef DISABLE_HTTP + case WIDX_DOWNLOAD_ALL: + DownloadAllObjects(); + break; +#endif + } + } + + void OnUpdate() override + { + frame_no++; + + // Check if the mouse is hovering over the list + if (!WidgetIsHighlighted(*this, WIDX_SCROLL)) + { + _highlightedIndex = -1; + WidgetInvalidate(*this, WIDX_SCROLL); + } + +#ifndef DISABLE_HTTP + _objDownloader.Update(); + + // Remove downloaded objects from our invalid entry list + if (_objDownloader.IsDownloading()) + { + // Don't do this too often as it isn't particularly efficient + if (frame_no % 64 == 0) + { + UpdateObjectList(); + } + } + else if (!_updatedListAfterDownload) { UpdateObjectList(); + _updatedListAfterDownload = true; } - } - else if (!_updatedListAfterDownload) - { - UpdateObjectList(); - _updatedListAfterDownload = true; - } #endif - } - - ScreenSize OnScrollGetSize(const int32_t scrollIndex) override - { - return ScreenSize(0, no_list_items * SCROLLABLE_ROW_HEIGHT); - } - - void OnScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - const auto selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - SelectObjectFromList(selectedItem); - } - - void OnScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - // Highlight item that the cursor is over, or remove highlighting if none - const auto selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - if (selectedItem < 0 || selectedItem >= no_list_items) - _highlightedIndex = -1; - else - _highlightedIndex = selectedItem; - - WidgetInvalidate(*this, WIDX_SCROLL); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - WindowDrawWidgets(*this, dpi); - - // Draw explanatory message - auto ft = Formatter(); - ft.Add(STR_OBJECT_ERROR_WINDOW_EXPLANATION); - DrawTextWrapped(dpi, windowPos + ScreenCoordsXY{ 5, 18 }, WW - 10, STR_BLACK_STRING, ft); - - // Draw file name - ft = Formatter(); - ft.Add(STR_OBJECT_ERROR_WINDOW_FILE); - ft.Add(_filePath.c_str()); - DrawTextEllipsised(dpi, { windowPos.x + 5, windowPos.y + 43 }, WW - 5, STR_BLACK_STRING, ft); - } - - void OnScrollDraw(const int32_t scrollIndex, DrawPixelInfo& dpi) override - { - auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; - GfxFillRect( - dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width - 1, dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); - const int32_t listWidth = widgets[WIDX_SCROLL].width(); - - for (int32_t i = 0; i < no_list_items; i++) - { - ScreenCoordsXY screenCoords; - screenCoords.y = i * SCROLLABLE_ROW_HEIGHT; - if (screenCoords.y > dpi.y + dpi.height) - break; - - if (screenCoords.y + SCROLLABLE_ROW_HEIGHT < dpi.y) - continue; - - const auto screenRect = ScreenRect{ { 0, screenCoords.y }, - { listWidth, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } }; - // If hovering over item, change the color and fill the backdrop. - if (i == selected_list_item) - GfxFillRect(dpi, screenRect, ColourMapA[colours[1]].darker); - else if (i == _highlightedIndex) - GfxFillRect(dpi, screenRect, ColourMapA[colours[1]].mid_dark); - else if ((i & 1) != 0) // odd / even check - GfxFillRect(dpi, screenRect, ColourMapA[colours[1]].light); - - // Draw the actual object entry's name... - screenCoords.x = NAME_COL_LEFT - 3; - - const auto& entry = _invalidEntries[i]; - - auto name = entry.GetName(); - char buffer[256]; - String::Set(buffer, sizeof(buffer), name.data(), name.size()); - GfxDrawString(dpi, screenCoords, buffer, { COLOUR_DARK_GREEN }); - - if (entry.Generation == ObjectGeneration::DAT) - { - // ... source game ... - const auto sourceStringId = ObjectManagerGetSourceGameString(entry.Entry.GetSourceGame()); - DrawTextBasic(dpi, { SOURCE_COL_LEFT - 3, screenCoords.y }, sourceStringId, {}, { COLOUR_DARK_GREEN }); - } - - // ... and type - const auto type = GetStringFromObjectType(entry.GetType()); - DrawTextBasic(dpi, { TYPE_COL_LEFT - 3, screenCoords.y }, type, {}, { COLOUR_DARK_GREEN }); } - } - void OnResize() override + ScreenSize OnScrollGetSize(const int32_t scrollIndex) override + { + return ScreenSize(0, no_list_items * SCROLLABLE_ROW_HEIGHT); + } + + void OnScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + const auto selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + SelectObjectFromList(selectedItem); + } + + void OnScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + // Highlight item that the cursor is over, or remove highlighting if none + const auto selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + if (selectedItem < 0 || selectedItem >= no_list_items) + _highlightedIndex = -1; + else + _highlightedIndex = selectedItem; + + WidgetInvalidate(*this, WIDX_SCROLL); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + WindowDrawWidgets(*this, dpi); + + // Draw explanatory message + auto ft = Formatter(); + ft.Add(STR_OBJECT_ERROR_WINDOW_EXPLANATION); + DrawTextWrapped(dpi, windowPos + ScreenCoordsXY{ 5, 18 }, WW - 10, STR_BLACK_STRING, ft); + + // Draw file name + ft = Formatter(); + ft.Add(STR_OBJECT_ERROR_WINDOW_FILE); + ft.Add(_filePath.c_str()); + DrawTextEllipsised(dpi, { windowPos.x + 5, windowPos.y + 43 }, WW - 5, STR_BLACK_STRING, ft); + } + + void OnScrollDraw(const int32_t scrollIndex, DrawPixelInfo& dpi) override + { + auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; + GfxFillRect( + dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width - 1, dpi.height - 1 } }, + ColourMapA[colours[1]].mid_light); + const int32_t listWidth = widgets[WIDX_SCROLL].width(); + + for (int32_t i = 0; i < no_list_items; i++) + { + ScreenCoordsXY screenCoords; + screenCoords.y = i * SCROLLABLE_ROW_HEIGHT; + if (screenCoords.y > dpi.y + dpi.height) + break; + + if (screenCoords.y + SCROLLABLE_ROW_HEIGHT < dpi.y) + continue; + + const auto screenRect = ScreenRect{ { 0, screenCoords.y }, + { listWidth, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } }; + // If hovering over item, change the color and fill the backdrop. + if (i == selected_list_item) + GfxFillRect(dpi, screenRect, ColourMapA[colours[1]].darker); + else if (i == _highlightedIndex) + GfxFillRect(dpi, screenRect, ColourMapA[colours[1]].mid_dark); + else if ((i & 1) != 0) // odd / even check + GfxFillRect(dpi, screenRect, ColourMapA[colours[1]].light); + + // Draw the actual object entry's name... + screenCoords.x = NAME_COL_LEFT - 3; + + const auto& entry = _invalidEntries[i]; + + auto name = entry.GetName(); + char buffer[256]; + String::Set(buffer, sizeof(buffer), name.data(), name.size()); + GfxDrawString(dpi, screenCoords, buffer, { COLOUR_DARK_GREEN }); + + if (entry.Generation == ObjectGeneration::DAT) + { + // ... source game ... + const auto sourceStringId = ObjectManagerGetSourceGameString(entry.Entry.GetSourceGame()); + DrawTextBasic(dpi, { SOURCE_COL_LEFT - 3, screenCoords.y }, sourceStringId, {}, { COLOUR_DARK_GREEN }); + } + + // ... and type + const auto type = GetStringFromObjectType(entry.GetType()); + DrawTextBasic(dpi, { TYPE_COL_LEFT - 3, screenCoords.y }, type, {}, { COLOUR_DARK_GREEN }); + } + } + + void OnResize() override + { + ResizeFrame(); + } + + void Initialise(utf8* path, const size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects) + { + _invalidEntries = std::vector(missingObjects, missingObjects + numMissingObjects); + + // Refresh list items and path + no_list_items = static_cast(numMissingObjects); + _filePath = path; + + Invalidate(); + } + }; + + WindowBase* ObjectLoadErrorOpen(utf8* path, size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects) { - ResizeFrame(); + // Check if window is already open + auto* window = WindowBringToFrontByClass(WindowClass::ObjectLoadError); + if (window == nullptr) + { + window = WindowCreate(WindowClass::ObjectLoadError, WW, WH, 0); + } + + static_cast(window)->Initialise(path, numMissingObjects, missingObjects); + + return window; } - - void Initialise(utf8* path, const size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects) - { - _invalidEntries = std::vector(missingObjects, missingObjects + numMissingObjects); - - // Refresh list items and path - no_list_items = static_cast(numMissingObjects); - _filePath = path; - - Invalidate(); - } -}; - -WindowBase* WindowObjectLoadErrorOpen(utf8* path, size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects) -{ - // Check if window is already open - auto* window = WindowBringToFrontByClass(WindowClass::ObjectLoadError); - if (window == nullptr) - { - window = WindowCreate(WindowClass::ObjectLoadError, WW, WH, 0); - } - - static_cast(window)->Initialise(path, numMissingObjects, missingObjects); - - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 93995d3e7b..325f915ff5 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -46,10 +46,10 @@ #include #include -using namespace OpenRCT2; using namespace OpenRCT2::Audio; - -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum WindowOptionsPage { WINDOW_OPTIONS_PAGE_DISPLAY, WINDOW_OPTIONS_PAGE_RENDERING, @@ -249,7 +249,7 @@ static Widget window_options_display_widgets[] = { MakeWidget ({ 11, 176}, {143, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_USE_VSYNC, STR_USE_VSYNC_TIP ), // Use vsync MakeWidget ({ 11, 191}, {280, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MINIMISE_FULLSCREEN_ON_FOCUS_LOSS, STR_MINIMISE_FULLSCREEN_ON_FOCUS_LOSS_TIP), // Minimise fullscreen focus loss MakeWidget ({ 11, 206}, {280, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DISABLE_SCREENSAVER, STR_DISABLE_SCREENSAVER_TIP ), // Disable screensaver - WIDGETS_END, + kWidgetsEnd, }; static Widget window_options_rendering_widgets[] = { @@ -273,7 +273,7 @@ static Widget window_options_rendering_widgets[] = { MakeWidget({10, FRAME_EFFECTS_START + 60}, {281, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_RENDER_WEATHER_EFFECTS, STR_RENDER_WEATHER_EFFECTS_TIP ), // Render weather effects MakeWidget({25, FRAME_EFFECTS_START + 75}, {266, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DISABLE_LIGHTNING_EFFECT, STR_DISABLE_LIGHTNING_EFFECT_TIP), // Disable lightning effect #undef FRAME_EFFECTS_START - WIDGETS_END, + kWidgetsEnd, }; static Widget window_options_culture_widgets[] = { @@ -296,7 +296,7 @@ static Widget window_options_culture_widgets[] = { MakeWidget({ 10, 128}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_DATE_FORMAT, STR_DATE_FORMAT_TIP ), // Date format MakeWidget({155, 128}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), MakeWidget({288, 129}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DATE_FORMAT_TIP ), - WIDGETS_END, + kWidgetsEnd, }; static Widget window_options_audio_widgets[] = { @@ -313,7 +313,7 @@ static Widget window_options_audio_widgets[] = { MakeWidget({155, 68}, {145, 13}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), // Master volume MakeWidget({155, 83}, {145, 13}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), // Sound effect volume MakeWidget({155, 98}, {145, 13}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), // Music volume - WIDGETS_END, + kWidgetsEnd, }; static Widget window_options_controls_and_interface_widgets[] = { @@ -344,7 +344,7 @@ static Widget window_options_controls_and_interface_widgets[] = { MakeWidget({ 24, TOOLBAR_GROUP_START + 61}, {162, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_MUTE_BUTTON_ON_TOOLBAR, STR_MUTE_BUTTON_ON_TOOLBAR_TIP ), // Mute MakeWidget({155, TOOLBAR_GROUP_START + 61}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_CHAT_BUTTON_ON_TOOLBAR, STR_CHAT_BUTTON_ON_TOOLBAR_TIP ), // Chat MakeWidget({ 24, TOOLBAR_GROUP_START + 76}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ZOOM_BUTTON_ON_TOOLBAR, STR_ZOOM_BUTTON_ON_TOOLBAR_TIP ), // Zoom - WIDGETS_END, + kWidgetsEnd, #undef TOOLBAR_GROUP_START }; @@ -374,7 +374,7 @@ static Widget window_options_misc_widgets[] = { MakeWidget({ 10, TWEAKS_START + 62}, {165, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_DEFAULT_INSPECTION_INTERVAL, STR_DEFAULT_INSPECTION_INTERVAL_TIP), MakeWidget({175, TWEAKS_START + 61}, {125, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Default inspection time dropdown MakeWidget({288, TWEAKS_START + 62}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DEFAULT_INSPECTION_INTERVAL_TIP ), // Default inspection time dropdown button - WIDGETS_END, + kWidgetsEnd, }; #undef TWEAKS_START @@ -397,7 +397,7 @@ static Widget window_options_advanced_widgets[] = { MakeWidget ({ 24, 184}, {266, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_NONE, STR_STRING_TOOLTIP ), // RCT 1 path button MakeWidget ({289, 184}, { 11, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CLOSE_X, STR_PATH_TO_RCT1_CLEAR_TIP ), // RCT 1 path clear button MakeWidget ({ 24, 200}, {140, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_ASSET_PACKS, STR_NONE ), // Asset packs - WIDGETS_END, + kWidgetsEnd, }; static Widget *window_options_page_widgets[] = { @@ -411,1791 +411,1798 @@ static Widget *window_options_page_widgets[] = { }; #pragma endregion -// clang-format on + // clang-format on -class OptionsWindow final : public Window -{ -public: - void OnOpen() override + class OptionsWindow final : public Window { - widgets = window_options_display_widgets; - page = WINDOW_OPTIONS_PAGE_DISPLAY; - frame_no = 0; - InitScrollWidgets(); - } + public: + void OnOpen() override + { + widgets = window_options_display_widgets; + page = WINDOW_OPTIONS_PAGE_DISPLAY; + frame_no = 0; + InitScrollWidgets(); + } - void OnMouseUp(WidgetIndex widgetIndex) override - { - if (widgetIndex < WIDX_PAGE_START) - CommonMouseUp(widgetIndex); - else + void OnMouseUp(WidgetIndex widgetIndex) override + { + if (widgetIndex < WIDX_PAGE_START) + CommonMouseUp(widgetIndex); + else + { + switch (page) + { + case WINDOW_OPTIONS_PAGE_DISPLAY: + DisplayMouseUp(widgetIndex); + break; + case WINDOW_OPTIONS_PAGE_RENDERING: + RenderingMouseUp(widgetIndex); + break; + case WINDOW_OPTIONS_PAGE_AUDIO: + AudioMouseUp(widgetIndex); + break; + case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: + ControlsMouseUp(widgetIndex); + break; + case WINDOW_OPTIONS_PAGE_MISC: + MiscMouseUp(widgetIndex); + break; + case WINDOW_OPTIONS_PAGE_ADVANCED: + AdvancedMouseUp(widgetIndex); + break; + case WINDOW_OPTIONS_PAGE_CULTURE: + default: + break; + } + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override { switch (page) { case WINDOW_OPTIONS_PAGE_DISPLAY: - DisplayMouseUp(widgetIndex); + DisplayMouseDown(widgetIndex); break; case WINDOW_OPTIONS_PAGE_RENDERING: - RenderingMouseUp(widgetIndex); - break; - case WINDOW_OPTIONS_PAGE_AUDIO: - AudioMouseUp(widgetIndex); - break; - case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: - ControlsMouseUp(widgetIndex); - break; - case WINDOW_OPTIONS_PAGE_MISC: - MiscMouseUp(widgetIndex); - break; - case WINDOW_OPTIONS_PAGE_ADVANCED: - AdvancedMouseUp(widgetIndex); + RenderingMouseDown(widgetIndex); break; case WINDOW_OPTIONS_PAGE_CULTURE: + CultureMouseDown(widgetIndex); + break; + case WINDOW_OPTIONS_PAGE_AUDIO: + AudioMouseDown(widgetIndex); + break; + case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: + ControlsMouseDown(widgetIndex); + break; + case WINDOW_OPTIONS_PAGE_MISC: + MiscMouseDown(widgetIndex); + break; + case WINDOW_OPTIONS_PAGE_ADVANCED: + AdvancedMouseDown(widgetIndex); + break; default: break; } } - } - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (page) + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { - case WINDOW_OPTIONS_PAGE_DISPLAY: - DisplayMouseDown(widgetIndex); - break; - case WINDOW_OPTIONS_PAGE_RENDERING: - RenderingMouseDown(widgetIndex); - break; - case WINDOW_OPTIONS_PAGE_CULTURE: - CultureMouseDown(widgetIndex); - break; - case WINDOW_OPTIONS_PAGE_AUDIO: - AudioMouseDown(widgetIndex); - break; - case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: - ControlsMouseDown(widgetIndex); - break; - case WINDOW_OPTIONS_PAGE_MISC: - MiscMouseDown(widgetIndex); - break; - case WINDOW_OPTIONS_PAGE_ADVANCED: - AdvancedMouseDown(widgetIndex); - break; - default: - break; - } - } + if (dropdownIndex == -1) + return; - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - if (dropdownIndex == -1) - return; - - switch (page) - { - case WINDOW_OPTIONS_PAGE_DISPLAY: - DisplayDropdown(widgetIndex, dropdownIndex); - break; - case WINDOW_OPTIONS_PAGE_RENDERING: - RenderingDropdown(widgetIndex, dropdownIndex); - break; - case WINDOW_OPTIONS_PAGE_CULTURE: - CultureDropdown(widgetIndex, dropdownIndex); - break; - case WINDOW_OPTIONS_PAGE_AUDIO: - AudioDropdown(widgetIndex, dropdownIndex); - break; - case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: - ControlsDropdown(widgetIndex, dropdownIndex); - break; - case WINDOW_OPTIONS_PAGE_MISC: - MiscDropdown(widgetIndex, dropdownIndex); - break; - case WINDOW_OPTIONS_PAGE_ADVANCED: - AdvancedDropdown(widgetIndex, dropdownIndex); - break; - default: - break; - } - } - - void OnPrepareDraw() override - { - CommonPrepareDrawBefore(); - - switch (page) - { - case WINDOW_OPTIONS_PAGE_DISPLAY: - DisplayPrepareDraw(); - break; - case WINDOW_OPTIONS_PAGE_RENDERING: - RenderingPrepareDraw(); - break; - case WINDOW_OPTIONS_PAGE_CULTURE: - CulturePrepareDraw(); - break; - case WINDOW_OPTIONS_PAGE_AUDIO: - AudioPrepareDraw(); - break; - case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: - ControlsPrepareDraw(); - break; - case WINDOW_OPTIONS_PAGE_MISC: - MiscPrepareDraw(); - break; - case WINDOW_OPTIONS_PAGE_ADVANCED: - AdvancedPrepareDraw(); - break; - default: - break; + switch (page) + { + case WINDOW_OPTIONS_PAGE_DISPLAY: + DisplayDropdown(widgetIndex, dropdownIndex); + break; + case WINDOW_OPTIONS_PAGE_RENDERING: + RenderingDropdown(widgetIndex, dropdownIndex); + break; + case WINDOW_OPTIONS_PAGE_CULTURE: + CultureDropdown(widgetIndex, dropdownIndex); + break; + case WINDOW_OPTIONS_PAGE_AUDIO: + AudioDropdown(widgetIndex, dropdownIndex); + break; + case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: + ControlsDropdown(widgetIndex, dropdownIndex); + break; + case WINDOW_OPTIONS_PAGE_MISC: + MiscDropdown(widgetIndex, dropdownIndex); + break; + case WINDOW_OPTIONS_PAGE_ADVANCED: + AdvancedDropdown(widgetIndex, dropdownIndex); + break; + default: + break; + } } - CommonPrepareDrawAfter(); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - switch (page) + void OnPrepareDraw() override { - case WINDOW_OPTIONS_PAGE_DISPLAY: - DisplayDraw(dpi); - break; - case WINDOW_OPTIONS_PAGE_ADVANCED: - AdvancedDraw(dpi); - break; - default: - break; + CommonPrepareDrawBefore(); + + switch (page) + { + case WINDOW_OPTIONS_PAGE_DISPLAY: + DisplayPrepareDraw(); + break; + case WINDOW_OPTIONS_PAGE_RENDERING: + RenderingPrepareDraw(); + break; + case WINDOW_OPTIONS_PAGE_CULTURE: + CulturePrepareDraw(); + break; + case WINDOW_OPTIONS_PAGE_AUDIO: + AudioPrepareDraw(); + break; + case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: + ControlsPrepareDraw(); + break; + case WINDOW_OPTIONS_PAGE_MISC: + MiscPrepareDraw(); + break; + case WINDOW_OPTIONS_PAGE_ADVANCED: + AdvancedPrepareDraw(); + break; + default: + break; + } + + CommonPrepareDrawAfter(); } - } - void OnUpdate() override - { - CommonUpdate(); - - switch (page) + void OnDraw(DrawPixelInfo& dpi) override { - case WINDOW_OPTIONS_PAGE_AUDIO: - AudioUpdate(); - break; - case WINDOW_OPTIONS_PAGE_DISPLAY: - case WINDOW_OPTIONS_PAGE_RENDERING: - case WINDOW_OPTIONS_PAGE_CULTURE: - case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: - case WINDOW_OPTIONS_PAGE_MISC: - case WINDOW_OPTIONS_PAGE_ADVANCED: - default: - break; - } - } + DrawWidgets(dpi); + DrawTabImages(dpi); - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - switch (page) + switch (page) + { + case WINDOW_OPTIONS_PAGE_DISPLAY: + DisplayDraw(dpi); + break; + case WINDOW_OPTIONS_PAGE_ADVANCED: + AdvancedDraw(dpi); + break; + default: + break; + } + } + + void OnUpdate() override { - case WINDOW_OPTIONS_PAGE_AUDIO: - return AudioScrollGetSize(scrollIndex); - case WINDOW_OPTIONS_PAGE_DISPLAY: - case WINDOW_OPTIONS_PAGE_RENDERING: - case WINDOW_OPTIONS_PAGE_CULTURE: - case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: - case WINDOW_OPTIONS_PAGE_MISC: - case WINDOW_OPTIONS_PAGE_ADVANCED: - default: - return { WW, WH }; + CommonUpdate(); + + switch (page) + { + case WINDOW_OPTIONS_PAGE_AUDIO: + AudioUpdate(); + break; + case WINDOW_OPTIONS_PAGE_DISPLAY: + case WINDOW_OPTIONS_PAGE_RENDERING: + case WINDOW_OPTIONS_PAGE_CULTURE: + case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: + case WINDOW_OPTIONS_PAGE_MISC: + case WINDOW_OPTIONS_PAGE_ADVANCED: + default: + break; + } } - } - OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override - { - if (page == WINDOW_OPTIONS_PAGE_ADVANCED) - return AdvancedTooltip(widgetIndex, fallback); + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + switch (page) + { + case WINDOW_OPTIONS_PAGE_AUDIO: + return AudioScrollGetSize(scrollIndex); + case WINDOW_OPTIONS_PAGE_DISPLAY: + case WINDOW_OPTIONS_PAGE_RENDERING: + case WINDOW_OPTIONS_PAGE_CULTURE: + case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE: + case WINDOW_OPTIONS_PAGE_MISC: + case WINDOW_OPTIONS_PAGE_ADVANCED: + default: + return { WW, WH }; + } + } - return WindowBase::OnTooltip(widgetIndex, fallback); - } + OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override + { + if (page == WINDOW_OPTIONS_PAGE_ADVANCED) + return AdvancedTooltip(widgetIndex, fallback); -private: + return WindowBase::OnTooltip(widgetIndex, fallback); + } + + private: #pragma region Common events - void CommonMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void CommonMouseUp(WidgetIndex widgetIndex) { - case WIDX_CLOSE: - WindowClose(*this); - break; - case WIDX_TAB_DISPLAY: - case WIDX_TAB_RENDERING: - case WIDX_TAB_CULTURE: - case WIDX_TAB_AUDIO: - case WIDX_TAB_CONTROLS_AND_INTERFACE: - case WIDX_TAB_MISC: - case WIDX_TAB_ADVANCED: - SetPage(widgetIndex - WIDX_FIRST_TAB); - break; + switch (widgetIndex) + { + case WIDX_CLOSE: + WindowClose(*this); + break; + case WIDX_TAB_DISPLAY: + case WIDX_TAB_RENDERING: + case WIDX_TAB_CULTURE: + case WIDX_TAB_AUDIO: + case WIDX_TAB_CONTROLS_AND_INTERFACE: + case WIDX_TAB_MISC: + case WIDX_TAB_ADVANCED: + SetPage(widgetIndex - WIDX_FIRST_TAB); + break; + } } - } - void CommonPrepareDrawBefore() - { - if (window_options_page_widgets[page] != widgets) + void CommonPrepareDrawBefore() { - widgets = window_options_page_widgets[page]; - InitScrollWidgets(); - } - SetPressedTab(); + if (window_options_page_widgets[page] != widgets) + { + widgets = window_options_page_widgets[page]; + InitScrollWidgets(); + } + SetPressedTab(); - disabled_widgets = 0; - auto hasFilePicker = OpenRCT2::GetContext()->GetUiContext()->HasFilePicker(); - const bool controlsTabSelected = (WIDX_FIRST_TAB + page) == WIDX_TAB_CONTROLS_AND_INTERFACE; - if (!hasFilePicker && controlsTabSelected) + disabled_widgets = 0; + auto hasFilePicker = OpenRCT2::GetContext()->GetUiContext()->HasFilePicker(); + const bool controlsTabSelected = (WIDX_FIRST_TAB + page) == WIDX_TAB_CONTROLS_AND_INTERFACE; + if (!hasFilePicker && controlsTabSelected) + { + disabled_widgets |= (1uLL << WIDX_ALWAYS_NATIVE_LOADSAVE); + widgets[WIDX_ALWAYS_NATIVE_LOADSAVE].type = WindowWidgetType::Empty; + } + } + + void CommonPrepareDrawAfter() { - disabled_widgets |= (1uLL << WIDX_ALWAYS_NATIVE_LOADSAVE); - widgets[WIDX_ALWAYS_NATIVE_LOADSAVE].type = WindowWidgetType::Empty; + // Automatically adjust window height to fit widgets + int32_t y = 0; + for (auto widget = &widgets[WIDX_PAGE_START]; widget->type != WindowWidgetType::Last; widget++) + { + y = std::max(y, widget->bottom); + } + height = y + 6; + ResizeFrameWithPage(); } - } - void CommonPrepareDrawAfter() - { - // Automatically adjust window height to fit widgets - int32_t y = 0; - for (auto widget = &widgets[WIDX_PAGE_START]; widget->type != WindowWidgetType::Last; widget++) + void OnResize() override { - y = std::max(y, widget->bottom); + ResizeFrameWithPage(); } - height = y + 6; - ResizeFrameWithPage(); - } - void OnResize() override - { - ResizeFrameWithPage(); - } - - void CommonUpdate() - { - // Tab animation - frame_no++; - InvalidateWidget(WIDX_FIRST_TAB + page); - } + void CommonUpdate() + { + // Tab animation + frame_no++; + InvalidateWidget(WIDX_FIRST_TAB + page); + } #pragma endregion #pragma region Display tab events - void DisplayMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void DisplayMouseUp(WidgetIndex widgetIndex) { - case WIDX_UNCAP_FPS_CHECKBOX: - gConfigGeneral.UncapFPS ^= 1; - DrawingEngineSetVSync(gConfigGeneral.UseVSync); - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_USE_VSYNC_CHECKBOX: - gConfigGeneral.UseVSync ^= 1; - DrawingEngineSetVSync(gConfigGeneral.UseVSync); - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_SHOW_FPS_CHECKBOX: - gConfigGeneral.ShowFPS ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_MULTITHREADING_CHECKBOX: - gConfigGeneral.MultiThreading ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_MINIMIZE_FOCUS_LOSS: - gConfigGeneral.MinimizeFullscreenFocusLoss ^= 1; - RefreshVideo(false); - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_STEAM_OVERLAY_PAUSE: - gConfigGeneral.SteamOverlayPause ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_DISABLE_SCREENSAVER_LOCK: - gConfigGeneral.DisableScreensaver ^= 1; - ApplyScreenSaverLockSetting(); - ConfigSaveDefault(); - Invalidate(); - break; - } - } - - void DisplayMouseDown(WidgetIndex widgetIndex) - { - Widget* widget = &widgets[widgetIndex - 1]; - - switch (widgetIndex) - { - case WIDX_RESOLUTION_DROPDOWN: + switch (widgetIndex) { - const auto& resolutions = OpenRCT2::GetContext()->GetUiContext()->GetFullscreenResolutions(); - - int32_t selectedResolution = -1; - for (size_t i = 0; i < resolutions.size(); i++) - { - const Resolution& resolution = resolutions[i]; - - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - - uint16_t* args = reinterpret_cast(&gDropdownItems[i].Args); - args[0] = STR_RESOLUTION_X_BY_Y; - args[1] = resolution.Width; - args[2] = resolution.Height; - - if (resolution.Width == gConfigGeneral.FullscreenWidth - && resolution.Height == gConfigGeneral.FullscreenHeight) - { - selectedResolution = static_cast(i); - } - } - - ShowDropdown(widget, static_cast(resolutions.size())); - - if (selectedResolution != -1 && selectedResolution < 32) - { - Dropdown::SetChecked(selectedResolution, true); - } - } - - break; - case WIDX_FULLSCREEN_DROPDOWN: - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[2].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_OPTIONS_DISPLAY_WINDOWED; - gDropdownItems[1].Args = STR_OPTIONS_DISPLAY_FULLSCREEN; - gDropdownItems[2].Args = STR_OPTIONS_DISPLAY_FULLSCREEN_BORDERLESS; - - ShowDropdown(widget, 3); - - Dropdown::SetChecked(gConfigGeneral.FullscreenMode, true); - break; - case WIDX_DRAWING_ENGINE_DROPDOWN: - { - int32_t numItems = 3; -#ifdef DISABLE_OPENGL - numItems = 2; -#endif - - for (int32_t i = 0; i < numItems; i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = DrawingEngineStringIds[i]; - } - ShowDropdown(widget, numItems); - Dropdown::SetChecked(EnumValue(gConfigGeneral.DrawingEngine), true); - break; - } - case WIDX_SCALE_UP: - gConfigGeneral.WindowScale += 0.25f; - ConfigSaveDefault(); - GfxInvalidateScreen(); - ContextTriggerResize(); - ContextUpdateCursorScale(); - break; - case WIDX_SCALE_DOWN: - gConfigGeneral.WindowScale -= 0.25f; - gConfigGeneral.WindowScale = std::max(0.5f, gConfigGeneral.WindowScale); - ConfigSaveDefault(); - GfxInvalidateScreen(); - ContextTriggerResize(); - ContextUpdateCursorScale(); - break; - } - } - - void DisplayDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - switch (widgetIndex) - { - case WIDX_RESOLUTION_DROPDOWN: - { - const auto& resolutions = OpenRCT2::GetContext()->GetUiContext()->GetFullscreenResolutions(); - - const Resolution& resolution = resolutions[dropdownIndex]; - if (resolution.Width != gConfigGeneral.FullscreenWidth || resolution.Height != gConfigGeneral.FullscreenHeight) - { - gConfigGeneral.FullscreenWidth = resolution.Width; - gConfigGeneral.FullscreenHeight = resolution.Height; - - if (gConfigGeneral.FullscreenMode == static_cast(OpenRCT2::Ui::FULLSCREEN_MODE::FULLSCREEN)) - ContextSetFullscreenMode(static_cast(OpenRCT2::Ui::FULLSCREEN_MODE::FULLSCREEN)); - - ConfigSaveDefault(); - GfxInvalidateScreen(); - } - } - break; - case WIDX_FULLSCREEN_DROPDOWN: - if (dropdownIndex != gConfigGeneral.FullscreenMode) - { - ContextSetFullscreenMode(dropdownIndex); - - gConfigGeneral.FullscreenMode = static_cast(dropdownIndex); - ConfigSaveDefault(); - GfxInvalidateScreen(); - } - break; - case WIDX_DRAWING_ENGINE_DROPDOWN: - if (dropdownIndex != EnumValue(gConfigGeneral.DrawingEngine)) - { - DrawingEngine srcEngine = drawing_engine_get_type(); - DrawingEngine dstEngine = static_cast(dropdownIndex); - - gConfigGeneral.DrawingEngine = dstEngine; - bool recreate_window = DrawingEngineRequiresNewWindow(srcEngine, dstEngine); - RefreshVideo(recreate_window); + case WIDX_UNCAP_FPS_CHECKBOX: + gConfigGeneral.UncapFPS ^= 1; + DrawingEngineSetVSync(gConfigGeneral.UseVSync); ConfigSaveDefault(); Invalidate(); - } - break; - } - } - - void DisplayPrepareDraw() - { - // Resolution dropdown caption. - auto ft = Formatter::Common(); - ft.Increment(16); - ft.Add(static_cast(gConfigGeneral.FullscreenWidth)); - ft.Add(static_cast(gConfigGeneral.FullscreenHeight)); - - // Disable resolution dropdown on "Windowed" and "Fullscreen (desktop)" - if (gConfigGeneral.FullscreenMode != static_cast(OpenRCT2::Ui::FULLSCREEN_MODE::FULLSCREEN)) - { - disabled_widgets |= (1uLL << WIDX_RESOLUTION_DROPDOWN); - disabled_widgets |= (1uLL << WIDX_RESOLUTION); - disabled_widgets |= (1uLL << WIDX_RESOLUTION_LABEL); - } - else - { - disabled_widgets &= ~(1uLL << WIDX_RESOLUTION_DROPDOWN); - disabled_widgets &= ~(1uLL << WIDX_RESOLUTION); - disabled_widgets &= ~(1uLL << WIDX_RESOLUTION_LABEL); - } - - // Disable Steam Overlay checkbox when using software or OpenGL rendering. - if (gConfigGeneral.DrawingEngine == DrawingEngine::Software || gConfigGeneral.DrawingEngine == DrawingEngine::OpenGL) - { - disabled_widgets |= (1uLL << WIDX_STEAM_OVERLAY_PAUSE); - } - else - { - disabled_widgets &= ~(1uLL << WIDX_STEAM_OVERLAY_PAUSE); - } - - // Disable changing VSync for Software engine, as we can't control its use of VSync - if (gConfigGeneral.DrawingEngine == DrawingEngine::Software) - { - disabled_widgets |= (1uLL << WIDX_USE_VSYNC_CHECKBOX); - } - else - { - disabled_widgets &= ~(1uLL << WIDX_USE_VSYNC_CHECKBOX); - } - - SetCheckboxValue(WIDX_UNCAP_FPS_CHECKBOX, gConfigGeneral.UncapFPS); - SetCheckboxValue(WIDX_USE_VSYNC_CHECKBOX, gConfigGeneral.UseVSync); - SetCheckboxValue(WIDX_SHOW_FPS_CHECKBOX, gConfigGeneral.ShowFPS); - SetCheckboxValue(WIDX_MULTITHREADING_CHECKBOX, gConfigGeneral.MultiThreading); - SetCheckboxValue(WIDX_MINIMIZE_FOCUS_LOSS, gConfigGeneral.MinimizeFullscreenFocusLoss); - SetCheckboxValue(WIDX_STEAM_OVERLAY_PAUSE, gConfigGeneral.SteamOverlayPause); - SetCheckboxValue(WIDX_DISABLE_SCREENSAVER_LOCK, gConfigGeneral.DisableScreensaver); - - // Dropdown captions for straightforward strings. - widgets[WIDX_FULLSCREEN].text = FullscreenModeNames[gConfigGeneral.FullscreenMode]; - widgets[WIDX_DRAWING_ENGINE].text = DrawingEngineStringIds[EnumValue(gConfigGeneral.DrawingEngine)]; - } - - void DisplayDraw(DrawPixelInfo& dpi) - { - auto ft = Formatter(); - ft.Add(static_cast(gConfigGeneral.WindowScale * 100)); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_SCALE].left + 1, widgets[WIDX_SCALE].top + 1 }, - STR_WINDOW_COLOUR_2_COMMA2DP32, ft, { colours[1] }); - } -#pragma endregion - -#pragma region Rendering tab events - void RenderingMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_TILE_SMOOTHING_CHECKBOX: - gConfigGeneral.LandscapeSmoothing ^= 1; - ConfigSaveDefault(); - GfxInvalidateScreen(); - break; - case WIDX_GRIDLINES_CHECKBOX: - { - gConfigGeneral.AlwaysShowGridlines ^= 1; - ConfigSaveDefault(); - GfxInvalidateScreen(); - WindowBase* mainWindow = WindowGetMain(); - if (mainWindow != nullptr) - { - if (gConfigGeneral.AlwaysShowGridlines) - mainWindow->viewport->flags |= VIEWPORT_FLAG_GRIDLINES; - else - mainWindow->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES; - } - break; + break; + case WIDX_USE_VSYNC_CHECKBOX: + gConfigGeneral.UseVSync ^= 1; + DrawingEngineSetVSync(gConfigGeneral.UseVSync); + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_SHOW_FPS_CHECKBOX: + gConfigGeneral.ShowFPS ^= 1; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_MULTITHREADING_CHECKBOX: + gConfigGeneral.MultiThreading ^= 1; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_MINIMIZE_FOCUS_LOSS: + gConfigGeneral.MinimizeFullscreenFocusLoss ^= 1; + RefreshVideo(false); + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_STEAM_OVERLAY_PAUSE: + gConfigGeneral.SteamOverlayPause ^= 1; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_DISABLE_SCREENSAVER_LOCK: + gConfigGeneral.DisableScreensaver ^= 1; + ApplyScreenSaverLockSetting(); + ConfigSaveDefault(); + Invalidate(); + break; } - case WIDX_DAY_NIGHT_CHECKBOX: - gConfigGeneral.DayNightCycle ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_ENABLE_LIGHT_FX_CHECKBOX: - gConfigGeneral.EnableLightFx ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX: - gConfigGeneral.EnableLightFxForVehicles ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_UPPER_CASE_BANNERS_CHECKBOX: - gConfigGeneral.UpperCaseBanners ^= 1; - ConfigSaveDefault(); - Invalidate(); - ScrollingTextInvalidate(); - break; - case WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX: - gConfigGeneral.DisableLightningEffect ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX: - gConfigGeneral.RenderWeatherEffects ^= 1; - gConfigGeneral.RenderWeatherGloom = gConfigGeneral.RenderWeatherEffects; - ConfigSaveDefault(); - Invalidate(); - GfxInvalidateScreen(); - break; - case WIDX_SHOW_GUEST_PURCHASES_CHECKBOX: - gConfigGeneral.ShowGuestPurchases ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX: - gConfigGeneral.TransparentScreenshot ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - } - } - - void RenderingMouseDown(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_VIRTUAL_FLOOR_DROPDOWN: - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[2].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_VIRTUAL_FLOOR_STYLE_DISABLED; - gDropdownItems[1].Args = STR_VIRTUAL_FLOOR_STYLE_TRANSPARENT; - gDropdownItems[2].Args = STR_VIRTUAL_FLOOR_STYLE_GLASSY; - - Widget* widget = &widgets[widgetIndex - 1]; - ShowDropdown(widget, 3); - - Dropdown::SetChecked(static_cast(gConfigGeneral.VirtualFloorStyle), true); - break; - } - } - - void RenderingDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - switch (widgetIndex) - { - case WIDX_VIRTUAL_FLOOR_DROPDOWN: - gConfigGeneral.VirtualFloorStyle = static_cast(dropdownIndex); - ConfigSaveDefault(); - break; - } - } - - void RenderingPrepareDraw() - { - SetCheckboxValue(WIDX_TILE_SMOOTHING_CHECKBOX, gConfigGeneral.LandscapeSmoothing); - SetCheckboxValue(WIDX_GRIDLINES_CHECKBOX, gConfigGeneral.AlwaysShowGridlines); - SetCheckboxValue(WIDX_DAY_NIGHT_CHECKBOX, gConfigGeneral.DayNightCycle); - SetCheckboxValue(WIDX_SHOW_GUEST_PURCHASES_CHECKBOX, gConfigGeneral.ShowGuestPurchases); - SetCheckboxValue(WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX, gConfigGeneral.TransparentScreenshot); - SetCheckboxValue(WIDX_UPPER_CASE_BANNERS_CHECKBOX, gConfigGeneral.UpperCaseBanners); - - static constexpr StringId _virtualFloorStyleStrings[] = { - STR_VIRTUAL_FLOOR_STYLE_DISABLED, - STR_VIRTUAL_FLOOR_STYLE_TRANSPARENT, - STR_VIRTUAL_FLOOR_STYLE_GLASSY, - }; - - widgets[WIDX_VIRTUAL_FLOOR].text = _virtualFloorStyleStrings[static_cast(gConfigGeneral.VirtualFloorStyle)]; - - SetCheckboxValue(WIDX_ENABLE_LIGHT_FX_CHECKBOX, gConfigGeneral.EnableLightFx); - if (gConfigGeneral.DayNightCycle && gConfigGeneral.DrawingEngine == DrawingEngine::SoftwareWithHardwareDisplay) - { - disabled_widgets &= ~(1uLL << WIDX_ENABLE_LIGHT_FX_CHECKBOX); - } - else - { - disabled_widgets |= (1uLL << WIDX_ENABLE_LIGHT_FX_CHECKBOX); - gConfigGeneral.EnableLightFx = false; } - SetCheckboxValue(WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX, gConfigGeneral.EnableLightFxForVehicles); - if (gConfigGeneral.DayNightCycle && gConfigGeneral.DrawingEngine == DrawingEngine::SoftwareWithHardwareDisplay - && gConfigGeneral.EnableLightFx) + void DisplayMouseDown(WidgetIndex widgetIndex) { - disabled_widgets &= ~(1uLL << WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX); - } - else - { - disabled_widgets |= (1uLL << WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX); - gConfigGeneral.EnableLightFxForVehicles = false; - } + Widget* widget = &widgets[widgetIndex - 1]; - WidgetSetCheckboxValue( - *this, WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX, - gConfigGeneral.RenderWeatherEffects || gConfigGeneral.RenderWeatherGloom); - SetCheckboxValue(WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, gConfigGeneral.DisableLightningEffect); - if (!gConfigGeneral.RenderWeatherEffects && !gConfigGeneral.RenderWeatherGloom) - { - SetCheckboxValue(WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, true); - disabled_widgets |= (1uLL << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX); - } - else - { - disabled_widgets &= ~(1uLL << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX); - } - } - -#pragma endregion - -#pragma region Culture tab events - void CultureMouseDown(WidgetIndex widgetIndex) - { - Widget* widget = &widgets[widgetIndex - 1]; - - switch (widgetIndex) - { - case WIDX_HEIGHT_LABELS_DROPDOWN: - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_HEIGHT_IN_UNITS; - gDropdownItems[1].Args = STR_REAL_VALUES; - - ShowDropdown(widget, 2); - - Dropdown::SetChecked(gConfigGeneral.ShowHeightAsUnits ? 0 : 1, true); - break; - case WIDX_CURRENCY_DROPDOWN: + switch (widgetIndex) { - // All the currencies plus the separator - constexpr auto numItems = EnumValue(CurrencyType::Count) + 1; - - // All the currencies except custom currency - size_t numOrdinaryCurrencies = EnumValue(CurrencyType::Count) - 1; - - for (size_t i = 0; i < numOrdinaryCurrencies; i++) + case WIDX_RESOLUTION_DROPDOWN: { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = CurrencyDescriptors[i].stringId; + const auto& resolutions = OpenRCT2::GetContext()->GetUiContext()->GetFullscreenResolutions(); + + int32_t selectedResolution = -1; + for (size_t i = 0; i < resolutions.size(); i++) + { + const Resolution& resolution = resolutions[i]; + + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + + uint16_t* args = reinterpret_cast(&gDropdownItems[i].Args); + args[0] = STR_RESOLUTION_X_BY_Y; + args[1] = resolution.Width; + args[2] = resolution.Height; + + if (resolution.Width == gConfigGeneral.FullscreenWidth + && resolution.Height == gConfigGeneral.FullscreenHeight) + { + selectedResolution = static_cast(i); + } + } + + ShowDropdown(widget, static_cast(resolutions.size())); + + if (selectedResolution != -1 && selectedResolution < 32) + { + Dropdown::SetChecked(selectedResolution, true); + } } - gDropdownItems[numOrdinaryCurrencies].Format = Dropdown::SeparatorString; + break; + case WIDX_FULLSCREEN_DROPDOWN: + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[2].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_OPTIONS_DISPLAY_WINDOWED; + gDropdownItems[1].Args = STR_OPTIONS_DISPLAY_FULLSCREEN; + gDropdownItems[2].Args = STR_OPTIONS_DISPLAY_FULLSCREEN_BORDERLESS; - gDropdownItems[numOrdinaryCurrencies + 1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[numOrdinaryCurrencies + 1].Args = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].stringId; + ShowDropdown(widget, 3); - ShowDropdown(widget, numItems); - - if (gConfigGeneral.CurrencyFormat == CurrencyType::Custom) + Dropdown::SetChecked(gConfigGeneral.FullscreenMode, true); + break; + case WIDX_DRAWING_ENGINE_DROPDOWN: { - Dropdown::SetChecked(EnumValue(gConfigGeneral.CurrencyFormat) + 1, true); - } - else - { - Dropdown::SetChecked(EnumValue(gConfigGeneral.CurrencyFormat), true); - } - break; - } - case WIDX_DISTANCE_DROPDOWN: - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[2].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_IMPERIAL; - gDropdownItems[1].Args = STR_METRIC; - gDropdownItems[2].Args = STR_SI; + int32_t numItems = 3; +#ifdef DISABLE_OPENGL + numItems = 2; +#endif - ShowDropdown(widget, 3); - - Dropdown::SetChecked(static_cast(gConfigGeneral.MeasurementFormat), true); - break; - case WIDX_TEMPERATURE_DROPDOWN: - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_CELSIUS; - gDropdownItems[1].Args = STR_FAHRENHEIT; - - ShowDropdown(widget, 2); - - Dropdown::SetChecked(static_cast(gConfigGeneral.TemperatureFormat), true); - break; - case WIDX_LANGUAGE_DROPDOWN: - for (size_t i = 1; i < LANGUAGE_COUNT; i++) - { - gDropdownItems[i - 1].Format = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItems[i - 1].Args = reinterpret_cast(LanguagesDescriptors[i].native_name); + for (int32_t i = 0; i < numItems; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = DrawingEngineStringIds[i]; + } + ShowDropdown(widget, numItems); + Dropdown::SetChecked(EnumValue(gConfigGeneral.DrawingEngine), true); + break; } - ShowDropdown(widget, LANGUAGE_COUNT - 1); - Dropdown::SetChecked(LocalisationService_GetCurrentLanguage() - 1, true); - break; - case WIDX_DATE_FORMAT_DROPDOWN: - for (size_t i = 0; i < 4; i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = DateFormatStringIDs[i]; - } - ShowDropdown(widget, 4); - Dropdown::SetChecked(gConfigGeneral.DateFormat, true); - break; - } - } - - void CultureDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - switch (widgetIndex) - { - case WIDX_HEIGHT_LABELS_DROPDOWN: - // reset flag and set it to 1 if height as units is selected - gConfigGeneral.ShowHeightAsUnits = 0; - - if (dropdownIndex == 0) - { - gConfigGeneral.ShowHeightAsUnits = 1; - } - ConfigSaveDefault(); - UpdateHeightMarkers(); - break; - case WIDX_CURRENCY_DROPDOWN: - if (dropdownIndex == EnumValue(CurrencyType::Custom) + 1) - { // Add 1 because the separator occupies a position - gConfigGeneral.CurrencyFormat = static_cast(dropdownIndex - 1); - ContextOpenWindow(WindowClass::CustomCurrencyConfig); - } - else - { - gConfigGeneral.CurrencyFormat = static_cast(dropdownIndex); - } - ConfigSaveDefault(); - GfxInvalidateScreen(); - break; - case WIDX_DISTANCE_DROPDOWN: - gConfigGeneral.MeasurementFormat = static_cast(dropdownIndex); - ConfigSaveDefault(); - UpdateHeightMarkers(); - break; - case WIDX_TEMPERATURE_DROPDOWN: - if (dropdownIndex != static_cast(gConfigGeneral.TemperatureFormat)) - { - gConfigGeneral.TemperatureFormat = static_cast(dropdownIndex); + case WIDX_SCALE_UP: + gConfigGeneral.WindowScale += 0.25f; ConfigSaveDefault(); GfxInvalidateScreen(); - } - break; - case WIDX_LANGUAGE_DROPDOWN: + ContextTriggerResize(); + ContextUpdateCursorScale(); + break; + case WIDX_SCALE_DOWN: + gConfigGeneral.WindowScale -= 0.25f; + gConfigGeneral.WindowScale = std::max(0.5f, gConfigGeneral.WindowScale); + ConfigSaveDefault(); + GfxInvalidateScreen(); + ContextTriggerResize(); + ContextUpdateCursorScale(); + break; + } + } + + void DisplayDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + switch (widgetIndex) { - auto fallbackLanguage = LocalisationService_GetCurrentLanguage(); - if (dropdownIndex != LocalisationService_GetCurrentLanguage() - 1) + case WIDX_RESOLUTION_DROPDOWN: { - if (!LanguageOpen(dropdownIndex + 1)) + const auto& resolutions = OpenRCT2::GetContext()->GetUiContext()->GetFullscreenResolutions(); + + const Resolution& resolution = resolutions[dropdownIndex]; + if (resolution.Width != gConfigGeneral.FullscreenWidth + || resolution.Height != gConfigGeneral.FullscreenHeight) { - // Failed to open language file, try to recover by falling - // back to previously used language - if (LanguageOpen(fallbackLanguage)) - { - // It worked, so we can say it with error message in-game - ContextShowError(STR_LANGUAGE_LOAD_FAILED, STR_NONE, {}); - } - // report error to console regardless - LOG_ERROR("Failed to open language file."); - } - else - { - gConfigGeneral.Language = dropdownIndex + 1; + gConfigGeneral.FullscreenWidth = resolution.Width; + gConfigGeneral.FullscreenHeight = resolution.Height; + + if (gConfigGeneral.FullscreenMode == static_cast(OpenRCT2::Ui::FULLSCREEN_MODE::FULLSCREEN)) + ContextSetFullscreenMode(static_cast(OpenRCT2::Ui::FULLSCREEN_MODE::FULLSCREEN)); + ConfigSaveDefault(); GfxInvalidateScreen(); } } + break; + case WIDX_FULLSCREEN_DROPDOWN: + if (dropdownIndex != gConfigGeneral.FullscreenMode) + { + ContextSetFullscreenMode(dropdownIndex); + + gConfigGeneral.FullscreenMode = static_cast(dropdownIndex); + ConfigSaveDefault(); + GfxInvalidateScreen(); + } + break; + case WIDX_DRAWING_ENGINE_DROPDOWN: + if (dropdownIndex != EnumValue(gConfigGeneral.DrawingEngine)) + { + DrawingEngine srcEngine = drawing_engine_get_type(); + DrawingEngine dstEngine = static_cast(dropdownIndex); + + gConfigGeneral.DrawingEngine = dstEngine; + bool recreate_window = DrawingEngineRequiresNewWindow(srcEngine, dstEngine); + RefreshVideo(recreate_window); + ConfigSaveDefault(); + Invalidate(); + } + break; } - break; - case WIDX_DATE_FORMAT_DROPDOWN: - if (dropdownIndex != gConfigGeneral.DateFormat) - { - gConfigGeneral.DateFormat = static_cast(dropdownIndex); + } + + void DisplayPrepareDraw() + { + // Resolution dropdown caption. + auto ft = Formatter::Common(); + ft.Increment(16); + ft.Add(static_cast(gConfigGeneral.FullscreenWidth)); + ft.Add(static_cast(gConfigGeneral.FullscreenHeight)); + + // Disable resolution dropdown on "Windowed" and "Fullscreen (desktop)" + if (gConfigGeneral.FullscreenMode != static_cast(OpenRCT2::Ui::FULLSCREEN_MODE::FULLSCREEN)) + { + disabled_widgets |= (1uLL << WIDX_RESOLUTION_DROPDOWN); + disabled_widgets |= (1uLL << WIDX_RESOLUTION); + disabled_widgets |= (1uLL << WIDX_RESOLUTION_LABEL); + } + else + { + disabled_widgets &= ~(1uLL << WIDX_RESOLUTION_DROPDOWN); + disabled_widgets &= ~(1uLL << WIDX_RESOLUTION); + disabled_widgets &= ~(1uLL << WIDX_RESOLUTION_LABEL); + } + + // Disable Steam Overlay checkbox when using software or OpenGL rendering. + if (gConfigGeneral.DrawingEngine == DrawingEngine::Software + || gConfigGeneral.DrawingEngine == DrawingEngine::OpenGL) + { + disabled_widgets |= (1uLL << WIDX_STEAM_OVERLAY_PAUSE); + } + else + { + disabled_widgets &= ~(1uLL << WIDX_STEAM_OVERLAY_PAUSE); + } + + // Disable changing VSync for Software engine, as we can't control its use of VSync + if (gConfigGeneral.DrawingEngine == DrawingEngine::Software) + { + disabled_widgets |= (1uLL << WIDX_USE_VSYNC_CHECKBOX); + } + else + { + disabled_widgets &= ~(1uLL << WIDX_USE_VSYNC_CHECKBOX); + } + + SetCheckboxValue(WIDX_UNCAP_FPS_CHECKBOX, gConfigGeneral.UncapFPS); + SetCheckboxValue(WIDX_USE_VSYNC_CHECKBOX, gConfigGeneral.UseVSync); + SetCheckboxValue(WIDX_SHOW_FPS_CHECKBOX, gConfigGeneral.ShowFPS); + SetCheckboxValue(WIDX_MULTITHREADING_CHECKBOX, gConfigGeneral.MultiThreading); + SetCheckboxValue(WIDX_MINIMIZE_FOCUS_LOSS, gConfigGeneral.MinimizeFullscreenFocusLoss); + SetCheckboxValue(WIDX_STEAM_OVERLAY_PAUSE, gConfigGeneral.SteamOverlayPause); + SetCheckboxValue(WIDX_DISABLE_SCREENSAVER_LOCK, gConfigGeneral.DisableScreensaver); + + // Dropdown captions for straightforward strings. + widgets[WIDX_FULLSCREEN].text = FullscreenModeNames[gConfigGeneral.FullscreenMode]; + widgets[WIDX_DRAWING_ENGINE].text = DrawingEngineStringIds[EnumValue(gConfigGeneral.DrawingEngine)]; + } + + void DisplayDraw(DrawPixelInfo& dpi) + { + auto ft = Formatter(); + ft.Add(static_cast(gConfigGeneral.WindowScale * 100)); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_SCALE].left + 1, widgets[WIDX_SCALE].top + 1 }, + STR_WINDOW_COLOUR_2_COMMA2DP32, ft, { colours[1] }); + } +#pragma endregion + +#pragma region Rendering tab events + void RenderingMouseUp(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_TILE_SMOOTHING_CHECKBOX: + gConfigGeneral.LandscapeSmoothing ^= 1; ConfigSaveDefault(); GfxInvalidateScreen(); + break; + case WIDX_GRIDLINES_CHECKBOX: + { + gConfigGeneral.AlwaysShowGridlines ^= 1; + ConfigSaveDefault(); + GfxInvalidateScreen(); + WindowBase* mainWindow = WindowGetMain(); + if (mainWindow != nullptr) + { + if (gConfigGeneral.AlwaysShowGridlines) + mainWindow->viewport->flags |= VIEWPORT_FLAG_GRIDLINES; + else + mainWindow->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES; + } + break; } - break; - } - } - - void CulturePrepareDraw() - { - // Language - auto ft = Formatter::Common(); - ft.Add(LanguagesDescriptors[LocalisationService_GetCurrentLanguage()].native_name); - - // Currency: pounds, dollars, etc. (10 total) - widgets[WIDX_CURRENCY].text = CurrencyDescriptors[EnumValue(gConfigGeneral.CurrencyFormat)].stringId; - - // Distance: metric / imperial / si - { - StringId stringId = STR_NONE; - switch (gConfigGeneral.MeasurementFormat) - { - case MeasurementFormat::Imperial: - stringId = STR_IMPERIAL; + case WIDX_DAY_NIGHT_CHECKBOX: + gConfigGeneral.DayNightCycle ^= 1; + ConfigSaveDefault(); + Invalidate(); break; - case MeasurementFormat::Metric: - stringId = STR_METRIC; + case WIDX_ENABLE_LIGHT_FX_CHECKBOX: + gConfigGeneral.EnableLightFx ^= 1; + ConfigSaveDefault(); + Invalidate(); break; - case MeasurementFormat::SI: - stringId = STR_SI; + case WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX: + gConfigGeneral.EnableLightFxForVehicles ^= 1; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_UPPER_CASE_BANNERS_CHECKBOX: + gConfigGeneral.UpperCaseBanners ^= 1; + ConfigSaveDefault(); + Invalidate(); + ScrollingTextInvalidate(); + break; + case WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX: + gConfigGeneral.DisableLightningEffect ^= 1; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX: + gConfigGeneral.RenderWeatherEffects ^= 1; + gConfigGeneral.RenderWeatherGloom = gConfigGeneral.RenderWeatherEffects; + ConfigSaveDefault(); + Invalidate(); + GfxInvalidateScreen(); + break; + case WIDX_SHOW_GUEST_PURCHASES_CHECKBOX: + gConfigGeneral.ShowGuestPurchases ^= 1; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX: + gConfigGeneral.TransparentScreenshot ^= 1; + ConfigSaveDefault(); + Invalidate(); break; } - widgets[WIDX_DISTANCE].text = stringId; } - // Date format - widgets[WIDX_DATE_FORMAT].text = DateFormatStringIDs[gConfigGeneral.DateFormat]; + void RenderingMouseDown(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_VIRTUAL_FLOOR_DROPDOWN: + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[2].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_VIRTUAL_FLOOR_STYLE_DISABLED; + gDropdownItems[1].Args = STR_VIRTUAL_FLOOR_STYLE_TRANSPARENT; + gDropdownItems[2].Args = STR_VIRTUAL_FLOOR_STYLE_GLASSY; - // Temperature: celsius/fahrenheit - widgets[WIDX_TEMPERATURE].text = gConfigGeneral.TemperatureFormat == TemperatureUnit::Fahrenheit ? STR_FAHRENHEIT - : STR_CELSIUS; + Widget* widget = &widgets[widgetIndex - 1]; + ShowDropdown(widget, 3); - // Height: units/real values - widgets[WIDX_HEIGHT_LABELS].text = gConfigGeneral.ShowHeightAsUnits ? STR_HEIGHT_IN_UNITS : STR_REAL_VALUES; - } + Dropdown::SetChecked(static_cast(gConfigGeneral.VirtualFloorStyle), true); + break; + } + } + + void RenderingDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + switch (widgetIndex) + { + case WIDX_VIRTUAL_FLOOR_DROPDOWN: + gConfigGeneral.VirtualFloorStyle = static_cast(dropdownIndex); + ConfigSaveDefault(); + break; + } + } + + void RenderingPrepareDraw() + { + SetCheckboxValue(WIDX_TILE_SMOOTHING_CHECKBOX, gConfigGeneral.LandscapeSmoothing); + SetCheckboxValue(WIDX_GRIDLINES_CHECKBOX, gConfigGeneral.AlwaysShowGridlines); + SetCheckboxValue(WIDX_DAY_NIGHT_CHECKBOX, gConfigGeneral.DayNightCycle); + SetCheckboxValue(WIDX_SHOW_GUEST_PURCHASES_CHECKBOX, gConfigGeneral.ShowGuestPurchases); + SetCheckboxValue(WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX, gConfigGeneral.TransparentScreenshot); + SetCheckboxValue(WIDX_UPPER_CASE_BANNERS_CHECKBOX, gConfigGeneral.UpperCaseBanners); + + static constexpr StringId _virtualFloorStyleStrings[] = { + STR_VIRTUAL_FLOOR_STYLE_DISABLED, + STR_VIRTUAL_FLOOR_STYLE_TRANSPARENT, + STR_VIRTUAL_FLOOR_STYLE_GLASSY, + }; + + widgets[WIDX_VIRTUAL_FLOOR].text = _virtualFloorStyleStrings[EnumValue(gConfigGeneral.VirtualFloorStyle)]; + + SetCheckboxValue(WIDX_ENABLE_LIGHT_FX_CHECKBOX, gConfigGeneral.EnableLightFx); + if (gConfigGeneral.DayNightCycle && gConfigGeneral.DrawingEngine == DrawingEngine::SoftwareWithHardwareDisplay) + { + disabled_widgets &= ~(1uLL << WIDX_ENABLE_LIGHT_FX_CHECKBOX); + } + else + { + disabled_widgets |= (1uLL << WIDX_ENABLE_LIGHT_FX_CHECKBOX); + gConfigGeneral.EnableLightFx = false; + } + + SetCheckboxValue(WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX, gConfigGeneral.EnableLightFxForVehicles); + if (gConfigGeneral.DayNightCycle && gConfigGeneral.DrawingEngine == DrawingEngine::SoftwareWithHardwareDisplay + && gConfigGeneral.EnableLightFx) + { + disabled_widgets &= ~(1uLL << WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX); + } + else + { + disabled_widgets |= (1uLL << WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX); + gConfigGeneral.EnableLightFxForVehicles = false; + } + + WidgetSetCheckboxValue( + *this, WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX, + gConfigGeneral.RenderWeatherEffects || gConfigGeneral.RenderWeatherGloom); + SetCheckboxValue(WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, gConfigGeneral.DisableLightningEffect); + if (!gConfigGeneral.RenderWeatherEffects && !gConfigGeneral.RenderWeatherGloom) + { + SetCheckboxValue(WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, true); + disabled_widgets |= (1uLL << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX); + } + else + { + disabled_widgets &= ~(1uLL << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX); + } + } + +#pragma endregion + +#pragma region Culture tab events + void CultureMouseDown(WidgetIndex widgetIndex) + { + Widget* widget = &widgets[widgetIndex - 1]; + + switch (widgetIndex) + { + case WIDX_HEIGHT_LABELS_DROPDOWN: + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_HEIGHT_IN_UNITS; + gDropdownItems[1].Args = STR_REAL_VALUES; + + ShowDropdown(widget, 2); + + Dropdown::SetChecked(gConfigGeneral.ShowHeightAsUnits ? 0 : 1, true); + break; + case WIDX_CURRENCY_DROPDOWN: + { + // All the currencies plus the separator + constexpr auto numItems = EnumValue(CurrencyType::Count) + 1; + + // All the currencies except custom currency + size_t numOrdinaryCurrencies = EnumValue(CurrencyType::Count) - 1; + + for (size_t i = 0; i < numOrdinaryCurrencies; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = CurrencyDescriptors[i].stringId; + } + + gDropdownItems[numOrdinaryCurrencies].Format = Dropdown::SeparatorString; + + gDropdownItems[numOrdinaryCurrencies + 1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[numOrdinaryCurrencies + 1].Args = CurrencyDescriptors[EnumValue(CurrencyType::Custom)] + .stringId; + + ShowDropdown(widget, numItems); + + if (gConfigGeneral.CurrencyFormat == CurrencyType::Custom) + { + Dropdown::SetChecked(EnumValue(gConfigGeneral.CurrencyFormat) + 1, true); + } + else + { + Dropdown::SetChecked(EnumValue(gConfigGeneral.CurrencyFormat), true); + } + break; + } + case WIDX_DISTANCE_DROPDOWN: + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[2].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_IMPERIAL; + gDropdownItems[1].Args = STR_METRIC; + gDropdownItems[2].Args = STR_SI; + + ShowDropdown(widget, 3); + + Dropdown::SetChecked(static_cast(gConfigGeneral.MeasurementFormat), true); + break; + case WIDX_TEMPERATURE_DROPDOWN: + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_CELSIUS; + gDropdownItems[1].Args = STR_FAHRENHEIT; + + ShowDropdown(widget, 2); + + Dropdown::SetChecked(static_cast(gConfigGeneral.TemperatureFormat), true); + break; + case WIDX_LANGUAGE_DROPDOWN: + for (size_t i = 1; i < LANGUAGE_COUNT; i++) + { + gDropdownItems[i - 1].Format = STR_OPTIONS_DROPDOWN_ITEM; + gDropdownItems[i - 1].Args = reinterpret_cast(LanguagesDescriptors[i].native_name); + } + ShowDropdown(widget, LANGUAGE_COUNT - 1); + Dropdown::SetChecked(LocalisationService_GetCurrentLanguage() - 1, true); + break; + case WIDX_DATE_FORMAT_DROPDOWN: + for (size_t i = 0; i < 4; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = DateFormatStringIDs[i]; + } + ShowDropdown(widget, 4); + Dropdown::SetChecked(gConfigGeneral.DateFormat, true); + break; + } + } + + void CultureDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + switch (widgetIndex) + { + case WIDX_HEIGHT_LABELS_DROPDOWN: + // reset flag and set it to 1 if height as units is selected + gConfigGeneral.ShowHeightAsUnits = 0; + + if (dropdownIndex == 0) + { + gConfigGeneral.ShowHeightAsUnits = 1; + } + ConfigSaveDefault(); + UpdateHeightMarkers(); + break; + case WIDX_CURRENCY_DROPDOWN: + if (dropdownIndex == EnumValue(CurrencyType::Custom) + 1) + { // Add 1 because the separator occupies a position + gConfigGeneral.CurrencyFormat = static_cast(dropdownIndex - 1); + ContextOpenWindow(WindowClass::CustomCurrencyConfig); + } + else + { + gConfigGeneral.CurrencyFormat = static_cast(dropdownIndex); + } + ConfigSaveDefault(); + GfxInvalidateScreen(); + break; + case WIDX_DISTANCE_DROPDOWN: + gConfigGeneral.MeasurementFormat = static_cast(dropdownIndex); + ConfigSaveDefault(); + UpdateHeightMarkers(); + break; + case WIDX_TEMPERATURE_DROPDOWN: + if (dropdownIndex != static_cast(gConfigGeneral.TemperatureFormat)) + { + gConfigGeneral.TemperatureFormat = static_cast(dropdownIndex); + ConfigSaveDefault(); + GfxInvalidateScreen(); + } + break; + case WIDX_LANGUAGE_DROPDOWN: + { + auto fallbackLanguage = LocalisationService_GetCurrentLanguage(); + if (dropdownIndex != LocalisationService_GetCurrentLanguage() - 1) + { + if (!LanguageOpen(dropdownIndex + 1)) + { + // Failed to open language file, try to recover by falling + // back to previously used language + if (LanguageOpen(fallbackLanguage)) + { + // It worked, so we can say it with error message in-game + ContextShowError(STR_LANGUAGE_LOAD_FAILED, STR_NONE, {}); + } + // report error to console regardless + LOG_ERROR("Failed to open language file."); + } + else + { + gConfigGeneral.Language = dropdownIndex + 1; + ConfigSaveDefault(); + GfxInvalidateScreen(); + } + } + } + break; + case WIDX_DATE_FORMAT_DROPDOWN: + if (dropdownIndex != gConfigGeneral.DateFormat) + { + gConfigGeneral.DateFormat = static_cast(dropdownIndex); + ConfigSaveDefault(); + GfxInvalidateScreen(); + } + break; + } + } + + void CulturePrepareDraw() + { + // Language + auto ft = Formatter::Common(); + ft.Add(LanguagesDescriptors[LocalisationService_GetCurrentLanguage()].native_name); + + // Currency: pounds, dollars, etc. (10 total) + widgets[WIDX_CURRENCY].text = CurrencyDescriptors[EnumValue(gConfigGeneral.CurrencyFormat)].stringId; + + // Distance: metric / imperial / si + { + StringId stringId = STR_NONE; + switch (gConfigGeneral.MeasurementFormat) + { + case MeasurementFormat::Imperial: + stringId = STR_IMPERIAL; + break; + case MeasurementFormat::Metric: + stringId = STR_METRIC; + break; + case MeasurementFormat::SI: + stringId = STR_SI; + break; + } + widgets[WIDX_DISTANCE].text = stringId; + } + + // Date format + widgets[WIDX_DATE_FORMAT].text = DateFormatStringIDs[gConfigGeneral.DateFormat]; + + // Temperature: celsius/fahrenheit + widgets[WIDX_TEMPERATURE].text = gConfigGeneral.TemperatureFormat == TemperatureUnit::Fahrenheit ? STR_FAHRENHEIT + : STR_CELSIUS; + + // Height: units/real values + widgets[WIDX_HEIGHT_LABELS].text = gConfigGeneral.ShowHeightAsUnits ? STR_HEIGHT_IN_UNITS : STR_REAL_VALUES; + } #pragma endregion #pragma region Audio tab events - void AudioMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void AudioMouseUp(WidgetIndex widgetIndex) { - case WIDX_SOUND_CHECKBOX: - gConfigSound.SoundEnabled = !gConfigSound.SoundEnabled; - ConfigSaveDefault(); - Invalidate(); - break; - - case WIDX_MASTER_SOUND_CHECKBOX: - gConfigSound.MasterSoundEnabled = !gConfigSound.MasterSoundEnabled; - if (!gConfigSound.MasterSoundEnabled) - OpenRCT2::Audio::Pause(); - else - OpenRCT2::Audio::Resume(); - WindowInvalidateByClass(WindowClass::TopToolbar); - ConfigSaveDefault(); - Invalidate(); - break; - - case WIDX_MUSIC_CHECKBOX: - gConfigSound.RideMusicEnabled = !gConfigSound.RideMusicEnabled; - if (!gConfigSound.RideMusicEnabled) - { - OpenRCT2::RideAudio::StopAllChannels(); - } - ConfigSaveDefault(); - Invalidate(); - break; - - case WIDX_AUDIO_FOCUS_CHECKBOX: - gConfigSound.audio_focus = !gConfigSound.audio_focus; - ConfigSaveDefault(); - Invalidate(); - break; - } - } - - void AudioMouseDown(WidgetIndex widgetIndex) - { - Widget* widget = &widgets[widgetIndex - 1]; - - switch (widgetIndex) - { - case WIDX_SOUND_DROPDOWN: - OpenRCT2::Audio::PopulateDevices(); - - // populate the list with the sound devices - for (int32_t i = 0; i < OpenRCT2::Audio::GetDeviceCount(); i++) - { - gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItems[i].Args = reinterpret_cast(OpenRCT2::Audio::GetDeviceName(i).c_str()); - } - - ShowDropdown(widget, OpenRCT2::Audio::GetDeviceCount()); - - Dropdown::SetChecked(OpenRCT2::Audio::GetCurrentDeviceIndex(), true); - break; - case WIDX_TITLE_MUSIC_DROPDOWN: + switch (widgetIndex) { - const bool rct1MusicThemeIsAvailable = IsRCT1TitleMusicAvailable(); - int32_t numItems{}; - int32_t checkedIndex{}; - for (auto theme : TitleThemeOptions) - { - if (theme.Kind == TitleMusicKind::RCT1 && !rct1MusicThemeIsAvailable) - continue; + case WIDX_SOUND_CHECKBOX: + gConfigSound.SoundEnabled = !gConfigSound.SoundEnabled; + ConfigSaveDefault(); + Invalidate(); + break; - if (gConfigSound.TitleMusic == theme.Kind) - checkedIndex = numItems; - - gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[numItems++].Args = theme.Name; - } - ShowDropdown(widget, numItems); - Dropdown::SetChecked(checkedIndex, true); - break; - } - } - } - - void AudioDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - switch (widgetIndex) - { - case WIDX_SOUND_DROPDOWN: - OpenRCT2::Audio::InitRideSounds(dropdownIndex); - if (dropdownIndex < OpenRCT2::Audio::GetDeviceCount()) - { - auto audioContext = GetContext()->GetAudioContext(); - if (dropdownIndex == 0) - { - audioContext->SetOutputDevice(""); - gConfigSound.Device = ""; - } + case WIDX_MASTER_SOUND_CHECKBOX: + gConfigSound.MasterSoundEnabled = !gConfigSound.MasterSoundEnabled; + if (!gConfigSound.MasterSoundEnabled) + OpenRCT2::Audio::Pause(); else + OpenRCT2::Audio::Resume(); + WindowInvalidateByClass(WindowClass::TopToolbar); + ConfigSaveDefault(); + Invalidate(); + break; + + case WIDX_MUSIC_CHECKBOX: + gConfigSound.RideMusicEnabled = !gConfigSound.RideMusicEnabled; + if (!gConfigSound.RideMusicEnabled) { - const auto& deviceName = GetDeviceName(dropdownIndex); - audioContext->SetOutputDevice(deviceName); - gConfigSound.Device = deviceName; + OpenRCT2::RideAudio::StopAllChannels(); } ConfigSaveDefault(); - OpenRCT2::Audio::PlayTitleMusic(); - } - Invalidate(); - break; - case WIDX_TITLE_MUSIC_DROPDOWN: - { - // HACK: When RCT1 is not available, it's not in the dropdown, so indices higher than it should be incremented - const bool rct1MusicThemeIsAvailable = IsRCT1TitleMusicAvailable(); - for (size_t i = 0; i < std::size(TitleThemeOptions) && static_cast(i) <= dropdownIndex; i++) - { - if (TitleThemeOptions[i].Kind == TitleMusicKind::RCT1 && !rct1MusicThemeIsAvailable) - dropdownIndex++; - } + Invalidate(); + break; - gConfigSound.TitleMusic = TitleThemeOptions[dropdownIndex].Kind; + case WIDX_AUDIO_FOCUS_CHECKBOX: + gConfigSound.audio_focus = !gConfigSound.audio_focus; + ConfigSaveDefault(); + Invalidate(); + break; + } + } + + void AudioMouseDown(WidgetIndex widgetIndex) + { + Widget* widget = &widgets[widgetIndex - 1]; + + switch (widgetIndex) + { + case WIDX_SOUND_DROPDOWN: + OpenRCT2::Audio::PopulateDevices(); + + // populate the list with the sound devices + for (int32_t i = 0; i < OpenRCT2::Audio::GetDeviceCount(); i++) + { + gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; + gDropdownItems[i].Args = reinterpret_cast(OpenRCT2::Audio::GetDeviceName(i).c_str()); + } + + ShowDropdown(widget, OpenRCT2::Audio::GetDeviceCount()); + + Dropdown::SetChecked(OpenRCT2::Audio::GetCurrentDeviceIndex(), true); + break; + case WIDX_TITLE_MUSIC_DROPDOWN: + { + const bool rct1MusicThemeIsAvailable = IsRCT1TitleMusicAvailable(); + int32_t numItems{}; + int32_t checkedIndex{}; + for (auto theme : TitleThemeOptions) + { + if (theme.Kind == TitleMusicKind::RCT1 && !rct1MusicThemeIsAvailable) + continue; + + if (gConfigSound.TitleMusic == theme.Kind) + checkedIndex = numItems; + + gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[numItems++].Args = theme.Name; + } + ShowDropdown(widget, numItems); + Dropdown::SetChecked(checkedIndex, true); + break; + } + } + } + + void AudioDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + switch (widgetIndex) + { + case WIDX_SOUND_DROPDOWN: + OpenRCT2::Audio::InitRideSounds(dropdownIndex); + if (dropdownIndex < OpenRCT2::Audio::GetDeviceCount()) + { + auto audioContext = GetContext()->GetAudioContext(); + if (dropdownIndex == 0) + { + audioContext->SetOutputDevice(""); + gConfigSound.Device = ""; + } + else + { + const auto& deviceName = GetDeviceName(dropdownIndex); + audioContext->SetOutputDevice(deviceName); + gConfigSound.Device = deviceName; + } + ConfigSaveDefault(); + OpenRCT2::Audio::PlayTitleMusic(); + } + Invalidate(); + break; + case WIDX_TITLE_MUSIC_DROPDOWN: + { + // HACK: When RCT1 is not available, it's not in the dropdown, so indices higher than it should be + // incremented + const bool rct1MusicThemeIsAvailable = IsRCT1TitleMusicAvailable(); + for (size_t i = 0; i < std::size(TitleThemeOptions) && static_cast(i) <= dropdownIndex; i++) + { + if (TitleThemeOptions[i].Kind == TitleMusicKind::RCT1 && !rct1MusicThemeIsAvailable) + dropdownIndex++; + } + + gConfigSound.TitleMusic = TitleThemeOptions[dropdownIndex].Kind; + ConfigSaveDefault(); + Invalidate(); + + OpenRCT2::Audio::StopTitleMusic(); + if (gConfigSound.TitleMusic != TitleMusicKind::None) + { + OpenRCT2::Audio::PlayTitleMusic(); + } + break; + } + } + } + + void AudioUpdate() + { + const auto& masterVolumeWidget = widgets[WIDX_MASTER_VOLUME]; + const auto& masterVolumeScroll = scrolls[0]; + uint8_t masterVolume = GetScrollPercentage(masterVolumeWidget, masterVolumeScroll); + if (masterVolume != gConfigSound.MasterVolume) + { + gConfigSound.MasterVolume = masterVolume; ConfigSaveDefault(); - Invalidate(); + InvalidateWidget(WIDX_MASTER_VOLUME); + } - OpenRCT2::Audio::StopTitleMusic(); - if (gConfigSound.TitleMusic != TitleMusicKind::None) - { - OpenRCT2::Audio::PlayTitleMusic(); - } - break; + const auto& soundVolumeWidget = widgets[WIDX_MASTER_VOLUME]; + const auto& soundVolumeScroll = scrolls[1]; + uint8_t soundVolume = GetScrollPercentage(soundVolumeWidget, soundVolumeScroll); + if (soundVolume != gConfigSound.SoundVolume) + { + gConfigSound.SoundVolume = soundVolume; + ConfigSaveDefault(); + InvalidateWidget(WIDX_SOUND_VOLUME); + } + + const auto& musicVolumeWidget = widgets[WIDX_MASTER_VOLUME]; + const auto& musicVolumeScroll = scrolls[2]; + uint8_t rideMusicVolume = GetScrollPercentage(musicVolumeWidget, musicVolumeScroll); + if (rideMusicVolume != gConfigSound.AudioFocus) + { + gConfigSound.AudioFocus = rideMusicVolume; + ConfigSaveDefault(); + InvalidateWidget(WIDX_MUSIC_VOLUME); } } - } - void AudioUpdate() - { - const auto& masterVolumeWidget = widgets[WIDX_MASTER_VOLUME]; - const auto& masterVolumeScroll = scrolls[0]; - uint8_t masterVolume = GetScrollPercentage(masterVolumeWidget, masterVolumeScroll); - if (masterVolume != gConfigSound.MasterVolume) + ScreenSize AudioScrollGetSize(int32_t scrollIndex) { - gConfigSound.MasterVolume = masterVolume; - ConfigSaveDefault(); - InvalidateWidget(WIDX_MASTER_VOLUME); + return { 500, 0 }; } - const auto& soundVolumeWidget = widgets[WIDX_MASTER_VOLUME]; - const auto& soundVolumeScroll = scrolls[1]; - uint8_t soundVolume = GetScrollPercentage(soundVolumeWidget, soundVolumeScroll); - if (soundVolume != gConfigSound.SoundVolume) + StringId GetTitleMusicName() const { - gConfigSound.SoundVolume = soundVolume; - ConfigSaveDefault(); - InvalidateWidget(WIDX_SOUND_VOLUME); + auto theme = std::find_if(std::begin(TitleThemeOptions), std::end(TitleThemeOptions), [](auto&& option) { + return gConfigSound.TitleMusic == option.Kind; + }); + if (theme != std::end(TitleThemeOptions)) + return theme->Name; + return STR_OPENRCT2_DROPDOWN; } - const auto& musicVolumeWidget = widgets[WIDX_MASTER_VOLUME]; - const auto& musicVolumeScroll = scrolls[2]; - uint8_t rideMusicVolume = GetScrollPercentage(musicVolumeWidget, musicVolumeScroll); - if (rideMusicVolume != gConfigSound.AudioFocus) + void AudioPrepareDraw() { - gConfigSound.AudioFocus = rideMusicVolume; - ConfigSaveDefault(); - InvalidateWidget(WIDX_MUSIC_VOLUME); - } - } - - ScreenSize AudioScrollGetSize(int32_t scrollIndex) - { - return { 500, 0 }; - } - - StringId GetTitleMusicName() const - { - auto theme = std::find_if(std::begin(TitleThemeOptions), std::end(TitleThemeOptions), [](auto&& option) { - return gConfigSound.TitleMusic == option.Kind; - }); - if (theme != std::end(TitleThemeOptions)) - return theme->Name; - return STR_OPENRCT2_DROPDOWN; - } - - void AudioPrepareDraw() - { - // Sound device - StringId audioDeviceStringId = STR_OPTIONS_SOUND_VALUE_DEFAULT; - const char* audioDeviceName = nullptr; - const int32_t currentDeviceIndex = OpenRCT2::Audio::GetCurrentDeviceIndex(); - if (currentDeviceIndex == -1 || OpenRCT2::Audio::GetDeviceCount() == 0) - { - audioDeviceStringId = STR_SOUND_NONE; - } - else - { - audioDeviceStringId = STR_STRING; + // Sound device + StringId audioDeviceStringId = STR_OPTIONS_SOUND_VALUE_DEFAULT; + const char* audioDeviceName = nullptr; + const int32_t currentDeviceIndex = OpenRCT2::Audio::GetCurrentDeviceIndex(); + if (currentDeviceIndex == -1 || OpenRCT2::Audio::GetDeviceCount() == 0) + { + audioDeviceStringId = STR_SOUND_NONE; + } + else + { + audioDeviceStringId = STR_STRING; #ifndef __linux__ - if (currentDeviceIndex == 0) - { - audioDeviceStringId = STR_OPTIONS_SOUND_VALUE_DEFAULT; - } + if (currentDeviceIndex == 0) + { + audioDeviceStringId = STR_OPTIONS_SOUND_VALUE_DEFAULT; + } #endif // __linux__ - if (audioDeviceStringId == STR_STRING) + if (audioDeviceStringId == STR_STRING) + { + audioDeviceName = OpenRCT2::Audio::GetDeviceName(currentDeviceIndex).c_str(); + } + } + + widgets[WIDX_SOUND].text = audioDeviceStringId; + auto ft = Formatter::Common(); + ft.Add(audioDeviceName); + + widgets[WIDX_TITLE_MUSIC].text = GetTitleMusicName(); + + SetCheckboxValue(WIDX_SOUND_CHECKBOX, gConfigSound.SoundEnabled); + SetCheckboxValue(WIDX_MASTER_SOUND_CHECKBOX, gConfigSound.MasterSoundEnabled); + SetCheckboxValue(WIDX_MUSIC_CHECKBOX, gConfigSound.RideMusicEnabled); + SetCheckboxValue(WIDX_AUDIO_FOCUS_CHECKBOX, gConfigSound.audio_focus); + WidgetSetEnabled(*this, WIDX_SOUND_CHECKBOX, gConfigSound.MasterSoundEnabled); + WidgetSetEnabled(*this, WIDX_MUSIC_CHECKBOX, gConfigSound.MasterSoundEnabled); + + // Initialize only on first frame, otherwise the scrollbars won't be able to be modified + if (frame_no == 0) { - audioDeviceName = OpenRCT2::Audio::GetDeviceName(currentDeviceIndex).c_str(); + InitializeScrollPosition(WIDX_MASTER_VOLUME, 0, gConfigSound.MasterVolume); + InitializeScrollPosition(WIDX_SOUND_VOLUME, 1, gConfigSound.SoundVolume); + InitializeScrollPosition(WIDX_MUSIC_VOLUME, 2, gConfigSound.AudioFocus); } } - widgets[WIDX_SOUND].text = audioDeviceStringId; - auto ft = Formatter::Common(); - ft.Add(audioDeviceName); - - widgets[WIDX_TITLE_MUSIC].text = GetTitleMusicName(); - - SetCheckboxValue(WIDX_SOUND_CHECKBOX, gConfigSound.SoundEnabled); - SetCheckboxValue(WIDX_MASTER_SOUND_CHECKBOX, gConfigSound.MasterSoundEnabled); - SetCheckboxValue(WIDX_MUSIC_CHECKBOX, gConfigSound.RideMusicEnabled); - SetCheckboxValue(WIDX_AUDIO_FOCUS_CHECKBOX, gConfigSound.audio_focus); - WidgetSetEnabled(*this, WIDX_SOUND_CHECKBOX, gConfigSound.MasterSoundEnabled); - WidgetSetEnabled(*this, WIDX_MUSIC_CHECKBOX, gConfigSound.MasterSoundEnabled); - - // Initialize only on first frame, otherwise the scrollbars won't be able to be modified - if (frame_no == 0) - { - InitializeScrollPosition(WIDX_MASTER_VOLUME, 0, gConfigSound.MasterVolume); - InitializeScrollPosition(WIDX_SOUND_VOLUME, 1, gConfigSound.SoundVolume); - InitializeScrollPosition(WIDX_MUSIC_VOLUME, 2, gConfigSound.AudioFocus); - } - } - #pragma endregion #pragma region Controls tab events - void ControlsMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void ControlsMouseUp(WidgetIndex widgetIndex) { - case WIDX_HOTKEY_DROPDOWN: - ContextOpenWindow(WindowClass::KeyboardShortcutList); - break; - case WIDX_SCREEN_EDGE_SCROLLING: - gConfigGeneral.EdgeScrolling ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_TRAP_CURSOR: - gConfigGeneral.TrapCursor ^= 1; - ConfigSaveDefault(); - ContextSetCursorTrap(gConfigGeneral.TrapCursor); - Invalidate(); - break; - case WIDX_ZOOM_TO_CURSOR: - gConfigGeneral.ZoomToCursor ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_TOOLBAR_SHOW_FINANCES: - gConfigInterface.ToolbarShowFinances ^= 1; - ConfigSaveDefault(); - Invalidate(); - WindowInvalidateByClass(WindowClass::TopToolbar); - break; - case WIDX_TOOLBAR_SHOW_RESEARCH: - gConfigInterface.ToolbarShowResearch ^= 1; - ConfigSaveDefault(); - Invalidate(); - WindowInvalidateByClass(WindowClass::TopToolbar); - break; - case WIDX_TOOLBAR_SHOW_CHEATS: - gConfigInterface.ToolbarShowCheats ^= 1; - ConfigSaveDefault(); - Invalidate(); - WindowInvalidateByClass(WindowClass::TopToolbar); - break; - case WIDX_TOOLBAR_SHOW_NEWS: - gConfigInterface.ToolbarShowNews ^= 1; - ConfigSaveDefault(); - Invalidate(); - WindowInvalidateByClass(WindowClass::TopToolbar); - break; - case WIDX_TOOLBAR_SHOW_MUTE: - gConfigInterface.ToolbarShowMute ^= 1; - ConfigSaveDefault(); - Invalidate(); - WindowInvalidateByClass(WindowClass::TopToolbar); - break; - case WIDX_TOOLBAR_SHOW_CHAT: - gConfigInterface.ToolbarShowChat ^= 1; - ConfigSaveDefault(); - Invalidate(); - WindowInvalidateByClass(WindowClass::TopToolbar); - break; - case WIDX_TOOLBAR_SHOW_ZOOM: - gConfigInterface.ToolbarShowZoom ^= 1; - ConfigSaveDefault(); - Invalidate(); - WindowInvalidateByClass(WindowClass::TopToolbar); - break; - case WIDX_WINDOW_BUTTONS_ON_THE_LEFT: - gConfigInterface.WindowButtonsOnTheLeft ^= 1; - ConfigSaveDefault(); - Invalidate(); - WindowInvalidateAll(); - break; - case WIDX_INVERT_DRAG: - gConfigGeneral.InvertViewportDrag ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_THEMES_BUTTON: - ContextOpenWindow(WindowClass::Themes); - Invalidate(); - break; + switch (widgetIndex) + { + case WIDX_HOTKEY_DROPDOWN: + ContextOpenWindow(WindowClass::KeyboardShortcutList); + break; + case WIDX_SCREEN_EDGE_SCROLLING: + gConfigGeneral.EdgeScrolling ^= 1; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_TRAP_CURSOR: + gConfigGeneral.TrapCursor ^= 1; + ConfigSaveDefault(); + ContextSetCursorTrap(gConfigGeneral.TrapCursor); + Invalidate(); + break; + case WIDX_ZOOM_TO_CURSOR: + gConfigGeneral.ZoomToCursor ^= 1; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_TOOLBAR_SHOW_FINANCES: + gConfigInterface.ToolbarShowFinances ^= 1; + ConfigSaveDefault(); + Invalidate(); + WindowInvalidateByClass(WindowClass::TopToolbar); + break; + case WIDX_TOOLBAR_SHOW_RESEARCH: + gConfigInterface.ToolbarShowResearch ^= 1; + ConfigSaveDefault(); + Invalidate(); + WindowInvalidateByClass(WindowClass::TopToolbar); + break; + case WIDX_TOOLBAR_SHOW_CHEATS: + gConfigInterface.ToolbarShowCheats ^= 1; + ConfigSaveDefault(); + Invalidate(); + WindowInvalidateByClass(WindowClass::TopToolbar); + break; + case WIDX_TOOLBAR_SHOW_NEWS: + gConfigInterface.ToolbarShowNews ^= 1; + ConfigSaveDefault(); + Invalidate(); + WindowInvalidateByClass(WindowClass::TopToolbar); + break; + case WIDX_TOOLBAR_SHOW_MUTE: + gConfigInterface.ToolbarShowMute ^= 1; + ConfigSaveDefault(); + Invalidate(); + WindowInvalidateByClass(WindowClass::TopToolbar); + break; + case WIDX_TOOLBAR_SHOW_CHAT: + gConfigInterface.ToolbarShowChat ^= 1; + ConfigSaveDefault(); + Invalidate(); + WindowInvalidateByClass(WindowClass::TopToolbar); + break; + case WIDX_TOOLBAR_SHOW_ZOOM: + gConfigInterface.ToolbarShowZoom ^= 1; + ConfigSaveDefault(); + Invalidate(); + WindowInvalidateByClass(WindowClass::TopToolbar); + break; + case WIDX_WINDOW_BUTTONS_ON_THE_LEFT: + gConfigInterface.WindowButtonsOnTheLeft ^= 1; + ConfigSaveDefault(); + Invalidate(); + WindowInvalidateAll(); + break; + case WIDX_INVERT_DRAG: + gConfigGeneral.InvertViewportDrag ^= 1; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_THEMES_BUTTON: + ContextOpenWindow(WindowClass::Themes); + Invalidate(); + break; + } } - } - void ControlsMouseDown(WidgetIndex widgetIndex) - { - Widget* widget = &widgets[widgetIndex - 1]; - - switch (widgetIndex) + void ControlsMouseDown(WidgetIndex widgetIndex) { - case WIDX_THEMES_DROPDOWN: - uint32_t numItems = static_cast(ThemeManagerGetNumAvailableThemes()); + Widget* widget = &widgets[widgetIndex - 1]; - for (size_t i = 0; i < numItems; i++) - { - gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItems[i].Args = reinterpret_cast(ThemeManagerGetAvailableThemeName(i)); - } + switch (widgetIndex) + { + case WIDX_THEMES_DROPDOWN: + uint32_t numItems = static_cast(ThemeManagerGetNumAvailableThemes()); - WindowDropdownShowTextCustomWidth( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, numItems, widget->width() - 3); + for (size_t i = 0; i < numItems; i++) + { + gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; + gDropdownItems[i].Args = reinterpret_cast(ThemeManagerGetAvailableThemeName(i)); + } - Dropdown::SetChecked(static_cast(ThemeManagerGetAvailableThemeIndex()), true); - InvalidateWidget(WIDX_THEMES_DROPDOWN); - break; + WindowDropdownShowTextCustomWidth( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, + Dropdown::Flag::StayOpen, numItems, widget->width() - 3); + + Dropdown::SetChecked(static_cast(ThemeManagerGetAvailableThemeIndex()), true); + InvalidateWidget(WIDX_THEMES_DROPDOWN); + break; + } } - } - void ControlsDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - switch (widgetIndex) + void ControlsDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) { - case WIDX_THEMES_DROPDOWN: - if (dropdownIndex != -1) - { - ThemeManagerSetActiveAvailableTheme(dropdownIndex); - } - ConfigSaveDefault(); - break; + switch (widgetIndex) + { + case WIDX_THEMES_DROPDOWN: + if (dropdownIndex != -1) + { + ThemeManagerSetActiveAvailableTheme(dropdownIndex); + } + ConfigSaveDefault(); + break; + } } - } - void ControlsPrepareDraw() - { - SetCheckboxValue(WIDX_SCREEN_EDGE_SCROLLING, gConfigGeneral.EdgeScrolling); - SetCheckboxValue(WIDX_TRAP_CURSOR, gConfigGeneral.TrapCursor); - SetCheckboxValue(WIDX_INVERT_DRAG, gConfigGeneral.InvertViewportDrag); - SetCheckboxValue(WIDX_ZOOM_TO_CURSOR, gConfigGeneral.ZoomToCursor); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_FINANCES, gConfigInterface.ToolbarShowFinances); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_RESEARCH, gConfigInterface.ToolbarShowResearch); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_CHEATS, gConfigInterface.ToolbarShowCheats); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_NEWS, gConfigInterface.ToolbarShowNews); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_MUTE, gConfigInterface.ToolbarShowMute); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_CHAT, gConfigInterface.ToolbarShowChat); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_ZOOM, gConfigInterface.ToolbarShowZoom); - SetCheckboxValue(WIDX_WINDOW_BUTTONS_ON_THE_LEFT, gConfigInterface.WindowButtonsOnTheLeft); + void ControlsPrepareDraw() + { + SetCheckboxValue(WIDX_SCREEN_EDGE_SCROLLING, gConfigGeneral.EdgeScrolling); + SetCheckboxValue(WIDX_TRAP_CURSOR, gConfigGeneral.TrapCursor); + SetCheckboxValue(WIDX_INVERT_DRAG, gConfigGeneral.InvertViewportDrag); + SetCheckboxValue(WIDX_ZOOM_TO_CURSOR, gConfigGeneral.ZoomToCursor); + SetCheckboxValue(WIDX_TOOLBAR_SHOW_FINANCES, gConfigInterface.ToolbarShowFinances); + SetCheckboxValue(WIDX_TOOLBAR_SHOW_RESEARCH, gConfigInterface.ToolbarShowResearch); + SetCheckboxValue(WIDX_TOOLBAR_SHOW_CHEATS, gConfigInterface.ToolbarShowCheats); + SetCheckboxValue(WIDX_TOOLBAR_SHOW_NEWS, gConfigInterface.ToolbarShowNews); + SetCheckboxValue(WIDX_TOOLBAR_SHOW_MUTE, gConfigInterface.ToolbarShowMute); + SetCheckboxValue(WIDX_TOOLBAR_SHOW_CHAT, gConfigInterface.ToolbarShowChat); + SetCheckboxValue(WIDX_TOOLBAR_SHOW_ZOOM, gConfigInterface.ToolbarShowZoom); + SetCheckboxValue(WIDX_WINDOW_BUTTONS_ON_THE_LEFT, gConfigInterface.WindowButtonsOnTheLeft); - size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); - const utf8* activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); - auto ft = Formatter::Common(); - ft.Add(activeThemeName); - } + size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); + const utf8* activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); + auto ft = Formatter::Common(); + ft.Add(activeThemeName); + } #pragma endregion #pragma region Misc tab events - void MiscMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void MiscMouseUp(WidgetIndex widgetIndex) { - case WIDX_REAL_NAME_CHECKBOX: - gConfigGeneral.ShowRealNamesOfGuests ^= 1; - ConfigSaveDefault(); - Invalidate(); - PeepUpdateNames(gConfigGeneral.ShowRealNamesOfGuests); - break; - case WIDX_AUTO_STAFF_PLACEMENT: - gConfigGeneral.AutoStaffPlacement ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_SCENARIO_UNLOCKING: - gConfigGeneral.ScenarioUnlockingEnabled ^= 1; - ConfigSaveDefault(); - WindowCloseByClass(WindowClass::ScenarioSelect); - break; - case WIDX_AUTO_OPEN_SHOPS: - gConfigGeneral.AutoOpenShops = !gConfigGeneral.AutoOpenShops; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_ALLOW_EARLY_COMPLETION: - gConfigGeneral.AllowEarlyCompletion ^= 1; - // Only the server can control this setting and needs to send the - // current value of allow_early_completion to all clients - if (NetworkGetMode() == NETWORK_MODE_SERVER) - { - auto setAllowEarlyCompletionAction = ScenarioSetSettingAction( - ScenarioSetSetting::AllowEarlyCompletion, gConfigGeneral.AllowEarlyCompletion); - GameActions::Execute(&setAllowEarlyCompletionAction); - } - ConfigSaveDefault(); - Invalidate(); - break; - } - } - - void MiscMouseDown(WidgetIndex widgetIndex) - { - Widget* widget = &widgets[widgetIndex - 1]; - - switch (widgetIndex) - { - case WIDX_TITLE_SEQUENCE_DROPDOWN: + switch (widgetIndex) { - uint32_t numItems = static_cast(TitleSequenceManagerGetCount()); - for (size_t i = 0; i < numItems; i++) - { - gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItems[i].Args = reinterpret_cast(TitleSequenceManagerGetName(i)); - } - - gDropdownItems[numItems].Format = 0; - numItems++; - gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[numItems].Args = STR_TITLE_SEQUENCE_RANDOM; - numItems++; - - WindowDropdownShowText( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], - Dropdown::Flag::StayOpen, numItems); - - auto selectedIndex = gConfigInterface.RandomTitleSequence ? numItems - 1 - : static_cast(TitleGetCurrentSequence()); - Dropdown::SetChecked(selectedIndex, true); - break; - } - case WIDX_SCENARIO_GROUPING_DROPDOWN: - { - uint32_t numItems = 2; - - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_OPTIONS_SCENARIO_DIFFICULTY; - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Args = STR_OPTIONS_SCENARIO_ORIGIN; - - WindowDropdownShowTextCustomWidth( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, numItems, widget->width() - 3); - - Dropdown::SetChecked(gConfigGeneral.ScenarioSelectMode, true); - break; - } - case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN: - for (size_t i = 0; i < 7; i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = RideInspectionIntervalNames[i]; - } - - ShowDropdown(widget, 7); - Dropdown::SetChecked(gConfigGeneral.DefaultInspectionInterval, true); - break; - } - } - - void MiscDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - switch (widgetIndex) - { - case WIDX_TITLE_SEQUENCE_DROPDOWN: - { - auto numItems = static_cast(TitleSequenceManagerGetCount()); - if (dropdownIndex < numItems && dropdownIndex != static_cast(TitleGetCurrentSequence())) - { - gConfigInterface.RandomTitleSequence = false; - TitleSequenceChangePreset(static_cast(dropdownIndex)); + case WIDX_REAL_NAME_CHECKBOX: + gConfigGeneral.ShowRealNamesOfGuests ^= 1; ConfigSaveDefault(); Invalidate(); - } - else if (dropdownIndex == numItems + 1) - { - gConfigInterface.RandomTitleSequence = true; + PeepUpdateNames(gConfigGeneral.ShowRealNamesOfGuests); + break; + case WIDX_AUTO_STAFF_PLACEMENT: + gConfigGeneral.AutoStaffPlacement ^= 1; ConfigSaveDefault(); Invalidate(); - } - break; - } - case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN: - if (dropdownIndex != gConfigGeneral.DefaultInspectionInterval) - { - gConfigGeneral.DefaultInspectionInterval = static_cast(dropdownIndex); + break; + case WIDX_SCENARIO_UNLOCKING: + gConfigGeneral.ScenarioUnlockingEnabled ^= 1; ConfigSaveDefault(); - Invalidate(); - } - break; - case WIDX_SCENARIO_GROUPING_DROPDOWN: - if (dropdownIndex != gConfigGeneral.ScenarioSelectMode) - { - gConfigGeneral.ScenarioSelectMode = dropdownIndex; - gConfigInterface.ScenarioselectLastTab = 0; - ConfigSaveDefault(); - Invalidate(); WindowCloseByClass(WindowClass::ScenarioSelect); - } - break; - } - } - - void MiscPrepareDraw() - { - auto ft = Formatter::Common(); - if (gConfigInterface.RandomTitleSequence) - { - ft.Add(STR_TITLE_SEQUENCE_RANDOM); - } - else - { - auto name = TitleSequenceManagerGetName(TitleGetConfigSequence()); - ft.Add(STR_STRING); - ft.Add(name); - } - - // The real name setting of clients is fixed to that of the server - // and the server cannot change the setting during gameplay to prevent desyncs - if (NetworkGetMode() != NETWORK_MODE_NONE) - { - disabled_widgets |= (1uLL << WIDX_REAL_NAME_CHECKBOX); - widgets[WIDX_REAL_NAME_CHECKBOX].tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY; - // Disable the use of the allow_early_completion option during network play on clients. - // This is to prevent confusion on clients because changing this setting during network play wouldn't change - // the way scenarios are completed during this network-session - if (NetworkGetMode() == NETWORK_MODE_CLIENT) - { - disabled_widgets |= (1uLL << WIDX_ALLOW_EARLY_COMPLETION); - widgets[WIDX_ALLOW_EARLY_COMPLETION].tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY; + break; + case WIDX_AUTO_OPEN_SHOPS: + gConfigGeneral.AutoOpenShops = !gConfigGeneral.AutoOpenShops; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_ALLOW_EARLY_COMPLETION: + gConfigGeneral.AllowEarlyCompletion ^= 1; + // Only the server can control this setting and needs to send the + // current value of allow_early_completion to all clients + if (NetworkGetMode() == NETWORK_MODE_SERVER) + { + auto setAllowEarlyCompletionAction = ScenarioSetSettingAction( + ScenarioSetSetting::AllowEarlyCompletion, gConfigGeneral.AllowEarlyCompletion); + GameActions::Execute(&setAllowEarlyCompletionAction); + } + ConfigSaveDefault(); + Invalidate(); + break; } } - SetCheckboxValue(WIDX_REAL_NAME_CHECKBOX, gConfigGeneral.ShowRealNamesOfGuests); - SetCheckboxValue(WIDX_AUTO_STAFF_PLACEMENT, gConfigGeneral.AutoStaffPlacement); - SetCheckboxValue(WIDX_AUTO_OPEN_SHOPS, gConfigGeneral.AutoOpenShops); - SetCheckboxValue(WIDX_ALLOW_EARLY_COMPLETION, gConfigGeneral.AllowEarlyCompletion); - - if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_DIFFICULTY) - widgets[WIDX_SCENARIO_GROUPING].text = STR_OPTIONS_SCENARIO_DIFFICULTY; - else - widgets[WIDX_SCENARIO_GROUPING].text = STR_OPTIONS_SCENARIO_ORIGIN; - - SetCheckboxValue(WIDX_SCENARIO_UNLOCKING, gConfigGeneral.ScenarioUnlockingEnabled); - - if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN) + void MiscMouseDown(WidgetIndex widgetIndex) { - disabled_widgets &= ~(1uLL << WIDX_SCENARIO_UNLOCKING); - } - else - { - disabled_widgets |= (1uLL << WIDX_SCENARIO_UNLOCKING); + Widget* widget = &widgets[widgetIndex - 1]; + + switch (widgetIndex) + { + case WIDX_TITLE_SEQUENCE_DROPDOWN: + { + uint32_t numItems = static_cast(TitleSequenceManagerGetCount()); + for (size_t i = 0; i < numItems; i++) + { + gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; + gDropdownItems[i].Args = reinterpret_cast(TitleSequenceManagerGetName(i)); + } + + gDropdownItems[numItems].Format = 0; + numItems++; + gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[numItems].Args = STR_TITLE_SEQUENCE_RANDOM; + numItems++; + + WindowDropdownShowText( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], + Dropdown::Flag::StayOpen, numItems); + + auto selectedIndex = gConfigInterface.RandomTitleSequence ? numItems - 1 + : static_cast(TitleGetCurrentSequence()); + Dropdown::SetChecked(selectedIndex, true); + break; + } + case WIDX_SCENARIO_GROUPING_DROPDOWN: + { + uint32_t numItems = 2; + + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_OPTIONS_SCENARIO_DIFFICULTY; + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Args = STR_OPTIONS_SCENARIO_ORIGIN; + + WindowDropdownShowTextCustomWidth( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, + Dropdown::Flag::StayOpen, numItems, widget->width() - 3); + + Dropdown::SetChecked(gConfigGeneral.ScenarioSelectMode, true); + break; + } + case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN: + for (size_t i = 0; i < 7; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = RideInspectionIntervalNames[i]; + } + + ShowDropdown(widget, 7); + Dropdown::SetChecked(gConfigGeneral.DefaultInspectionInterval, true); + break; + } } - widgets[WIDX_DEFAULT_INSPECTION_INTERVAL].text = RideInspectionIntervalNames[gConfigGeneral.DefaultInspectionInterval]; - } + void MiscDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + switch (widgetIndex) + { + case WIDX_TITLE_SEQUENCE_DROPDOWN: + { + auto numItems = static_cast(TitleSequenceManagerGetCount()); + if (dropdownIndex < numItems && dropdownIndex != static_cast(TitleGetCurrentSequence())) + { + gConfigInterface.RandomTitleSequence = false; + TitleSequenceChangePreset(static_cast(dropdownIndex)); + ConfigSaveDefault(); + Invalidate(); + } + else if (dropdownIndex == numItems + 1) + { + gConfigInterface.RandomTitleSequence = true; + ConfigSaveDefault(); + Invalidate(); + } + break; + } + case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN: + if (dropdownIndex != gConfigGeneral.DefaultInspectionInterval) + { + gConfigGeneral.DefaultInspectionInterval = static_cast(dropdownIndex); + ConfigSaveDefault(); + Invalidate(); + } + break; + case WIDX_SCENARIO_GROUPING_DROPDOWN: + if (dropdownIndex != gConfigGeneral.ScenarioSelectMode) + { + gConfigGeneral.ScenarioSelectMode = dropdownIndex; + gConfigInterface.ScenarioselectLastTab = 0; + ConfigSaveDefault(); + Invalidate(); + WindowCloseByClass(WindowClass::ScenarioSelect); + } + break; + } + } + + void MiscPrepareDraw() + { + auto ft = Formatter::Common(); + if (gConfigInterface.RandomTitleSequence) + { + ft.Add(STR_TITLE_SEQUENCE_RANDOM); + } + else + { + auto name = TitleSequenceManagerGetName(TitleGetConfigSequence()); + ft.Add(STR_STRING); + ft.Add(name); + } + + // The real name setting of clients is fixed to that of the server + // and the server cannot change the setting during gameplay to prevent desyncs + if (NetworkGetMode() != NETWORK_MODE_NONE) + { + disabled_widgets |= (1uLL << WIDX_REAL_NAME_CHECKBOX); + widgets[WIDX_REAL_NAME_CHECKBOX].tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY; + // Disable the use of the allow_early_completion option during network play on clients. + // This is to prevent confusion on clients because changing this setting during network play wouldn't change + // the way scenarios are completed during this network-session + if (NetworkGetMode() == NETWORK_MODE_CLIENT) + { + disabled_widgets |= (1uLL << WIDX_ALLOW_EARLY_COMPLETION); + widgets[WIDX_ALLOW_EARLY_COMPLETION].tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY; + } + } + + SetCheckboxValue(WIDX_REAL_NAME_CHECKBOX, gConfigGeneral.ShowRealNamesOfGuests); + SetCheckboxValue(WIDX_AUTO_STAFF_PLACEMENT, gConfigGeneral.AutoStaffPlacement); + SetCheckboxValue(WIDX_AUTO_OPEN_SHOPS, gConfigGeneral.AutoOpenShops); + SetCheckboxValue(WIDX_ALLOW_EARLY_COMPLETION, gConfigGeneral.AllowEarlyCompletion); + + if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_DIFFICULTY) + widgets[WIDX_SCENARIO_GROUPING].text = STR_OPTIONS_SCENARIO_DIFFICULTY; + else + widgets[WIDX_SCENARIO_GROUPING].text = STR_OPTIONS_SCENARIO_ORIGIN; + + SetCheckboxValue(WIDX_SCENARIO_UNLOCKING, gConfigGeneral.ScenarioUnlockingEnabled); + + if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN) + { + disabled_widgets &= ~(1uLL << WIDX_SCENARIO_UNLOCKING); + } + else + { + disabled_widgets |= (1uLL << WIDX_SCENARIO_UNLOCKING); + } + + widgets[WIDX_DEFAULT_INSPECTION_INTERVAL].text = RideInspectionIntervalNames[gConfigGeneral + .DefaultInspectionInterval]; + } #pragma endregion #pragma region Advanced tab events - void AdvancedMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void AdvancedMouseUp(WidgetIndex widgetIndex) { - case WIDX_DEBUGGING_TOOLS: - gConfigGeneral.DebuggingTools ^= 1; - ConfigSaveDefault(); - GfxInvalidateScreen(); - break; - case WIDX_SAVE_PLUGIN_DATA_CHECKBOX: - gConfigGeneral.SavePluginData ^= 1; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_STAY_CONNECTED_AFTER_DESYNC: - gConfigNetwork.StayConnected = !gConfigNetwork.StayConnected; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_ALWAYS_NATIVE_LOADSAVE: - gConfigGeneral.UseNativeBrowseDialog = !gConfigGeneral.UseNativeBrowseDialog; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_PATH_TO_RCT1_BUTTON: + switch (widgetIndex) { - auto rct1path = OpenRCT2::GetContext()->GetUiContext()->ShowDirectoryDialog( - LanguageGetString(STR_PATH_TO_RCT1_BROWSER)); - if (!rct1path.empty()) + case WIDX_DEBUGGING_TOOLS: + gConfigGeneral.DebuggingTools ^= 1; + ConfigSaveDefault(); + GfxInvalidateScreen(); + break; + case WIDX_SAVE_PLUGIN_DATA_CHECKBOX: + gConfigGeneral.SavePluginData ^= 1; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_STAY_CONNECTED_AFTER_DESYNC: + gConfigNetwork.StayConnected = !gConfigNetwork.StayConnected; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_ALWAYS_NATIVE_LOADSAVE: + gConfigGeneral.UseNativeBrowseDialog = !gConfigGeneral.UseNativeBrowseDialog; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_PATH_TO_RCT1_BUTTON: { - // Check if this directory actually contains RCT1 - if (Csg1datPresentAtLocation(rct1path)) + auto rct1path = OpenRCT2::GetContext()->GetUiContext()->ShowDirectoryDialog( + LanguageGetString(STR_PATH_TO_RCT1_BROWSER)); + if (!rct1path.empty()) { - if (Csg1idatPresentAtLocation(rct1path)) + // Check if this directory actually contains RCT1 + if (Csg1datPresentAtLocation(rct1path)) { - if (CsgAtLocationIsUsable(rct1path)) + if (Csg1idatPresentAtLocation(rct1path)) { - gConfigGeneral.RCT1Path = std::move(rct1path); - gConfigInterface.ScenarioselectLastTab = 0; - ConfigSaveDefault(); - ContextShowError(STR_RESTART_REQUIRED, STR_NONE, {}); + if (CsgAtLocationIsUsable(rct1path)) + { + gConfigGeneral.RCT1Path = std::move(rct1path); + gConfigInterface.ScenarioselectLastTab = 0; + ConfigSaveDefault(); + ContextShowError(STR_RESTART_REQUIRED, STR_NONE, {}); + } + else + { + ContextShowError(STR_PATH_TO_RCT1_IS_WRONG_VERSION, STR_NONE, {}); + } } else { - ContextShowError(STR_PATH_TO_RCT1_IS_WRONG_VERSION, STR_NONE, {}); + ContextShowError(STR_PATH_TO_RCT1_DOES_NOT_CONTAIN_CSG1I_DAT, STR_NONE, {}); } } else { - ContextShowError(STR_PATH_TO_RCT1_DOES_NOT_CONTAIN_CSG1I_DAT, STR_NONE, {}); + ContextShowError(STR_PATH_TO_RCT1_WRONG_ERROR, STR_NONE, {}); } } - else + Invalidate(); + break; + } + case WIDX_PATH_TO_RCT1_CLEAR: + if (!gConfigGeneral.RCT1Path.empty()) { - ContextShowError(STR_PATH_TO_RCT1_WRONG_ERROR, STR_NONE, {}); + gConfigGeneral.RCT1Path.clear(); + ConfigSaveDefault(); } - } - Invalidate(); - break; + Invalidate(); + break; + case WIDX_ASSET_PACKS: + ContextOpenWindow(WindowClass::AssetPacks); + break; } - case WIDX_PATH_TO_RCT1_CLEAR: - if (!gConfigGeneral.RCT1Path.empty()) - { - gConfigGeneral.RCT1Path.clear(); - ConfigSaveDefault(); - } - Invalidate(); - break; - case WIDX_ASSET_PACKS: - ContextOpenWindow(WindowClass::AssetPacks); - break; } - } - void AdvancedMouseDown(WidgetIndex widgetIndex) - { - Widget* widget = &widgets[widgetIndex - 1]; - - switch (widgetIndex) + void AdvancedMouseDown(WidgetIndex widgetIndex) { - case WIDX_AUTOSAVE_FREQUENCY_DROPDOWN: - for (size_t i = AUTOSAVE_EVERY_MINUTE; i <= AUTOSAVE_NEVER; i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = AutosaveNames[i]; - } + Widget* widget = &widgets[widgetIndex - 1]; - ShowDropdown(widget, AUTOSAVE_NEVER + 1); - Dropdown::SetChecked(gConfigGeneral.AutosaveFrequency, true); - break; - case WIDX_AUTOSAVE_AMOUNT_UP: - gConfigGeneral.AutosaveAmount += 1; - ConfigSaveDefault(); - InvalidateWidget(WIDX_AUTOSAVE_FREQUENCY); - InvalidateWidget(WIDX_AUTOSAVE_FREQUENCY_DROPDOWN); - InvalidateWidget(WIDX_AUTOSAVE_AMOUNT); - break; - case WIDX_AUTOSAVE_AMOUNT_DOWN: - if (gConfigGeneral.AutosaveAmount > 1) - { - gConfigGeneral.AutosaveAmount -= 1; + switch (widgetIndex) + { + case WIDX_AUTOSAVE_FREQUENCY_DROPDOWN: + for (size_t i = AUTOSAVE_EVERY_MINUTE; i <= AUTOSAVE_NEVER; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = AutosaveNames[i]; + } + + ShowDropdown(widget, AUTOSAVE_NEVER + 1); + Dropdown::SetChecked(gConfigGeneral.AutosaveFrequency, true); + break; + case WIDX_AUTOSAVE_AMOUNT_UP: + gConfigGeneral.AutosaveAmount += 1; ConfigSaveDefault(); InvalidateWidget(WIDX_AUTOSAVE_FREQUENCY); InvalidateWidget(WIDX_AUTOSAVE_FREQUENCY_DROPDOWN); InvalidateWidget(WIDX_AUTOSAVE_AMOUNT); - } - } - } - - void AdvancedDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - switch (widgetIndex) - { - case WIDX_AUTOSAVE_FREQUENCY_DROPDOWN: - if (dropdownIndex != gConfigGeneral.AutosaveFrequency) - { - gConfigGeneral.AutosaveFrequency = static_cast(dropdownIndex); - ConfigSaveDefault(); - Invalidate(); - } - break; - } - } - - void AdvancedPrepareDraw() - { - SetCheckboxValue(WIDX_DEBUGGING_TOOLS, gConfigGeneral.DebuggingTools); - SetCheckboxValue(WIDX_SAVE_PLUGIN_DATA_CHECKBOX, gConfigGeneral.SavePluginData); - SetCheckboxValue(WIDX_STAY_CONNECTED_AFTER_DESYNC, gConfigNetwork.StayConnected); - SetCheckboxValue(WIDX_ALWAYS_NATIVE_LOADSAVE, gConfigGeneral.UseNativeBrowseDialog); - widgets[WIDX_AUTOSAVE_FREQUENCY].text = AutosaveNames[gConfigGeneral.AutosaveFrequency]; - } - - void AdvancedDraw(DrawPixelInfo& dpi) - { - auto ft = Formatter(); - ft.Add(static_cast(gConfigGeneral.AutosaveAmount)); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_AUTOSAVE_AMOUNT].left + 1, widgets[WIDX_AUTOSAVE_AMOUNT].top + 1 }, - STR_WINDOW_COLOUR_2_COMMA16, ft, { colours[1] }); - - const auto normalisedPath = Platform::StrDecompToPrecomp(gConfigGeneral.RCT1Path); - ft = Formatter(); - ft.Add(normalisedPath.c_str()); - - Widget pathWidget = widgets[WIDX_PATH_TO_RCT1_BUTTON]; - - // Apply vertical alignment if appropriate. - int32_t widgetHeight = pathWidget.bottom - pathWidget.top; - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); - uint32_t padding = widgetHeight > lineHeight ? (widgetHeight - lineHeight) / 2 : 0; - ScreenCoordsXY screenCoords = { windowPos.x + pathWidget.left + 1, - windowPos.y + pathWidget.top + static_cast(padding) }; - DrawTextEllipsised(dpi, screenCoords, 277, STR_STRING, ft, { colours[1] }); - } - - OpenRCT2String AdvancedTooltip(WidgetIndex widgetIndex, StringId fallback) - { - if (widgetIndex == WIDX_PATH_TO_RCT1_BUTTON) - { - if (gConfigGeneral.RCT1Path.empty()) - { - // No tooltip if the path is empty - return { STR_NONE, {} }; + break; + case WIDX_AUTOSAVE_AMOUNT_DOWN: + if (gConfigGeneral.AutosaveAmount > 1) + { + gConfigGeneral.AutosaveAmount -= 1; + ConfigSaveDefault(); + InvalidateWidget(WIDX_AUTOSAVE_FREQUENCY); + InvalidateWidget(WIDX_AUTOSAVE_FREQUENCY_DROPDOWN); + InvalidateWidget(WIDX_AUTOSAVE_AMOUNT); + } } - - auto ft = Formatter(); - ft.Add(gConfigGeneral.RCT1Path.c_str()); - return { fallback, ft }; } - return { fallback, {} }; - } + + void AdvancedDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + switch (widgetIndex) + { + case WIDX_AUTOSAVE_FREQUENCY_DROPDOWN: + if (dropdownIndex != gConfigGeneral.AutosaveFrequency) + { + gConfigGeneral.AutosaveFrequency = static_cast(dropdownIndex); + ConfigSaveDefault(); + Invalidate(); + } + break; + } + } + + void AdvancedPrepareDraw() + { + SetCheckboxValue(WIDX_DEBUGGING_TOOLS, gConfigGeneral.DebuggingTools); + SetCheckboxValue(WIDX_SAVE_PLUGIN_DATA_CHECKBOX, gConfigGeneral.SavePluginData); + SetCheckboxValue(WIDX_STAY_CONNECTED_AFTER_DESYNC, gConfigNetwork.StayConnected); + SetCheckboxValue(WIDX_ALWAYS_NATIVE_LOADSAVE, gConfigGeneral.UseNativeBrowseDialog); + widgets[WIDX_AUTOSAVE_FREQUENCY].text = AutosaveNames[gConfigGeneral.AutosaveFrequency]; + } + + void AdvancedDraw(DrawPixelInfo& dpi) + { + auto ft = Formatter(); + ft.Add(static_cast(gConfigGeneral.AutosaveAmount)); + DrawTextBasic( + dpi, + windowPos + ScreenCoordsXY{ widgets[WIDX_AUTOSAVE_AMOUNT].left + 1, widgets[WIDX_AUTOSAVE_AMOUNT].top + 1 }, + STR_WINDOW_COLOUR_2_COMMA32, ft, { colours[1] }); + + const auto normalisedPath = Platform::StrDecompToPrecomp(gConfigGeneral.RCT1Path); + ft = Formatter(); + ft.Add(normalisedPath.c_str()); + + Widget pathWidget = widgets[WIDX_PATH_TO_RCT1_BUTTON]; + + // Apply vertical alignment if appropriate. + int32_t widgetHeight = pathWidget.bottom - pathWidget.top; + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + uint32_t padding = widgetHeight > lineHeight ? (widgetHeight - lineHeight) / 2 : 0; + ScreenCoordsXY screenCoords = { windowPos.x + pathWidget.left + 1, + windowPos.y + pathWidget.top + static_cast(padding) }; + DrawTextEllipsised(dpi, screenCoords, 277, STR_STRING, ft, { colours[1] }); + } + + OpenRCT2String AdvancedTooltip(WidgetIndex widgetIndex, StringId fallback) + { + if (widgetIndex == WIDX_PATH_TO_RCT1_BUTTON) + { + if (gConfigGeneral.RCT1Path.empty()) + { + // No tooltip if the path is empty + return { STR_NONE, {} }; + } + + auto ft = Formatter(); + ft.Add(gConfigGeneral.RCT1Path.c_str()); + return { fallback, ft }; + } + return { fallback, {} }; + } #pragma endregion - void SetPage(int32_t p) - { - page = p; - frame_no = 0; - pressed_widgets = 0; - widgets = window_options_page_widgets[page]; - - Invalidate(); - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); - InitScrollWidgets(); - Invalidate(); - } - - void SetPressedTab() - { - for (int32_t i = 0; i < WINDOW_OPTIONS_PAGE_COUNT; i++) - pressed_widgets &= ~(1 << (WIDX_FIRST_TAB + i)); - pressed_widgets |= 1LL << (WIDX_FIRST_TAB + page); - } - - void ShowDropdown(Widget* widget, int32_t num_items) - { - // helper function, all dropdown boxes have similar properties - WindowDropdownShowTextCustomWidth( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, num_items, widget->width() - 3); - } - - void DrawTabImages(DrawPixelInfo& dpi) - { - DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_DISPLAY, SPR_TAB_PAINT_0); - DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_RENDERING, SPR_G2_TAB_TREE); - DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_CULTURE, SPR_TAB_TIMER_0); - DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_AUDIO, SPR_TAB_MUSIC_0); - DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE, SPR_TAB_GEARS_0); - DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_MISC, SPR_TAB_RIDE_0); - DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_ADVANCED, SPR_TAB_WRENCH_0); - } - - void DrawTabImage(DrawPixelInfo& dpi, int32_t p, int32_t spriteIndex) - { - WidgetIndex widgetIndex = WIDX_FIRST_TAB + p; - Widget* widget = &widgets[widgetIndex]; - - auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; - - if (!WidgetIsDisabled(*this, widgetIndex)) + void SetPage(int32_t p) { - if (page == p) + page = p; + frame_no = 0; + pressed_widgets = 0; + widgets = window_options_page_widgets[page]; + + Invalidate(); + OnResize(); + OnPrepareDraw(); + InitScrollWidgets(); + Invalidate(); + } + + void SetPressedTab() + { + for (int32_t i = 0; i < WINDOW_OPTIONS_PAGE_COUNT; i++) + pressed_widgets &= ~(1 << (WIDX_FIRST_TAB + i)); + pressed_widgets |= 1LL << (WIDX_FIRST_TAB + page); + } + + void ShowDropdown(Widget* widget, int32_t num_items) + { + // helper function, all dropdown boxes have similar properties + WindowDropdownShowTextCustomWidth( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, + Dropdown::Flag::StayOpen, num_items, widget->width() - 3); + } + + void DrawTabImages(DrawPixelInfo& dpi) + { + DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_DISPLAY, SPR_TAB_PAINT_0); + DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_RENDERING, SPR_G2_TAB_TREE); + DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_CULTURE, SPR_TAB_TIMER_0); + DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_AUDIO, SPR_TAB_MUSIC_0); + DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE, SPR_TAB_GEARS_0); + DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_MISC, SPR_TAB_RIDE_0); + DrawTabImage(dpi, WINDOW_OPTIONS_PAGE_ADVANCED, SPR_TAB_WRENCH_0); + } + + void DrawTabImage(DrawPixelInfo& dpi, int32_t p, int32_t spriteIndex) + { + WidgetIndex widgetIndex = WIDX_FIRST_TAB + p; + Widget* widget = &widgets[widgetIndex]; + + auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; + + if (!WidgetIsDisabled(*this, widgetIndex)) { - int32_t frame = frame_no / TabAnimationDivisor[page]; - spriteIndex += (frame % TabAnimationFrames[page]); + if (page == p) + { + int32_t frame = frame_no / TabAnimationDivisor[page]; + spriteIndex += (frame % TabAnimationFrames[page]); + } + + // Draw normal, enabled sprite. + GfxDrawSprite(dpi, ImageId(spriteIndex), screenCoords); } + else + { + // Get the window background colour + uint8_t window_colour = NOT_TRANSLUCENT(colours[widget->colour]); - // Draw normal, enabled sprite. - GfxDrawSprite(dpi, ImageId(spriteIndex), screenCoords); + // Draw greyed out (light border bottom right shadow) + GfxDrawSpriteSolid( + dpi, ImageId(spriteIndex), screenCoords + ScreenCoordsXY{ 1, 1 }, ColourMapA[window_colour].lighter); + + // Draw greyed out (dark) + GfxDrawSpriteSolid(dpi, ImageId(spriteIndex), screenCoords, ColourMapA[window_colour].mid_light); + } } - else + + void UpdateHeightMarkers() { - // Get the window background colour - uint8_t window_colour = NOT_TRANSLUCENT(colours[widget->colour]); - - // Draw greyed out (light border bottom right shadow) - GfxDrawSpriteSolid( - &dpi, ImageId(spriteIndex), screenCoords + ScreenCoordsXY{ 1, 1 }, ColourMapA[window_colour].lighter); - - // Draw greyed out (dark) - GfxDrawSpriteSolid(&dpi, ImageId(spriteIndex), screenCoords, ColourMapA[window_colour].mid_light); + ConfigSaveDefault(); + GfxInvalidateScreen(); } - } - void UpdateHeightMarkers() - { - ConfigSaveDefault(); - GfxInvalidateScreen(); - } + uint8_t GetScrollPercentage(const Widget& widget, const ScrollBar& scroll) + { + uint8_t w = widget.width() - 1; + return static_cast(scroll.h_left) / (scroll.h_right - w) * 100; + } - uint8_t GetScrollPercentage(const Widget& widget, const ScrollBar& scroll) - { - uint8_t w = widget.width() - 1; - return static_cast(scroll.h_left) / (scroll.h_right - w) * 100; - } + void InitializeScrollPosition(WidgetIndex widgetIndex, int32_t scrollId, uint8_t volume) + { + const auto& widget = widgets[widgetIndex]; + auto& scroll = scrolls[scrollId]; - void InitializeScrollPosition(WidgetIndex widgetIndex, int32_t scrollId, uint8_t volume) - { - const auto& widget = widgets[widgetIndex]; - auto& scroll = scrolls[scrollId]; + int32_t widgetSize = scroll.h_right - (widget.width() - 1); + scroll.h_left = ceil(volume / 100.0f * widgetSize); - int32_t widgetSize = scroll.h_right - (widget.width() - 1); - scroll.h_left = ceil(volume / 100.0f * widgetSize); + WidgetScrollUpdateThumbs(*this, widgetIndex); + } - WidgetScrollUpdateThumbs(*this, widgetIndex); - } + static bool IsRCT1TitleMusicAvailable() + { + auto env = GetContext()->GetPlatformEnvironment(); + auto rct1path = env->GetDirectoryPath(DIRBASE::RCT1); + return !rct1path.empty(); + } - static bool IsRCT1TitleMusicAvailable() - { - auto env = GetContext()->GetPlatformEnvironment(); - auto rct1path = env->GetDirectoryPath(DIRBASE::RCT1); - return !rct1path.empty(); - } + static constexpr StringId AutosaveNames[] = { + STR_SAVE_EVERY_MINUTE, STR_SAVE_EVERY_5MINUTES, STR_SAVE_EVERY_15MINUTES, + STR_SAVE_EVERY_30MINUTES, STR_SAVE_EVERY_HOUR, STR_SAVE_NEVER, + }; - static constexpr StringId AutosaveNames[] = { - STR_SAVE_EVERY_MINUTE, STR_SAVE_EVERY_5MINUTES, STR_SAVE_EVERY_15MINUTES, - STR_SAVE_EVERY_30MINUTES, STR_SAVE_EVERY_HOUR, STR_SAVE_NEVER, + static constexpr struct + { + TitleMusicKind Kind; + StringId Name; + } TitleThemeOptions[] = { + { TitleMusicKind::None, STR_OPTIONS_MUSIC_VALUE_NONE }, + { TitleMusicKind::OpenRCT2, STR_OPENRCT2_DROPDOWN }, + { TitleMusicKind::RCT1, STR_ROLLERCOASTER_TYCOON_1_DROPDOWN }, + { TitleMusicKind::RCT2, STR_ROLLERCOASTER_TYCOON_2_DROPDOWN }, + { TitleMusicKind::Random, STR_OPTIONS_MUSIC_VALUE_RANDOM }, + }; + + static constexpr StringId FullscreenModeNames[] = { + STR_OPTIONS_DISPLAY_WINDOWED, + STR_OPTIONS_DISPLAY_FULLSCREEN, + STR_OPTIONS_DISPLAY_FULLSCREEN_BORDERLESS, + }; + + static constexpr int32_t TabAnimationDivisor[] = { + 4, // WINDOW_OPTIONS_PAGE_DISPLAY, + 1, // WINDOW_OPTIONS_PAGE_RENDERING, + 8, // WINDOW_OPTIONS_PAGE_CULTURE, + 2, // WINDOW_OPTIONS_PAGE_AUDIO, + 2, // WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE, + 4, // WINDOW_OPTIONS_PAGE_MISC, + 2, // WINDOW_OPTIONS_PAGE_ADVANCED, + }; + + static constexpr int32_t TabAnimationFrames[] = { + 8, // WINDOW_OPTIONS_PAGE_DISPLAY, + 1, // WINDOW_OPTIONS_PAGE_RENDERING, + 8, // WINDOW_OPTIONS_PAGE_CULTURE, + 16, // WINDOW_OPTIONS_PAGE_AUDIO, + 4, // WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE, + 16, // WINDOW_OPTIONS_PAGE_MISC, + 16, // WINDOW_OPTIONS_PAGE_ADVANCED, + }; }; - static constexpr struct + /** + * + * rct2: 0x006BAC5B + */ + WindowBase* OptionsOpen() { - TitleMusicKind Kind; - StringId Name; - } TitleThemeOptions[] = { - { TitleMusicKind::None, STR_OPTIONS_MUSIC_VALUE_NONE }, - { TitleMusicKind::OpenRCT2, STR_OPENRCT2_DROPDOWN }, - { TitleMusicKind::RCT1, STR_ROLLERCOASTER_TYCOON_1_DROPDOWN }, - { TitleMusicKind::RCT2, STR_ROLLERCOASTER_TYCOON_2_DROPDOWN }, - { TitleMusicKind::Random, STR_OPTIONS_MUSIC_VALUE_RANDOM }, - }; - - static constexpr StringId FullscreenModeNames[] = { - STR_OPTIONS_DISPLAY_WINDOWED, - STR_OPTIONS_DISPLAY_FULLSCREEN, - STR_OPTIONS_DISPLAY_FULLSCREEN_BORDERLESS, - }; - - static constexpr int32_t TabAnimationDivisor[] = { - 4, // WINDOW_OPTIONS_PAGE_DISPLAY, - 1, // WINDOW_OPTIONS_PAGE_RENDERING, - 8, // WINDOW_OPTIONS_PAGE_CULTURE, - 2, // WINDOW_OPTIONS_PAGE_AUDIO, - 2, // WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE, - 4, // WINDOW_OPTIONS_PAGE_MISC, - 2, // WINDOW_OPTIONS_PAGE_ADVANCED, - }; - - static constexpr int32_t TabAnimationFrames[] = { - 8, // WINDOW_OPTIONS_PAGE_DISPLAY, - 1, // WINDOW_OPTIONS_PAGE_RENDERING, - 8, // WINDOW_OPTIONS_PAGE_CULTURE, - 16, // WINDOW_OPTIONS_PAGE_AUDIO, - 4, // WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE, - 16, // WINDOW_OPTIONS_PAGE_MISC, - 16, // WINDOW_OPTIONS_PAGE_ADVANCED, - }; -}; - -/** - * - * rct2: 0x006BAC5B - */ -WindowBase* WindowOptionsOpen() -{ - return WindowFocusOrCreate(WindowClass::Options, WW, WH, WF_CENTRE_SCREEN); -} + return WindowFocusOrCreate(WindowClass::Options, WW, WH, WF_CENTRE_SCREEN); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 4cbaeda968..02310b3c7a 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -35,12 +36,12 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_STRINGID; + static constexpr int32_t WH = 224; -static constexpr StringId WINDOW_TITLE = STR_STRINGID; -static constexpr int32_t WH = 224; - -// clang-format off + // clang-format off enum WindowParkPage { WINDOW_PARK_PAGE_ENTRANCE, WINDOW_PARK_PAGE_RATING, @@ -105,40 +106,40 @@ static Widget _entranceWidgets[] = { MakeWidget({205, 121}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_NAME_PARK_TIP ), // rename MakeWidget({210, 51}, { 14, 15}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_CLOSE_BUTTON_0), STR_CLOSE_PARK_TIP ), MakeWidget({210, 66}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_OPEN_BUTTON_0), STR_OPEN_PARK_TIP ), - WIDGETS_END, + kWidgetsEnd, }; static Widget _ratingWidgets[] = { MAIN_PARK_WIDGETS(255), - WIDGETS_END, + kWidgetsEnd, }; static Widget _guestsWidgets[] = { MAIN_PARK_WIDGETS(255), - WIDGETS_END, + kWidgetsEnd, }; static Widget _priceWidgets[] = { MAIN_PARK_WIDGETS(230), MakeWidget ({ 21, 50}, {126, 14}, WindowWidgetType::Label, WindowColour::Secondary, STR_ADMISSION_PRICE), MakeSpinnerWidgets({147, 50}, { 76, 14}, WindowWidgetType::Spinner, WindowColour::Secondary ), // Price (3 widgets) - WIDGETS_END, + kWidgetsEnd, }; static Widget _statsWidgets[] = { MAIN_PARK_WIDGETS(230), - WIDGETS_END, + kWidgetsEnd, }; static Widget _objectiveWidgets[] = { MAIN_PARK_WIDGETS(230), MakeWidget({7, 207}, {216, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_ENTER_NAME_INTO_SCENARIO_CHART), // enter name - WIDGETS_END, + kWidgetsEnd, }; static Widget _awardsWidgets[] = { MAIN_PARK_WIDGETS(230), - WIDGETS_END, + kWidgetsEnd, }; static std::array _pagedWidgets = { @@ -188,328 +189,218 @@ static constexpr WindowParkAward _parkAwards[] = { { STR_AWARD_MOST_CONFUSING_LAYOUT, SPR_AWARD_MOST_CONFUSING_LAYOUT }, { STR_AWARD_BEST_GENTLE_RIDES, SPR_AWARD_BEST_GENTLE_RIDES }, }; -// clang-format on + // clang-format on -class ParkWindow final : public Window -{ - int32_t _numberOfStaff = -1; - int32_t _numberOfRides = -1; - uint8_t _peepAnimationFrame = 0; - -public: - void OnOpen() override + class ParkWindow final : public Window { - number = 0; - frame_no = 0; - _numberOfRides = -1; - _numberOfStaff = -1; - _peepAnimationFrame = 0; - SetPage(0); - } + int32_t _numberOfStaff = -1; + int32_t _numberOfRides = -1; + uint8_t _peepAnimationFrame = 0; - void OnClose() override - { - if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && classification == gCurrentToolWidget.window_classification - && number == gCurrentToolWidget.window_number) + public: + void OnOpen() override { - ToolCancel(); + number = 0; + frame_no = 0; + _numberOfRides = -1; + _numberOfStaff = -1; + _peepAnimationFrame = 0; + SetPage(0); } - } - void OnMouseUp(WidgetIndex idx) override - { - switch (idx) + void OnClose() override { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - SetPage(idx - WIDX_TAB_1); - return; - } - switch (page) - { - case WINDOW_PARK_PAGE_ENTRANCE: - OnMouseUpEntrance(idx); - break; - case WINDOW_PARK_PAGE_OBJECTIVE: - OnMouseUpObjective(idx); - break; - } - } - - void OnResize() override - { - switch (page) - { - case WINDOW_PARK_PAGE_ENTRANCE: - OnResizeEntrance(); - break; - case WINDOW_PARK_PAGE_RATING: - OnResizeRating(); - break; - case WINDOW_PARK_PAGE_GUESTS: - OnResizeGuests(); - break; - case WINDOW_PARK_PAGE_PRICE: - OnResizePrice(); - break; - case WINDOW_PARK_PAGE_STATS: - OnResizeStats(); - break; - case WINDOW_PARK_PAGE_OBJECTIVE: - OnResizeObjective(); - break; - case WINDOW_PARK_PAGE_AWARDS: - OnResizeAwards(); - break; - } - } - - void OnMouseDown(WidgetIndex idx) override - { - switch (page) - { - case WINDOW_PARK_PAGE_ENTRANCE: - OnMouseDownEntrance(idx); - break; - case WINDOW_PARK_PAGE_PRICE: - OnMouseDownPrice(idx); - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - switch (page) - { - case WINDOW_PARK_PAGE_ENTRANCE: - OnDropdownEntrance(widgetIndex, selectedIndex); - break; - } - } - - void OnUpdate() override - { - switch (page) - { - case WINDOW_PARK_PAGE_ENTRANCE: - OnUpdateEntrance(); - break; - case WINDOW_PARK_PAGE_RATING: - OnUpdateRating(); - break; - case WINDOW_PARK_PAGE_GUESTS: - OnUpdateGuests(); - break; - case WINDOW_PARK_PAGE_PRICE: - OnUpdatePrice(); - break; - case WINDOW_PARK_PAGE_STATS: - OnUpdateStats(); - break; - case WINDOW_PARK_PAGE_OBJECTIVE: - OnUpdateObjective(); - break; - case WINDOW_PARK_PAGE_AWARDS: - OnUpdateAwards(); - break; - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - switch (page) - { - case WINDOW_PARK_PAGE_ENTRANCE: - OnTextInputEntrance(widgetIndex, text); - break; - case WINDOW_PARK_PAGE_OBJECTIVE: - OnTextInputObjective(widgetIndex, text); - break; - } - } - - void OnPrepareDraw() override - { - switch (page) - { - case WINDOW_PARK_PAGE_ENTRANCE: - OnPrepareDrawEntrance(); - break; - case WINDOW_PARK_PAGE_RATING: - OnPrepareDrawRating(); - break; - case WINDOW_PARK_PAGE_GUESTS: - OnPrepareDrawGuests(); - break; - case WINDOW_PARK_PAGE_PRICE: - OnPrepareDrawPrice(); - break; - case WINDOW_PARK_PAGE_STATS: - OnPrepareDrawStats(); - break; - case WINDOW_PARK_PAGE_OBJECTIVE: - OnPrepareDrawObjective(); - break; - case WINDOW_PARK_PAGE_AWARDS: - OnPrepareDrawAwards(); - break; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - switch (page) - { - case WINDOW_PARK_PAGE_ENTRANCE: - OnDrawEntrance(dpi); - break; - case WINDOW_PARK_PAGE_RATING: - OnDrawRating(dpi); - break; - case WINDOW_PARK_PAGE_GUESTS: - OnDrawGuests(dpi); - break; - case WINDOW_PARK_PAGE_PRICE: - OnDrawPrice(dpi); - break; - case WINDOW_PARK_PAGE_STATS: - OnDrawStats(dpi); - break; - case WINDOW_PARK_PAGE_OBJECTIVE: - OnDrawObjective(dpi); - break; - case WINDOW_PARK_PAGE_AWARDS: - OnDrawAwards(dpi); - break; - } - } - -private: - void SetDisabledTabs() - { - // Disable price tab if money is disabled - disabled_widgets = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) ? (1uLL << WIDX_TAB_4) : 0; - } - - void PrepareWindowTitleText() - { - auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); - auto parkName = park.Name.c_str(); - - auto ft = Formatter::Common(); - ft.Add(STR_STRING); - ft.Add(parkName); - } - -#pragma region Entrance page - void OnMouseUpEntrance(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_BUY_LAND_RIGHTS: - ContextOpenWindow(WindowClass::LandRights); - break; - case WIDX_LOCATE: - ScrollToViewport(); - break; - case WIDX_RENAME: + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && classification == gCurrentToolWidget.window_classification + && number == gCurrentToolWidget.window_number) { - auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); - WindowTextInputRawOpen( - this, WIDX_RENAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, {}, park.Name.c_str(), USER_STRING_MAX_LENGTH); - break; - } - case WIDX_CLOSE_LIGHT: - ParkSetOpen(false); - break; - case WIDX_OPEN_LIGHT: - ParkSetOpen(true); - break; - } - } - - void OnResizeEntrance() - { - flags |= WF_RESIZABLE; - WindowSetResize(*this, 230, 174 + 9, 230 * 3, (274 + 9) * 3); - InitViewport(); - } - - void OnMouseDownEntrance(WidgetIndex widgetIndex) - { - if (widgetIndex == WIDX_OPEN_OR_CLOSE) - { - auto& widget = widgets[widgetIndex]; - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_CLOSE_PARK; - gDropdownItems[1].Args = STR_OPEN_PARK; - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1], 0, 2); - - if (ParkIsOpen()) - { - gDropdownDefaultIndex = 0; - Dropdown::SetChecked(1, true); - } - else - { - gDropdownDefaultIndex = 1; - Dropdown::SetChecked(0, true); + ToolCancel(); } } - } - void OnDropdownEntrance(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - if (widgetIndex == WIDX_OPEN_OR_CLOSE) + void OnMouseUp(WidgetIndex idx) override { - if (dropdownIndex == -1) - dropdownIndex = gDropdownHighlightedIndex; - - if (dropdownIndex != 0) + switch (idx) { - ParkSetOpen(true); + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + SetPage(idx - WIDX_TAB_1); + return; } - else + switch (page) { - ParkSetOpen(false); + case WINDOW_PARK_PAGE_ENTRANCE: + OnMouseUpEntrance(idx); + break; + case WINDOW_PARK_PAGE_OBJECTIVE: + OnMouseUpObjective(idx); + break; } } - } - void OnUpdateEntrance() - { - frame_no++; - WidgetInvalidate(*this, WIDX_TAB_1); - } - - void OnTextInputEntrance(WidgetIndex widgetIndex, std::string_view text) - { - if (widgetIndex == WIDX_RENAME && !text.empty()) + void OnResize() override { - auto action = ParkSetNameAction(std::string(text)); - GameActions::Execute(&action); + switch (page) + { + case WINDOW_PARK_PAGE_ENTRANCE: + OnResizeEntrance(); + break; + case WINDOW_PARK_PAGE_RATING: + OnResizeRating(); + break; + case WINDOW_PARK_PAGE_GUESTS: + OnResizeGuests(); + break; + case WINDOW_PARK_PAGE_PRICE: + OnResizePrice(); + break; + case WINDOW_PARK_PAGE_STATS: + OnResizeStats(); + break; + case WINDOW_PARK_PAGE_OBJECTIVE: + OnResizeObjective(); + break; + case WINDOW_PARK_PAGE_AWARDS: + OnResizeAwards(); + break; + } } - } - void OnPrepareDrawEntrance() - { - const auto& gameState = GetGameState(); - widgets = _pagedWidgets[page]; - InitScrollWidgets(); + void OnMouseDown(WidgetIndex idx) override + { + switch (page) + { + case WINDOW_PARK_PAGE_ENTRANCE: + OnMouseDownEntrance(idx); + break; + case WINDOW_PARK_PAGE_PRICE: + OnMouseDownPrice(idx); + break; + } + } - SetPressedTab(); + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + switch (page) + { + case WINDOW_PARK_PAGE_ENTRANCE: + OnDropdownEntrance(widgetIndex, selectedIndex); + break; + } + } - // Set open / close park button state + void OnUpdate() override + { + switch (page) + { + case WINDOW_PARK_PAGE_ENTRANCE: + OnUpdateEntrance(); + break; + case WINDOW_PARK_PAGE_RATING: + OnUpdateRating(); + break; + case WINDOW_PARK_PAGE_GUESTS: + OnUpdateGuests(); + break; + case WINDOW_PARK_PAGE_PRICE: + OnUpdatePrice(); + break; + case WINDOW_PARK_PAGE_STATS: + OnUpdateStats(); + break; + case WINDOW_PARK_PAGE_OBJECTIVE: + OnUpdateObjective(); + break; + case WINDOW_PARK_PAGE_AWARDS: + OnUpdateAwards(); + break; + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + switch (page) + { + case WINDOW_PARK_PAGE_ENTRANCE: + OnTextInputEntrance(widgetIndex, text); + break; + case WINDOW_PARK_PAGE_OBJECTIVE: + OnTextInputObjective(widgetIndex, text); + break; + } + } + + void OnPrepareDraw() override + { + switch (page) + { + case WINDOW_PARK_PAGE_ENTRANCE: + OnPrepareDrawEntrance(); + break; + case WINDOW_PARK_PAGE_RATING: + OnPrepareDrawRating(); + break; + case WINDOW_PARK_PAGE_GUESTS: + OnPrepareDrawGuests(); + break; + case WINDOW_PARK_PAGE_PRICE: + OnPrepareDrawPrice(); + break; + case WINDOW_PARK_PAGE_STATS: + OnPrepareDrawStats(); + break; + case WINDOW_PARK_PAGE_OBJECTIVE: + OnPrepareDrawObjective(); + break; + case WINDOW_PARK_PAGE_AWARDS: + OnPrepareDrawAwards(); + break; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + switch (page) + { + case WINDOW_PARK_PAGE_ENTRANCE: + OnDrawEntrance(dpi); + break; + case WINDOW_PARK_PAGE_RATING: + OnDrawRating(dpi); + break; + case WINDOW_PARK_PAGE_GUESTS: + OnDrawGuests(dpi); + break; + case WINDOW_PARK_PAGE_PRICE: + OnDrawPrice(dpi); + break; + case WINDOW_PARK_PAGE_STATS: + OnDrawStats(dpi); + break; + case WINDOW_PARK_PAGE_OBJECTIVE: + OnDrawObjective(dpi); + break; + case WINDOW_PARK_PAGE_AWARDS: + OnDrawAwards(dpi); + break; + } + } + + private: + void SetDisabledTabs() + { + // Disable price tab if money is disabled + disabled_widgets = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) ? (1uLL << WIDX_TAB_4) : 0; + } + + void PrepareWindowTitleText() { auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); auto parkName = park.Name.c_str(); @@ -518,843 +409,944 @@ private: ft.Add(STR_STRING); ft.Add(parkName); } - widgets[WIDX_OPEN_OR_CLOSE].image = ImageId(ParkIsOpen() ? SPR_OPEN : SPR_CLOSED); - const auto closeLightImage = SPR_G2_RCT1_CLOSE_BUTTON_0 + !ParkIsOpen() * 2 + WidgetIsPressed(*this, WIDX_CLOSE_LIGHT); - widgets[WIDX_CLOSE_LIGHT].image = ImageId(closeLightImage); - const auto openLightImage = SPR_G2_RCT1_OPEN_BUTTON_0 + ParkIsOpen() * 2 + WidgetIsPressed(*this, WIDX_OPEN_LIGHT); - widgets[WIDX_OPEN_LIGHT].image = ImageId(openLightImage); - // Only allow closing of park for guest / rating objective - if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) - disabled_widgets |= (1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT); - else - disabled_widgets &= ~((1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT)); - - // Only allow purchase of land when there is money - if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) - widgets[WIDX_BUY_LAND_RIGHTS].type = WindowWidgetType::Empty; - else - widgets[WIDX_BUY_LAND_RIGHTS].type = WindowWidgetType::FlatBtn; - - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); - AnchorBorderWidgets(); - - // Anchor entrance page specific widgets - widgets[WIDX_VIEWPORT].right = width - 26; - widgets[WIDX_VIEWPORT].bottom = height - 14; - widgets[WIDX_STATUS].right = width - 26; - widgets[WIDX_STATUS].top = height - 13; - widgets[WIDX_STATUS].bottom = height - 3; - - auto y = 0; - if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK) +#pragma region Entrance page + void OnMouseUpEntrance(WidgetIndex widgetIndex) { - widgets[WIDX_OPEN_OR_CLOSE].type = WindowWidgetType::Empty; - if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) + switch (widgetIndex) { - widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::FlatBtn; - widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::FlatBtn; + case WIDX_BUY_LAND_RIGHTS: + ContextOpenWindow(WindowClass::LandRights); + break; + case WIDX_LOCATE: + ScrollToViewport(); + break; + case WIDX_RENAME: + { + auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); + WindowTextInputRawOpen( + this, WIDX_RENAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, {}, park.Name.c_str(), USER_STRING_MAX_LENGTH); + break; + } + case WIDX_CLOSE_LIGHT: + ParkSetOpen(false); + break; + case WIDX_OPEN_LIGHT: + ParkSetOpen(true); + break; + } + } + + void OnResizeEntrance() + { + flags |= WF_RESIZABLE; + WindowSetResize(*this, 230, 174 + 9, 230 * 3, (274 + 9) * 3); + InitViewport(); + } + + void OnMouseDownEntrance(WidgetIndex widgetIndex) + { + if (widgetIndex == WIDX_OPEN_OR_CLOSE) + { + auto& widget = widgets[widgetIndex]; + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_CLOSE_PARK; + gDropdownItems[1].Args = STR_OPEN_PARK; + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1], 0, 2); + + if (ParkIsOpen()) + { + gDropdownDefaultIndex = 0; + Dropdown::SetChecked(1, true); + } + else + { + gDropdownDefaultIndex = 1; + Dropdown::SetChecked(0, true); + } + } + } + + void OnDropdownEntrance(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + if (widgetIndex == WIDX_OPEN_OR_CLOSE) + { + if (dropdownIndex == -1) + dropdownIndex = gDropdownHighlightedIndex; + + if (dropdownIndex != 0) + { + ParkSetOpen(true); + } + else + { + ParkSetOpen(false); + } + } + } + + void OnUpdateEntrance() + { + frame_no++; + WidgetInvalidate(*this, WIDX_TAB_1); + } + + void OnTextInputEntrance(WidgetIndex widgetIndex, std::string_view text) + { + if (widgetIndex == WIDX_RENAME && !text.empty()) + { + auto action = ParkSetNameAction(std::string(text)); + GameActions::Execute(&action); + } + } + + void OnPrepareDrawEntrance() + { + const auto& gameState = GetGameState(); + widgets = _pagedWidgets[page]; + InitScrollWidgets(); + + SetPressedTab(); + + // Set open / close park button state + { + auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); + auto parkName = park.Name.c_str(); + + auto ft = Formatter::Common(); + ft.Add(STR_STRING); + ft.Add(parkName); + } + widgets[WIDX_OPEN_OR_CLOSE].image = ImageId(ParkIsOpen() ? SPR_OPEN : SPR_CLOSED); + const auto closeLightImage = SPR_G2_RCT1_CLOSE_BUTTON_0 + !ParkIsOpen() * 2 + + WidgetIsPressed(*this, WIDX_CLOSE_LIGHT); + widgets[WIDX_CLOSE_LIGHT].image = ImageId(closeLightImage); + const auto openLightImage = SPR_G2_RCT1_OPEN_BUTTON_0 + ParkIsOpen() * 2 + WidgetIsPressed(*this, WIDX_OPEN_LIGHT); + widgets[WIDX_OPEN_LIGHT].image = ImageId(openLightImage); + + // Only allow closing of park for guest / rating objective + if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) + disabled_widgets |= (1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT); + else + disabled_widgets &= ~((1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT)); + + // Only allow purchase of land when there is money + if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) + widgets[WIDX_BUY_LAND_RIGHTS].type = WindowWidgetType::Empty; + else + widgets[WIDX_BUY_LAND_RIGHTS].type = WindowWidgetType::FlatBtn; + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); + AnchorBorderWidgets(); + + // Anchor entrance page specific widgets + widgets[WIDX_VIEWPORT].right = width - 26; + widgets[WIDX_VIEWPORT].bottom = height - 14; + widgets[WIDX_STATUS].right = width - 26; + widgets[WIDX_STATUS].top = height - 13; + widgets[WIDX_STATUS].bottom = height - 3; + + auto y = 0; + if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK) + { + widgets[WIDX_OPEN_OR_CLOSE].type = WindowWidgetType::Empty; + if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) + { + widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::FlatBtn; + widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::FlatBtn; + } + else + { + widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::ImgBtn; + widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::ImgBtn; + } + y = widgets[WIDX_OPEN_LIGHT].bottom + 5; } else { - widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::ImgBtn; - widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::ImgBtn; + widgets[WIDX_OPEN_OR_CLOSE].type = WindowWidgetType::FlatBtn; + widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::Empty; + widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::Empty; + y = 49; + } + + for (int32_t i = WIDX_CLOSE_LIGHT; i <= WIDX_OPEN_LIGHT; i++) + { + widgets[i].left = width - 20; + widgets[i].right = width - 7; + } + for (int32_t i = WIDX_OPEN_OR_CLOSE; i <= WIDX_RENAME; i++) + { + if (widgets[i].type == WindowWidgetType::Empty) + continue; + + widgets[i].left = width - 25; + widgets[i].right = width - 2; + widgets[i].top = y; + widgets[i].bottom = y + 23; + y += 24; } - y = widgets[WIDX_OPEN_LIGHT].bottom + 5; - } - else - { - widgets[WIDX_OPEN_OR_CLOSE].type = WindowWidgetType::FlatBtn; - widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::Empty; - widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::Empty; - y = 49; } - for (int32_t i = WIDX_CLOSE_LIGHT; i <= WIDX_OPEN_LIGHT; i++) + void OnDrawEntrance(DrawPixelInfo& dpi) { - widgets[i].left = width - 20; - widgets[i].right = width - 7; - } - for (int32_t i = WIDX_OPEN_OR_CLOSE; i <= WIDX_RENAME; i++) - { - if (widgets[i].type == WindowWidgetType::Empty) - continue; + DrawWidgets(dpi); + DrawTabImages(dpi); - widgets[i].left = width - 25; - widgets[i].right = width - 2; - widgets[i].top = y; - widgets[i].bottom = y + 23; - y += 24; - } - } + // Draw viewport + if (viewport != nullptr) + { + WindowDrawViewport(dpi, *this); + if (viewport->flags & VIEWPORT_FLAG_SOUND_ON) + GfxDrawSprite(dpi, ImageId(SPR_HEARING_VIEWPORT), WindowGetViewportSoundIconPos(*this)); + } - void OnDrawEntrance(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); + // Draw park closed / open label + auto ft = Formatter(); + ft.Add(ParkIsOpen() ? STR_PARK_OPEN : STR_PARK_CLOSED); - // Draw viewport - if (viewport != nullptr) - { - WindowDrawViewport(dpi, *this); - if (viewport->flags & VIEWPORT_FLAG_SOUND_ON) - GfxDrawSprite(dpi, ImageId(SPR_HEARING_VIEWPORT), WindowGetViewportSoundIconPos(*this)); + auto* labelWidget = &widgets[WIDX_STATUS]; + DrawTextEllipsised( + dpi, windowPos + ScreenCoordsXY{ labelWidget->midX(), labelWidget->top }, labelWidget->width(), + STR_BLACK_STRING, ft, { TextAlignment::CENTRE }); } - // Draw park closed / open label - auto ft = Formatter(); - ft.Add(ParkIsOpen() ? STR_PARK_OPEN : STR_PARK_CLOSED); - - auto* labelWidget = &widgets[WIDX_STATUS]; - DrawTextEllipsised( - dpi, windowPos + ScreenCoordsXY{ labelWidget->midX(), labelWidget->top }, labelWidget->width(), STR_BLACK_STRING, - ft, { TextAlignment::CENTRE }); - } - - void InitViewport() - { - if (page != WINDOW_PARK_PAGE_ENTRANCE) - return; - - const auto& gameState = GetGameState(); - - std::optional newFocus = std::nullopt; - if (!gameState.ParkEntrances.empty()) + void InitViewport() { - const auto& entrance = gameState.ParkEntrances[0]; - newFocus = Focus(CoordsXYZ{ entrance.x + 16, entrance.y + 16, entrance.z + 32 }); - } + if (page != WINDOW_PARK_PAGE_ENTRANCE) + return; - int32_t viewportFlags{}; - if (viewport == nullptr) - { - viewportFlags = gConfigGeneral.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : 0; - } - else - { - viewportFlags = viewport->flags; - RemoveViewport(); - } + const auto& gameState = GetGameState(); - // Call invalidate event - WindowEventOnPrepareDrawCall(this); + std::optional newFocus = std::nullopt; + if (!gameState.ParkEntrances.empty()) + { + const auto& entrance = gameState.ParkEntrances[0]; + newFocus = Focus(CoordsXYZ{ entrance.x + 16, entrance.y + 16, entrance.z + 32 }); + } - focus = newFocus; - - if (focus.has_value()) - { - // Create viewport + int32_t viewportFlags{}; if (viewport == nullptr) { - Widget* viewportWidget = &widgets[WIDX_VIEWPORT]; - ViewportCreate( - this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, - viewportWidget->width() - 1, viewportWidget->height() - 1, focus.value()); - flags |= WF_NO_SCROLLING; - Invalidate(); + viewportFlags = gConfigGeneral.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE; + } + else + { + viewportFlags = viewport->flags; + RemoveViewport(); } - } - if (viewport != nullptr) - viewport->flags = viewportFlags; - Invalidate(); - } + // Call invalidate event + OnPrepareDraw(); + + focus = newFocus; + + if (focus.has_value()) + { + // Create viewport + if (viewport == nullptr) + { + Widget* viewportWidget = &widgets[WIDX_VIEWPORT]; + ViewportCreate( + this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, + viewportWidget->width() - 1, viewportWidget->height() - 1, focus.value()); + flags |= WF_NO_SCROLLING; + Invalidate(); + } + } + + if (viewport != nullptr) + viewport->flags = viewportFlags; + Invalidate(); + } #pragma endregion #pragma region Rating page - void OnResizeRating() - { - WindowSetResize(*this, 255, 182, 255, 182); - } - - void OnUpdateRating() - { - frame_no++; - WidgetInvalidate(*this, WIDX_TAB_2); - } - - void OnPrepareDrawRating() - { - auto* ratingWidgets = _pagedWidgets[page]; - if (ratingWidgets != widgets) + void OnResizeRating() { - widgets = ratingWidgets; - InitScrollWidgets(); + WindowSetResize(*this, 255, 182, 255, 182); } - SetPressedTab(); - PrepareWindowTitleText(); - - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); - AnchorBorderWidgets(); - } - - void OnDrawRating(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - auto screenPos = windowPos; - Widget* widget = &widgets[WIDX_PAGE_BACKGROUND]; - - // Current value - auto ft = Formatter(); - ft.Add(GetGameState().ParkRating); - DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_PARK_RATING_LABEL, ft); - - // Graph border - GfxFillRectInset( - dpi, - { screenPos + ScreenCoordsXY{ widget->left + 4, widget->top + 15 }, - screenPos + ScreenCoordsXY{ widget->right - 4, widget->bottom - 4 } }, - colours[1], INSET_RECT_F_30); - - // Y axis labels - screenPos = screenPos + ScreenCoordsXY{ widget->left + 27, widget->top + 23 }; - for (int i = 5; i >= 0; i--) + void OnUpdateRating() { - uint32_t axisValue = i * 200; - ft = Formatter(); - ft.Add(axisValue); - DrawTextBasic( - dpi, screenPos + ScreenCoordsXY{ 10, 0 }, STR_GRAPH_AXIS_LABEL, ft, { FontStyle::Small, TextAlignment::RIGHT }); + frame_no++; + WidgetInvalidate(*this, WIDX_TAB_2); + } + + void OnPrepareDrawRating() + { + auto* ratingWidgets = _pagedWidgets[page]; + if (ratingWidgets != widgets) + { + widgets = ratingWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + PrepareWindowTitleText(); + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); + AnchorBorderWidgets(); + } + + void OnDrawRating(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + auto screenPos = windowPos; + Widget* widget = &widgets[WIDX_PAGE_BACKGROUND]; + + // Current value + auto ft = Formatter(); + ft.Add(GetGameState().ParkRating); + DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_PARK_RATING_LABEL, ft); + + // Graph border GfxFillRectInset( - dpi, { screenPos + ScreenCoordsXY{ 15, 5 }, screenPos + ScreenCoordsXY{ width - 32, 5 } }, colours[2], - INSET_RECT_FLAG_BORDER_INSET); - screenPos.y += 20; + dpi, + { screenPos + ScreenCoordsXY{ widget->left + 4, widget->top + 15 }, + screenPos + ScreenCoordsXY{ widget->right - 4, widget->bottom - 4 } }, + colours[1], INSET_RECT_F_30); + + // Y axis labels + screenPos = screenPos + ScreenCoordsXY{ widget->left + 27, widget->top + 23 }; + for (int i = 5; i >= 0; i--) + { + uint32_t axisValue = i * 200; + ft = Formatter(); + ft.Add(axisValue); + DrawTextBasic( + dpi, screenPos + ScreenCoordsXY{ 10, 0 }, STR_GRAPH_AXIS_LABEL, ft, + { FontStyle::Small, TextAlignment::RIGHT }); + GfxFillRectInset( + dpi, { screenPos + ScreenCoordsXY{ 15, 5 }, screenPos + ScreenCoordsXY{ width - 32, 5 } }, colours[2], + INSET_RECT_FLAG_BORDER_INSET); + screenPos.y += 20; + } + + // Graph + screenPos = windowPos + ScreenCoordsXY{ widget->left + 47, widget->top + 26 }; + + Graph::Draw(dpi, GetGameState().ParkRatingHistory, kParkRatingHistorySize, screenPos); } - // Graph - screenPos = windowPos + ScreenCoordsXY{ widget->left + 47, widget->top + 26 }; - - Graph::Draw(dpi, GetGameState().ParkRatingHistory, 32, screenPos); - } - #pragma endregion #pragma region Guests page - void OnResizeGuests() - { - WindowSetResize(*this, 255, 182, 255, 182); - } - - void OnUpdateGuests() - { - frame_no++; - _peepAnimationFrame = (_peepAnimationFrame + 1) % 24; - WidgetInvalidate(*this, WIDX_TAB_3); - } - - void OnPrepareDrawGuests() - { - auto* guestsWidgets = _pagedWidgets[page]; - if (widgets != guestsWidgets) + void OnResizeGuests() { - widgets = guestsWidgets; - InitScrollWidgets(); + WindowSetResize(*this, 255, 182, 255, 182); } - SetPressedTab(); - PrepareWindowTitleText(); - - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); - AnchorBorderWidgets(); - } - - void OnDrawGuests(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - auto screenPos = windowPos; - Widget* widget = &widgets[WIDX_PAGE_BACKGROUND]; - - // Current value - auto ft = Formatter(); - ft.Add(OpenRCT2::GetGameState().NumGuestsInPark); - DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_GUESTS_IN_PARK_LABEL, ft); - - // Graph border - GfxFillRectInset( - dpi, - { screenPos + ScreenCoordsXY{ widget->left + 4, widget->top + 15 }, - screenPos + ScreenCoordsXY{ widget->right - 4, widget->bottom - 4 } }, - colours[1], INSET_RECT_F_30); - - // Y axis labels - screenPos = screenPos + ScreenCoordsXY{ widget->left + 27, widget->top + 23 }; - for (int i = 5; i >= 0; i--) + void OnUpdateGuests() { - uint32_t axisValue = i * 1000; - ft = Formatter(); - ft.Add(axisValue); - DrawTextBasic( - dpi, screenPos + ScreenCoordsXY{ 10, 0 }, STR_GRAPH_AXIS_LABEL, ft, { FontStyle::Small, TextAlignment::RIGHT }); + frame_no++; + _peepAnimationFrame = (_peepAnimationFrame + 1) % 24; + WidgetInvalidate(*this, WIDX_TAB_3); + } + + void OnPrepareDrawGuests() + { + auto* guestsWidgets = _pagedWidgets[page]; + if (widgets != guestsWidgets) + { + widgets = guestsWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + PrepareWindowTitleText(); + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); + AnchorBorderWidgets(); + } + + void OnDrawGuests(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + auto screenPos = windowPos; + Widget* widget = &widgets[WIDX_PAGE_BACKGROUND]; + + const auto& gameState = OpenRCT2::GetGameState(); + + // Current value + auto ft = Formatter(); + ft.Add(gameState.NumGuestsInPark); + DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_GUESTS_IN_PARK_LABEL, ft); + + // Graph border GfxFillRectInset( - dpi, { screenPos + ScreenCoordsXY{ 15, 5 }, screenPos + ScreenCoordsXY{ width - 32, 5 } }, colours[2], - INSET_RECT_FLAG_BORDER_INSET); - screenPos.y += 20; - } + dpi, + { screenPos + ScreenCoordsXY{ widget->left + 4, widget->top + 15 }, + screenPos + ScreenCoordsXY{ widget->right - 4, widget->bottom - 4 } }, + colours[1], INSET_RECT_F_30); - // Graph - screenPos = windowPos + ScreenCoordsXY{ widget->left + 47, widget->top + 26 }; + // Y axis labels + screenPos = screenPos + ScreenCoordsXY{ widget->left + 27, widget->top + 23 }; + for (int i = 5; i >= 0; i--) + { + uint32_t axisValue = i * 1000; + ft = Formatter(); + ft.Add(axisValue); + DrawTextBasic( + dpi, screenPos + ScreenCoordsXY{ 10, 0 }, STR_GRAPH_AXIS_LABEL, ft, + { FontStyle::Small, TextAlignment::RIGHT }); + GfxFillRectInset( + dpi, { screenPos + ScreenCoordsXY{ 15, 5 }, screenPos + ScreenCoordsXY{ width - 32, 5 } }, colours[2], + INSET_RECT_FLAG_BORDER_INSET); + screenPos.y += 20; + } - uint8_t cappedHistory[32]; - for (size_t i = 0; i < std::size(cappedHistory); i++) - { - auto value = gGuestsInParkHistory[i]; - if (value != std::numeric_limits::max()) + // Graph + screenPos = windowPos + ScreenCoordsXY{ widget->left + 47, widget->top + 26 }; + + uint8_t cappedHistory[32]; + for (size_t i = 0; i < std::size(cappedHistory); i++) { - cappedHistory[i] = static_cast(std::min(value, 5000) / 20); - } - else - { - cappedHistory[i] = std::numeric_limits::max(); + auto value = gameState.GuestsInParkHistory[i]; + if (value != std::numeric_limits::max()) + { + cappedHistory[i] = static_cast(std::min(value, 5000) / 20); + } + else + { + cappedHistory[i] = std::numeric_limits::max(); + } } + Graph::Draw(dpi, cappedHistory, static_cast(std::size(cappedHistory)), screenPos); } - Graph::Draw(dpi, cappedHistory, static_cast(std::size(cappedHistory)), screenPos); - } #pragma endregion #pragma region Price page - void OnResizePrice() - { - WindowSetResize(*this, 230, 124, 230, 124); - } - - void OnMouseDownPrice(WidgetIndex widgetIndex) - { - const auto& gameState = GetGameState(); - switch (widgetIndex) + void OnResizePrice() { - case WIDX_INCREASE_PRICE: + WindowSetResize(*this, 230, 124, 230, 124); + } + + void OnMouseDownPrice(WidgetIndex widgetIndex) + { + const auto& gameState = GetGameState(); + switch (widgetIndex) { - const auto newFee = std::min(MAX_ENTRANCE_FEE, gameState.ParkEntranceFee + 1.00_GBP); - auto gameAction = ParkSetEntranceFeeAction(newFee); - GameActions::Execute(&gameAction); - break; - } - case WIDX_DECREASE_PRICE: - { - const auto newFee = std::max(0.00_GBP, gameState.ParkEntranceFee - 1.00_GBP); - auto gameAction = ParkSetEntranceFeeAction(newFee); - GameActions::Execute(&gameAction); - break; + case WIDX_INCREASE_PRICE: + { + const auto newFee = std::min(MAX_ENTRANCE_FEE, gameState.ParkEntranceFee + 1.00_GBP); + auto gameAction = ParkSetEntranceFeeAction(newFee); + GameActions::Execute(&gameAction); + break; + } + case WIDX_DECREASE_PRICE: + { + const auto newFee = std::max(0.00_GBP, gameState.ParkEntranceFee - 1.00_GBP); + auto gameAction = ParkSetEntranceFeeAction(newFee); + GameActions::Execute(&gameAction); + break; + } } } - } - void OnUpdatePrice() - { - frame_no++; - WidgetInvalidate(*this, WIDX_TAB_4); - } - - void OnPrepareDrawPrice() - { - auto* priceWidgets = _pagedWidgets[page]; - if (widgets != priceWidgets) + void OnUpdatePrice() { - widgets = priceWidgets; - InitScrollWidgets(); + frame_no++; + WidgetInvalidate(*this, WIDX_TAB_4); } - SetPressedTab(); - PrepareWindowTitleText(); - - // Show a tooltip if the park is pay per ride. - widgets[WIDX_PRICE_LABEL].tooltip = STR_NONE; - widgets[WIDX_PRICE].tooltip = STR_NONE; - - if (!ParkEntranceFeeUnlocked()) + void OnPrepareDrawPrice() { - widgets[WIDX_PRICE_LABEL].tooltip = STR_ADMISSION_PRICE_PAY_PER_RIDE_TIP; - widgets[WIDX_PRICE].tooltip = STR_ADMISSION_PRICE_PAY_PER_RIDE_TIP; + auto* priceWidgets = _pagedWidgets[page]; + if (widgets != priceWidgets) + { + widgets = priceWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + PrepareWindowTitleText(); + + // Show a tooltip if the park is pay per ride. + widgets[WIDX_PRICE_LABEL].tooltip = STR_NONE; + widgets[WIDX_PRICE].tooltip = STR_NONE; + + if (!ParkEntranceFeeUnlocked()) + { + widgets[WIDX_PRICE_LABEL].tooltip = STR_ADMISSION_PRICE_PAY_PER_RIDE_TIP; + widgets[WIDX_PRICE].tooltip = STR_ADMISSION_PRICE_PAY_PER_RIDE_TIP; + } + + // If the entry price is locked at free, disable the widget, unless the unlock_all_prices cheat is active. + if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) || !ParkEntranceFeeUnlocked()) + { + widgets[WIDX_PRICE].type = WindowWidgetType::LabelCentred; + widgets[WIDX_INCREASE_PRICE].type = WindowWidgetType::Empty; + widgets[WIDX_DECREASE_PRICE].type = WindowWidgetType::Empty; + } + else + { + widgets[WIDX_PRICE].type = WindowWidgetType::Spinner; + widgets[WIDX_INCREASE_PRICE].type = WindowWidgetType::Button; + widgets[WIDX_DECREASE_PRICE].type = WindowWidgetType::Button; + } + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); + AnchorBorderWidgets(); } - // If the entry price is locked at free, disable the widget, unless the unlock_all_prices cheat is active. - if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) || !ParkEntranceFeeUnlocked()) + void OnDrawPrice(DrawPixelInfo& dpi) { - widgets[WIDX_PRICE].type = WindowWidgetType::LabelCentred; - widgets[WIDX_INCREASE_PRICE].type = WindowWidgetType::Empty; - widgets[WIDX_DECREASE_PRICE].type = WindowWidgetType::Empty; + DrawWidgets(dpi); + DrawTabImages(dpi); + + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 30 }; + auto ft = Formatter(); + ft.Add(GetGameState().TotalIncomeFromAdmissions); + DrawTextBasic(dpi, screenCoords, STR_INCOME_FROM_ADMISSIONS, ft); + + money64 parkEntranceFee = ParkGetEntranceFee(); + auto stringId = parkEntranceFee == 0 ? STR_FREE : STR_BOTTOM_TOOLBAR_CASH; + screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_PRICE].left + 1, widgets[WIDX_PRICE].top + 1 }; + ft = Formatter(); + ft.Add(parkEntranceFee); + DrawTextBasic(dpi, screenCoords, stringId, ft, { colours[1] }); } - else - { - widgets[WIDX_PRICE].type = WindowWidgetType::Spinner; - widgets[WIDX_INCREASE_PRICE].type = WindowWidgetType::Button; - widgets[WIDX_DECREASE_PRICE].type = WindowWidgetType::Button; - } - - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); - AnchorBorderWidgets(); - } - - void OnDrawPrice(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 30 }; - auto ft = Formatter(); - ft.Add(GetGameState().TotalIncomeFromAdmissions); - DrawTextBasic(dpi, screenCoords, STR_INCOME_FROM_ADMISSIONS, ft); - - money64 parkEntranceFee = ParkGetEntranceFee(); - auto stringId = parkEntranceFee == 0 ? STR_FREE : STR_BOTTOM_TOOLBAR_CASH; - screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_PRICE].left + 1, widgets[WIDX_PRICE].top + 1 }; - ft = Formatter(); - ft.Add(parkEntranceFee); - DrawTextBasic(dpi, screenCoords, stringId, ft, { colours[1] }); - } #pragma endregion #pragma region Stats page - void OnResizeStats() - { - WindowSetResize(*this, 230, 119, 230, 119); - } - - void OnUpdateStats() - { - frame_no++; - WidgetInvalidate(*this, WIDX_TAB_5); - - // Invalidate ride count if changed - const auto rideCount = RideGetCount(); - if (_numberOfRides != rideCount) + void OnResizeStats() { - _numberOfRides = rideCount; - WidgetInvalidate(*this, WIDX_PAGE_BACKGROUND); + WindowSetResize(*this, 230, 119, 230, 119); } - // Invalidate number of staff if changed - const auto staffCount = PeepGetStaffCount(); - if (_numberOfStaff != staffCount) + void OnUpdateStats() { - _numberOfStaff = staffCount; - WidgetInvalidate(*this, WIDX_PAGE_BACKGROUND); - } - } + frame_no++; + WidgetInvalidate(*this, WIDX_TAB_5); - void OnPrepareDrawStats() - { - auto* statsWidgets = _pagedWidgets[page]; - if (widgets != statsWidgets) - { - widgets = statsWidgets; - InitScrollWidgets(); + // Invalidate ride count if changed + const auto rideCount = RideGetCount(); + if (_numberOfRides != rideCount) + { + _numberOfRides = rideCount; + WidgetInvalidate(*this, WIDX_PAGE_BACKGROUND); + } + + // Invalidate number of staff if changed + const auto staffCount = PeepGetStaffCount(); + if (_numberOfStaff != staffCount) + { + _numberOfStaff = staffCount; + WidgetInvalidate(*this, WIDX_PAGE_BACKGROUND); + } } - SetPressedTab(); - PrepareWindowTitleText(); - - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); - AnchorBorderWidgets(); - } - - void OnDrawStats(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - - auto& gameState = GetGameState(); - // Draw park size - auto parkSize = gameState.ParkSize * 10; - auto stringIndex = STR_PARK_SIZE_METRIC_LABEL; - if (gConfigGeneral.MeasurementFormat == MeasurementFormat::Imperial) + void OnPrepareDrawStats() { - stringIndex = STR_PARK_SIZE_IMPERIAL_LABEL; - parkSize = SquaredMetresToSquaredFeet(parkSize); + auto* statsWidgets = _pagedWidgets[page]; + if (widgets != statsWidgets) + { + widgets = statsWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + PrepareWindowTitleText(); + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); + AnchorBorderWidgets(); } - auto ft = Formatter(); - ft.Add(parkSize); - DrawTextBasic(dpi, screenCoords, stringIndex, ft); - screenCoords.y += LIST_ROW_HEIGHT; - // Draw number of rides / attractions - if (_numberOfRides != -1) + void OnDrawStats(DrawPixelInfo& dpi) { + DrawWidgets(dpi); + DrawTabImages(dpi); + + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; + + auto& gameState = GetGameState(); + // Draw park size + auto parkSize = gameState.ParkSize * 10; + auto stringIndex = STR_PARK_SIZE_METRIC_LABEL; + if (gConfigGeneral.MeasurementFormat == MeasurementFormat::Imperial) + { + stringIndex = STR_PARK_SIZE_IMPERIAL_LABEL; + parkSize = SquaredMetresToSquaredFeet(parkSize); + } + auto ft = Formatter(); + ft.Add(parkSize); + DrawTextBasic(dpi, screenCoords, stringIndex, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Draw number of rides / attractions + if (_numberOfRides != -1) + { + ft = Formatter(); + ft.Add(_numberOfRides); + DrawTextBasic(dpi, screenCoords, STR_NUMBER_OF_RIDES_LABEL, ft); + } + screenCoords.y += LIST_ROW_HEIGHT; + + // Draw number of staff + if (_numberOfStaff != -1) + { + ft = Formatter(); + ft.Add(_numberOfStaff); + DrawTextBasic(dpi, screenCoords, STR_STAFF_LABEL, ft); + } + screenCoords.y += LIST_ROW_HEIGHT; + + // Draw number of guests in park ft = Formatter(); - ft.Add(_numberOfRides); - DrawTextBasic(dpi, screenCoords, STR_NUMBER_OF_RIDES_LABEL, ft); - } - screenCoords.y += LIST_ROW_HEIGHT; + ft.Add(gameState.NumGuestsInPark); + DrawTextBasic(dpi, screenCoords, STR_GUESTS_IN_PARK_LABEL, ft); + screenCoords.y += LIST_ROW_HEIGHT; - // Draw number of staff - if (_numberOfStaff != -1) - { ft = Formatter(); - ft.Add(_numberOfStaff); - DrawTextBasic(dpi, screenCoords, STR_STAFF_LABEL, ft); + ft.Add(gameState.TotalAdmissions); + DrawTextBasic(dpi, screenCoords, STR_TOTAL_ADMISSIONS, ft); } - screenCoords.y += LIST_ROW_HEIGHT; - - // Draw number of guests in park - ft = Formatter(); - ft.Add(gameState.NumGuestsInPark); - DrawTextBasic(dpi, screenCoords, STR_GUESTS_IN_PARK_LABEL, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - ft = Formatter(); - ft.Add(gameState.TotalAdmissions); - DrawTextBasic(dpi, screenCoords, STR_TOTAL_ADMISSIONS, ft); - } #pragma endregion #pragma region Objective page - void OnMouseUpObjective(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void OnMouseUpObjective(WidgetIndex widgetIndex) { - case WIDX_ENTER_NAME: - WindowTextInputOpen( - this, WIDX_ENTER_NAME, STR_ENTER_NAME, STR_PLEASE_ENTER_YOUR_NAME_FOR_THE_SCENARIO_CHART, {}, 0, 0, - ParkNameMaxLength); - break; + switch (widgetIndex) + { + case WIDX_ENTER_NAME: + WindowTextInputOpen( + this, WIDX_ENTER_NAME, STR_ENTER_NAME, STR_PLEASE_ENTER_YOUR_NAME_FOR_THE_SCENARIO_CHART, {}, 0, 0, + ParkNameMaxLength); + break; + } } - } - void OnResizeObjective() - { + void OnResizeObjective() + { #ifndef NO_TTF - if (gCurrentTTFFontSet != nullptr) - WindowSetResize(*this, 230, 270, 230, 270); - else + if (gCurrentTTFFontSet != nullptr) + WindowSetResize(*this, 230, 270, 230, 270); + else #endif - WindowSetResize(*this, 230, 226, 230, 226); - } - - void OnUpdateObjective() - { - frame_no++; - WidgetInvalidate(*this, WIDX_TAB_6); - } - - void OnTextInputObjective(WidgetIndex widgetIndex, std::string_view text) - { - if (widgetIndex == WIDX_ENTER_NAME && !text.empty()) - { - std::string strText(text); - ScenarioSuccessSubmitName(GetGameState(), strText.c_str()); - Invalidate(); + WindowSetResize(*this, 230, 226, 230, 226); } - } - void OnPrepareDrawObjective() - { - SetPressedTab(); - PrepareWindowTitleText(); - - // Show name input button on scenario completion. - if (GetGameState().ParkFlags & PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT) + void OnUpdateObjective() { - widgets[WIDX_ENTER_NAME].type = WindowWidgetType::Button; - widgets[WIDX_ENTER_NAME].top = height - 19; - widgets[WIDX_ENTER_NAME].bottom = height - 6; + frame_no++; + WidgetInvalidate(*this, WIDX_TAB_6); } - else - widgets[WIDX_ENTER_NAME].type = WindowWidgetType::Empty; - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); - AnchorBorderWidgets(); - } - - void OnDrawObjective(DrawPixelInfo& dpi) - { - auto& gameState = GetGameState(); - DrawWidgets(dpi); - DrawTabImages(dpi); - - // Scenario description - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 7 }; - auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(gameState.ScenarioDetails.c_str()); - screenCoords.y += DrawTextWrapped(dpi, screenCoords, 222, STR_BLACK_STRING, ft); - screenCoords.y += 5; - - // Your objective: - DrawTextBasic(dpi, screenCoords, STR_OBJECTIVE_LABEL); - screenCoords.y += LIST_ROW_HEIGHT; - - // Objective - ft = Formatter(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_BUILD_THE_BEST) + void OnTextInputObjective(WidgetIndex widgetIndex, std::string_view text) { - StringId rideTypeString = STR_NONE; - auto rideTypeId = gameState.ScenarioObjective.RideId; - if (rideTypeId != RIDE_TYPE_NULL && rideTypeId < RIDE_TYPE_COUNT) + if (widgetIndex == WIDX_ENTER_NAME && !text.empty()) { - rideTypeString = GetRideTypeDescriptor(rideTypeId).Naming.Name; + std::string strText(text); + ScenarioSuccessSubmitName(GetGameState(), strText.c_str()); + Invalidate(); } - ft.Add(rideTypeString); - } - else - { - ft.Add(gameState.ScenarioObjective.NumGuests); - ft.Add(DateGetTotalMonths(MONTH_OCTOBER, gameState.ScenarioObjective.Year)); - if (gameState.ScenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS) - ft.Add(gameState.ScenarioObjective.MinimumExcitement); - else - ft.Add(gameState.ScenarioObjective.Currency); } - screenCoords.y += DrawTextWrapped(dpi, screenCoords, 221, ObjectiveNames[gameState.ScenarioObjective.Type], ft); - screenCoords.y += 5; - - // Objective outcome - if (gameState.ScenarioCompletedCompanyValue != kMoney64Undefined) + void OnPrepareDrawObjective() { - if (gameState.ScenarioCompletedCompanyValue == COMPANY_VALUE_ON_FAILED_OBJECTIVE) + SetPressedTab(); + PrepareWindowTitleText(); + + // Show name input button on scenario completion. + if (GetGameState().ParkFlags & PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT) { - // Objective failed - DrawTextWrapped(dpi, screenCoords, 222, STR_OBJECTIVE_FAILED); + widgets[WIDX_ENTER_NAME].type = WindowWidgetType::Button; + widgets[WIDX_ENTER_NAME].top = height - 19; + widgets[WIDX_ENTER_NAME].bottom = height - 6; } else + widgets[WIDX_ENTER_NAME].type = WindowWidgetType::Empty; + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); + AnchorBorderWidgets(); + } + + void OnDrawObjective(DrawPixelInfo& dpi) + { + auto& gameState = GetGameState(); + DrawWidgets(dpi); + DrawTabImages(dpi); + + // Scenario description + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 7 }; + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(gameState.ScenarioDetails.c_str()); + screenCoords.y += DrawTextWrapped(dpi, screenCoords, 222, STR_BLACK_STRING, ft); + screenCoords.y += 5; + + // Your objective: + DrawTextBasic(dpi, screenCoords, STR_OBJECTIVE_LABEL); + screenCoords.y += LIST_ROW_HEIGHT; + + // Objective + ft = Formatter(); + formatObjective(ft, gameState.ScenarioObjective); + + screenCoords.y += DrawTextWrapped(dpi, screenCoords, 221, ObjectiveNames[gameState.ScenarioObjective.Type], ft); + screenCoords.y += 5; + + // Objective outcome + if (gameState.ScenarioCompletedCompanyValue != kMoney64Undefined) { - // Objective completed - ft = Formatter(); - ft.Add(gameState.ScenarioCompletedCompanyValue); - DrawTextWrapped(dpi, screenCoords, 222, STR_OBJECTIVE_ACHIEVED, ft); + if (gameState.ScenarioCompletedCompanyValue == COMPANY_VALUE_ON_FAILED_OBJECTIVE) + { + // Objective failed + DrawTextWrapped(dpi, screenCoords, 222, STR_OBJECTIVE_FAILED); + } + else + { + // Objective completed + ft = Formatter(); + ft.Add(gameState.ScenarioCompletedCompanyValue); + DrawTextWrapped(dpi, screenCoords, 222, STR_OBJECTIVE_ACHIEVED, ft); + } } } - } #pragma endregion #pragma region Awards page - void OnResizeAwards() - { - WindowSetResize(*this, 230, 182, 230, 182); - } - - void OnUpdateAwards() - { - frame_no++; - WidgetInvalidate(*this, WIDX_TAB_7); - } - - void OnPrepareDrawAwards() - { - auto* awardsWidgets = _pagedWidgets[page]; - if (widgets != awardsWidgets) + void OnResizeAwards() { - widgets = awardsWidgets; - InitScrollWidgets(); + WindowSetResize(*this, 230, 182, 230, 182); } - SetPressedTab(); - PrepareWindowTitleText(); - - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); - AnchorBorderWidgets(); - } - - void OnDrawAwards(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - - for (const auto& award : GetAwards()) + void OnUpdateAwards() { - GfxDrawSprite(dpi, ImageId(_parkAwards[EnumValue(award.Type)].sprite), screenCoords); - DrawTextWrapped(dpi, screenCoords + ScreenCoordsXY{ 34, 6 }, 180, _parkAwards[EnumValue(award.Type)].text); - - screenCoords.y += 32; + frame_no++; + WidgetInvalidate(*this, WIDX_TAB_7); } - if (GetAwards().empty()) - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 6, 6 }, STR_NO_RECENT_AWARDS); - } + void OnPrepareDrawAwards() + { + auto* awardsWidgets = _pagedWidgets[page]; + if (widgets != awardsWidgets) + { + widgets = awardsWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + PrepareWindowTitleText(); + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); + AnchorBorderWidgets(); + } + + void OnDrawAwards(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; + + auto& currentAwards = OpenRCT2::GetGameState().CurrentAwards; + + for (const auto& award : currentAwards) + { + GfxDrawSprite(dpi, ImageId(_parkAwards[EnumValue(award.Type)].sprite), screenCoords); + DrawTextWrapped(dpi, screenCoords + ScreenCoordsXY{ 34, 6 }, 180, _parkAwards[EnumValue(award.Type)].text); + + screenCoords.y += 32; + } + + if (currentAwards.empty()) + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 6, 6 }, STR_NO_RECENT_AWARDS); + } #pragma endregion #pragma region Common - void SetPage(int32_t newPage) + void SetPage(int32_t newPage) + { + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) + if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) + ToolCancel(); + + // Set listen only to viewport + bool listen = false; + if (newPage == WINDOW_PARK_PAGE_ENTRANCE && viewport != nullptr && !(viewport->flags & VIEWPORT_FLAG_SOUND_ON)) + listen = true; + + page = newPage; + frame_no = 0; + _peepAnimationFrame = 0; + RemoveViewport(); + + hold_down_widgets = _pagedHoldDownWidgets[newPage]; + widgets = _pagedWidgets[newPage]; + SetDisabledTabs(); + Invalidate(); + + OnResize(); + OnPrepareDraw(); + OnUpdate(); + if (listen && viewport != nullptr) + viewport->flags |= VIEWPORT_FLAG_SOUND_ON; + } + + void AnchorBorderWidgets() + { + ResizeFrameWithPage(); + } + + void SetPressedTab() + { + for (int32_t i = WIDX_TAB_1; i <= WIDX_TAB_7; i++) + pressed_widgets &= ~(1 << i); + pressed_widgets |= 1LL << (WIDX_TAB_1 + page); + } + + void DrawTabImages(DrawPixelInfo& dpi) + { + // Entrance tab + if (!WidgetIsDisabled(*this, WIDX_TAB_1)) + { + GfxDrawSprite( + dpi, ImageId(SPR_TAB_PARK_ENTRANCE), + windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].left, widgets[WIDX_TAB_1].top }); + } + + // Rating tab + if (!WidgetIsDisabled(*this, WIDX_TAB_2)) + { + ImageId spriteIdx(SPR_TAB_GRAPH_0); + if (page == WINDOW_PARK_PAGE_RATING) + spriteIdx = spriteIdx.WithIndexOffset((frame_no / 8) % 8); + GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top }); + GfxDrawSprite( + dpi, ImageId(SPR_RATING_HIGH), + windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left + 7, widgets[WIDX_TAB_2].top + 1 }); + GfxDrawSprite( + dpi, ImageId(SPR_RATING_LOW), + windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left + 16, widgets[WIDX_TAB_2].top + 12 }); + } + + // Guests tab + if (!WidgetIsDisabled(*this, WIDX_TAB_3)) + { + ImageId spriteIdx(SPR_TAB_GRAPH_0); + if (page == WINDOW_PARK_PAGE_GUESTS) + spriteIdx = spriteIdx.WithIndexOffset((frame_no / 8) % 8); + GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_3].left, widgets[WIDX_TAB_3].top }); + + ImageId peepImage(GetPeepAnimation(PeepSpriteType::Normal).base_image + 1, COLOUR_BRIGHT_RED, COLOUR_TEAL); + if (page == WINDOW_PARK_PAGE_GUESTS) + peepImage = peepImage.WithIndexOffset(_peepAnimationFrame & 0xFFFFFFFC); + + GfxDrawSprite( + dpi, peepImage, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_3].midX(), widgets[WIDX_TAB_3].bottom - 9 }); + } + + // Price tab + if (!WidgetIsDisabled(*this, WIDX_TAB_4)) + { + ImageId spriteIdx(SPR_TAB_ADMISSION_0); + if (page == WINDOW_PARK_PAGE_PRICE) + spriteIdx = spriteIdx.WithIndexOffset((frame_no / 2) % 8); + GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_4].left, widgets[WIDX_TAB_4].top }); + } + + // Statistics tab + if (!WidgetIsDisabled(*this, WIDX_TAB_5)) + { + ImageId spriteIdx(SPR_TAB_STATS_0); + if (page == WINDOW_PARK_PAGE_STATS) + spriteIdx = spriteIdx.WithIndexOffset((frame_no / 4) % 7); + GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_5].left, widgets[WIDX_TAB_5].top }); + } + + // Objective tab + if (!WidgetIsDisabled(*this, WIDX_TAB_6)) + { + ImageId spriteIdx(SPR_TAB_OBJECTIVE_0); + if (page == WINDOW_PARK_PAGE_OBJECTIVE) + spriteIdx = spriteIdx.WithIndexOffset((frame_no / 4) % 16); + GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_6].left, widgets[WIDX_TAB_6].top }); + } + + // Awards tab + if (!WidgetIsDisabled(*this, WIDX_TAB_7)) + { + GfxDrawSprite( + dpi, ImageId(SPR_TAB_AWARDS), + windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_7].left, widgets[WIDX_TAB_7].top }); + } + } + }; + + static ParkWindow* ParkWindowOpen(uint8_t page) { - if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) - if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) - ToolCancel(); - - // Set listen only to viewport - bool listen = false; - if (newPage == WINDOW_PARK_PAGE_ENTRANCE && viewport != nullptr && !(viewport->flags & VIEWPORT_FLAG_SOUND_ON)) - listen = true; - - page = newPage; - frame_no = 0; - _peepAnimationFrame = 0; - RemoveViewport(); - - hold_down_widgets = _pagedHoldDownWidgets[newPage]; - widgets = _pagedWidgets[newPage]; - SetDisabledTabs(); - Invalidate(); - - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); - WindowEventUpdateCall(this); - if (listen && viewport != nullptr) - viewport->flags |= VIEWPORT_FLAG_SOUND_ON; + auto* wnd = WindowFocusOrCreate(WindowClass::ParkInformation, 230, 174 + 9, WF_10); + if (wnd != nullptr && page != WINDOW_PARK_PAGE_ENTRANCE) + { + wnd->OnMouseUp(WIDX_TAB_1 + page); + } + return wnd; } - void AnchorBorderWidgets() + /** + * + * rct2: 0x00667C48 + */ + WindowBase* ParkEntranceOpen() { - ResizeFrameWithPage(); + return ParkWindowOpen(WINDOW_PARK_PAGE_ENTRANCE); } - void SetPressedTab() + /** + * + * rct2: 0x00667CA4 + */ + WindowBase* ParkRatingOpen() { - for (int32_t i = WIDX_TAB_1; i <= WIDX_TAB_7; i++) - pressed_widgets &= ~(1 << i); - pressed_widgets |= 1LL << (WIDX_TAB_1 + page); + return ParkWindowOpen(WINDOW_PARK_PAGE_RATING); } - void DrawTabImages(DrawPixelInfo& dpi) + /** + * + * rct2: 0x00667D35 + */ + WindowBase* ParkGuestsOpen() { - // Entrance tab - if (!WidgetIsDisabled(*this, WIDX_TAB_1)) - { - GfxDrawSprite( - dpi, ImageId(SPR_TAB_PARK_ENTRANCE), - windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].left, widgets[WIDX_TAB_1].top }); - } - - // Rating tab - if (!WidgetIsDisabled(*this, WIDX_TAB_2)) - { - ImageId spriteIdx(SPR_TAB_GRAPH_0); - if (page == WINDOW_PARK_PAGE_RATING) - spriteIdx = spriteIdx.WithIndexOffset((frame_no / 8) % 8); - GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top }); - GfxDrawSprite( - dpi, ImageId(SPR_RATING_HIGH), - windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left + 7, widgets[WIDX_TAB_2].top + 1 }); - GfxDrawSprite( - dpi, ImageId(SPR_RATING_LOW), - windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left + 16, widgets[WIDX_TAB_2].top + 12 }); - } - - // Guests tab - if (!WidgetIsDisabled(*this, WIDX_TAB_3)) - { - ImageId spriteIdx(SPR_TAB_GRAPH_0); - if (page == WINDOW_PARK_PAGE_GUESTS) - spriteIdx = spriteIdx.WithIndexOffset((frame_no / 8) % 8); - GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_3].left, widgets[WIDX_TAB_3].top }); - - ImageId peepImage(GetPeepAnimation(PeepSpriteType::Normal).base_image + 1, COLOUR_BRIGHT_RED, COLOUR_TEAL); - if (page == WINDOW_PARK_PAGE_GUESTS) - peepImage = peepImage.WithIndexOffset(_peepAnimationFrame & 0xFFFFFFFC); - - GfxDrawSprite( - dpi, peepImage, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_3].midX(), widgets[WIDX_TAB_3].bottom - 9 }); - } - - // Price tab - if (!WidgetIsDisabled(*this, WIDX_TAB_4)) - { - ImageId spriteIdx(SPR_TAB_ADMISSION_0); - if (page == WINDOW_PARK_PAGE_PRICE) - spriteIdx = spriteIdx.WithIndexOffset((frame_no / 2) % 8); - GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_4].left, widgets[WIDX_TAB_4].top }); - } - - // Statistics tab - if (!WidgetIsDisabled(*this, WIDX_TAB_5)) - { - ImageId spriteIdx(SPR_TAB_STATS_0); - if (page == WINDOW_PARK_PAGE_STATS) - spriteIdx = spriteIdx.WithIndexOffset((frame_no / 4) % 7); - GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_5].left, widgets[WIDX_TAB_5].top }); - } - - // Objective tab - if (!WidgetIsDisabled(*this, WIDX_TAB_6)) - { - ImageId spriteIdx(SPR_TAB_OBJECTIVE_0); - if (page == WINDOW_PARK_PAGE_OBJECTIVE) - spriteIdx = spriteIdx.WithIndexOffset((frame_no / 4) % 16); - GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_6].left, widgets[WIDX_TAB_6].top }); - } - - // Awards tab - if (!WidgetIsDisabled(*this, WIDX_TAB_7)) - { - GfxDrawSprite( - dpi, ImageId(SPR_TAB_AWARDS), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_7].left, widgets[WIDX_TAB_7].top }); - } + return ParkWindowOpen(WINDOW_PARK_PAGE_GUESTS); } -}; -static ParkWindow* ParkWindowOpen(uint8_t page) -{ - auto* wnd = WindowFocusOrCreate(WindowClass::ParkInformation, 230, 174 + 9, WF_10); - if (wnd != nullptr && page != WINDOW_PARK_PAGE_ENTRANCE) + /** + * + * rct2: 0x00667E57 + */ + WindowBase* ParkObjectiveOpen() { - wnd->OnMouseUp(WIDX_TAB_1 + page); + auto* wnd = ParkWindowOpen(WINDOW_PARK_PAGE_OBJECTIVE); + if (wnd != nullptr) + { + wnd->Invalidate(); + wnd->windowPos.x = ContextGetWidth() / 2 - 115; + wnd->windowPos.y = ContextGetHeight() / 2 - 87; + wnd->Invalidate(); + } + return wnd; } - return wnd; -} -/** - * - * rct2: 0x00667C48 - */ -WindowBase* WindowParkEntranceOpen() -{ - return ParkWindowOpen(WINDOW_PARK_PAGE_ENTRANCE); -} - -/** - * - * rct2: 0x00667CA4 - */ -WindowBase* WindowParkRatingOpen() -{ - return ParkWindowOpen(WINDOW_PARK_PAGE_RATING); -} - -/** - * - * rct2: 0x00667D35 - */ -WindowBase* WindowParkGuestsOpen() -{ - return ParkWindowOpen(WINDOW_PARK_PAGE_GUESTS); -} - -/** - * - * rct2: 0x00667E57 - */ -WindowBase* WindowParkObjectiveOpen() -{ - auto* wnd = ParkWindowOpen(WINDOW_PARK_PAGE_OBJECTIVE); - if (wnd != nullptr) + /** + * + * rct2: 0x00667DC6 + */ + WindowBase* ParkAwardsOpen() { - wnd->Invalidate(); - wnd->windowPos.x = ContextGetWidth() / 2 - 115; - wnd->windowPos.y = ContextGetHeight() / 2 - 87; - wnd->Invalidate(); + return ParkWindowOpen(WINDOW_PARK_PAGE_AWARDS); } - return wnd; -} - -/** - * - * rct2: 0x00667DC6 - */ -WindowBase* WindowParkAwardsOpen() -{ - return ParkWindowOpen(WINDOW_PARK_PAGE_AWARDS); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index 75e70d9834..4b6d01b0ce 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -25,284 +25,288 @@ #include #include -static constexpr StringId WINDOW_TITLE = STR_SET_PATROL_AREA; -static constexpr int32_t WH = 54; -static constexpr int32_t WW = 104; - -enum WindowPatrolAreaWidgetIdx +namespace OpenRCT2::Ui::Windows { - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_PREVIEW, - WIDX_DECREMENT, - WIDX_INCREMENT, -}; + static constexpr StringId WINDOW_TITLE = STR_SET_PATROL_AREA; + static constexpr int32_t WH = 54; + static constexpr int32_t WW = 104; -// clang-format off + enum WindowPatrolAreaWidgetIdx + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_PREVIEW, + WIDX_DECREMENT, + WIDX_INCREMENT, + }; + + // clang-format off static Widget PatrolAreaWidgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget ({27, 17}, {44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary , ImageId(SPR_LAND_TOOL_SIZE_0) ), // preview box MakeRemapWidget({28, 18}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_PATROL_AREA_TIP), // decrement size MakeRemapWidget({54, 32}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_PATROL_AREA_TIP ), // increment size - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class PatrolAreaWindow final : public Window -{ -public: - void OnOpen() override + class PatrolAreaWindow final : public Window { - widgets = PatrolAreaWidgets; - hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); - WindowInitScrollWidgets(*this); - WindowPushOthersBelow(*this); - gLandToolSize = 4; - } - - void OnClose() override - { - // If the tool wasn't changed, turn tool off - if (PatrolAreaToolIsActive()) - ToolCancel(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_CLOSE: + widgets = PatrolAreaWidgets; + hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); + WindowInitScrollWidgets(*this); + WindowPushOthersBelow(*this); + gLandToolSize = 4; + } + + void OnClose() override + { + // If the tool wasn't changed, turn tool off + if (PatrolAreaToolIsActive()) + ToolCancel(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_PREVIEW: + InputSize(); + break; + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_DECREMENT: + gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); + Invalidate(); + break; + case WIDX_INCREMENT: + gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); + Invalidate(); + break; + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (text.empty()) + return; + + if (widgetIndex != WIDX_PREVIEW) + return; + + const auto res = String::Parse(text); + if (res.has_value()) + { + int32_t size; + size = res.value(); + size = std::max(kLandToolMinimumSize, size); + size = std::min(kLandToolMaximumSize, size); + gLandToolSize = size; + Invalidate(); + } + } + + void OnUpdate() override + { + // Close window if another tool is open or staff window gets closed + if (!PatrolAreaToolIsActive() || !IsStaffWindowOpen()) + { Close(); - break; - case WIDX_PREVIEW: - InputSize(); - break; + } } - } - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + void OnPrepareDraw() override { - case WIDX_DECREMENT: - gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); - Invalidate(); - break; - case WIDX_INCREMENT: - gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); - Invalidate(); - break; + SetWidgetPressed(WIDX_PREVIEW, true); + PatrolAreaWidgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); } - } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (text.empty()) - return; - - if (widgetIndex != WIDX_PREVIEW) - return; - - const auto res = String::Parse(text); - if (res.has_value()) + void OnDraw(DrawPixelInfo& dpi) override { - int32_t size; - size = res.value(); - size = std::max(kLandToolMinimumSize, size); - size = std::min(kLandToolMaximumSize, size); - gLandToolSize = size; - Invalidate(); - } - } + DrawWidgets(dpi); - void OnUpdate() override - { - // Close window if another tool is open or staff window gets closed - if (!PatrolAreaToolIsActive() || !IsStaffWindowOpen()) + // Draw number for tool sizes bigger than 7 + if (gLandToolSize > kLandToolMaximumSizeWithSprite) + { + auto screenCoords = ScreenCoordsXY{ windowPos.x + PatrolAreaWidgets[WIDX_PREVIEW].midX(), + windowPos.y + PatrolAreaWidgets[WIDX_PREVIEW].midY() }; + auto ft = Formatter(); + ft.Add(gLandToolSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + } + } + + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - Close(); + auto mapTile = GetBestCoordsFromPos(screenCoords); + if (!mapTile) + return; + + auto stateChanged = false; + if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) + stateChanged = true; + + if (gMapSelectType != MAP_SELECT_TYPE_FULL) + stateChanged = true; + + auto toolSize = std::max(1, gLandToolSize); + auto toolLength = (toolSize - 1) * 32; + + // Move to tool bottom left + mapTile->x -= (toolSize - 1) * 16; + mapTile->y -= (toolSize - 1) * 16; + mapTile = mapTile->ToTileStart(); + auto posA = *mapTile; + mapTile->x += toolLength; + mapTile->y += toolLength; + auto posB = *mapTile; + if (gMapSelectPositionA != posA || gMapSelectPositionB != posB) + stateChanged = true; + + if (stateChanged) + { + // Invalidate previous area + MapInvalidateSelectionRect(); + + // Update and invalidate new area + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectType = MAP_SELECT_TYPE_FULL; + gMapSelectPositionA = posA; + gMapSelectPositionB = posB; + MapInvalidateSelectionRect(); + } } - } - void OnPrepareDraw() override - { - SetWidgetPressed(WIDX_PREVIEW, true); - PatrolAreaWidgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - // Draw number for tool sizes bigger than 7 - if (gLandToolSize > kLandToolMaximumSizeWithSprite) + void OnToolAbort(WidgetIndex widgetIndex) override { - auto screenCoords = ScreenCoordsXY{ windowPos.x + PatrolAreaWidgets[WIDX_PREVIEW].midX(), - windowPos.y + PatrolAreaWidgets[WIDX_PREVIEW].midY() }; - auto ft = Formatter(); - ft.Add(gLandToolSize); - DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + HideGridlines(); + ClearPatrolAreaToRender(); + GfxInvalidateScreen(); } - } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - auto mapTile = GetBestCoordsFromPos(screenCoords); - if (!mapTile) - return; - - auto stateChanged = false; - if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) - stateChanged = true; - - if (gMapSelectType != MAP_SELECT_TYPE_FULL) - stateChanged = true; - - auto toolSize = std::max(1, gLandToolSize); - auto toolLength = (toolSize - 1) * 32; - - // Move to tool bottom left - mapTile->x -= (toolSize - 1) * 16; - mapTile->y -= (toolSize - 1) * 16; - mapTile = mapTile->ToTileStart(); - auto posA = *mapTile; - mapTile->x += toolLength; - mapTile->y += toolLength; - auto posB = *mapTile; - if (gMapSelectPositionA != posA || gMapSelectPositionB != posB) - stateChanged = true; - - if (stateChanged) + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - // Invalidate previous area - MapInvalidateSelectionRect(); + auto mapTile = GetBestCoordsFromPos(screenCoords); + if (mapTile) + { + auto staff = GetEntity(_staffId); + if (staff != nullptr) + { + _mode = staff->IsPatrolAreaSet(*mapTile) ? StaffSetPatrolAreaMode::Unset : StaffSetPatrolAreaMode::Set; + } + } - // Update and invalidate new area - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectType = MAP_SELECT_TYPE_FULL; - gMapSelectPositionA = posA; - gMapSelectPositionB = posB; - MapInvalidateSelectionRect(); + OnToolDrag(widgetIndex, screenCoords); } - } - void OnToolAbort(WidgetIndex widgetIndex) override - { - HideGridlines(); - ClearPatrolAreaToRender(); - GfxInvalidateScreen(); - } - - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - auto mapTile = GetBestCoordsFromPos(screenCoords); - if (mapTile) + void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { auto staff = GetEntity(_staffId); if (staff != nullptr) { - _mode = staff->IsPatrolAreaSet(*mapTile) ? StaffSetPatrolAreaMode::Unset : StaffSetPatrolAreaMode::Set; + MapRange range(gMapSelectPositionA, gMapSelectPositionB); + auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(_staffId, range, _mode); + GameActions::Execute(&staffSetPatrolAreaAction); } } - OnToolDrag(widgetIndex, screenCoords); - } - - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - auto staff = GetEntity(_staffId); - if (staff != nullptr) + EntityId GetStaffId() const { - MapRange range(gMapSelectPositionA, gMapSelectPositionB); - auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(_staffId, range, _mode); - GameActions::Execute(&staffSetPatrolAreaAction); + return _staffId; } - } - EntityId GetStaffId() const - { - return _staffId; - } - - void SetStaffId(EntityId staffId) - { - _staffId = staffId; - EnableTool(); - } - -private: - EntityId _staffId; - StaffSetPatrolAreaMode _mode; - - void EnableTool() - { - if (PatrolAreaToolIsActive()) + void SetStaffId(EntityId staffId) { - SetPatrolAreaToRender(_staffId); - GfxInvalidateScreen(); + _staffId = staffId; + EnableTool(); } - else + + private: + EntityId _staffId; + StaffSetPatrolAreaMode _mode; + + void EnableTool() { - if (!ToolSet(*this, 0, Tool::WalkDown)) + if (PatrolAreaToolIsActive()) { - ShowGridlines(); - InputSetFlag(INPUT_FLAG_6, true); SetPatrolAreaToRender(_staffId); GfxInvalidateScreen(); } + else + { + if (!ToolSet(*this, 0, Tool::WalkDown)) + { + ShowGridlines(); + InputSetFlag(INPUT_FLAG_6, true); + SetPatrolAreaToRender(_staffId); + GfxInvalidateScreen(); + } + } } - } - void InputSize() + void InputSize() + { + Formatter ft; + ft.Add(kLandToolMinimumSize); + ft.Add(kLandToolMaximumSize); + WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); + } + + bool PatrolAreaToolIsActive() + { + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) + return false; + if (gCurrentToolWidget.window_classification != WindowClass::PatrolArea) + return false; + return true; + } + + bool IsStaffWindowOpen() + { + // If staff window for this patrol area was closed, tool is no longer active + auto staffWindow = WindowFindByNumber(WindowClass::Peep, _staffId); + return staffWindow != nullptr; + } + + std::optional GetBestCoordsFromPos(const ScreenCoordsXY& pos) + { + auto coords = FootpathGetCoordinatesFromPos(pos, nullptr, nullptr); + return coords.IsNull() ? std::nullopt : std::make_optional(coords); + } + + void OnResize() override + { + ResizeFrame(); + } + }; + + WindowBase* PatrolAreaOpen(EntityId staffId) { - Formatter ft; - ft.Add(kLandToolMinimumSize); - ft.Add(kLandToolMaximumSize); - WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); + auto w = WindowFocusOrCreate( + WindowClass::PatrolArea, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); + if (w != nullptr) + { + w->SetStaffId(staffId); + } + return w; } - bool PatrolAreaToolIsActive() + EntityId WindowPatrolAreaGetCurrentStaffId() { - if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) - return false; - if (gCurrentToolWidget.window_classification != WindowClass::PatrolArea) - return false; - return true; + auto current = reinterpret_cast(WindowFindByClass(WindowClass::PatrolArea)); + return current != nullptr ? current->GetStaffId() : EntityId::GetNull(); } - - bool IsStaffWindowOpen() - { - // If staff window for this patrol area was closed, tool is no longer active - auto staffWindow = WindowFindByNumber(WindowClass::Peep, _staffId); - return staffWindow != nullptr; - } - - std::optional GetBestCoordsFromPos(const ScreenCoordsXY& pos) - { - auto coords = FootpathGetCoordinatesFromPos(pos, nullptr, nullptr); - return coords.IsNull() ? std::nullopt : std::make_optional(coords); - } - - void OnResize() override - { - ResizeFrame(); - } -}; - -WindowBase* WindowPatrolAreaOpen(EntityId staffId) -{ - auto w = WindowFocusOrCreate( - WindowClass::PatrolArea, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); - if (w != nullptr) - { - w->SetStaffId(staffId); - } - return w; -} - -EntityId WindowPatrolAreaGetCurrentStaffId() -{ - auto current = reinterpret_cast(WindowFindByClass(WindowClass::PatrolArea)); - return current != nullptr ? current->GetStaffId() : EntityId::GetNull(); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index 9ca72b6dc2..14d722d22b 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -21,7 +21,9 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum WindowPlayerPage { WINDOW_PLAYER_PAGE_OVERVIEW, WINDOW_PLAYER_PAGE_STATISTICS, @@ -59,12 +61,12 @@ static Widget window_player_overview_widgets[] = { MakeWidget({179, 45}, { 12, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_PLAYER_TIP), // Locate button MakeWidget({179, 69}, { 12, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_KICK_PLAYER_TIP ), // Kick button MakeWidget({ 3, 60}, {175, 61}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport - WIDGETS_END, + kWidgetsEnd, }; static Widget window_player_statistics_widgets[] = { WINDOW_PLAYER_COMMON_WIDGETS, - WIDGETS_END, + kWidgetsEnd, }; static Widget *window_player_page_widgets[] = { @@ -74,579 +76,580 @@ static Widget *window_player_page_widgets[] = { #pragma endregion -// clang-format on + // clang-format on -class PlayerWindow final : public Window -{ - int16_t _previousRotation = -1; - bool _drawViewport = true; - -public: - void Init(const uint8_t id) + class PlayerWindow final : public Window { - number = id; - InitScrollWidgets(); - SetPage(WINDOW_PLAYER_PAGE_OVERVIEW); - } + int16_t _previousRotation = -1; + bool _drawViewport = true; + + public: + void Init(const uint8_t id) + { + number = id; + InitScrollWidgets(); + SetPage(WINDOW_PLAYER_PAGE_OVERVIEW); + } #pragma region Events - void OnOpen() override - { - page = 0; - frame_no = 0; - list_information_type = 0; - min_width = 210; - min_height = 134; - max_width = 500; - max_height = 450; - - Invalidate(); - - widgets = window_player_page_widgets[WINDOW_PLAYER_PAGE_OVERVIEW]; - hold_down_widgets = 0; - pressed_widgets = 0; - } - - void OnResize() override - { - switch (page) + void OnOpen() override { - case WINDOW_PLAYER_PAGE_OVERVIEW: - OnResizeOverview(); - break; + page = 0; + frame_no = 0; + list_information_type = 0; + min_width = 210; + min_height = 134; + max_width = 500; + max_height = 450; - case WINDOW_PLAYER_PAGE_STATISTICS: - OnResizeStatistics(); - break; - } - } + Invalidate(); - void OnUpdate() override - { - switch (page) - { - case WINDOW_PLAYER_PAGE_OVERVIEW: - OnUpdateOverview(); - break; - - case WINDOW_PLAYER_PAGE_STATISTICS: - OnUpdateStatistics(); - break; - } - } - - void OnPrepareDraw() override - { - switch (page) - { - case WINDOW_PLAYER_PAGE_OVERVIEW: - OnPrepareDrawOverview(); - break; - - case WINDOW_PLAYER_PAGE_STATISTICS: - OnPrepareDrawStatistics(); - break; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - switch (page) - { - case WINDOW_PLAYER_PAGE_OVERVIEW: - OnDrawOverview(dpi); - break; - - case WINDOW_PLAYER_PAGE_STATISTICS: - OnDrawStatistics(dpi); - break; - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (page) - { - case WINDOW_PLAYER_PAGE_OVERVIEW: - OnMouseDownOverview(widgetIndex); - break; - } - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - SetPage(widgetIndex - WIDX_TAB_1); - return; + widgets = window_player_page_widgets[WINDOW_PLAYER_PAGE_OVERVIEW]; + hold_down_widgets = 0; + pressed_widgets = 0; } - switch (page) + void OnResize() override { - case WINDOW_PLAYER_PAGE_OVERVIEW: - OnMouseUpOverview(widgetIndex); - break; - } - } + switch (page) + { + case WINDOW_PLAYER_PAGE_OVERVIEW: + OnResizeOverview(); + break; - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - switch (page) + case WINDOW_PLAYER_PAGE_STATISTICS: + OnResizeStatistics(); + break; + } + } + + void OnUpdate() override { - case WINDOW_PLAYER_PAGE_OVERVIEW: - OnDropdownOverview(widgetIndex, selectedIndex); - break; + switch (page) + { + case WINDOW_PLAYER_PAGE_OVERVIEW: + OnUpdateOverview(); + break; + + case WINDOW_PLAYER_PAGE_STATISTICS: + OnUpdateStatistics(); + break; + } + } + + void OnPrepareDraw() override + { + switch (page) + { + case WINDOW_PLAYER_PAGE_OVERVIEW: + OnPrepareDrawOverview(); + break; + + case WINDOW_PLAYER_PAGE_STATISTICS: + OnPrepareDrawStatistics(); + break; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + switch (page) + { + case WINDOW_PLAYER_PAGE_OVERVIEW: + OnDrawOverview(dpi); + break; + + case WINDOW_PLAYER_PAGE_STATISTICS: + OnDrawStatistics(dpi); + break; + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (page) + { + case WINDOW_PLAYER_PAGE_OVERVIEW: + OnMouseDownOverview(widgetIndex); + break; + } + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + SetPage(widgetIndex - WIDX_TAB_1); + return; + } + + switch (page) + { + case WINDOW_PLAYER_PAGE_OVERVIEW: + OnMouseUpOverview(widgetIndex); + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + switch (page) + { + case WINDOW_PLAYER_PAGE_OVERVIEW: + OnDropdownOverview(widgetIndex, selectedIndex); + break; + } } - } #pragma endregion -private: - void SetPage(int32_t newPage) - { - int32_t originalPage = page; - - page = newPage; - frame_no = 0; - - hold_down_widgets = 0; - pressed_widgets = 0; - widgets = window_player_page_widgets[newPage]; - Invalidate(); - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); - - if (page == WINDOW_PLAYER_PAGE_OVERVIEW) + private: + void SetPage(int32_t newPage) { - if (viewport == nullptr) + int32_t originalPage = page; + + page = newPage; + frame_no = 0; + + hold_down_widgets = 0; + pressed_widgets = 0; + widgets = window_player_page_widgets[newPage]; + Invalidate(); + OnResize(); + OnPrepareDraw(); + InitScrollWidgets(); + Invalidate(); + + if (page == WINDOW_PLAYER_PAGE_OVERVIEW) { - const auto viewportFocus = Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ()); - ViewportCreate(this, windowPos, width, height, viewportFocus); - flags |= WF_NO_SCROLLING; - OnPrepareDraw(); - UpdateViewport(false); - } - else if (originalPage != page) - { - OnPrepareDraw(); - UpdateViewport(false); - } - } - else - { - RemoveViewport(); - } - } - - void DrawTabImages(DrawPixelInfo& dpi) - { - Widget* widget; - - // Tab 1 - if (!IsWidgetDisabled(WIDX_TAB_1)) - { - widget = &this->widgets[WIDX_TAB_1]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; - GfxDrawSprite(dpi, ImageId(SPR_PEEP_LARGE_FACE_NORMAL), screenCoords); - } - - // Tab 2 - if (!IsWidgetDisabled(WIDX_TAB_2)) - { - widget = &this->widgets[WIDX_TAB_2]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; - int32_t imageId = SPR_TAB_FINANCES_SUMMARY_0; - - if (page == WINDOW_PLAYER_PAGE_STATISTICS) - { - imageId += (frame_no / 2) & 7; - } - - GfxDrawSprite(dpi, ImageId(imageId), screenCoords); - } - } - - void UpdateViewport(bool scroll) - { - int32_t playerIndex = NetworkGetPlayerIndex(static_cast(number)); - if (playerIndex == -1) - { - return; - } - - if (viewport != nullptr) - { - auto coord = NetworkGetPlayerLastActionCoord(playerIndex); - if (coord.x != 0 || coord.y != 0 || coord.z != 0) - { - auto centreLoc = centre_2d_coordinates(coord, viewport); - if (!centreLoc.has_value()) + if (viewport == nullptr) { - return; + const auto viewportFocus = Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ()); + ViewportCreate(this, windowPos, width, height, viewportFocus); + flags |= WF_NO_SCROLLING; + OnPrepareDraw(); + UpdateViewport(false); } - // Don't scroll if the view was originally undefined - if (!_drawViewport) + else if (originalPage != page) { - scroll = false; + OnPrepareDraw(); + UpdateViewport(false); } - - if (!scroll || savedViewPos != centreLoc.value()) - { - flags |= WF_SCROLLING_TO_LOCATION; - savedViewPos = centreLoc.value(); - if (!scroll) - { - viewport->viewPos = centreLoc.value(); - } - InvalidateWidget(WIDX_VIEWPORT); - } - - // Draw the viewport - _drawViewport = true; } else { - // Don't draw the viewport - _drawViewport = false; + RemoveViewport(); } } - } - void UpdateTitle() - { - auto ft = Formatter::Common(); - int32_t player = NetworkGetPlayerIndex(static_cast(number)); - if (player != -1) + void DrawTabImages(DrawPixelInfo& dpi) { - ft.Add(NetworkGetPlayerName(player)); // set title caption to player name - } - else - { - ft.Add(""); - } - } + Widget* widget; -#pragma region Overview - - void OnResizeOverview() - { - WindowSetResize(*this, 240, 170, 500, 300); - } - - void OnUpdateOverview() - { - frame_no++; - InvalidateWidget(WIDX_TAB_1 + page); - - if (NetworkGetPlayerIndex(static_cast(number)) == -1) - { - Close(); - return; - } - - // Update viewport - bool scroll = true; - - // Use this spare window field for rotation check - if (_previousRotation != GetCurrentRotation()) - { - _previousRotation = GetCurrentRotation(); - scroll = false; - } - UpdateViewport(scroll); - } - - void OnPrepareDrawOverview() - { - int32_t playerIndex = NetworkGetPlayerIndex(static_cast(number)); - if (playerIndex == -1) - { - return; - } - - if (window_player_page_widgets[page] != widgets) - { - widgets = window_player_page_widgets[page]; - InitScrollWidgets(); - } - - pressed_widgets &= ~(WIDX_TAB_1); - pressed_widgets &= ~(WIDX_TAB_2); - pressed_widgets |= 1uLL << (page + WIDX_TAB_1); - - UpdateTitle(); - - ResizeFrameWithPage(); - widgets[WIDX_LOCATE].right = width - 2; - widgets[WIDX_LOCATE].left = width - 25; - widgets[WIDX_KICK].right = width - 2; - widgets[WIDX_KICK].left = width - 25; - widgets[WIDX_VIEWPORT].right = width - 26; - widgets[WIDX_VIEWPORT].bottom = height - 14; - - int32_t groupDropdownWidth = widgets[WIDX_GROUP].width(); - widgets[WIDX_GROUP].left = (width - groupDropdownWidth) / 2; - widgets[WIDX_GROUP].right = widgets[WIDX_GROUP].left + groupDropdownWidth; - widgets[WIDX_GROUP_DROPDOWN].left = widgets[WIDX_GROUP].right - 10; - widgets[WIDX_GROUP_DROPDOWN].right = widgets[WIDX_GROUP].right; - - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_2); - - if (viewport != nullptr) - { - Widget* viewportWidget = &window_player_overview_widgets[WIDX_VIEWPORT]; - - viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left, viewportWidget->top }; - viewport->width = viewportWidget->width(); - viewport->height = viewportWidget->height(); - viewport->view_width = viewport->zoom.ApplyTo(viewport->width); - viewport->view_height = viewport->zoom.ApplyTo(viewport->height); - } - - // Only enable kick button for other players - const bool canKick = NetworkCanPerformAction(NetworkGetCurrentPlayerGroupIndex(), NetworkPermission::KickPlayer); - const bool isServer = NetworkGetPlayerFlags(playerIndex) & NETWORK_PLAYER_FLAG_ISSERVER; - const bool isOwnWindow = (NetworkGetCurrentPlayerId() == number); - WidgetSetEnabled(*this, WIDX_KICK, canKick && !isOwnWindow && !isServer); - } - - void OnDrawOverview(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - int32_t player = NetworkGetPlayerIndex(static_cast(number)); - if (player == -1) - { - return; - } - - // Draw current group - int32_t groupindex = NetworkGetGroupIndex(NetworkGetPlayerGroup(player)); - if (groupindex != -1) - { - Widget* widget = &window_player_overview_widgets[WIDX_GROUP]; - - thread_local std::string _buffer; - _buffer.assign("{WINDOW_COLOUR_2}"); - _buffer += NetworkGetGroupName(groupindex); - auto ft = Formatter(); - ft.Add(_buffer.c_str()); - - DrawTextEllipsised( - dpi, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); - } - - // Draw ping - auto screenCoords = windowPos + ScreenCoordsXY{ 90, 24 }; - - auto ft = Formatter(); - ft.Add(STR_PING); - DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); - char ping[64]; - snprintf(ping, 64, "%d ms", NetworkGetPlayerPing(player)); - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(30, 0), ping, { colours[2] }); - - // Draw last action - screenCoords = windowPos + ScreenCoordsXY{ width / 2, height - 13 }; - int32_t updatedWidth = this->width - 8; - int32_t lastaction = NetworkGetPlayerLastAction(player, 0); - ft = Formatter(); - if (lastaction != -999) - { - ft.Add(NetworkGetActionNameStringID(lastaction)); - } - else - { - ft.Add(STR_ACTION_NA); - } - DrawTextEllipsised(dpi, screenCoords, updatedWidth, STR_LAST_ACTION_RAN, ft, { TextAlignment::CENTRE }); - - if (viewport != nullptr && _drawViewport) - { - WindowDrawViewport(dpi, *this); - } - } - - void OnMouseDownOverview(WidgetIndex widgetIndex) - { - auto* widget = &widgets[widgetIndex]; - switch (widgetIndex) - { - case WIDX_GROUP_DROPDOWN: - ShowGroupDropdownOverview(widget); - break; - } - } - - void OnMouseUpOverview(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_LOCATE: + // Tab 1 + if (!IsWidgetDisabled(WIDX_TAB_1)) { - WindowBase* mainWindow = WindowGetMain(); - if (mainWindow != nullptr) + widget = &this->widgets[WIDX_TAB_1]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; + GfxDrawSprite(dpi, ImageId(SPR_PEEP_LARGE_FACE_NORMAL), screenCoords); + } + + // Tab 2 + if (!IsWidgetDisabled(WIDX_TAB_2)) + { + widget = &this->widgets[WIDX_TAB_2]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; + int32_t imageId = SPR_TAB_FINANCES_SUMMARY_0; + + if (page == WINDOW_PLAYER_PAGE_STATISTICS) { - int32_t player = NetworkGetPlayerIndex(static_cast(number)); - if (player == -1) + imageId += (frame_no / 2) & 7; + } + + GfxDrawSprite(dpi, ImageId(imageId), screenCoords); + } + } + + void UpdateViewport(bool scroll) + { + int32_t playerIndex = NetworkGetPlayerIndex(static_cast(number)); + if (playerIndex == -1) + { + return; + } + + if (viewport != nullptr) + { + auto coord = NetworkGetPlayerLastActionCoord(playerIndex); + if (coord.x != 0 || coord.y != 0 || coord.z != 0) + { + auto centreLoc = centre_2d_coordinates(coord, viewport); + if (!centreLoc.has_value()) { return; } - auto coord = NetworkGetPlayerLastActionCoord(player); - if (coord.x || coord.y || coord.z) + // Don't scroll if the view was originally undefined + if (!_drawViewport) { - WindowScrollToLocation(*mainWindow, coord); + scroll = false; } + + if (!scroll || savedViewPos != centreLoc.value()) + { + flags |= WF_SCROLLING_TO_LOCATION; + savedViewPos = centreLoc.value(); + if (!scroll) + { + viewport->viewPos = centreLoc.value(); + } + InvalidateWidget(WIDX_VIEWPORT); + } + + // Draw the viewport + _drawViewport = true; + } + else + { + // Don't draw the viewport + _drawViewport = false; } } - break; - case WIDX_KICK: + } + + void UpdateTitle() + { + auto ft = Formatter::Common(); + int32_t player = NetworkGetPlayerIndex(static_cast(number)); + if (player != -1) { - auto kickPlayerAction = PlayerKickAction(number); - GameActions::Execute(&kickPlayerAction); + ft.Add(NetworkGetPlayerName(player)); // set title caption to player name } - break; - } - } - - void OnDropdownOverview(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - const auto playerId = static_cast(number); - const auto playerIdx = NetworkGetPlayerIndex(playerId); - if (playerIdx == -1) - { - return; - } - if (dropdownIndex == -1) - { - return; - } - const auto groupId = NetworkGetGroupID(dropdownIndex); - const auto windowHandle = std::make_pair(classification, number); - auto playerSetGroupAction = PlayerSetGroupAction(playerId, groupId); - playerSetGroupAction.SetCallback([windowHandle](const GameAction* ga, const GameActions::Result* result) { - if (result->Error == GameActions::Status::Ok) + else { - WindowInvalidateByNumber(windowHandle.first, windowHandle.second); + ft.Add(""); } - }); - GameActions::Execute(&playerSetGroupAction); - } - - void ShowGroupDropdownOverview(Widget* widget) - { - Widget* dropdownWidget; - int32_t numItems, i; - int32_t player = NetworkGetPlayerIndex(static_cast(number)); - if (player == -1) - { - return; } - dropdownWidget = widget - 1; +#pragma region Overview - numItems = NetworkGetNumGroups(); - - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], - 0, 0, numItems, widget->right - dropdownWidget->left); - - for (i = 0; i < NetworkGetNumGroups(); i++) + void OnResizeOverview() { - gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItems[i].Args = reinterpret_cast(NetworkGetGroupName(i)); + WindowSetResize(*this, 240, 170, 500, 300); } - Dropdown::SetChecked(NetworkGetGroupIndex(NetworkGetPlayerGroup(player)), true); - } + void OnUpdateOverview() + { + frame_no++; + InvalidateWidget(WIDX_TAB_1 + page); + + if (NetworkGetPlayerIndex(static_cast(number)) == -1) + { + Close(); + return; + } + + // Update viewport + bool scroll = true; + + // Use this spare window field for rotation check + if (_previousRotation != GetCurrentRotation()) + { + _previousRotation = GetCurrentRotation(); + scroll = false; + } + UpdateViewport(scroll); + } + + void OnPrepareDrawOverview() + { + int32_t playerIndex = NetworkGetPlayerIndex(static_cast(number)); + if (playerIndex == -1) + { + return; + } + + if (window_player_page_widgets[page] != widgets) + { + widgets = window_player_page_widgets[page]; + InitScrollWidgets(); + } + + pressed_widgets &= ~(WIDX_TAB_1); + pressed_widgets &= ~(WIDX_TAB_2); + pressed_widgets |= 1uLL << (page + WIDX_TAB_1); + + UpdateTitle(); + + ResizeFrameWithPage(); + widgets[WIDX_LOCATE].right = width - 2; + widgets[WIDX_LOCATE].left = width - 25; + widgets[WIDX_KICK].right = width - 2; + widgets[WIDX_KICK].left = width - 25; + widgets[WIDX_VIEWPORT].right = width - 26; + widgets[WIDX_VIEWPORT].bottom = height - 14; + + int32_t groupDropdownWidth = widgets[WIDX_GROUP].width(); + widgets[WIDX_GROUP].left = (width - groupDropdownWidth) / 2; + widgets[WIDX_GROUP].right = widgets[WIDX_GROUP].left + groupDropdownWidth; + widgets[WIDX_GROUP_DROPDOWN].left = widgets[WIDX_GROUP].right - 10; + widgets[WIDX_GROUP_DROPDOWN].right = widgets[WIDX_GROUP].right; + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_2); + + if (viewport != nullptr) + { + Widget* viewportWidget = &window_player_overview_widgets[WIDX_VIEWPORT]; + + viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left, viewportWidget->top }; + viewport->width = viewportWidget->width(); + viewport->height = viewportWidget->height(); + viewport->view_width = viewport->zoom.ApplyTo(viewport->width); + viewport->view_height = viewport->zoom.ApplyTo(viewport->height); + } + + // Only enable kick button for other players + const bool canKick = NetworkCanPerformAction(NetworkGetCurrentPlayerGroupIndex(), NetworkPermission::KickPlayer); + const bool isServer = NetworkGetPlayerFlags(playerIndex) & NETWORK_PLAYER_FLAG_ISSERVER; + const bool isOwnWindow = (NetworkGetCurrentPlayerId() == number); + WidgetSetEnabled(*this, WIDX_KICK, canKick && !isOwnWindow && !isServer); + } + + void OnDrawOverview(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + int32_t player = NetworkGetPlayerIndex(static_cast(number)); + if (player == -1) + { + return; + } + + // Draw current group + int32_t groupindex = NetworkGetGroupIndex(NetworkGetPlayerGroup(player)); + if (groupindex != -1) + { + Widget* widget = &window_player_overview_widgets[WIDX_GROUP]; + + thread_local std::string _buffer; + _buffer.assign("{WINDOW_COLOUR_2}"); + _buffer += NetworkGetGroupName(groupindex); + auto ft = Formatter(); + ft.Add(_buffer.c_str()); + + DrawTextEllipsised( + dpi, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, + { TextAlignment::CENTRE }); + } + + // Draw ping + auto screenCoords = windowPos + ScreenCoordsXY{ 90, 24 }; + + auto ft = Formatter(); + ft.Add(STR_PING); + DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); + char ping[64]; + snprintf(ping, 64, "%d ms", NetworkGetPlayerPing(player)); + GfxDrawString(dpi, screenCoords + ScreenCoordsXY(30, 0), ping, { colours[2] }); + + // Draw last action + screenCoords = windowPos + ScreenCoordsXY{ width / 2, height - 13 }; + int32_t updatedWidth = this->width - 8; + int32_t lastaction = NetworkGetPlayerLastAction(player, 0); + ft = Formatter(); + if (lastaction != -999) + { + ft.Add(NetworkGetActionNameStringID(lastaction)); + } + else + { + ft.Add(STR_ACTION_NA); + } + DrawTextEllipsised(dpi, screenCoords, updatedWidth, STR_LAST_ACTION_RAN, ft, { TextAlignment::CENTRE }); + + if (viewport != nullptr && _drawViewport) + { + WindowDrawViewport(dpi, *this); + } + } + + void OnMouseDownOverview(WidgetIndex widgetIndex) + { + auto* widget = &widgets[widgetIndex]; + switch (widgetIndex) + { + case WIDX_GROUP_DROPDOWN: + ShowGroupDropdownOverview(widget); + break; + } + } + + void OnMouseUpOverview(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_LOCATE: + { + WindowBase* mainWindow = WindowGetMain(); + if (mainWindow != nullptr) + { + int32_t player = NetworkGetPlayerIndex(static_cast(number)); + if (player == -1) + { + return; + } + auto coord = NetworkGetPlayerLastActionCoord(player); + if (coord.x || coord.y || coord.z) + { + WindowScrollToLocation(*mainWindow, coord); + } + } + } + break; + case WIDX_KICK: + { + auto kickPlayerAction = PlayerKickAction(number); + GameActions::Execute(&kickPlayerAction); + } + break; + } + } + + void OnDropdownOverview(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + const auto playerId = static_cast(number); + const auto playerIdx = NetworkGetPlayerIndex(playerId); + if (playerIdx == -1) + { + return; + } + if (dropdownIndex == -1) + { + return; + } + const auto groupId = NetworkGetGroupID(dropdownIndex); + const auto windowHandle = std::make_pair(classification, number); + auto playerSetGroupAction = PlayerSetGroupAction(playerId, groupId); + playerSetGroupAction.SetCallback([windowHandle](const GameAction* ga, const GameActions::Result* result) { + if (result->Error == GameActions::Status::Ok) + { + WindowInvalidateByNumber(windowHandle.first, windowHandle.second); + } + }); + GameActions::Execute(&playerSetGroupAction); + } + + void ShowGroupDropdownOverview(Widget* widget) + { + Widget* dropdownWidget; + int32_t numItems, i; + int32_t player = NetworkGetPlayerIndex(static_cast(number)); + if (player == -1) + { + return; + } + + dropdownWidget = widget - 1; + + numItems = NetworkGetNumGroups(); + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, 0, numItems, widget->right - dropdownWidget->left); + + for (i = 0; i < NetworkGetNumGroups(); i++) + { + gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; + gDropdownItems[i].Args = reinterpret_cast(NetworkGetGroupName(i)); + } + + Dropdown::SetChecked(NetworkGetGroupIndex(NetworkGetPlayerGroup(player)), true); + } #pragma endregion #pragma region Statistics - void OnResizeStatistics() - { - WindowSetResize(*this, 210, 80, 210, 80); - } - - void OnUpdateStatistics() - { - frame_no++; - InvalidateWidget(WIDX_TAB_1 + page); - - if (NetworkGetPlayerIndex(static_cast(number)) == -1) + void OnResizeStatistics() { - Close(); - } - } - - void OnPrepareDrawStatistics() - { - if (window_player_page_widgets[page] != widgets) - { - widgets = window_player_page_widgets[page]; - InitScrollWidgets(); + WindowSetResize(*this, 210, 80, 210, 80); } - pressed_widgets &= ~(WIDX_TAB_1); - pressed_widgets &= ~(WIDX_TAB_2); - pressed_widgets |= 1uLL << (page + WIDX_TAB_1); - - UpdateTitle(); - - ResizeFrameWithPage(); - - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_2); - } - - void OnDrawStatistics(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - int32_t player = NetworkGetPlayerIndex(static_cast(number)); - if (player == -1) + void OnUpdateStatistics() { - return; + frame_no++; + InvalidateWidget(WIDX_TAB_1 + page); + + if (NetworkGetPlayerIndex(static_cast(number)) == -1) + { + Close(); + } } - auto screenCoords = windowPos - + ScreenCoordsXY{ window_player_overview_widgets[WIDX_PAGE_BACKGROUND].left + 4, - window_player_overview_widgets[WIDX_PAGE_BACKGROUND].top + 4 }; + void OnPrepareDrawStatistics() + { + if (window_player_page_widgets[page] != widgets) + { + widgets = window_player_page_widgets[page]; + InitScrollWidgets(); + } - auto ft = Formatter(); - ft.Add(NetworkGetPlayerCommandsRan(player)); - DrawTextBasic(dpi, screenCoords, STR_COMMANDS_RAN, ft); + pressed_widgets &= ~(WIDX_TAB_1); + pressed_widgets &= ~(WIDX_TAB_2); + pressed_widgets |= 1uLL << (page + WIDX_TAB_1); - screenCoords.y += LIST_ROW_HEIGHT; + UpdateTitle(); - ft = Formatter(); - ft.Add(NetworkGetPlayerMoneySpent(player)); - DrawTextBasic(dpi, screenCoords, STR_MONEY_SPENT, ft); - } + ResizeFrameWithPage(); + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_2); + } + + void OnDrawStatistics(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + int32_t player = NetworkGetPlayerIndex(static_cast(number)); + if (player == -1) + { + return; + } + + auto screenCoords = windowPos + + ScreenCoordsXY{ window_player_overview_widgets[WIDX_PAGE_BACKGROUND].left + 4, + window_player_overview_widgets[WIDX_PAGE_BACKGROUND].top + 4 }; + + auto ft = Formatter(); + ft.Add(NetworkGetPlayerCommandsRan(player)); + DrawTextBasic(dpi, screenCoords, STR_COMMANDS_RAN, ft); + + screenCoords.y += LIST_ROW_HEIGHT; + + ft = Formatter(); + ft.Add(NetworkGetPlayerMoneySpent(player)); + DrawTextBasic(dpi, screenCoords, STR_MONEY_SPENT, ft); + } #pragma endregion -}; + }; -WindowBase* WindowPlayerOpen(uint8_t id) -{ - auto* window = static_cast(WindowBringToFrontByNumber(WindowClass::Player, id)); - if (window == nullptr) + WindowBase* PlayerOpen(uint8_t id) { - window = WindowCreate(WindowClass::Player, 240, 170, WF_RESIZABLE); + auto* window = static_cast(WindowBringToFrontByNumber(WindowClass::Player, id)); + if (window == nullptr) + { + window = WindowCreate(WindowClass::Player, 240, 170, WF_RESIZABLE); + } + + window->Init(id); + + return window; } - - window->Init(id); - - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index 07a854f109..1afb893d01 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -18,12 +18,12 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr int32_t WW = 200; + static constexpr int32_t WH = 100; -static constexpr int32_t WW = 200; -static constexpr int32_t WH = 100; - -// clang-format off + // clang-format off enum WindowRideRefurbishWidgetIdx { WIDX_BACKGROUND, @@ -38,87 +38,89 @@ static Widget window_ride_refurbish_widgets[] = WINDOW_SHIM_WHITE(STR_REFURBISH_RIDE, WW, WH), MakeWidget({ 10, WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_REFURBISH), MakeWidget({ WW - 95, WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class RefurbishRidePromptWindow final : public Window -{ - money64 _demolishRideCost; - -public: - void SetRide(const Ride& currentRide) + class RefurbishRidePromptWindow final : public Window { - rideId = currentRide.id; - _demolishRideCost = -RideGetRefundPrice(currentRide); - } + money64 _demolishRideCost; - void OnOpen() override - { - widgets = window_ride_refurbish_widgets; - WindowInitScrollWidgets(*this); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void SetRide(const Ride& currentRide) { - case WIDX_REFURBISH: + rideId = currentRide.id; + _demolishRideCost = -RideGetRefundPrice(currentRide); + } + + void OnOpen() override + { + widgets = window_ride_refurbish_widgets; + WindowInitScrollWidgets(*this); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) { - auto gameAction = RideDemolishAction(rideId, RIDE_MODIFY_RENEW); - GameActions::Execute(&gameAction); - break; + case WIDX_REFURBISH: + { + auto gameAction = RideDemolishAction(rideId, RIDE_MODIFY_RENEW); + GameActions::Execute(&gameAction); + break; + } + case WIDX_CANCEL: + case WIDX_CLOSE: + Close(); + break; } - case WIDX_CANCEL: - case WIDX_CLOSE: - Close(); - break; } - } - void OnDraw(DrawPixelInfo& dpi) override - { - WindowDrawWidgets(*this, dpi); - - auto currentRide = GetRide(rideId); - if (currentRide != nullptr) + void OnDraw(DrawPixelInfo& dpi) override { - auto stringId = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) ? STR_REFURBISH_RIDE_ID_NO_MONEY - : STR_REFURBISH_RIDE_ID_MONEY; - auto ft = Formatter(); - currentRide->FormatNameTo(ft); - ft.Add(_demolishRideCost / 2); + WindowDrawWidgets(*this, dpi); - ScreenCoordsXY stringCoords(windowPos.x + WW / 2, windowPos.y + (WH / 2) - 3); - DrawTextWrapped(dpi, stringCoords, WW - 4, stringId, ft, { TextAlignment::CENTRE }); + auto currentRide = GetRide(rideId); + if (currentRide != nullptr) + { + auto stringId = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) ? STR_REFURBISH_RIDE_ID_NO_MONEY + : STR_REFURBISH_RIDE_ID_MONEY; + auto ft = Formatter(); + currentRide->FormatNameTo(ft); + ft.Add(_demolishRideCost / 2); + + ScreenCoordsXY stringCoords(windowPos.x + WW / 2, windowPos.y + (WH / 2) - 3); + DrawTextWrapped(dpi, stringCoords, WW - 4, stringId, ft, { TextAlignment::CENTRE }); + } } - } - void OnResize() override + void OnResize() override + { + ResizeFrame(); + } + }; + + WindowBase* RideRefurbishPromptOpen(const Ride& ride) { - ResizeFrame(); + WindowBase* w; + RefurbishRidePromptWindow* newWindow; + + w = WindowFindByClass(WindowClass::DemolishRidePrompt); + if (w != nullptr) + { + auto windowPos = w->windowPos; + WindowClose(*w); + newWindow = WindowCreate( + WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT); + } + else + { + newWindow = WindowCreate( + WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); + } + + newWindow->SetRide(ride); + + return newWindow; } -}; - -WindowBase* WindowRideRefurbishPromptOpen(const Ride& ride) -{ - WindowBase* w; - RefurbishRidePromptWindow* newWindow; - - w = WindowFindByClass(WindowClass::DemolishRidePrompt); - if (w != nullptr) - { - auto windowPos = w->windowPos; - WindowClose(*w); - newWindow = WindowCreate(WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT); - } - else - { - newWindow = WindowCreate( - WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); - } - - newWindow->SetRide(ride); - - return newWindow; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp index 9d6e591a03..73a0e23a68 100644 --- a/src/openrct2-ui/windows/Research.cpp +++ b/src/openrct2-ui/windows/Research.cpp @@ -24,14 +24,14 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr int32_t WH_DEVELOPMENT = 196; + static constexpr int32_t WW_DEVELOPMENT = 300; + static constexpr int32_t WH_FUNDING = 207; + static constexpr int32_t WW_FUNDING = 320; -static constexpr int32_t WH_DEVELOPMENT = 196; -static constexpr int32_t WW_DEVELOPMENT = 300; -static constexpr int32_t WH_FUNDING = 207; -static constexpr int32_t WW_FUNDING = 320; - -// clang-format off + // clang-format off enum { WINDOW_RESEARCH_PAGE_DEVELOPMENT, WINDOW_RESEARCH_PAGE_FUNDING, @@ -73,7 +73,7 @@ static Widget window_research_development_widgets[] = { MakeWidget({ 3, 47}, {WW_DEVELOPMENT - 10, 70}, WindowWidgetType::Groupbox, WindowColour::Tertiary , STR_CURRENTLY_IN_DEVELOPMENT ), MakeWidget({ 3, 124}, {WW_DEVELOPMENT - 10, 65}, WindowWidgetType::Groupbox, WindowColour::Tertiary , STR_LAST_DEVELOPMENT ), MakeWidget({265, 161}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Tertiary , 0xFFFFFFFF, STR_RESEARCH_SHOW_DETAILS_TIP ), - WIDGETS_END, + kWidgetsEnd, }; static Widget window_research_funding_widgets[] = { @@ -92,7 +92,7 @@ static Widget window_research_funding_widgets[] = { MakeWidget({ 8, 160}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_WATER_RIDES, STR_RESEARCH_NEW_WATER_RIDES_TIP ), MakeWidget({ 8, 173}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_SHOPS_AND_STALLS, STR_RESEARCH_NEW_SHOPS_AND_STALLS_TIP ), MakeWidget({ 8, 186}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_SCENERY_AND_THEMING, STR_RESEARCH_NEW_SCENERY_AND_THEMING_TIP ), - WIDGETS_END, + kWidgetsEnd, }; static Widget *window_research_page_widgets[] = { @@ -102,502 +102,504 @@ static Widget *window_research_page_widgets[] = { #pragma endregion -// clang-format on + // clang-format on -const int32_t window_research_tab_animation_loops[] = { - 16, - 16, -}; + const int32_t window_research_tab_animation_loops[] = { + 16, + 16, + }; -static constexpr StringId ResearchStageNames[] = { - STR_RESEARCH_STAGE_INITIAL_RESEARCH, - STR_RESEARCH_STAGE_DESIGNING, - STR_RESEARCH_STAGE_COMPLETING_DESIGN, - STR_RESEARCH_STAGE_UNKNOWN, -}; + static constexpr StringId ResearchStageNames[] = { + STR_RESEARCH_STAGE_INITIAL_RESEARCH, + STR_RESEARCH_STAGE_DESIGNING, + STR_RESEARCH_STAGE_COMPLETING_DESIGN, + STR_RESEARCH_STAGE_UNKNOWN, + }; -class ResearchWindow final : public Window -{ -public: - void OnOpen() override + class ResearchWindow final : public Window { - widgets = window_research_page_widgets[WINDOW_RESEARCH_PAGE_DEVELOPMENT]; - width = WW_DEVELOPMENT; - height = WH_DEVELOPMENT; - ResearchUpdateUncompletedTypes(); - } - - void SetPage(int32_t newPageIndex) - { - page = newPageIndex; - frame_no = 0; - RemoveViewport(); - - hold_down_widgets = 0; - widgets = window_research_page_widgets[newPageIndex]; - disabled_widgets = 0; - pressed_widgets = 0; - - Invalidate(); - if (newPageIndex == WINDOW_RESEARCH_PAGE_DEVELOPMENT) + public: + void OnOpen() override { + widgets = window_research_page_widgets[WINDOW_RESEARCH_PAGE_DEVELOPMENT]; width = WW_DEVELOPMENT; height = WH_DEVELOPMENT; + ResearchUpdateUncompletedTypes(); } - else + + void SetPage(int32_t newPageIndex) { - width = WW_FUNDING; - height = WH_FUNDING; - } - OnResize(); - - InitScrollWidgets(); - Invalidate(); - } - -private: - void OnUpdate() override - { - // Tab animation - if (++frame_no >= window_research_tab_animation_loops[page]) + page = newPageIndex; frame_no = 0; + RemoveViewport(); - switch (page) - { - case WINDOW_RESEARCH_PAGE_DEVELOPMENT: + hold_down_widgets = 0; + widgets = window_research_page_widgets[newPageIndex]; + disabled_widgets = 0; + pressed_widgets = 0; + + Invalidate(); + if (newPageIndex == WINDOW_RESEARCH_PAGE_DEVELOPMENT) { - InvalidateWidget(WIDX_TAB_1); - break; + width = WW_DEVELOPMENT; + height = WH_DEVELOPMENT; } - case WINDOW_RESEARCH_PAGE_FUNDING: + else { - InvalidateWidget(WIDX_TAB_2); - break; + width = WW_FUNDING; + height = WH_FUNDING; } - } - } + OnResize(); - void OnMouseDown(WidgetIndex widgetIndex) override - { - if (page == WINDOW_RESEARCH_PAGE_FUNDING) - { - WindowResearchFundingMouseDown(this, widgetIndex, WIDX_RESEARCH_FUNDING); - } - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - // Switch tab or close - switch (widgetIndex) - { - case WIDX_CLOSE: - { - Close(); - break; - } - case WIDX_TAB_1: - case WIDX_TAB_2: - { - SetPage(widgetIndex - WIDX_TAB_1); - break; - } - } - - // Process mouse up for specific tab - switch (page) - { - case WINDOW_RESEARCH_PAGE_DEVELOPMENT: - { - WindowResearchDevelopmentMouseUp(widgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); - break; - } - case WINDOW_RESEARCH_PAGE_FUNDING: - { - WindowResearchFundingMouseUp(widgetIndex, WIDX_RESEARCH_FUNDING); - break; - } - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - if (page == WINDOW_RESEARCH_PAGE_FUNDING) - { - WindowResearchFundingDropdown(widgetIndex, selectedIndex, WIDX_RESEARCH_FUNDING); - } - } - - void OnPrepareDraw() override - { - auto* targetWidgets = window_research_page_widgets[page]; - - if (widgets != targetWidgets) - { - widgets = targetWidgets; InitScrollWidgets(); + Invalidate(); } - for (auto i = 0; i < WINDOW_RESEARCH_PAGE_COUNT; i++) + private: + void OnUpdate() override { - SetWidgetPressed(WIDX_TAB_1 + i, false); + // Tab animation + if (++frame_no >= window_research_tab_animation_loops[page]) + frame_no = 0; + + switch (page) + { + case WINDOW_RESEARCH_PAGE_DEVELOPMENT: + { + InvalidateWidget(WIDX_TAB_1); + break; + } + case WINDOW_RESEARCH_PAGE_FUNDING: + { + InvalidateWidget(WIDX_TAB_2); + break; + } + } } - SetWidgetPressed(WIDX_TAB_1 + page, true); - - switch (page) + void OnMouseDown(WidgetIndex widgetIndex) override { - case WINDOW_RESEARCH_PAGE_DEVELOPMENT: + if (page == WINDOW_RESEARCH_PAGE_FUNDING) { - WindowResearchDevelopmentPrepareDraw(this, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); - break; - } - case WINDOW_RESEARCH_PAGE_FUNDING: - { - WindowResearchFundingPrepareDraw(this, WIDX_RESEARCH_FUNDING); - break; + WindowResearchFundingMouseDown(this, widgetIndex, WIDX_RESEARCH_FUNDING); } } - } - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - switch (page) + void OnMouseUp(WidgetIndex widgetIndex) override { - case WINDOW_RESEARCH_PAGE_DEVELOPMENT: + // Switch tab or close + switch (widgetIndex) { - WindowResearchDevelopmentDraw(this, dpi, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); - break; + case WIDX_CLOSE: + { + Close(); + break; + } + case WIDX_TAB_1: + case WIDX_TAB_2: + { + SetPage(widgetIndex - WIDX_TAB_1); + break; + } } - case WINDOW_RESEARCH_PAGE_FUNDING: + + // Process mouse up for specific tab + switch (page) { - WindowResearchFundingDraw(this, dpi); - break; + case WINDOW_RESEARCH_PAGE_DEVELOPMENT: + { + WindowResearchDevelopmentMouseUp(widgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); + break; + } + case WINDOW_RESEARCH_PAGE_FUNDING: + { + WindowResearchFundingMouseUp(widgetIndex, WIDX_RESEARCH_FUNDING); + break; + } } } - } - void OnResize() override - { - ResizeFrameWithPage(); - } - - void DrawTabImage(DrawPixelInfo& dpi, int32_t tabPage, int32_t spriteIndex) - { - WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage; - - if (!IsWidgetDisabled(widgetIndex)) + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { - if (page == tabPage) + if (page == WINDOW_RESEARCH_PAGE_FUNDING) { - int32_t frame = frame_no / 2; - if (tabPage == WINDOW_RESEARCH_PAGE_DEVELOPMENT) - frame %= 8; - spriteIndex += frame; + WindowResearchFundingDropdown(widgetIndex, selectedIndex, WIDX_RESEARCH_FUNDING); + } + } + + void OnPrepareDraw() override + { + auto* targetWidgets = window_research_page_widgets[page]; + + if (widgets != targetWidgets) + { + widgets = targetWidgets; + InitScrollWidgets(); } - GfxDrawSprite( - dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); + for (auto i = 0; i < WINDOW_RESEARCH_PAGE_COUNT; i++) + { + SetWidgetPressed(WIDX_TAB_1 + i, false); + } + + SetWidgetPressed(WIDX_TAB_1 + page, true); + + switch (page) + { + case WINDOW_RESEARCH_PAGE_DEVELOPMENT: + { + WindowResearchDevelopmentPrepareDraw(this, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); + break; + } + case WINDOW_RESEARCH_PAGE_FUNDING: + { + WindowResearchFundingPrepareDraw(this, WIDX_RESEARCH_FUNDING); + break; + } + } } - } - void DrawTabImages(DrawPixelInfo& dpi) + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + switch (page) + { + case WINDOW_RESEARCH_PAGE_DEVELOPMENT: + { + WindowResearchDevelopmentDraw(this, dpi, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); + break; + } + case WINDOW_RESEARCH_PAGE_FUNDING: + { + WindowResearchFundingDraw(this, dpi); + break; + } + } + } + + void OnResize() override + { + ResizeFrameWithPage(); + } + + void DrawTabImage(DrawPixelInfo& dpi, int32_t tabPage, int32_t spriteIndex) + { + WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage; + + if (!IsWidgetDisabled(widgetIndex)) + { + if (page == tabPage) + { + int32_t frame = frame_no / 2; + if (tabPage == WINDOW_RESEARCH_PAGE_DEVELOPMENT) + frame %= 8; + spriteIndex += frame; + } + + GfxDrawSprite( + dpi, ImageId(spriteIndex), + windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); + } + } + + void DrawTabImages(DrawPixelInfo& dpi) + { + DrawTabImage(dpi, WINDOW_RESEARCH_PAGE_DEVELOPMENT, SPR_TAB_FINANCES_RESEARCH_0); + DrawTabImage(dpi, WINDOW_RESEARCH_PAGE_FUNDING, SPR_TAB_FINANCES_SUMMARY_0); + } + }; + + WindowBase* ResearchOpen() { - DrawTabImage(dpi, WINDOW_RESEARCH_PAGE_DEVELOPMENT, SPR_TAB_FINANCES_RESEARCH_0); - DrawTabImage(dpi, WINDOW_RESEARCH_PAGE_FUNDING, SPR_TAB_FINANCES_SUMMARY_0); + ResearchWindow* window = WindowFocusOrCreate(WindowClass::Research, WW_FUNDING, WH_FUNDING, WF_10); + window->SetPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT); + return window; } -}; -WindowBase* WindowResearchOpen() -{ - ResearchWindow* window = WindowFocusOrCreate(WindowClass::Research, WW_FUNDING, WH_FUNDING, WF_10); - window->SetPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT); - return window; -} - -static WidgetIndex GetWidgetIndexOffset(WidgetIndex baseWidgetIndex, WidgetIndex currentPageWidgetIndex) -{ - // Other windows that reuse the logic here will have different values for the widget enums, but they otherwise align to - // those in this class. Therefore, they can be referenced relative to the widget index for the page in this class, using - // the difference between them as an offset. - return baseWidgetIndex - currentPageWidgetIndex; -} + static WidgetIndex GetWidgetIndexOffset(WidgetIndex baseWidgetIndex, WidgetIndex currentPageWidgetIndex) + { + // Other windows that reuse the logic here will have different values for the widget enums, but they otherwise align to + // those in this class. Therefore, they can be referenced relative to the widget index for the page in this class, using + // the difference between them as an offset. + return baseWidgetIndex - currentPageWidgetIndex; + } #pragma region Development page -void WindowResearchDevelopmentMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex) -{ - const auto& gameState = GetGameState(); - auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); - - if (widgetIndex == (WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset)) + void WindowResearchDevelopmentMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex) { - News::OpenSubject(News::ItemType::Research, gameState.ResearchLastItem->rawValue); - } -} + const auto& gameState = GetGameState(); + auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); -void WindowResearchDevelopmentPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex) -{ - const auto& gameState = GetGameState(); - // Offset the widget index to allow reuse from other windows - auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); - w->widgets[WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset].type = WindowWidgetType::Empty; - - // Display button to link to the last development, if there is one - if (gameState.ResearchLastItem.has_value()) - { - auto type = gameState.ResearchLastItem->type; - w->widgets[WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset].type = WindowWidgetType::FlatBtn; - const auto image = type == Research::EntryType::Ride ? SPR_NEW_RIDE : SPR_NEW_SCENERY; - w->widgets[WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset].image = ImageId(image); - } -} - -void WindowResearchDevelopmentDraw(WindowBase* w, DrawPixelInfo& dpi, WidgetIndex baseWidgetIndex) -{ - const auto& gameState = GetGameState(); - - auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); - auto screenCoords = w->windowPos - + ScreenCoordsXY{ 10, w->widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP + widgetOffset].top + 12 }; - - if (gameState.ResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL) - { - // Research type - auto ft = Formatter(); - ft.Add(STR_RESEARCH_UNKNOWN); - DrawTextWrapped(dpi, screenCoords, 296, STR_RESEARCH_TYPE_LABEL, ft); - screenCoords.y += 25; - - // Progress - ft = Formatter(); - ft.Add(STR_RESEARCH_COMPLETED_AL); - DrawTextWrapped(dpi, screenCoords, 296, STR_RESEARCH_PROGRESS_LABEL, ft); - screenCoords.y += 15; - - // Expected - ft = Formatter(); - ft.Add(STR_RESEARCH_STAGE_UNKNOWN); - DrawTextBasic(dpi, screenCoords, STR_RESEARCH_EXPECTED_LABEL, ft); - } - else - { - // Research type - auto ft = Formatter(); - StringId label = STR_RESEARCH_TYPE_LABEL; - if (gameState.ResearchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH) + if (widgetIndex == (WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset)) { + News::OpenSubject(News::ItemType::Research, gameState.ResearchLastItem->rawValue); + } + } + + void WindowResearchDevelopmentPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex) + { + const auto& gameState = GetGameState(); + // Offset the widget index to allow reuse from other windows + auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); + w->widgets[WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset].type = WindowWidgetType::Empty; + + // Display button to link to the last development, if there is one + if (gameState.ResearchLastItem.has_value()) + { + auto type = gameState.ResearchLastItem->type; + w->widgets[WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset].type = WindowWidgetType::FlatBtn; + const auto image = type == Research::EntryType::Ride ? SPR_NEW_RIDE : SPR_NEW_SCENERY; + w->widgets[WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset].image = ImageId(image); + } + } + + void WindowResearchDevelopmentDraw(WindowBase* w, DrawPixelInfo& dpi, WidgetIndex baseWidgetIndex) + { + const auto& gameState = GetGameState(); + + auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); + auto screenCoords = w->windowPos + + ScreenCoordsXY{ 10, w->widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP + widgetOffset].top + 12 }; + + if (gameState.ResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL) + { + // Research type + auto ft = Formatter(); ft.Add(STR_RESEARCH_UNKNOWN); - } - else if (gameState.ResearchProgressStage == RESEARCH_STAGE_DESIGNING) - { - ft.Add(gameState.ResearchNextItem->GetCategoryName()); - } - else if (gameState.ResearchNextItem->type == Research::EntryType::Ride) - { - const auto& rtd = GetRideTypeDescriptor(gameState.ResearchNextItem->baseRideType); - if (rtd.HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) - { - ft.Add(gameState.ResearchNextItem->GetName()); - } - else if (gameState.ResearchNextItem->flags & RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE) - { - ft.Add(rtd.Naming.Name); - } - else - { - ft.Add(gameState.ResearchNextItem->GetName()); - ft.Add(rtd.Naming.Name); - label = STR_RESEARCH_TYPE_LABEL_VEHICLE; - } - } - else - { - ft.Add(gameState.ResearchNextItem->GetName()); - } - DrawTextWrapped(dpi, screenCoords, 296, label, ft); - screenCoords.y += 25; + DrawTextWrapped(dpi, screenCoords, 296, STR_RESEARCH_TYPE_LABEL, ft); + screenCoords.y += 25; - // Progress - ft = Formatter(); - ft.Add(ResearchStageNames[gameState.ResearchProgressStage]); - DrawTextWrapped(dpi, screenCoords, 296, STR_RESEARCH_PROGRESS_LABEL, ft); - screenCoords.y += 15; + // Progress + ft = Formatter(); + ft.Add(STR_RESEARCH_COMPLETED_AL); + DrawTextWrapped(dpi, screenCoords, 296, STR_RESEARCH_PROGRESS_LABEL, ft); + screenCoords.y += 15; - // Expected - ft = Formatter(); - if (gameState.ResearchProgressStage != RESEARCH_STAGE_INITIAL_RESEARCH && gameState.ResearchExpectedDay != 255) - { - // TODO: Should probably use game date format setting - ft.Add(STR_RESEARCH_EXPECTED_FORMAT); - ft.Add(DateDayNames[gameState.ResearchExpectedDay]); - ft.Add(DateGameMonthNames[gameState.ResearchExpectedMonth]); - } - else - { + // Expected + ft = Formatter(); ft.Add(STR_RESEARCH_STAGE_UNKNOWN); - } - DrawTextBasic(dpi, screenCoords, STR_RESEARCH_EXPECTED_LABEL, ft); - } - - // Last development - screenCoords = w->windowPos + ScreenCoordsXY{ 10, w->widgets[WIDX_LAST_DEVELOPMENT_GROUP + widgetOffset].top + 12 }; - - if (gameState.ResearchLastItem.has_value()) - { - StringId lastDevelopmentFormat = STR_EMPTY; - auto ft = Formatter(); - if (gameState.ResearchLastItem->type == Research::EntryType::Scenery) - { - lastDevelopmentFormat = STR_RESEARCH_SCENERY_LABEL; - ft.Add(gameState.ResearchLastItem->GetName()); + DrawTextBasic(dpi, screenCoords, STR_RESEARCH_EXPECTED_LABEL, ft); } else { - lastDevelopmentFormat = STR_RESEARCH_RIDE_LABEL; - const auto& rtd = GetRideTypeDescriptor(gameState.ResearchLastItem->baseRideType); - if (rtd.HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) + // Research type + auto ft = Formatter(); + StringId label = STR_RESEARCH_TYPE_LABEL; + if (gameState.ResearchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH) { - ft.Add(gameState.ResearchLastItem->GetName()); + ft.Add(STR_RESEARCH_UNKNOWN); } - else if (gameState.ResearchLastItem->flags & RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE) + else if (gameState.ResearchProgressStage == RESEARCH_STAGE_DESIGNING) { - ft.Add(rtd.Naming.Name); + ft.Add(gameState.ResearchNextItem->GetCategoryName()); + } + else if (gameState.ResearchNextItem->type == Research::EntryType::Ride) + { + const auto& rtd = GetRideTypeDescriptor(gameState.ResearchNextItem->baseRideType); + if (rtd.HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) + { + ft.Add(gameState.ResearchNextItem->GetName()); + } + else if (gameState.ResearchNextItem->flags & RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE) + { + ft.Add(rtd.Naming.Name); + } + else + { + ft.Add(gameState.ResearchNextItem->GetName()); + ft.Add(rtd.Naming.Name); + label = STR_RESEARCH_TYPE_LABEL_VEHICLE; + } } else { - ft.Add(gameState.ResearchLastItem->GetName()); - ft.Add(rtd.Naming.Name); - lastDevelopmentFormat = STR_RESEARCH_VEHICLE_LABEL; + ft.Add(gameState.ResearchNextItem->GetName()); } + DrawTextWrapped(dpi, screenCoords, 296, label, ft); + screenCoords.y += 25; + + // Progress + ft = Formatter(); + ft.Add(ResearchStageNames[gameState.ResearchProgressStage]); + DrawTextWrapped(dpi, screenCoords, 296, STR_RESEARCH_PROGRESS_LABEL, ft); + screenCoords.y += 15; + + // Expected + ft = Formatter(); + if (gameState.ResearchProgressStage != RESEARCH_STAGE_INITIAL_RESEARCH && gameState.ResearchExpectedDay != 255) + { + // TODO: Should probably use game date format setting + ft.Add(STR_RESEARCH_EXPECTED_FORMAT); + ft.Add(DateDayNames[gameState.ResearchExpectedDay]); + ft.Add(DateGameMonthNames[gameState.ResearchExpectedMonth]); + } + else + { + ft.Add(STR_RESEARCH_STAGE_UNKNOWN); + } + DrawTextBasic(dpi, screenCoords, STR_RESEARCH_EXPECTED_LABEL, ft); } - DrawTextWrapped(dpi, screenCoords, 266, lastDevelopmentFormat, ft); + // Last development + screenCoords = w->windowPos + ScreenCoordsXY{ 10, w->widgets[WIDX_LAST_DEVELOPMENT_GROUP + widgetOffset].top + 12 }; + + if (gameState.ResearchLastItem.has_value()) + { + StringId lastDevelopmentFormat = STR_EMPTY; + auto ft = Formatter(); + if (gameState.ResearchLastItem->type == Research::EntryType::Scenery) + { + lastDevelopmentFormat = STR_RESEARCH_SCENERY_LABEL; + ft.Add(gameState.ResearchLastItem->GetName()); + } + else + { + lastDevelopmentFormat = STR_RESEARCH_RIDE_LABEL; + const auto& rtd = GetRideTypeDescriptor(gameState.ResearchLastItem->baseRideType); + if (rtd.HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) + { + ft.Add(gameState.ResearchLastItem->GetName()); + } + else if (gameState.ResearchLastItem->flags & RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE) + { + ft.Add(rtd.Naming.Name); + } + else + { + ft.Add(gameState.ResearchLastItem->GetName()); + ft.Add(rtd.Naming.Name); + lastDevelopmentFormat = STR_RESEARCH_VEHICLE_LABEL; + } + } + + DrawTextWrapped(dpi, screenCoords, 266, lastDevelopmentFormat, ft); + } } -} #pragma endregion #pragma region Funding page -void WindowResearchFundingMouseDown(WindowBase* w, WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex) -{ - const auto& gameState = GetGameState(); - auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); - - if (widgetIndex != (WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset)) - return; - - Widget* dropdownWidget = &w->widgets[widgetIndex - 1]; - - for (std::size_t i = 0; i < std::size(ResearchFundingLevelNames); i++) + void WindowResearchFundingMouseDown(WindowBase* w, WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex) { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = ResearchFundingLevelNames[i]; - } - WindowDropdownShowTextCustomWidth( - { w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - w->colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget->width() - 3); + const auto& gameState = GetGameState(); + auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); - int32_t currentResearchLevel = gameState.ResearchFundingLevel; - Dropdown::SetChecked(currentResearchLevel, true); -} + if (widgetIndex != (WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset)) + return; -void WindowResearchFundingMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex) -{ - const auto& gameState = GetGameState(); - auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); + Widget* dropdownWidget = &w->widgets[widgetIndex - 1]; - switch (widgetIndex - widgetOffset) - { - case WIDX_TRANSPORT_RIDES: - case WIDX_GENTLE_RIDES: - case WIDX_ROLLER_COASTERS: - case WIDX_THRILL_RIDES: - case WIDX_WATER_RIDES: - case WIDX_SHOPS_AND_STALLS: - case WIDX_SCENERY_AND_THEMING: + for (std::size_t i = 0; i < std::size(ResearchFundingLevelNames); i++) { - auto activeResearchTypes = gameState.ResearchPriorities; - activeResearchTypes ^= 1uLL << (widgetIndex - (WIDX_TRANSPORT_RIDES + widgetOffset)); - auto gameAction = ParkSetResearchFundingAction(activeResearchTypes, gameState.ResearchFundingLevel); - GameActions::Execute(&gameAction); - break; + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = ResearchFundingLevelNames[i]; + } + WindowDropdownShowTextCustomWidth( + { w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + w->colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget->width() - 3); + + int32_t currentResearchLevel = gameState.ResearchFundingLevel; + Dropdown::SetChecked(currentResearchLevel, true); + } + + void WindowResearchFundingMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex) + { + const auto& gameState = GetGameState(); + auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); + + switch (widgetIndex - widgetOffset) + { + case WIDX_TRANSPORT_RIDES: + case WIDX_GENTLE_RIDES: + case WIDX_ROLLER_COASTERS: + case WIDX_THRILL_RIDES: + case WIDX_WATER_RIDES: + case WIDX_SHOPS_AND_STALLS: + case WIDX_SCENERY_AND_THEMING: + { + auto activeResearchTypes = gameState.ResearchPriorities; + activeResearchTypes ^= 1uLL << (widgetIndex - (WIDX_TRANSPORT_RIDES + widgetOffset)); + auto gameAction = ParkSetResearchFundingAction(activeResearchTypes, gameState.ResearchFundingLevel); + GameActions::Execute(&gameAction); + break; + } } } -} -void WindowResearchFundingDropdown(WidgetIndex widgetIndex, int32_t selectedIndex, WidgetIndex baseWidgetIndex) -{ - const auto& gameState = GetGameState(); - auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); - - if (widgetIndex != (WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset) || selectedIndex == -1) - return; - - auto gameAction = ParkSetResearchFundingAction(gameState.ResearchPriorities, selectedIndex); - GameActions::Execute(&gameAction); -} - -void WindowResearchFundingPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex) -{ - const auto& gameState = GetGameState(); - auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); - - if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) || gameState.ResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL) + void WindowResearchFundingDropdown(WidgetIndex widgetIndex, int32_t selectedIndex, WidgetIndex baseWidgetIndex) { - w->widgets[WIDX_RESEARCH_FUNDING + widgetOffset].type = WindowWidgetType::Empty; - w->widgets[WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset].type = WindowWidgetType::Empty; - } - else - { - w->widgets[WIDX_RESEARCH_FUNDING + widgetOffset].type = WindowWidgetType::DropdownMenu; - w->widgets[WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset].type = WindowWidgetType::Button; + const auto& gameState = GetGameState(); + auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); + + if (widgetIndex != (WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset) || selectedIndex == -1) + return; + + auto gameAction = ParkSetResearchFundingAction(gameState.ResearchPriorities, selectedIndex); + GameActions::Execute(&gameAction); } - // Current funding - int32_t currentResearchLevel = gameState.ResearchFundingLevel; - w->widgets[WIDX_RESEARCH_FUNDING + widgetOffset].text = ResearchFundingLevelNames[currentResearchLevel]; - - // Checkboxes - uint8_t activeResearchTypes = gameState.ResearchPriorities; - int32_t uncompletedResearchTypes = gameState.ResearchUncompletedCategories; - for (int32_t i = 0; i < 7; i++) + void WindowResearchFundingPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex) { - int32_t mask = 1 << i; - int32_t widgetMask = 1uLL << (i + WIDX_TRANSPORT_RIDES + widgetOffset); + const auto& gameState = GetGameState(); + auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); - // Set checkbox disabled if research type is complete - if (uncompletedResearchTypes & mask) + if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) || gameState.ResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL) { - w->disabled_widgets &= ~widgetMask; - - // Set checkbox ticked if research type is active - if (activeResearchTypes & mask) - w->pressed_widgets |= widgetMask; - else - w->pressed_widgets &= ~widgetMask; + w->widgets[WIDX_RESEARCH_FUNDING + widgetOffset].type = WindowWidgetType::Empty; + w->widgets[WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset].type = WindowWidgetType::Empty; } else { - w->disabled_widgets |= widgetMask; - w->pressed_widgets &= ~widgetMask; + w->widgets[WIDX_RESEARCH_FUNDING + widgetOffset].type = WindowWidgetType::DropdownMenu; + w->widgets[WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset].type = WindowWidgetType::Button; + } + + // Current funding + int32_t currentResearchLevel = gameState.ResearchFundingLevel; + w->widgets[WIDX_RESEARCH_FUNDING + widgetOffset].text = ResearchFundingLevelNames[currentResearchLevel]; + + // Checkboxes + uint8_t activeResearchTypes = gameState.ResearchPriorities; + int32_t uncompletedResearchTypes = gameState.ResearchUncompletedCategories; + for (int32_t i = 0; i < 7; i++) + { + int32_t mask = 1 << i; + int32_t widgetMask = 1uLL << (i + WIDX_TRANSPORT_RIDES + widgetOffset); + + // Set checkbox disabled if research type is complete + if (uncompletedResearchTypes & mask) + { + w->disabled_widgets &= ~widgetMask; + + // Set checkbox ticked if research type is active + if (activeResearchTypes & mask) + w->pressed_widgets |= widgetMask; + else + w->pressed_widgets &= ~widgetMask; + } + else + { + w->disabled_widgets |= widgetMask; + w->pressed_widgets &= ~widgetMask; + } } } -} -void WindowResearchFundingDraw(WindowBase* w, DrawPixelInfo& dpi) -{ - if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) - return; + void WindowResearchFundingDraw(WindowBase* w, DrawPixelInfo& dpi) + { + if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) + return; - const auto& gameState = GetGameState(); - int32_t currentResearchLevel = gameState.ResearchFundingLevel; - auto ft = Formatter(); - ft.Add(research_cost_table[currentResearchLevel]); - DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 10, 77 }, STR_RESEARCH_COST_PER_MONTH, ft); -} + const auto& gameState = GetGameState(); + int32_t currentResearchLevel = gameState.ResearchFundingLevel; + auto ft = Formatter(); + ft.Add(research_cost_table[currentResearchLevel]); + DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 10, 77 }, STR_RESEARCH_COST_PER_MONTH, ft); + } #pragma endregion +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 03d4880f9f..d943d21522 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -67,31 +67,31 @@ #include #include -using namespace OpenRCT2; using namespace OpenRCT2::TrackMetaData; - -static constexpr StringId WINDOW_TITLE = STR_RIDE_WINDOW_TITLE; -static constexpr int32_t WH = 207; -static constexpr int32_t WW = 316; - -enum +namespace OpenRCT2::Ui::Windows { - WINDOW_RIDE_PAGE_MAIN, - WINDOW_RIDE_PAGE_VEHICLE, - WINDOW_RIDE_PAGE_OPERATING, - WINDOW_RIDE_PAGE_MAINTENANCE, - WINDOW_RIDE_PAGE_COLOUR, - WINDOW_RIDE_PAGE_MUSIC, - WINDOW_RIDE_PAGE_MEASUREMENTS, - WINDOW_RIDE_PAGE_GRAPHS, - WINDOW_RIDE_PAGE_INCOME, - WINDOW_RIDE_PAGE_CUSTOMER, - WINDOW_RIDE_PAGE_COUNT -}; + static constexpr StringId WINDOW_TITLE = STR_RIDE_WINDOW_TITLE; + static constexpr int32_t WH = 207; + static constexpr int32_t WW = 316; + + enum + { + WINDOW_RIDE_PAGE_MAIN, + WINDOW_RIDE_PAGE_VEHICLE, + WINDOW_RIDE_PAGE_OPERATING, + WINDOW_RIDE_PAGE_MAINTENANCE, + WINDOW_RIDE_PAGE_COLOUR, + WINDOW_RIDE_PAGE_MUSIC, + WINDOW_RIDE_PAGE_MEASUREMENTS, + WINDOW_RIDE_PAGE_GRAPHS, + WINDOW_RIDE_PAGE_INCOME, + WINDOW_RIDE_PAGE_CUSTOMER, + WINDOW_RIDE_PAGE_COUNT + }; #pragma region Widgets -// clang-format off + // clang-format off enum { WIDX_BACKGROUND, WIDX_TITLE, @@ -188,7 +188,7 @@ enum { WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN, WIDX_VEHICLE_BODY_COLOUR, WIDX_VEHICLE_TRIM_COLOUR, - WIDX_VEHICLE_TERNARY_COLOUR, + WIDX_VEHICLE_TERTIARY_COLOUR, WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX, WIDX_PLAY_MUSIC = 14, @@ -257,7 +257,7 @@ static Widget _mainWidgets[] = { MakeWidget({296, 76}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_OPEN_BUTTON_0), STR_OPEN_RIDE_TIP ), MakeWidget({ 3, 180}, {305, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_6_STRINGID ), MakeWidget({297, 180}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), - WIDGETS_END, + kWidgetsEnd, }; // 0x009ADDA8 @@ -269,7 +269,7 @@ static Widget _vehicleWidgets[] = { MakeWidget ({ 7, 154}, {302, 43}, WindowWidgetType::Scroll, WindowColour::Secondary, STR_EMPTY ), MakeSpinnerWidgets({ 7, 203}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_RIDE_VEHICLE_COUNT, STR_MAX_VEHICLES_TIP ), MakeSpinnerWidgets({164, 203}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_1_CAR_PER_TRAIN, STR_MAX_CARS_PER_TRAIN_TIP), - WIDGETS_END, + kWidgetsEnd, }; // 0x009ADEFC @@ -292,7 +292,7 @@ static Widget _operatingWidgets[] = { MakeWidget ({297, 110}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), MakeWidget ({ 21, 89}, {129, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_NUMBER_OF_CIRCUITS, STR_NUMBER_OF_CIRCUITS_TIP ), MakeSpinnerWidgets({157, 89}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_NUMBER_OF_CIRCUITS_VALUE ), // NB: 3 widgets - WIDGETS_END, + kWidgetsEnd, }; // 0x009AE190 @@ -303,7 +303,7 @@ static Widget _maintenanceWidgets[] = { MakeWidget({289, 108}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_LOCATE_NEAREST_AVAILABLE_MECHANIC_TIP ), MakeWidget({265, 108}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_CONSTRUCTION), STR_REFURBISH_RIDE_TIP ), MakeWidget({241, 108}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_NO_ENTRY), STR_DEBUG_FORCE_BREAKDOWN_TIP ), - WIDGETS_END, + kWidgetsEnd, }; // 0x009AE2A4 @@ -330,7 +330,7 @@ static Widget _colourWidgets[] = { MakeWidget({ 99, 190}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_ADDITIONAL_COLOUR_1_TIP ), MakeWidget({119, 190}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_ADDITIONAL_COLOUR_2_TIP ), MakeWidget({100, 74}, {239, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_RANDOM_COLOUR ), - WIDGETS_END, + kWidgetsEnd, }; // 0x009AE4C8 @@ -339,7 +339,7 @@ static Widget _musicWidgets[] = { MakeWidget({ 7, 47}, {302, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_PLAY_MUSIC, STR_SELECT_MUSIC_TIP ), MakeWidget({ 7, 62}, {302, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_EMPTY ), MakeWidget({297, 63}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_MUSIC_STYLE_TIP), - WIDGETS_END, + kWidgetsEnd, }; // 0x009AE5DC @@ -350,7 +350,7 @@ static Widget _measurementWidgets[] = { MakeWidget({158, 127}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RESET_SELECTION ), MakeWidget({ 4, 177}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_DESIGN_SAVE ), MakeWidget({158, 177}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_DESIGN_CANCEL ), - WIDGETS_END, + kWidgetsEnd, }; // 0x009AE710 @@ -361,7 +361,7 @@ static Widget _graphsWidgets[] = { MakeWidget({ 76, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_ALTITUDE, STR_SHOW_GRAPH_OF_ALTITUDE_AGAINST_TIME_TIP ), MakeWidget({149, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_VERT_G, STR_SHOW_GRAPH_OF_VERTICAL_ACCELERATION_AGAINST_TIME_TIP), MakeWidget({222, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_LAT_G, STR_SHOW_GRAPH_OF_LATERAL_ACCELERATION_AGAINST_TIME_TIP ), - WIDGETS_END, + kWidgetsEnd, }; // 0x009AE844 @@ -373,7 +373,7 @@ static Widget _incomeWidgets[] = { MakeWidget ({ 19, 94}, {126, 14}, WindowWidgetType::Label, WindowColour::Secondary ), MakeSpinnerWidgets({147, 94}, {162, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_RIDE_SECONDARY_PRICE_VALUE ), // NB: 3 widgets MakeWidget ({ 5, 106}, {306, 13}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_SAME_PRICE_THROUGHOUT_PARK, STR_SAME_PRICE_THROUGHOUT_PARK_TIP), - WIDGETS_END, + kWidgetsEnd, }; // 0x009AE9C8 @@ -382,7 +382,7 @@ static Widget _customerWidgets[] = { MakeWidget({289, 54}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SHOW_GUESTS_THOUGHTS_ABOUT_THIS_RIDE_ATTRACTION), STR_SHOW_GUESTS_THOUGHTS_ABOUT_THIS_RIDE_ATTRACTION_TIP), MakeWidget({289, 78}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SHOW_GUESTS_ON_THIS_RIDE_ATTRACTION), STR_SHOW_GUESTS_ON_THIS_RIDE_ATTRACTION_TIP ), MakeWidget({289, 102}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SHOW_GUESTS_QUEUING_FOR_THIS_RIDE_ATTRACTION), STR_SHOW_GUESTS_QUEUING_FOR_THIS_RIDE_ATTRACTION_TIP ), - WIDGETS_END, + kWidgetsEnd, }; static const std::array PageWidgets = { @@ -427,56 +427,56 @@ static constexpr std::array PageHoldDownWidgets = { 0uLL, }; static_assert(std::size(PageHoldDownWidgets) == WINDOW_RIDE_PAGE_COUNT); -// clang-format on + // clang-format on #pragma endregion -static void CancelScenerySelection(); + static void CancelScenerySelection(); -static bool _collectTrackDesignScenery = false; -static int32_t _lastSceneryX = 0; -static int32_t _lastSceneryY = 0; -static std::unique_ptr _trackDesign; + static bool _collectTrackDesignScenery = false; + static int32_t _lastSceneryX = 0; + static int32_t _lastSceneryY = 0; + static std::unique_ptr _trackDesign; -// Cached overall view for each ride -// (Re)calculated when the ride window is opened -struct RideOverallView -{ - CoordsXYZ loc; - ZoomLevel zoom; -}; + // Cached overall view for each ride + // (Re)calculated when the ride window is opened + struct RideOverallView + { + CoordsXYZ loc; + ZoomLevel zoom; + }; -static std::vector _rideOverallViewsCache = {}; + static std::vector _rideOverallViewsCache = {}; -static constexpr std::array PageTabAnimationDivisor = { - 0, // WINDOW_RIDE_PAGE_MAIN - 0, // WINDOW_RIDE_PAGE_VEHICLE - 2, // WINDOW_RIDE_PAGE_OPERATING - 2, // WINDOW_RIDE_PAGE_MAINTENANCE - 4, // WINDOW_RIDE_PAGE_COLOUR - 2, // WINDOW_RIDE_PAGE_MUSIC - 8, // WINDOW_RIDE_PAGE_MEASUREMENTS - 8, // WINDOW_RIDE_PAGE_GRAPHS - 2, // WINDOW_RIDE_PAGE_INCOME - 0, // WINDOW_RIDE_PAGE_CUSTOMER -}; -static_assert(std::size(PageTabAnimationDivisor) == WINDOW_RIDE_PAGE_COUNT); + static constexpr std::array PageTabAnimationDivisor = { + 0, // WINDOW_RIDE_PAGE_MAIN + 0, // WINDOW_RIDE_PAGE_VEHICLE + 2, // WINDOW_RIDE_PAGE_OPERATING + 2, // WINDOW_RIDE_PAGE_MAINTENANCE + 4, // WINDOW_RIDE_PAGE_COLOUR + 2, // WINDOW_RIDE_PAGE_MUSIC + 8, // WINDOW_RIDE_PAGE_MEASUREMENTS + 8, // WINDOW_RIDE_PAGE_GRAPHS + 2, // WINDOW_RIDE_PAGE_INCOME + 0, // WINDOW_RIDE_PAGE_CUSTOMER + }; + static_assert(std::size(PageTabAnimationDivisor) == WINDOW_RIDE_PAGE_COUNT); -static constexpr std::array PageTabAnimationNumFrames = { - 0, // WINDOW_RIDE_PAGE_MAIN - 0, // WINDOW_RIDE_PAGE_VEHICLE - 4, // WINDOW_RIDE_PAGE_OPERATING - 16, // WINDOW_RIDE_PAGE_MAINTENANCE - 8, // WINDOW_RIDE_PAGE_COLOUR - 16, // WINDOW_RIDE_PAGE_MUSIC - 8, // WINDOW_RIDE_PAGE_MEASUREMENTS - 8, // WINDOW_RIDE_PAGE_GRAPHS - 8, // WINDOW_RIDE_PAGE_INCOME - 0, // WINDOW_RIDE_PAGE_CUSTOMER -}; -static_assert(std::size(PageTabAnimationNumFrames) == WINDOW_RIDE_PAGE_COUNT); + static constexpr std::array PageTabAnimationNumFrames = { + 0, // WINDOW_RIDE_PAGE_MAIN + 0, // WINDOW_RIDE_PAGE_VEHICLE + 4, // WINDOW_RIDE_PAGE_OPERATING + 16, // WINDOW_RIDE_PAGE_MAINTENANCE + 8, // WINDOW_RIDE_PAGE_COLOUR + 16, // WINDOW_RIDE_PAGE_MUSIC + 8, // WINDOW_RIDE_PAGE_MEASUREMENTS + 8, // WINDOW_RIDE_PAGE_GRAPHS + 8, // WINDOW_RIDE_PAGE_INCOME + 0, // WINDOW_RIDE_PAGE_CUSTOMER + }; + static_assert(std::size(PageTabAnimationNumFrames) == WINDOW_RIDE_PAGE_COUNT); -// clang-format off + // clang-format off static constexpr std::array RatingNames = { static_cast(STR_RATING_LOW), static_cast(STR_RATING_MEDIUM), @@ -486,689 +486,2300 @@ static constexpr std::array RatingNames = { static_cast(STR_RATING_ULTRA_EXTREME), }; static_assert(std::size(RatingNames) == 6); -// clang-format on + // clang-format on -static constexpr std::array RideBreakdownReasonNames = { - static_cast(STR_RIDE_BREAKDOWN_SAFETY_CUT_OUT), // BREAKDOWN_SAFETY_CUT_OUT - static_cast(STR_RIDE_BREAKDOWN_RESTRAINTS_STUCK_CLOSED), // BREAKDOWN_RESTRAINTS_STUCK_CLOSED - static_cast(STR_RIDE_BREAKDOWN_RESTRAINTS_STUCK_OPEN), // BREAKDOWN_RESTRAINTS_STUCK_OPEN - static_cast(STR_RIDE_BREAKDOWN_DOORS_STUCK_CLOSED), // BREAKDOWN_DOORS_STUCK_CLOSED - static_cast(STR_RIDE_BREAKDOWN_DOORS_STUCK_OPEN), // BREAKDOWN_DOORS_STUCK_OPEN - static_cast(STR_RIDE_BREAKDOWN_VEHICLE_MALFUNCTION), // BREAKDOWN_VEHICLE_MALFUNCTION - static_cast(STR_RIDE_BREAKDOWN_BRAKES_FAILURE), // BREAKDOWN_BRAKES_FAILURE - static_cast(STR_RIDE_BREAKDOWN_CONTROL_FAILURE), // BREAKDOWN_CONTROL_FAILURE -}; -static_assert(std::size(RideBreakdownReasonNames) == BREAKDOWN_COUNT); + static constexpr std::array RideBreakdownReasonNames = { + static_cast(STR_RIDE_BREAKDOWN_SAFETY_CUT_OUT), // BREAKDOWN_SAFETY_CUT_OUT + static_cast(STR_RIDE_BREAKDOWN_RESTRAINTS_STUCK_CLOSED), // BREAKDOWN_RESTRAINTS_STUCK_CLOSED + static_cast(STR_RIDE_BREAKDOWN_RESTRAINTS_STUCK_OPEN), // BREAKDOWN_RESTRAINTS_STUCK_OPEN + static_cast(STR_RIDE_BREAKDOWN_DOORS_STUCK_CLOSED), // BREAKDOWN_DOORS_STUCK_CLOSED + static_cast(STR_RIDE_BREAKDOWN_DOORS_STUCK_OPEN), // BREAKDOWN_DOORS_STUCK_OPEN + static_cast(STR_RIDE_BREAKDOWN_VEHICLE_MALFUNCTION), // BREAKDOWN_VEHICLE_MALFUNCTION + static_cast(STR_RIDE_BREAKDOWN_BRAKES_FAILURE), // BREAKDOWN_BRAKES_FAILURE + static_cast(STR_RIDE_BREAKDOWN_CONTROL_FAILURE), // BREAKDOWN_CONTROL_FAILURE + }; + static_assert(std::size(RideBreakdownReasonNames) == BREAKDOWN_COUNT); -// Used in other places as well -const StringId ColourSchemeNames[4] = { - STR_MAIN_COLOUR_SCHEME, // RIDE_COLOUR_SCHEME_MAIN - STR_ALTERNATIVE_COLOUR_SCHEME_1, // RIDE_COLOUR_SCHEME_ADDITIONAL_1 - STR_ALTERNATIVE_COLOUR_SCHEME_2, // RIDE_COLOUR_SCHEME_ADDITIONAL_2 - STR_ALTERNATIVE_COLOUR_SCHEME_3, // RIDE_COLOUR_SCHEME_ADDITIONAL_3 -}; -static_assert(std::size(ColourSchemeNames) == RIDE_COLOUR_SCHEME_COUNT); + // Used in other places as well + const StringId ColourSchemeNames[4] = { + STR_MAIN_COLOUR_SCHEME, // RIDE_COLOUR_SCHEME_MAIN + STR_ALTERNATIVE_COLOUR_SCHEME_1, // RIDE_COLOUR_SCHEME_ADDITIONAL_1 + STR_ALTERNATIVE_COLOUR_SCHEME_2, // RIDE_COLOUR_SCHEME_ADDITIONAL_2 + STR_ALTERNATIVE_COLOUR_SCHEME_3, // RIDE_COLOUR_SCHEME_ADDITIONAL_3 + }; + static_assert(std::size(ColourSchemeNames) == RIDE_COLOUR_SCHEME_COUNT); -static constexpr std::array VehicleLoadNames = { - static_cast(STR_QUARTER_LOAD), // WAIT_FOR_LOAD_QUARTER - static_cast(STR_HALF_LOAD), // WAIT_FOR_LOAD_HALF - static_cast(STR_THREE_QUARTER_LOAD), // WAIT_FOR_LOAD_THREE_QUARTER - static_cast(STR_FULL_LOAD), // WAIT_FOR_LOAD_FULL - static_cast(STR_ANY_LOAD), // WAIT_FOR_LOAD_ANY -}; -static_assert(std::size(VehicleLoadNames) == WAIT_FOR_LOAD_COUNT); + static constexpr std::array VehicleLoadNames = { + static_cast(STR_QUARTER_LOAD), // WAIT_FOR_LOAD_QUARTER + static_cast(STR_HALF_LOAD), // WAIT_FOR_LOAD_HALF + static_cast(STR_THREE_QUARTER_LOAD), // WAIT_FOR_LOAD_THREE_QUARTER + static_cast(STR_FULL_LOAD), // WAIT_FOR_LOAD_FULL + static_cast(STR_ANY_LOAD), // WAIT_FOR_LOAD_ANY + }; + static_assert(std::size(VehicleLoadNames) == WAIT_FOR_LOAD_COUNT); -static constexpr std::array VehicleColourSchemeNames = { - static_cast(STR_ALL_VEHICLES_IN_SAME_COLOURS), // RIDE_COLOUR_SCHEME_MODE_ALL_SAME, - static_cast(STR_DIFFERENT_COLOURS_PER), // RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_TRAIN, - static_cast(STR_DIFFERENT_COLOURS_PER_VEHICLE), // RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_CAR, -}; -static_assert(std::size(VehicleColourSchemeNames) == RIDE_COLOUR_SCHEME_MODE_COUNT); + static constexpr std::array VehicleColourSchemeNames = { + static_cast(STR_ALL_VEHICLES_IN_SAME_COLOURS), // RIDE_COLOUR_SCHEME_MODE_ALL_SAME, + static_cast(STR_DIFFERENT_COLOURS_PER), // RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_TRAIN, + static_cast(STR_DIFFERENT_COLOURS_PER_VEHICLE), // RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_CAR, + }; + static_assert(std::size(VehicleColourSchemeNames) == RIDE_COLOUR_SCHEME_MODE_COUNT); -static constexpr std::array VehicleStatusNames = { - static_cast(STR_MOVING_TO_END_OF), // Vehicle::Status::MovingToEndOfStation - static_cast(STR_WAITING_FOR_PASSENGERS_AT), // Vehicle::Status::WaitingForPassengers - static_cast(STR_WAITING_TO_DEPART), // Vehicle::Status::WaitingToDepart - static_cast(STR_DEPARTING), // Vehicle::Status::Departing - static_cast(STR_TRAVELLING_AT_0), // Vehicle::Status::Travelling - static_cast(STR_ARRIVING_AT), // Vehicle::Status::Arriving - static_cast(STR_UNLOADING_PASSENGERS_AT), // Vehicle::Status::UnloadingPassengers - static_cast(STR_TRAVELLING_AT_1), // Vehicle::Status::TravellingBoat - static_cast(STR_CRASHING), // Vehicle::Status::Crashing - static_cast(STR_CRASHED_0), // Vehicle::Status::Crashed - static_cast(STR_TRAVELLING_AT_2), // Vehicle::Status::TravellingDodgems - static_cast(STR_SWINGING), // Vehicle::Status::Swinging - static_cast(STR_ROTATING_0), // Vehicle::Status::Rotating - static_cast(STR_ROTATING_1), // Vehicle::Status::FerrisWheelRotating - static_cast(STR_OPERATING_0), // Vehicle::Status::SimulatorOperating - static_cast(STR_SHOWING_FILM), // Vehicle::Status::ShowingFilm - static_cast(STR_ROTATING_2), // Vehicle::Status::SpaceRingsOperating - static_cast(STR_OPERATING_1), // Vehicle::Status::TopSpinOperating - static_cast(STR_OPERATING_2), // Vehicle::Status::HauntedHouseOperating - static_cast(STR_DOING_CIRCUS_SHOW), // Vehicle::Status::DoingCircusShow - static_cast(STR_OPERATING_3), // Vehicle::Status::CrookedHouseOperating - static_cast(STR_WAITING_FOR_CABLE_LIFT), // Vehicle::Status::WaitingForCableLift - static_cast(STR_TRAVELLING_AT_3), // Vehicle::Status::TravellingCableLift - static_cast(STR_STOPPING_0), // Vehicle::Status::Stopping - static_cast(STR_WAITING_FOR_PASSENGERS), // Vehicle::Status::WaitingForPassengers17 - static_cast(STR_WAITING_TO_START), // Vehicle::Status::WaitingToStart - static_cast(STR_STARTING), // Vehicle::Status::Starting - static_cast(STR_OPERATING), // Vehicle::Status::Operating1A - static_cast(STR_STOPPING_1), // Vehicle::Status::Stopping1B - static_cast(STR_UNLOADING_PASSENGERS), // Vehicle::Status::UnloadingPassengers1C - static_cast(STR_STOPPED_BY_BLOCK_BRAKES), // Vehicle::Status::StoppedByBlockBrakes -}; -static_assert(std::size(VehicleStatusNames) == 31); + static constexpr std::array VehicleStatusNames = { + static_cast(STR_MOVING_TO_END_OF), // Vehicle::Status::MovingToEndOfStation + static_cast(STR_WAITING_FOR_PASSENGERS_AT), // Vehicle::Status::WaitingForPassengers + static_cast(STR_WAITING_TO_DEPART), // Vehicle::Status::WaitingToDepart + static_cast(STR_DEPARTING), // Vehicle::Status::Departing + static_cast(STR_TRAVELLING_AT_0), // Vehicle::Status::Travelling + static_cast(STR_ARRIVING_AT), // Vehicle::Status::Arriving + static_cast(STR_UNLOADING_PASSENGERS_AT), // Vehicle::Status::UnloadingPassengers + static_cast(STR_TRAVELLING_AT_1), // Vehicle::Status::TravellingBoat + static_cast(STR_CRASHING), // Vehicle::Status::Crashing + static_cast(STR_CRASHED_0), // Vehicle::Status::Crashed + static_cast(STR_TRAVELLING_AT_2), // Vehicle::Status::TravellingDodgems + static_cast(STR_SWINGING), // Vehicle::Status::Swinging + static_cast(STR_ROTATING_0), // Vehicle::Status::Rotating + static_cast(STR_ROTATING_1), // Vehicle::Status::FerrisWheelRotating + static_cast(STR_OPERATING_0), // Vehicle::Status::SimulatorOperating + static_cast(STR_SHOWING_FILM), // Vehicle::Status::ShowingFilm + static_cast(STR_ROTATING_2), // Vehicle::Status::SpaceRingsOperating + static_cast(STR_OPERATING_1), // Vehicle::Status::TopSpinOperating + static_cast(STR_OPERATING_2), // Vehicle::Status::HauntedHouseOperating + static_cast(STR_DOING_CIRCUS_SHOW), // Vehicle::Status::DoingCircusShow + static_cast(STR_OPERATING_3), // Vehicle::Status::CrookedHouseOperating + static_cast(STR_WAITING_FOR_CABLE_LIFT), // Vehicle::Status::WaitingForCableLift + static_cast(STR_TRAVELLING_AT_3), // Vehicle::Status::TravellingCableLift + static_cast(STR_STOPPING_0), // Vehicle::Status::Stopping + static_cast(STR_WAITING_FOR_PASSENGERS), // Vehicle::Status::WaitingForPassengers17 + static_cast(STR_WAITING_TO_START), // Vehicle::Status::WaitingToStart + static_cast(STR_STARTING), // Vehicle::Status::Starting + static_cast(STR_OPERATING), // Vehicle::Status::Operating1A + static_cast(STR_STOPPING_1), // Vehicle::Status::Stopping1B + static_cast(STR_UNLOADING_PASSENGERS), // Vehicle::Status::UnloadingPassengers1C + static_cast(STR_STOPPED_BY_BLOCK_BRAKES), // Vehicle::Status::StoppedByBlockBrakes + }; + static_assert(std::size(VehicleStatusNames) == 31); -static constexpr std::array SingleSessionVehicleStatusNames = { - static_cast(STR_STOPPING_0), // Vehicle::Status::MovingToEndOfStation - static_cast(STR_WAITING_FOR_PASSENGERS), // Vehicle::Status::WaitingForPassengers - static_cast(STR_WAITING_TO_START), // Vehicle::Status::WaitingToDepart - static_cast(STR_STARTING), // Vehicle::Status::Departing - static_cast(STR_OPERATING), // Vehicle::Status::Travelling - static_cast(STR_STOPPING_1), // Vehicle::Status::Arriving - static_cast(STR_UNLOADING_PASSENGERS), // Vehicle::Status::UnloadingPassengers -}; -static_assert(std::size(SingleSessionVehicleStatusNames) == 7); + static constexpr std::array SingleSessionVehicleStatusNames = { + static_cast(STR_STOPPING_0), // Vehicle::Status::MovingToEndOfStation + static_cast(STR_WAITING_FOR_PASSENGERS), // Vehicle::Status::WaitingForPassengers + static_cast(STR_WAITING_TO_START), // Vehicle::Status::WaitingToDepart + static_cast(STR_STARTING), // Vehicle::Status::Departing + static_cast(STR_OPERATING), // Vehicle::Status::Travelling + static_cast(STR_STOPPING_1), // Vehicle::Status::Arriving + static_cast(STR_UNLOADING_PASSENGERS), // Vehicle::Status::UnloadingPassengers + }; + static_assert(std::size(SingleSessionVehicleStatusNames) == 7); -struct WindowRideMazeDesignOption -{ - StringId text; - uint32_t sprite; -}; - -static constexpr std::array MazeOptions = { - WindowRideMazeDesignOption{ STR_RIDE_DESIGN_MAZE_BRICK_WALLS, SPR_RIDE_DESIGN_PREVIEW_MAZE_BRICK_WALLS }, - WindowRideMazeDesignOption{ STR_RIDE_DESIGN_MAZE_HEDGES, SPR_RIDE_DESIGN_PREVIEW_MAZE_HEDGES }, - WindowRideMazeDesignOption{ STR_RIDE_DESIGN_MAZE_ICE_BLOCKS, SPR_RIDE_DESIGN_PREVIEW_MAZE_ICE_BLOCKS }, - WindowRideMazeDesignOption{ STR_RIDE_DESIGN_MAZE_WOODEN_FENCES, SPR_RIDE_DESIGN_PREVIEW_MAZE_WOODEN_FENCES }, -}; -static_assert(std::size(MazeOptions) == 4); - -struct GraphsYAxis -{ - uint8_t interval; - int8_t unit; - int8_t unit_interval; - StringId label; -}; - -static constexpr const std::array GraphsYAxisDetails = { - GraphsYAxis{ 11, 0, 10, STR_RIDE_STATS_VELOCITY_FORMAT }, // GRAPH_VELOCITY - GraphsYAxis{ 10, 0, 15, STR_RIDE_STATS_ALTITUDE_FORMAT }, // GRAPH_ALTITUDE - GraphsYAxis{ 13, -3, 1, STR_RIDE_STATS_G_FORCE_FORMAT }, // GRAPH_VERTICAL - GraphsYAxis{ 13, -4, 1, STR_RIDE_STATS_G_FORCE_FORMAT }, // GRAPH_LATERAL -}; -static_assert(std::size(GraphsYAxisDetails) == 4); - -static constexpr auto RIDE_G_FORCES_RED_NEG_VERTICAL = -FIXED_2DP(2, 50); -static constexpr auto RIDE_G_FORCES_RED_LATERAL = FIXED_2DP(2, 80); - -// Used for sorting the ride type cheat dropdown. -struct RideTypeLabel -{ - ride_type_t RideTypeId; - StringId LabelId; - u8string_view LabelString; -}; - -// Used for sorting the vehicle type dropdown. -struct VehicleTypeLabel -{ - ObjectEntryIndex SubTypeId; - StringId LabelId; - u8string_view LabelString; -}; - -// Used for sorting the entrance type dropdown. -struct EntranceTypeLabel -{ - ObjectEntryIndex EntranceTypeId; - StringId LabelId; - u8string_view LabelString; -}; - -class RideWindow final : public Window -{ - int16_t _viewIndex; - std::vector _rideDropdownData; - int32_t _rideDropdownDataLanguage = LANGUAGE_UNDEFINED; - int32_t _vehicleDropdownDataLanguage = LANGUAGE_UNDEFINED; - int32_t _entranceDropdownDataLanguage = LANGUAGE_UNDEFINED; - const RideObjectEntry* _vehicleDropdownRideType = nullptr; - bool _vehicleDropdownExpanded = false; - std::vector _vehicleDropdownData; - int16_t _vehicleIndex = 0; - uint16_t _rideColour = 0; - std::vector _entranceDropdownData; - bool _autoScrollGraph = true; - -public: - RideWindow(const Ride& ride) + struct WindowRideMazeDesignOption { - rideId = ride.id; - } + StringId text; + uint32_t sprite; + }; - virtual void OnOpen() override + static constexpr std::array MazeOptions = { + WindowRideMazeDesignOption{ STR_RIDE_DESIGN_MAZE_BRICK_WALLS, SPR_RIDE_DESIGN_PREVIEW_MAZE_BRICK_WALLS }, + WindowRideMazeDesignOption{ STR_RIDE_DESIGN_MAZE_HEDGES, SPR_RIDE_DESIGN_PREVIEW_MAZE_HEDGES }, + WindowRideMazeDesignOption{ STR_RIDE_DESIGN_MAZE_ICE_BLOCKS, SPR_RIDE_DESIGN_PREVIEW_MAZE_ICE_BLOCKS }, + WindowRideMazeDesignOption{ STR_RIDE_DESIGN_MAZE_WOODEN_FENCES, SPR_RIDE_DESIGN_PREVIEW_MAZE_WOODEN_FENCES }, + }; + static_assert(std::size(MazeOptions) == 4); + + struct GraphsYAxis { - widgets = PageWidgets[WINDOW_RIDE_PAGE_MAIN]; - hold_down_widgets = PageHoldDownWidgets[WINDOW_RIDE_PAGE_MAIN]; + uint8_t interval; + int8_t unit; + int8_t unit_interval; + StringId label; + }; - page = WINDOW_RIDE_PAGE_MAIN; - frame_no = 0; - list_information_type = 0; - picked_peep_frame = 0; - DisableTabs(); - min_width = 316; - min_height = 180; - max_width = 500; - max_height = 450; + static constexpr const std::array GraphsYAxisDetails = { + GraphsYAxis{ 11, 0, 10, STR_RIDE_STATS_VELOCITY_FORMAT }, // GRAPH_VELOCITY + GraphsYAxis{ 10, 0, 15, STR_RIDE_STATS_ALTITUDE_FORMAT }, // GRAPH_ALTITUDE + GraphsYAxis{ 13, -3, 1, STR_RIDE_STATS_G_FORCE_FORMAT }, // GRAPH_VERTICAL + GraphsYAxis{ 13, -4, 1, STR_RIDE_STATS_G_FORCE_FORMAT }, // GRAPH_LATERAL + }; + static_assert(std::size(GraphsYAxisDetails) == 4); - auto ride = GetRide(rideId); - if (ride == nullptr) + static constexpr auto RIDE_G_FORCES_RED_NEG_VERTICAL = -FIXED_2DP(2, 50); + static constexpr auto RIDE_G_FORCES_RED_LATERAL = FIXED_2DP(2, 80); + + // Used for sorting the ride type cheat dropdown. + struct RideTypeLabel + { + ride_type_t RideTypeId; + StringId LabelId; + u8string_view LabelString; + }; + + // Used for sorting the vehicle type dropdown. + struct VehicleTypeLabel + { + ObjectEntryIndex SubTypeId; + StringId LabelId; + u8string_view LabelString; + }; + + // Used for sorting the entrance type dropdown. + struct EntranceTypeLabel + { + ObjectEntryIndex EntranceTypeId; + StringId LabelId; + u8string_view LabelString; + }; + + class RideWindow final : public Window + { + int16_t _viewIndex; + std::vector _rideDropdownData; + int32_t _rideDropdownDataLanguage = LANGUAGE_UNDEFINED; + int32_t _vehicleDropdownDataLanguage = LANGUAGE_UNDEFINED; + int32_t _entranceDropdownDataLanguage = LANGUAGE_UNDEFINED; + const RideObjectEntry* _vehicleDropdownRideType = nullptr; + bool _vehicleDropdownExpanded = false; + std::vector _vehicleDropdownData; + int16_t _vehicleIndex = 0; + uint16_t _rideColour = 0; + std::vector _entranceDropdownData; + bool _autoScrollGraph = true; + + public: + RideWindow(const Ride& ride) { - Close(); - return; - } - UpdateOverallView(*ride); - - PopulateVehicleTypeDropdown(*ride, true); - } - - virtual void OnClose() override - { - switch (page) - { - case WINDOW_RIDE_PAGE_COLOUR: - ColourClose(); - break; - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsClose(); - break; - } - } - virtual void OnResize() override - { - switch (page) - { - case WINDOW_RIDE_PAGE_MAIN: - MainResize(); - break; - case WINDOW_RIDE_PAGE_VEHICLE: - VehicleResize(); - break; - case WINDOW_RIDE_PAGE_OPERATING: - OperatingResize(); - break; - case WINDOW_RIDE_PAGE_MAINTENANCE: - MaintenanceResize(); - break; - case WINDOW_RIDE_PAGE_COLOUR: - ColourResize(); - break; - case WINDOW_RIDE_PAGE_MUSIC: - MusicResize(); - break; - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsResize(); - break; - case WINDOW_RIDE_PAGE_GRAPHS: - GraphsResize(); - break; - case WINDOW_RIDE_PAGE_INCOME: - IncomeResize(); - break; - case WINDOW_RIDE_PAGE_CUSTOMER: - CustomerResize(); - break; - } - } - virtual void OnUpdate() override - { - switch (page) - { - case WINDOW_RIDE_PAGE_MAIN: - MainUpdate(); - break; - case WINDOW_RIDE_PAGE_VEHICLE: - VehicleUpdate(); - break; - case WINDOW_RIDE_PAGE_OPERATING: - OperatingUpdate(); - break; - case WINDOW_RIDE_PAGE_MAINTENANCE: - MaintenanceUpdate(); - break; - case WINDOW_RIDE_PAGE_COLOUR: - ColourUpdate(); - break; - case WINDOW_RIDE_PAGE_MUSIC: - MusicUpdate(); - break; - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsUpdate(); - break; - case WINDOW_RIDE_PAGE_GRAPHS: - GraphsUpdate(); - break; - case WINDOW_RIDE_PAGE_INCOME: - IncomeUpdate(); - break; - case WINDOW_RIDE_PAGE_CUSTOMER: - CustomerUpdate(); - break; - } - } - - virtual void OnPrepareDraw() override - { - switch (page) - { - case WINDOW_RIDE_PAGE_MAIN: - MainOnPrepareDraw(); - break; - case WINDOW_RIDE_PAGE_VEHICLE: - VehicleOnPrepareDraw(); - break; - case WINDOW_RIDE_PAGE_OPERATING: - OperatingOnPrepareDraw(); - break; - case WINDOW_RIDE_PAGE_MAINTENANCE: - MaintenanceOnPrepareDraw(); - break; - case WINDOW_RIDE_PAGE_COLOUR: - ColourOnPrepareDraw(); - break; - case WINDOW_RIDE_PAGE_MUSIC: - MusicOnPrepareDraw(); - break; - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsOnPrepareDraw(); - break; - case WINDOW_RIDE_PAGE_GRAPHS: - GraphsOnPrepareDraw(); - break; - case WINDOW_RIDE_PAGE_INCOME: - IncomeOnPrepareDraw(); - break; - case WINDOW_RIDE_PAGE_CUSTOMER: - CustomerOnPrepareDraw(); - break; - } - } - virtual void OnDraw(DrawPixelInfo& dpi) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_MAIN: - MainOnDraw(dpi); - break; - case WINDOW_RIDE_PAGE_VEHICLE: - VehicleOnDraw(dpi); - break; - case WINDOW_RIDE_PAGE_OPERATING: - OperatingOnDraw(dpi); - break; - case WINDOW_RIDE_PAGE_MAINTENANCE: - MaintenanceOnDraw(dpi); - break; - case WINDOW_RIDE_PAGE_COLOUR: - ColourOnDraw(dpi); - break; - case WINDOW_RIDE_PAGE_MUSIC: - MusicOnDraw(dpi); - break; - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsOnDraw(dpi); - break; - case WINDOW_RIDE_PAGE_GRAPHS: - GraphsOnDraw(dpi); - break; - case WINDOW_RIDE_PAGE_INCOME: - IncomeOnDraw(dpi); - break; - case WINDOW_RIDE_PAGE_CUSTOMER: - CustomerOnDraw(dpi); - break; - } - } - - virtual OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_VEHICLE: - return VehicleTooltip(widgetIndex, fallback); - case WINDOW_RIDE_PAGE_GRAPHS: - return GraphsTooltip(widgetIndex, fallback); - } - return { fallback, {} }; - } - virtual void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_MAIN: - MainOnMouseDown(widgetIndex); - break; - case WINDOW_RIDE_PAGE_VEHICLE: - VehicleOnMouseDown(widgetIndex); - break; - case WINDOW_RIDE_PAGE_OPERATING: - OperatingOnMouseDown(widgetIndex); - break; - case WINDOW_RIDE_PAGE_MAINTENANCE: - MaintenanceOnMouseDown(widgetIndex); - break; - case WINDOW_RIDE_PAGE_COLOUR: - ColourOnMouseDown(widgetIndex); - break; - case WINDOW_RIDE_PAGE_MUSIC: - MusicOnMouseDown(widgetIndex); - break; - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsOnMouseDown(widgetIndex); - break; - case WINDOW_RIDE_PAGE_GRAPHS: - GraphsOnMouseDown(widgetIndex); - break; - case WINDOW_RIDE_PAGE_INCOME: - IncomeOnMouseDown(widgetIndex); - break; - } - } - virtual void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_MAIN: - MainOnMouseUp(widgetIndex); - break; - case WINDOW_RIDE_PAGE_VEHICLE: - VehicleOnMouseUp(widgetIndex); - break; - case WINDOW_RIDE_PAGE_OPERATING: - OperatingOnMouseUp(widgetIndex); - break; - case WINDOW_RIDE_PAGE_MAINTENANCE: - MaintenanceOnMouseUp(widgetIndex); - break; - case WINDOW_RIDE_PAGE_COLOUR: - ColourOnMouseUp(widgetIndex); - break; - case WINDOW_RIDE_PAGE_MUSIC: - MusicOnMouseUp(widgetIndex); - break; - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsOnMouseUp(widgetIndex); - break; - case WINDOW_RIDE_PAGE_GRAPHS: - GraphsOnMouseUp(widgetIndex); - break; - case WINDOW_RIDE_PAGE_INCOME: - IncomeOnMouseUp(widgetIndex); - break; - case WINDOW_RIDE_PAGE_CUSTOMER: - CustomerOnMouseUp(widgetIndex); - break; - } - } - virtual void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_MAIN: - MainOnDropdown(widgetIndex, selectedIndex); - break; - case WINDOW_RIDE_PAGE_VEHICLE: - VehicleOnDropdown(widgetIndex, selectedIndex); - break; - case WINDOW_RIDE_PAGE_OPERATING: - OperatingOnDropdown(widgetIndex, selectedIndex); - break; - case WINDOW_RIDE_PAGE_MAINTENANCE: - MaintenanceOnDropdown(widgetIndex, selectedIndex); - break; - case WINDOW_RIDE_PAGE_COLOUR: - ColourOnDropdown(widgetIndex, selectedIndex); - break; - case WINDOW_RIDE_PAGE_MUSIC: - MusicOnDropdown(widgetIndex, selectedIndex); - break; - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsOnDropdown(widgetIndex, selectedIndex); - break; - } - } - virtual void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_MAIN: - MainOnTextInput(widgetIndex, text); - break; - case WINDOW_RIDE_PAGE_OPERATING: - OperatingOnTextInput(widgetIndex, text); - break; - case WINDOW_RIDE_PAGE_INCOME: - IncomeOnTextInput(widgetIndex, text); - break; - } - } - virtual ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_GRAPHS: - return GraphsScrollGetSize(scrollIndex); - } - return {}; - } - virtual void OnScrollSelect(int32_t scrollIndex, int32_t scrollAreaType) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_GRAPHS: - GraphsOnScrollSelect(scrollIndex, scrollAreaType); - break; - } - } - virtual void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_VEHICLE: - VehicleOnScrollDraw(dpi, scrollIndex); - break; - case WINDOW_RIDE_PAGE_COLOUR: - ColourOnScrollDraw(dpi, scrollIndex); - break; - case WINDOW_RIDE_PAGE_GRAPHS: - GraphsOnScrollDraw(dpi, scrollIndex); - break; - } - } - virtual void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_COLOUR: - ColourOnToolDown(widgetIndex, screenCoords); - break; - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsOnToolDown(widgetIndex, screenCoords); - break; - } - } - virtual void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_COLOUR: - ColourOnToolDrag(widgetIndex, screenCoords); - break; - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsOnToolDrag(widgetIndex, screenCoords); - break; - } - } - virtual void OnToolAbort(WidgetIndex widgetIndex) override - { - switch (page) - { - case WINDOW_RIDE_PAGE_MEASUREMENTS: - MeasurementsOnToolAbort(widgetIndex); - break; - } - } - virtual void OnViewportRotate() override - { - switch (page) - { - case WINDOW_RIDE_PAGE_MAIN: - MainViewportRotate(); - break; - } - } - - void SetPage(int32_t newPage) - { - if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) - if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) - ToolCancel(); - - if (newPage == WINDOW_RIDE_PAGE_VEHICLE) - { - auto constructionWindow = WindowFindByClass(WindowClass::RideConstruction); - if (constructionWindow != nullptr && constructionWindow->number == number) - { - WindowCloseByClass(WindowClass::RideConstruction); - // Closing the construction window sets the tab to the first page, which we don't want here, - // as user just clicked the Vehicle page - SetPage(WINDOW_RIDE_PAGE_VEHICLE); - } + rideId = ride.id; } - // Set listen only to viewport - bool listen = false; - if (newPage == WINDOW_RIDE_PAGE_MAIN && page == WINDOW_RIDE_PAGE_MAIN && viewport != nullptr - && !(viewport->flags & VIEWPORT_FLAG_SOUND_ON)) - listen = true; - - page = newPage; - frame_no = 0; - picked_peep_frame = 0; - - // There doesn't seem to be any need for this call, and it can sometimes modify the reported number of cars per train, - // so I've removed it if (newPage == WINDOW_RIDE_PAGE_VEHICLE) { ride_update_max_vehicles(ride); - //} - - RemoveViewport(); - - hold_down_widgets = PageHoldDownWidgets[page]; - pressed_widgets = 0; - widgets = PageWidgets[page]; - DisableTabs(); - Invalidate(); - - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); - - if (listen && viewport != nullptr) - viewport->flags |= VIEWPORT_FLAG_SOUND_ON; - } - - void SetViewIndex(int16_t newIndex) - { - _viewIndex = newIndex; - OnViewportRotate(); - } - int16_t GetViewIndex() const - { - return _viewIndex; - } - - void ResetVehicleIndex() - { - _vehicleIndex = 0; - } - -private: - void DrawTabImage(DrawPixelInfo& dpi, int32_t tab, int32_t spriteIndex) - { - WidgetIndex widgetIndex = WIDX_TAB_1 + tab; - - if (!WidgetIsDisabled(*this, widgetIndex)) + virtual void OnOpen() override { - if (page == tab) - { - int32_t frame = frame_no / PageTabAnimationDivisor[page]; - spriteIndex += (frame % PageTabAnimationNumFrames[page]); - } + widgets = PageWidgets[WINDOW_RIDE_PAGE_MAIN]; + hold_down_widgets = PageHoldDownWidgets[WINDOW_RIDE_PAGE_MAIN]; - const auto& widget = widgets[widgetIndex]; - GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget.left, widget.top }); - } - } + page = WINDOW_RIDE_PAGE_MAIN; + frame_no = 0; + list_information_type = 0; + picked_peep_frame = 0; + DisableTabs(); + min_width = 316; + min_height = 180; + max_width = 500; + max_height = 450; - void DrawTabMain(DrawPixelInfo& dpi) - { - WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_MAIN); - if (!WidgetIsDisabled(*this, widgetIndex)) - { auto ride = GetRide(rideId); - if (ride != nullptr) + if (ride == nullptr) { - int32_t spriteIndex = 0; - switch (ride->GetClassification()) + Close(); + return; + } + UpdateOverallView(*ride); + + PopulateVehicleTypeDropdown(*ride, true); + } + + virtual void OnClose() override + { + switch (page) + { + case WINDOW_RIDE_PAGE_COLOUR: + ColourClose(); + break; + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsClose(); + break; + } + } + virtual void OnResize() override + { + switch (page) + { + case WINDOW_RIDE_PAGE_MAIN: + MainResize(); + break; + case WINDOW_RIDE_PAGE_VEHICLE: + VehicleResize(); + break; + case WINDOW_RIDE_PAGE_OPERATING: + OperatingResize(); + break; + case WINDOW_RIDE_PAGE_MAINTENANCE: + MaintenanceResize(); + break; + case WINDOW_RIDE_PAGE_COLOUR: + ColourResize(); + break; + case WINDOW_RIDE_PAGE_MUSIC: + MusicResize(); + break; + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsResize(); + break; + case WINDOW_RIDE_PAGE_GRAPHS: + GraphsResize(); + break; + case WINDOW_RIDE_PAGE_INCOME: + IncomeResize(); + break; + case WINDOW_RIDE_PAGE_CUSTOMER: + CustomerResize(); + break; + } + } + virtual void OnUpdate() override + { + switch (page) + { + case WINDOW_RIDE_PAGE_MAIN: + MainUpdate(); + break; + case WINDOW_RIDE_PAGE_VEHICLE: + VehicleUpdate(); + break; + case WINDOW_RIDE_PAGE_OPERATING: + OperatingUpdate(); + break; + case WINDOW_RIDE_PAGE_MAINTENANCE: + MaintenanceUpdate(); + break; + case WINDOW_RIDE_PAGE_COLOUR: + ColourUpdate(); + break; + case WINDOW_RIDE_PAGE_MUSIC: + MusicUpdate(); + break; + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsUpdate(); + break; + case WINDOW_RIDE_PAGE_GRAPHS: + GraphsUpdate(); + break; + case WINDOW_RIDE_PAGE_INCOME: + IncomeUpdate(); + break; + case WINDOW_RIDE_PAGE_CUSTOMER: + CustomerUpdate(); + break; + } + } + + virtual void OnPrepareDraw() override + { + switch (page) + { + case WINDOW_RIDE_PAGE_MAIN: + MainOnPrepareDraw(); + break; + case WINDOW_RIDE_PAGE_VEHICLE: + VehicleOnPrepareDraw(); + break; + case WINDOW_RIDE_PAGE_OPERATING: + OperatingOnPrepareDraw(); + break; + case WINDOW_RIDE_PAGE_MAINTENANCE: + MaintenanceOnPrepareDraw(); + break; + case WINDOW_RIDE_PAGE_COLOUR: + ColourOnPrepareDraw(); + break; + case WINDOW_RIDE_PAGE_MUSIC: + MusicOnPrepareDraw(); + break; + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsOnPrepareDraw(); + break; + case WINDOW_RIDE_PAGE_GRAPHS: + GraphsOnPrepareDraw(); + break; + case WINDOW_RIDE_PAGE_INCOME: + IncomeOnPrepareDraw(); + break; + case WINDOW_RIDE_PAGE_CUSTOMER: + CustomerOnPrepareDraw(); + break; + } + } + virtual void OnDraw(DrawPixelInfo& dpi) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_MAIN: + MainOnDraw(dpi); + break; + case WINDOW_RIDE_PAGE_VEHICLE: + VehicleOnDraw(dpi); + break; + case WINDOW_RIDE_PAGE_OPERATING: + OperatingOnDraw(dpi); + break; + case WINDOW_RIDE_PAGE_MAINTENANCE: + MaintenanceOnDraw(dpi); + break; + case WINDOW_RIDE_PAGE_COLOUR: + ColourOnDraw(dpi); + break; + case WINDOW_RIDE_PAGE_MUSIC: + MusicOnDraw(dpi); + break; + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsOnDraw(dpi); + break; + case WINDOW_RIDE_PAGE_GRAPHS: + GraphsOnDraw(dpi); + break; + case WINDOW_RIDE_PAGE_INCOME: + IncomeOnDraw(dpi); + break; + case WINDOW_RIDE_PAGE_CUSTOMER: + CustomerOnDraw(dpi); + break; + } + } + + virtual OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_VEHICLE: + return VehicleTooltip(widgetIndex, fallback); + case WINDOW_RIDE_PAGE_GRAPHS: + return GraphsTooltip(widgetIndex, fallback); + } + return { fallback, {} }; + } + virtual void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_MAIN: + MainOnMouseDown(widgetIndex); + break; + case WINDOW_RIDE_PAGE_VEHICLE: + VehicleOnMouseDown(widgetIndex); + break; + case WINDOW_RIDE_PAGE_OPERATING: + OperatingOnMouseDown(widgetIndex); + break; + case WINDOW_RIDE_PAGE_MAINTENANCE: + MaintenanceOnMouseDown(widgetIndex); + break; + case WINDOW_RIDE_PAGE_COLOUR: + ColourOnMouseDown(widgetIndex); + break; + case WINDOW_RIDE_PAGE_MUSIC: + MusicOnMouseDown(widgetIndex); + break; + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsOnMouseDown(widgetIndex); + break; + case WINDOW_RIDE_PAGE_GRAPHS: + GraphsOnMouseDown(widgetIndex); + break; + case WINDOW_RIDE_PAGE_INCOME: + IncomeOnMouseDown(widgetIndex); + break; + } + } + virtual void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_MAIN: + MainOnMouseUp(widgetIndex); + break; + case WINDOW_RIDE_PAGE_VEHICLE: + VehicleOnMouseUp(widgetIndex); + break; + case WINDOW_RIDE_PAGE_OPERATING: + OperatingOnMouseUp(widgetIndex); + break; + case WINDOW_RIDE_PAGE_MAINTENANCE: + MaintenanceOnMouseUp(widgetIndex); + break; + case WINDOW_RIDE_PAGE_COLOUR: + ColourOnMouseUp(widgetIndex); + break; + case WINDOW_RIDE_PAGE_MUSIC: + MusicOnMouseUp(widgetIndex); + break; + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsOnMouseUp(widgetIndex); + break; + case WINDOW_RIDE_PAGE_GRAPHS: + GraphsOnMouseUp(widgetIndex); + break; + case WINDOW_RIDE_PAGE_INCOME: + IncomeOnMouseUp(widgetIndex); + break; + case WINDOW_RIDE_PAGE_CUSTOMER: + CustomerOnMouseUp(widgetIndex); + break; + } + } + virtual void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_MAIN: + MainOnDropdown(widgetIndex, selectedIndex); + break; + case WINDOW_RIDE_PAGE_VEHICLE: + VehicleOnDropdown(widgetIndex, selectedIndex); + break; + case WINDOW_RIDE_PAGE_OPERATING: + OperatingOnDropdown(widgetIndex, selectedIndex); + break; + case WINDOW_RIDE_PAGE_MAINTENANCE: + MaintenanceOnDropdown(widgetIndex, selectedIndex); + break; + case WINDOW_RIDE_PAGE_COLOUR: + ColourOnDropdown(widgetIndex, selectedIndex); + break; + case WINDOW_RIDE_PAGE_MUSIC: + MusicOnDropdown(widgetIndex, selectedIndex); + break; + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsOnDropdown(widgetIndex, selectedIndex); + break; + } + } + virtual void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_MAIN: + MainOnTextInput(widgetIndex, text); + break; + case WINDOW_RIDE_PAGE_OPERATING: + OperatingOnTextInput(widgetIndex, text); + break; + case WINDOW_RIDE_PAGE_INCOME: + IncomeOnTextInput(widgetIndex, text); + break; + } + } + virtual ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_GRAPHS: + return GraphsScrollGetSize(scrollIndex); + } + return {}; + } + virtual void OnScrollSelect(int32_t scrollIndex, int32_t scrollAreaType) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_GRAPHS: + GraphsOnScrollSelect(scrollIndex, scrollAreaType); + break; + } + } + virtual void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_VEHICLE: + VehicleOnScrollDraw(dpi, scrollIndex); + break; + case WINDOW_RIDE_PAGE_COLOUR: + ColourOnScrollDraw(dpi, scrollIndex); + break; + case WINDOW_RIDE_PAGE_GRAPHS: + GraphsOnScrollDraw(dpi, scrollIndex); + break; + } + } + virtual void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_COLOUR: + ColourOnToolDown(widgetIndex, screenCoords); + break; + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsOnToolDown(widgetIndex, screenCoords); + break; + } + } + virtual void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_COLOUR: + ColourOnToolDrag(widgetIndex, screenCoords); + break; + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsOnToolDrag(widgetIndex, screenCoords); + break; + } + } + virtual void OnToolAbort(WidgetIndex widgetIndex) override + { + switch (page) + { + case WINDOW_RIDE_PAGE_MEASUREMENTS: + MeasurementsOnToolAbort(widgetIndex); + break; + } + } + virtual void OnViewportRotate() override + { + switch (page) + { + case WINDOW_RIDE_PAGE_MAIN: + MainViewportRotate(); + break; + } + } + + void SetPage(int32_t newPage) + { + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) + if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) + ToolCancel(); + + if (newPage == WINDOW_RIDE_PAGE_VEHICLE) + { + auto constructionWindow = WindowFindByClass(WindowClass::RideConstruction); + if (constructionWindow != nullptr && constructionWindow->number == number) { - case RideClassification::Ride: - spriteIndex = SPR_TAB_RIDE_0; - if (page == WINDOW_RIDE_PAGE_MAIN) - spriteIndex += (frame_no / 4) % 16; - break; - case RideClassification::ShopOrStall: - spriteIndex = SPR_TAB_SHOPS_AND_STALLS_0; - if (page == WINDOW_RIDE_PAGE_MAIN) - spriteIndex += (frame_no / 4) % 16; - break; - case RideClassification::KioskOrFacility: - spriteIndex = SPR_TAB_KIOSKS_AND_FACILITIES_0; - if (page == WINDOW_RIDE_PAGE_MAIN) - spriteIndex += (frame_no / 4) % 8; - break; + WindowCloseByClass(WindowClass::RideConstruction); + // Closing the construction window sets the tab to the first page, which we don't want here, + // as user just clicked the Vehicle page + SetPage(WINDOW_RIDE_PAGE_VEHICLE); + } + } + + // Set listen only to viewport + bool listen = false; + if (newPage == WINDOW_RIDE_PAGE_MAIN && page == WINDOW_RIDE_PAGE_MAIN && viewport != nullptr + && !(viewport->flags & VIEWPORT_FLAG_SOUND_ON)) + listen = true; + + page = newPage; + frame_no = 0; + picked_peep_frame = 0; + + // There doesn't seem to be any need for this call, and it can sometimes modify the reported number of cars per + // train, so I've removed it if (newPage == WINDOW_RIDE_PAGE_VEHICLE) { ride_update_max_vehicles(ride); + //} + + RemoveViewport(); + + hold_down_widgets = PageHoldDownWidgets[page]; + pressed_widgets = 0; + widgets = PageWidgets[page]; + DisableTabs(); + Invalidate(); + + OnResize(); + OnPrepareDraw(); + InitScrollWidgets(); + Invalidate(); + + if (listen && viewport != nullptr) + viewport->flags |= VIEWPORT_FLAG_SOUND_ON; + } + + void SetViewIndex(int16_t newIndex) + { + _viewIndex = newIndex; + OnViewportRotate(); + } + int16_t GetViewIndex() const + { + return _viewIndex; + } + + void ResetVehicleIndex() + { + _vehicleIndex = 0; + } + + private: + void DrawTabImage(DrawPixelInfo& dpi, int32_t tab, int32_t spriteIndex) + { + WidgetIndex widgetIndex = WIDX_TAB_1 + tab; + + if (!WidgetIsDisabled(*this, widgetIndex)) + { + if (page == tab) + { + int32_t frame = frame_no / PageTabAnimationDivisor[page]; + spriteIndex += (frame % PageTabAnimationNumFrames[page]); } const auto& widget = widgets[widgetIndex]; GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget.left, widget.top }); } } - } - void DrawTabVehicle(DrawPixelInfo& dpi) - { - WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_VEHICLE); - const auto& widget = widgets[widgetIndex]; - - if (!WidgetIsDisabled(*this, widgetIndex)) + void DrawTabMain(DrawPixelInfo& dpi) { - auto screenCoords = ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; - int32_t clipWidth = widget.right - screenCoords.x; - int32_t clipHeight = widget.bottom - 3 - screenCoords.y; - if (page == WINDOW_RIDE_PAGE_VEHICLE) - clipHeight += 4; - - screenCoords += windowPos; - - DrawPixelInfo clipDPI; - if (!ClipDrawPixelInfo(clipDPI, dpi, screenCoords, clipWidth, clipHeight)) + WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_MAIN); + if (!WidgetIsDisabled(*this, widgetIndex)) { + auto ride = GetRide(rideId); + if (ride != nullptr) + { + int32_t spriteIndex = 0; + switch (ride->GetClassification()) + { + case RideClassification::Ride: + spriteIndex = SPR_TAB_RIDE_0; + if (page == WINDOW_RIDE_PAGE_MAIN) + spriteIndex += (frame_no / 4) % 16; + break; + case RideClassification::ShopOrStall: + spriteIndex = SPR_TAB_SHOPS_AND_STALLS_0; + if (page == WINDOW_RIDE_PAGE_MAIN) + spriteIndex += (frame_no / 4) % 16; + break; + case RideClassification::KioskOrFacility: + spriteIndex = SPR_TAB_KIOSKS_AND_FACILITIES_0; + if (page == WINDOW_RIDE_PAGE_MAIN) + spriteIndex += (frame_no / 4) % 8; + break; + } + + const auto& widget = widgets[widgetIndex]; + GfxDrawSprite(dpi, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widget.left, widget.top }); + } + } + } + + void DrawTabVehicle(DrawPixelInfo& dpi) + { + WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_VEHICLE); + const auto& widget = widgets[widgetIndex]; + + if (!WidgetIsDisabled(*this, widgetIndex)) + { + auto screenCoords = ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; + int32_t clipWidth = widget.right - screenCoords.x; + int32_t clipHeight = widget.bottom - 3 - screenCoords.y; + if (page == WINDOW_RIDE_PAGE_VEHICLE) + clipHeight += 4; + + screenCoords += windowPos; + + DrawPixelInfo clipDPI; + if (!ClipDrawPixelInfo(clipDPI, dpi, screenCoords, clipWidth, clipHeight)) + { + return; + } + + screenCoords = ScreenCoordsXY{ widget.width() / 2, widget.height() - 12 }; + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr) + return; + + if (rideEntry->flags & RIDE_ENTRY_FLAG_VEHICLE_TAB_SCALE_HALF) + { + clipDPI.zoom_level = ZoomLevel{ 1 }; + clipDPI.width *= 2; + clipDPI.height *= 2; + screenCoords.x *= 2; + screenCoords.y *= 2; + clipDPI.x *= 2; + clipDPI.y *= 2; + } + + // For any suspended rides, move image higher in the vehicle tab on the rides window + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SUSPENDED)) + { + screenCoords.y /= 4; + } + + const auto vehicle = RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, rideEntry->TabCar); + const auto& carEntry = rideEntry->Cars[vehicle]; + + auto vehicleId = ((ride->colour_scheme_type & 3) == VEHICLE_COLOUR_SCHEME_PER_VEHICLE) ? rideEntry->TabCar : 0; + VehicleColour vehicleColour = RideGetVehicleColour(*ride, vehicleId); + + // imageIndex represents a precision of 64 + auto imageIndex = OpenRCT2::Entity::Yaw::YawFrom4(2) * 2; + if (page == WINDOW_RIDE_PAGE_VEHICLE) + imageIndex += frame_no; + imageIndex = carEntry.SpriteByYaw(imageIndex / 2, SpriteGroupType::SlopeFlat); + imageIndex &= carEntry.TabRotationMask; + imageIndex *= carEntry.base_num_frames; + imageIndex += carEntry.base_image_id; + auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Tertiary); + GfxDrawSprite(clipDPI, imageId, screenCoords); + } + } + + void DrawTabCustomer(DrawPixelInfo& dpi) + { + WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_CUSTOMER); + + if (!WidgetIsDisabled(*this, widgetIndex)) + { + const auto& widget = widgets[widgetIndex]; + int32_t spriteIndex = 0; + if (page == WINDOW_RIDE_PAGE_CUSTOMER) + spriteIndex = picked_peep_frame & ~3; + + spriteIndex += GetPeepAnimation(PeepSpriteType::Normal).base_image + 1; + + GfxDrawSprite( + dpi, ImageId(spriteIndex, COLOUR_BRIGHT_RED, COLOUR_TEAL), + windowPos + ScreenCoordsXY{ widget.midX(), widget.bottom - 6 }); + } + } + + void DrawTabImages(DrawPixelInfo& dpi) + { + DrawTabVehicle(dpi); + DrawTabImage(dpi, WINDOW_RIDE_PAGE_OPERATING, SPR_TAB_GEARS_0); + DrawTabImage(dpi, WINDOW_RIDE_PAGE_MAINTENANCE, SPR_TAB_WRENCH_0); + DrawTabImage(dpi, WINDOW_RIDE_PAGE_INCOME, SPR_TAB_ADMISSION_0); + DrawTabMain(dpi); + DrawTabImage(dpi, WINDOW_RIDE_PAGE_MEASUREMENTS, SPR_TAB_TIMER_0); + DrawTabImage(dpi, WINDOW_RIDE_PAGE_COLOUR, SPR_TAB_PAINT_0); + DrawTabImage(dpi, WINDOW_RIDE_PAGE_GRAPHS, SPR_TAB_GRAPH_A_0); + DrawTabCustomer(dpi); + DrawTabImage(dpi, WINDOW_RIDE_PAGE_MUSIC, SPR_TAB_MUSIC_0); + } + + void DisableTabs() + { + uint32_t disabledTabs = 0; + auto ride = GetRide(rideId); + if (ride == nullptr) return; + + const auto& rtd = ride->GetRideTypeDescriptor(); + + if (!rtd.HasFlag(RIDE_TYPE_FLAG_HAS_DATA_LOGGING)) + disabledTabs |= (1uLL << WIDX_TAB_8); // 0x800 + + if (ride->type == RIDE_TYPE_MINI_GOLF) + disabledTabs |= (1uLL << WIDX_TAB_2 | 1uLL << WIDX_TAB_3 | 1uLL << WIDX_TAB_4); // 0xE0 + + if (rtd.HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)) + disabledTabs |= (1uLL << WIDX_TAB_2); // 0x20 + + if (!rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN) && !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL) + && !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS) && !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_VEHICLE_COLOURS) + && !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_ENTRANCE_EXIT)) + { + disabledTabs |= (1uLL << WIDX_TAB_5); // 0x100 } - screenCoords = ScreenCoordsXY{ widget.width() / 2, widget.height() - 12 }; + if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY)) + disabledTabs |= (1uLL << WIDX_TAB_3 | 1uLL << WIDX_TAB_4 | 1uLL << WIDX_TAB_7); // 0x4C0 + + if (!rtd.HasFlag(RIDE_TYPE_FLAG_ALLOW_MUSIC)) + { + disabledTabs |= (1uLL << WIDX_TAB_6); // 0x200 + } + + if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_CASH_MACHINE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_FIRST_AID) + || (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) != 0) + disabledTabs |= (1uLL << WIDX_TAB_9); // 0x1000 + + if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) != 0) + disabledTabs |= (1uLL << WIDX_TAB_4 | 1uLL << WIDX_TAB_6 | 1uLL << WIDX_TAB_9 | 1uLL << WIDX_TAB_10); // 0x3280 + + const auto* rideEntry = GetRideEntryByIndex(ride->subtype); + + if (rideEntry == nullptr) + { + disabledTabs |= 1uLL << WIDX_TAB_2 | 1uLL << WIDX_TAB_3 | 1uLL << WIDX_TAB_4 | 1uLL << WIDX_TAB_5 + | 1uLL << WIDX_TAB_6 | 1uLL << WIDX_TAB_7 | 1uLL << WIDX_TAB_8 | 1uLL << WIDX_TAB_9 | 1uLL << WIDX_TAB_10; + } + else if ((rideEntry->flags & RIDE_ENTRY_FLAG_DISABLE_COLOUR_TAB) != 0) + { + disabledTabs |= (1uLL << WIDX_TAB_5); + } + + disabled_widgets = disabledTabs; + } + + void UpdateOverallView(const Ride& ride) const + { + // Calculate x, y, z bounds of the entire ride using its track elements + TileElementIterator it; + + TileElementIteratorBegin(&it); + + CoordsXYZ min = { std::numeric_limits::max(), std::numeric_limits::max(), + std::numeric_limits::max() }; + CoordsXYZ max = { std::numeric_limits::min(), std::numeric_limits::min(), + std::numeric_limits::min() }; + + while (TileElementIteratorNext(&it)) + { + if (it.element->GetType() != TileElementType::Track) + continue; + + if (it.element->AsTrack()->GetRideIndex() != ride.id) + continue; + + auto location = TileCoordsXY(it.x, it.y).ToCoordsXY(); + int32_t baseZ = it.element->GetBaseZ(); + int32_t clearZ = it.element->GetClearanceZ(); + + min.x = std::min(min.x, location.x); + min.y = std::min(min.y, location.y); + min.z = std::min(min.z, baseZ); + + max.x = std::max(max.x, location.x); + max.y = std::max(max.y, location.y); + max.z = std::max(max.z, clearZ); + } + + const auto rideIndex = ride.id.ToUnderlying(); + if (rideIndex >= _rideOverallViewsCache.size()) + { + _rideOverallViewsCache.resize(rideIndex + 1); + } + + auto& view = _rideOverallViewsCache[rideIndex]; + view.loc = CoordsXYZ{ (min.x + max.x) / 2, (min.y + max.y) / 2, (min.z + max.z) / 2 } + CoordsXYZ{ 16, 16, -8 }; + + // Calculate size to determine from how far away to view the ride + const auto diff = max - min; + + const int32_t size = static_cast(std::sqrt(diff.x * diff.x + diff.y * diff.y + diff.z * diff.z)); + + if (size >= 80) + { + // Each farther zoom level shows twice as many tiles (log) + // Appropriate zoom is lowered by one to fill the entire view with the ride + const auto zoomValue = static_cast(std::ceil(std::log(size / 80)) - 1); + view.zoom = std::clamp(ZoomLevel{ zoomValue }, ZoomLevel{ 0 }, ZoomLevel::max()); + } + else + { + // Small rides or stalls are zoomed in all the way. + view.zoom = ZoomLevel{ 0 }; + } + } + + void SetPressedTab() + { + int32_t i; + for (i = 0; i < WINDOW_RIDE_PAGE_COUNT; i++) + pressed_widgets &= ~(1 << (WIDX_TAB_1 + i)); + pressed_widgets |= 1LL << (WIDX_TAB_1 + page); + } + + void AnchorBorderWidgets() + { + ResizeFrameWithPage(); + } + +#pragma region Main + + std::optional GetStationIndexFromViewSelection() const + { + const auto* ride = GetRide(RideId::FromUnderlying(number)); + if (ride == nullptr) + return std::nullopt; + + int32_t viewSelectionIndex = _viewIndex - 1 - ride->NumTrains; + if (viewSelectionIndex < 0) + { + return std::nullopt; + } + + for (const auto& station : ride->GetStations()) + { + if (!station.Start.IsNull() && viewSelectionIndex-- == 0) + { + const auto stationIndex = ride->GetStationIndex(&station); + return std::make_optional(stationIndex); + } + } + return std::nullopt; + } + + void InitViewport() + { + if (page != WINDOW_RIDE_PAGE_MAIN) + return; + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + int32_t viewSelectionIndex = _viewIndex - 1; + + std::optional newFocus; + + if (viewSelectionIndex >= 0 && viewSelectionIndex < ride->NumTrains + && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK) + { + auto vehId = ride->vehicles[viewSelectionIndex]; + const auto* rideEntry = ride->GetRideEntry(); + if (rideEntry != nullptr && rideEntry->TabCar != 0) + { + Vehicle* vehicle = GetEntity(vehId); + if (vehicle == nullptr) + { + vehId = EntityId::GetNull(); + } + else if (!vehicle->next_vehicle_on_train.IsNull()) + { + vehId = vehicle->next_vehicle_on_train; + } + } + if (!vehId.IsNull()) + { + newFocus = Focus(vehId); + } + } + else if (viewSelectionIndex >= ride->NumTrains && viewSelectionIndex < (ride->NumTrains + ride->num_stations)) + { + auto stationIndex = GetStationIndexFromViewSelection(); + if (stationIndex) + { + const auto location = ride->GetStation(*stationIndex).GetStart(); + newFocus = Focus(location); + } + } + else + { + if (viewSelectionIndex > 0) + { + _viewIndex = 0; + } + if (number < _rideOverallViewsCache.size()) + { + const auto& view = _rideOverallViewsCache[number]; + newFocus = Focus(view.loc, view.zoom); + } + } + + uint16_t newViewportFlags = 0; + if (viewport != nullptr) + { + if (focus == newFocus) + { + return; + } + newViewportFlags = viewport->flags; + RemoveViewport(); + } + else if (gConfigGeneral.AlwaysShowGridlines) + { + newViewportFlags |= VIEWPORT_FLAG_GRIDLINES; + } + + OnPrepareDraw(); + + focus = newFocus; + + // rct2: 0x006aec9c only used here so brought it into the function + if (viewport == nullptr && !ride->overall_view.IsNull() && focus.has_value()) + { + const auto& viewWidget = widgets[WIDX_VIEWPORT]; + + auto screenPos = windowPos + ScreenCoordsXY{ viewWidget.left + 1, viewWidget.top + 1 }; + int32_t viewWidth = viewWidget.width() - 1; + int32_t viewHeight = viewWidget.height() - 1; + + ViewportCreate(this, screenPos, viewWidth, viewHeight, focus.value()); + + flags |= WF_NO_SCROLLING; + Invalidate(); + } + if (viewport != nullptr) + { + viewport->flags = newViewportFlags; + Invalidate(); + } + } + + void Rename() + { + auto ride = GetRide(rideId); + if (ride != nullptr) + { + auto rideName = ride->GetName(); + WindowTextInputRawOpen( + this, WIDX_RENAME, STR_RIDE_ATTRACTION_NAME, STR_ENTER_NEW_NAME_FOR_THIS_RIDE_ATTRACTION, {}, + rideName.c_str(), 32); + } + } + + void MainOnMouseUp(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + case WIDX_TAB_8: + case WIDX_TAB_9: + case WIDX_TAB_10: + SetPage(widgetIndex - WIDX_TAB_1); + break; + case WIDX_CONSTRUCTION: + { + auto ride = GetRide(rideId); + if (ride != nullptr) + { + RideConstructionStart(*ride); + if (WindowFindByNumber(WindowClass::RideConstruction, ride->id.ToUnderlying()) != nullptr) + { + Close(); + return; + } + } + break; + } + case WIDX_RENAME: + Rename(); + break; + case WIDX_DEMOLISH: + ContextOpenDetailWindow(WD_DEMOLISH_RIDE, number); + break; + case WIDX_CLOSE_LIGHT: + case WIDX_SIMULATE_LIGHT: + case WIDX_TEST_LIGHT: + case WIDX_OPEN_LIGHT: + { + auto ride = GetRide(rideId); + if (ride != nullptr) + { + RideStatus status; + switch (widgetIndex) + { + default: + case WIDX_CLOSE_LIGHT: + status = RideStatus::Closed; + break; + case WIDX_SIMULATE_LIGHT: + status = RideStatus::Simulating; + break; + case WIDX_TEST_LIGHT: + status = RideStatus::Testing; + break; + case WIDX_OPEN_LIGHT: + status = RideStatus::Open; + break; + } + auto gameAction = RideSetStatusAction(ride->id, status); + GameActions::Execute(&gameAction); + } + break; + } + } + } + + void MainResize() + { + int32_t minHeight = 180; + if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE) + { + minHeight += 20 + RCT1_LIGHT_OFFSET; + + auto ride = GetRide(rideId); + if (ride != nullptr) + { +#ifdef __SIMULATE_IN_RIDE_WINDOW__ + if (ride->SupportsStatus(RideStatus::Simulating)) + { + minHeight += 14; + } +#endif + if (ride->SupportsStatus(RideStatus::Testing)) + { + minHeight += 14; + } + } + } + if (GetGameState().Cheats.AllowArbitraryRideTypeChanges) + { + minHeight += 15; + } + + flags |= WF_RESIZABLE; + WindowSetResize(*this, 316, minHeight, 500, 450); + // Unlike with other windows, the focus needs to be recentred so it’s best to just reset it. + focus = std::nullopt; + InitViewport(); + } + + size_t GetNumPeepsInTrain(const Ride& ride, int32_t trainIndex) const + { + auto numPeepsInTrain = 0; + const auto* vehicle = TryGetVehicle(ride.vehicles[trainIndex]); + while (vehicle != nullptr) + { + numPeepsInTrain += vehicle->num_peeps; + vehicle = TryGetVehicle(vehicle->next_vehicle_on_train); + } + return numPeepsInTrain; + } + + bool TrainMustBeHidden(const Ride& ride, int32_t trainIndex) const + { + if (!(ride.lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) + return true; + + const auto* rideEntry = ride.GetRideEntry(); + if (rideEntry == nullptr) + return false; + + if (!(rideEntry->flags & RIDE_ENTRY_FLAG_HIDE_EMPTY_TRAINS)) + return false; + + return GetNumPeepsInTrain(ride, trainIndex) == 0; + } + + void ShowViewDropdown(Widget* widget) + { + Widget* dropdownWidget = widget - 1; + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + const auto& rtd = ride->GetRideTypeDescriptor(); + + int32_t numItems = 1; + if (!rtd.HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)) + { + numItems += ride->num_stations; + numItems += ride->NumTrains; + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, 0, numItems, widget->right - dropdownWidget->left); + + // First item + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_OVERALL_VIEW; + int32_t currentItem = 1; + + // Vehicles + int32_t name = GetRideComponentName(rtd.NameConvention.vehicle).number; + for (int32_t i = 0; i < ride->NumTrains; i++) + { + gDropdownItems[currentItem].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[currentItem].Args = name | (currentItem << 16); + if (TrainMustBeHidden(*ride, i)) + { + Dropdown::SetDisabled(currentItem, true); + } + currentItem++; + } + + // Stations + name = GetRideComponentName(rtd.NameConvention.station).number; + for (int32_t i = 1; i <= ride->num_stations; i++) + { + gDropdownItems[currentItem].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[currentItem].Args = name | (i << 16); + currentItem++; + } + + // Set checked item + Dropdown::SetChecked(_viewIndex, true); + } + + RideStatus GetNextDefaultStatus(const Ride& ride) const + { + switch (ride.status) + { + default: + case RideStatus::Closed: + if ((ride.lifecycle_flags & RIDE_LIFECYCLE_CRASHED) + || (ride.lifecycle_flags & RIDE_LIFECYCLE_HAS_STALLED_VEHICLE)) + { + return RideStatus::Closed; + } + if (ride.SupportsStatus(RideStatus::Testing) && !(ride.lifecycle_flags & RIDE_LIFECYCLE_TESTED)) + { + return RideStatus::Testing; + } + return RideStatus::Open; + case RideStatus::Simulating: + return RideStatus::Testing; + case RideStatus::Testing: + return (ride.lifecycle_flags & RIDE_LIFECYCLE_TESTED) ? RideStatus::Open : RideStatus::Closed; + case RideStatus::Open: + return RideStatus::Closed; + } + } + + struct RideStatusDropdownInfo + { + struct Ride* Ride{}; + RideStatus CurrentStatus{}; + RideStatus DefaultStatus{}; + + int32_t NumItems{}; + int32_t CheckedIndex = -1; + int32_t DefaultIndex = -1; + }; + + void SetDropdown(RideStatusDropdownInfo& info, RideStatus status, StringId text) const + { + if (info.Ride->SupportsStatus(status)) + { + auto index = info.NumItems; + gDropdownItems[index].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[index].Args = text; + if (info.CurrentStatus == status) + { + info.CheckedIndex = index; + } + if (info.DefaultStatus == status) + { + info.DefaultIndex = index; + } + info.NumItems++; + } + } + + void ShowOpenDropdown(Widget* widget) + { + RideStatusDropdownInfo info; + info.Ride = GetRide(rideId); + if (info.Ride == nullptr) + return; + + info.CurrentStatus = info.Ride->status; + info.DefaultStatus = GetNextDefaultStatus(*info.Ride); + SetDropdown(info, RideStatus::Closed, STR_CLOSE_RIDE); +#ifdef __SIMULATE_IN_RIDE_WINDOW__ + SetDropdown(info, RideStatus::Simulating, STR_SIMULATE_RIDE); +#endif + 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); + Dropdown::SetChecked(info.CheckedIndex, true); + gDropdownDefaultIndex = info.DefaultIndex; + } + + static constexpr StringId GetRideTypeNameForDropdown(ride_type_t rideType) + { + switch (rideType) + { + case RIDE_TYPE_1D: + return STR_RIDE_NAME_1D; + case RIDE_TYPE_1F: + return STR_RIDE_NAME_1F; + case RIDE_TYPE_22: + return STR_RIDE_NAME_22; + case RIDE_TYPE_50: + return STR_RIDE_NAME_50; + case RIDE_TYPE_52: + return STR_RIDE_NAME_52; + case RIDE_TYPE_53: + return STR_RIDE_NAME_53; + case RIDE_TYPE_54: + return STR_RIDE_NAME_54; + case RIDE_TYPE_55: + return STR_RIDE_NAME_55; + case RIDE_TYPE_59: + return STR_RIDE_NAME_59; + default: + return GetRideTypeDescriptor(rideType).Naming.Name; + } + } + + void PopulateRideTypeDropdown() + { + auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); + if (_rideDropdownDataLanguage == ls.GetCurrentLanguage()) + return; + + _rideDropdownData.clear(); + + for (uint8_t i = 0; i < RIDE_TYPE_COUNT; i++) + { + auto name = GetRideTypeNameForDropdown(i); + _rideDropdownData.push_back({ i, name, u8string_view{ ls.GetString(name) } }); + } + + std::sort(_rideDropdownData.begin(), _rideDropdownData.end(), [](auto& a, auto& b) { + return a.LabelString.compare(b.LabelString) < 0; + }); + + _rideDropdownDataLanguage = ls.GetCurrentLanguage(); + } + + void ShowRideTypeDropdown(Widget* widget) + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + PopulateRideTypeDropdown(); + + for (size_t i = 0; i < _rideDropdownData.size(); i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = _rideDropdownData[i].LabelId; + } + + Widget* dropdownWidget = widget - 1; + WindowDropdownShowText( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], Dropdown::Flag::StayOpen, RIDE_TYPE_COUNT); + + // Find the current ride type in the ordered list. + int32_t pos = 0; + for (int32_t i = 0; i < RIDE_TYPE_COUNT; i++) + { + if (_rideDropdownData[i].RideTypeId == ride->type) + { + pos = i; + break; + } + } + + gDropdownHighlightedIndex = pos; + gDropdownDefaultIndex = pos; + Dropdown::SetChecked(pos, true); + } + + void ShowLocateDropdown(Widget* widget) + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + gDropdownItems[0].Format = STR_LOCATE_SUBJECT_TIP; + gDropdownItems[1].Format = STR_FOLLOW_SUBJECT_TIP; + + WindowDropdownShowText( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 2); + gDropdownDefaultIndex = 0; + if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK) || _viewIndex == 0 + || _viewIndex > ride->NumTrains) + { + // Disable if we're a flat ride, 'overall view' is selected or a station is selected + Dropdown::SetDisabled(1, true); + } + } + + void MainFollowRide() + { + auto* ride = GetRide(rideId); + if (ride != nullptr) + { + if (!(ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_MAIN)) + { + if (_viewIndex > 0) + { + if (_viewIndex <= ride->NumTrains) + { + Vehicle* vehicle = GetEntity(ride->vehicles[_viewIndex - 1]); + if (vehicle != nullptr) + { + auto headVehicleSpriteIndex = vehicle->Id; + WindowBase* w_main = WindowGetMain(); + WindowFollowSprite(*w_main, headVehicleSpriteIndex); + } + } + } + } + } + } + + void PopulateVehicleTypeDropdown(const Ride& ride, bool forceRefresh = false) + { + auto& objManager = GetContext()->GetObjectManager(); + const auto* rideEntry = ride.GetRideEntry(); + + bool selectionShouldBeExpanded; + int32_t rideTypeIterator, rideTypeIteratorMax; + + const auto& rtd = ride.GetRideTypeDescriptor(); + if (GetGameState().Cheats.ShowVehiclesFromOtherTrackTypes + && !( + rtd.HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE) + || ride.type == RIDE_TYPE_MINI_GOLF)) + { + selectionShouldBeExpanded = true; + rideTypeIterator = 0; + rideTypeIteratorMax = RIDE_TYPE_COUNT - 1; + } + else + { + selectionShouldBeExpanded = false; + rideTypeIterator = ride.type; + rideTypeIteratorMax = ride.type; + } + + // Don't repopulate the list if we just did. + auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); + if (!forceRefresh && _vehicleDropdownExpanded == selectionShouldBeExpanded && _vehicleDropdownRideType == rideEntry + && _vehicleDropdownDataLanguage == ls.GetCurrentLanguage()) + return; + + _vehicleDropdownData.clear(); + + for (; rideTypeIterator <= rideTypeIteratorMax; rideTypeIterator++) + { + const auto& rtdIterator = GetRideTypeDescriptor(rideTypeIterator); + if (selectionShouldBeExpanded && rtdIterator.HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE)) + continue; + if (selectionShouldBeExpanded + && (rtdIterator.HasFlag(RIDE_TYPE_FLAG_IS_MAZE) || rideTypeIterator == RIDE_TYPE_MINI_GOLF)) + continue; + + auto& rideEntries = objManager.GetAllRideEntries(rideTypeIterator); + for (auto rideEntryIndex : rideEntries) + { + const auto* currentRideEntry = GetRideEntryByIndex(rideEntryIndex); + if (currentRideEntry == nullptr) + continue; + + // Skip if vehicle type has not been invented yet + if (!RideEntryIsInvented(rideEntryIndex) && !GetGameState().Cheats.IgnoreResearchStatus) + continue; + + auto name = currentRideEntry->naming.Name; + _vehicleDropdownData.push_back({ rideEntryIndex, name, u8string_view{ ls.GetString(name) } }); + } + } + + std::sort(_vehicleDropdownData.begin(), _vehicleDropdownData.end(), [](auto& a, auto& b) { + return a.LabelString.compare(b.LabelString) < 0; + }); + + _vehicleDropdownExpanded = selectionShouldBeExpanded; + _vehicleDropdownRideType = rideEntry; + _vehicleDropdownDataLanguage = ls.GetCurrentLanguage(); + } + + void ShowVehicleTypeDropdown(Widget* widget) + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + PopulateVehicleTypeDropdown(*ride); + + size_t numItems = std::min(_vehicleDropdownData.size(), Dropdown::ItemsMaxSize); + + for (size_t i = 0; i < numItems; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = _vehicleDropdownData[i].LabelId; + } + + Widget* dropdownWidget = widget - 1; + auto ddWidth = WindowDropDownHasMultipleColumns(numItems) ? dropdownWidget->width() - 24 : dropdownWidget->width(); + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, numItems, ddWidth); + + // Find the current vehicle type in the ordered list. + int32_t pos = 0; + for (int32_t i = 0; i < static_cast(_vehicleDropdownData.size()); i++) + { + if (_vehicleDropdownData[i].SubTypeId == ride->subtype) + { + pos = i; + break; + } + } + + gDropdownHighlightedIndex = pos; + gDropdownDefaultIndex = pos; + Dropdown::SetChecked(pos, true); + } + + void PopulateEntranceStyleDropdown() + { + auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); + if (_entranceDropdownDataLanguage == ls.GetCurrentLanguage()) + return; + + _entranceDropdownData.clear(); + + auto& objManager = GetContext()->GetObjectManager(); + + for (ObjectEntryIndex i = 0; i < MAX_STATION_OBJECTS; i++) + { + auto stationObj = static_cast(objManager.GetLoadedObject(ObjectType::Station, i)); + if (stationObj != nullptr) + { + auto name = stationObj->NameStringId; + _entranceDropdownData.push_back({ i, name, u8string_view{ ls.GetString(name) } }); + } + } + + std::sort(_entranceDropdownData.begin(), _entranceDropdownData.end(), [](auto& a, auto& b) { + return a.LabelString.compare(b.LabelString) < 0; + }); + + _entranceDropdownDataLanguage = ls.GetCurrentLanguage(); + } + + void ShowEntranceStyleDropdown() + { + auto dropdownWidget = &widgets[WIDX_ENTRANCE_STYLE_DROPDOWN] - 1; + auto ride = GetRide(rideId); + + PopulateEntranceStyleDropdown(); + + for (size_t i = 0; i < _entranceDropdownData.size(); i++) + { + gDropdownItems[i].Args = _entranceDropdownData[i].LabelId; + gDropdownItems[i].Format = _entranceDropdownData[i].EntranceTypeId == ride->entrance_style + ? STR_DROPDOWN_MENU_LABEL_SELECTED + : STR_DROPDOWN_MENU_LABEL; + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, _entranceDropdownData.size(), + widgets[WIDX_ENTRANCE_STYLE_DROPDOWN].right - dropdownWidget->left); + } + + void MainOnMouseDown(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_VIEW_DROPDOWN: + ShowViewDropdown(&widgets[widgetIndex]); + break; + case WIDX_OPEN: + ShowOpenDropdown(&widgets[widgetIndex]); + break; + case WIDX_RIDE_TYPE_DROPDOWN: + ShowRideTypeDropdown(&widgets[widgetIndex]); + break; + case WIDX_LOCATE: + ShowLocateDropdown(&widgets[widgetIndex]); + break; + } + } + + void MainOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + switch (widgetIndex) + { + case WIDX_VIEW_DROPDOWN: + if (dropdownIndex == -1) + { + dropdownIndex = _viewIndex + 1; + auto ride = GetRide(rideId); + if (ride != nullptr) + { + if (dropdownIndex != 0 && dropdownIndex <= ride->NumTrains + && !(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) + { + dropdownIndex = ride->NumTrains + 1; + } + if (dropdownIndex >= gDropdownNumItems) + { + dropdownIndex = 0; + } + } + } + + _viewIndex = dropdownIndex; + InitViewport(); + Invalidate(); + break; + case WIDX_OPEN: + { + auto ride = GetRide(rideId); + if (ride != nullptr) + { + auto status = RideStatus::Closed; + if (dropdownIndex < 0) + { + dropdownIndex = gDropdownHighlightedIndex; + } + if (dropdownIndex < static_cast(std::size(gDropdownItems))) + { + switch (gDropdownItems[dropdownIndex].Args) + { + case STR_CLOSE_RIDE: + status = RideStatus::Closed; + break; + case STR_SIMULATE_RIDE: + status = RideStatus::Simulating; + break; + case STR_TEST_RIDE: + status = RideStatus::Testing; + break; + case STR_OPEN_RIDE: + status = RideStatus::Open; + break; + } + } + auto gameAction = RideSetStatusAction(ride->id, status); + GameActions::Execute(&gameAction); + } + break; + } + case WIDX_RIDE_TYPE_DROPDOWN: + if (dropdownIndex != -1 && dropdownIndex < RIDE_TYPE_COUNT) + { + auto rideLabelId = std::clamp(dropdownIndex, 0, RIDE_TYPE_COUNT - 1); + auto rideType = _rideDropdownData[rideLabelId].RideTypeId; + if (rideType < RIDE_TYPE_COUNT) + { + auto rideSetSetting = RideSetSettingAction(rideId, RideSetSetting::RideType, rideType); + rideSetSetting.SetCallback([](const GameAction* ga, const GameActions::Result* result) { + // Reset ghost track if ride construction window is open, prevents a crash + // Will get set to the correct Alternative variable during set_default_next_piece. + // TODO: Rework construction window to prevent the need for this. + _currentTrackAlternative = RIDE_TYPE_NO_ALTERNATIVES; + RideConstructionSetDefaultNextPiece(); + }); + GameActions::Execute(&rideSetSetting); + } + } + break; + case WIDX_LOCATE: + { + if (dropdownIndex == 0) + { + ScrollToViewport(); + } + else if (dropdownIndex == 1) + { + MainFollowRide(); + } + break; + } + } + } + + void MainUpdate() + { + // Update tab animation + frame_no++; + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_1); + + // Update status + auto ride = GetRide(rideId); + if (ride != nullptr) + { + if (!(ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_MAIN)) + { + if (_viewIndex == 0) + return; + + if (_viewIndex <= ride->NumTrains) + { + Vehicle* vehicle = GetEntity(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)) + { + return; + } + } + } + ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_MAIN; + } + WidgetInvalidate(*this, WIDX_STATUS); + } + + void MainOnTextInput(WidgetIndex widgetIndex, std::string_view text) + { + if (widgetIndex != WIDX_RENAME || text.empty()) + return; + + auto ride = GetRide(rideId); + if (ride != nullptr) + { + auto strText = std::string(text); + auto gameAction = RideSetNameAction(ride->id, strText); + GameActions::Execute(&gameAction); + } + } + + void MainViewportRotate() + { + InitViewport(); + } + + void MainOnPrepareDraw() + { + int32_t i, widgetHeight; + + auto* newWidgets = PageWidgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + disabled_widgets &= ~((1uLL << WIDX_DEMOLISH) | (1uLL << WIDX_CONSTRUCTION)); + if (ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) + && !GetGameState().Cheats.MakeAllDestructible) + disabled_widgets |= (1uLL << WIDX_DEMOLISH); + + auto ft = Formatter::Common(); + ride->FormatNameTo(ft); + + uint32_t spriteIds[] = { + SPR_CLOSED, + SPR_OPEN, + SPR_TESTING, + SPR_G2_SIMULATE, + }; + widgets[WIDX_OPEN].image = ImageId(spriteIds[EnumValue(ride->status)]); + +#ifdef __SIMULATE_IN_RIDE_WINDOW__ + widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + (ride->status == RideStatus::Closed) * 2 + + WidgetIsPressed(*this, WIDX_CLOSE_LIGHT); + widgets[WIDX_SIMULATE_LIGHT].image = SPR_G2_RCT1_SIMULATE_BUTTON_0 + (ride->status == RideStatus::Simulating) * 2 + + WidgetIsPressed(*w, WIDX_SIMULATE_LIGHT); + widgets[WIDX_TEST_LIGHT].image = SPR_G2_RCT1_TEST_BUTTON_0 + (ride->status == RideStatus::Testing) * 2 + + WidgetIsPressed(*this, WIDX_TEST_LIGHT); +#else + const auto closeLightImage = SPR_G2_RCT1_CLOSE_BUTTON_0 + (ride->status == RideStatus::Closed) * 2 + + WidgetIsPressed(*this, WIDX_CLOSE_LIGHT); + widgets[WIDX_CLOSE_LIGHT].image = ImageId(closeLightImage); + + auto baseSprite = ride->status == RideStatus::Simulating ? SPR_G2_RCT1_SIMULATE_BUTTON_0 + : SPR_G2_RCT1_TEST_BUTTON_0; + const auto testLightImage = baseSprite + + (ride->status == RideStatus::Testing || ride->status == RideStatus::Simulating) * 2 + + WidgetIsPressed(*this, WIDX_TEST_LIGHT); + widgets[WIDX_TEST_LIGHT].image = ImageId(testLightImage); +#endif + const auto openLightImage = SPR_G2_RCT1_OPEN_BUTTON_0 + (ride->status == RideStatus::Open) * 2 + + WidgetIsPressed(*this, WIDX_OPEN_LIGHT); + widgets[WIDX_OPEN_LIGHT].image = ImageId(openLightImage); + + AnchorBorderWidgets(); + + const int32_t offset = GetGameState().Cheats.AllowArbitraryRideTypeChanges ? 15 : 0; + // Anchor main page specific widgets + widgets[WIDX_VIEWPORT].right = width - 26; + widgets[WIDX_VIEWPORT].bottom = height - (14 + offset); + widgets[WIDX_STATUS].right = width - 26; + widgets[WIDX_STATUS].top = height - (13 + offset); + widgets[WIDX_STATUS].bottom = height - (3 + offset); + widgets[WIDX_VIEW].right = width - 60; + widgets[WIDX_VIEW_DROPDOWN].right = width - 61; + widgets[WIDX_VIEW_DROPDOWN].left = width - 71; + widgets[WIDX_RIDE_TYPE].right = width - 26; + widgets[WIDX_RIDE_TYPE].top = height - 17; + widgets[WIDX_RIDE_TYPE].bottom = height - 4; + widgets[WIDX_RIDE_TYPE_DROPDOWN].left = width - 37; + widgets[WIDX_RIDE_TYPE_DROPDOWN].right = width - 27; + widgets[WIDX_RIDE_TYPE_DROPDOWN].top = height - 16; + widgets[WIDX_RIDE_TYPE_DROPDOWN].bottom = height - 5; + + if (!GetGameState().Cheats.AllowArbitraryRideTypeChanges) + { + widgets[WIDX_RIDE_TYPE].type = WindowWidgetType::Empty; + widgets[WIDX_RIDE_TYPE_DROPDOWN].type = WindowWidgetType::Empty; + } + else + { + widgets[WIDX_RIDE_TYPE].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_RIDE_TYPE].text = ride->GetRideTypeDescriptor().Naming.Name; + widgets[WIDX_RIDE_TYPE_DROPDOWN].type = WindowWidgetType::Button; + } + + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); + + if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE) + { + widgets[WIDX_OPEN].type = WindowWidgetType::Empty; + widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::ImgBtn; + widgets[WIDX_SIMULATE_LIGHT].type = WindowWidgetType::Empty; +#ifdef __SIMULATE_IN_RIDE_WINDOW__ + if (ride->SupportsStatus(RideStatus::Simulating)) + widgets[WIDX_SIMULATE_LIGHT].type = WindowWidgetType::ImgBtn; +#endif + widgets[WIDX_TEST_LIGHT].type = ride->SupportsStatus(RideStatus::Testing) ? WindowWidgetType::ImgBtn + : WindowWidgetType::Empty; + widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::ImgBtn; + + widgetHeight = 62; + if (widgets[WIDX_SIMULATE_LIGHT].type != WindowWidgetType::Empty) + { + widgets[WIDX_SIMULATE_LIGHT].top = widgetHeight; + widgets[WIDX_SIMULATE_LIGHT].bottom = widgetHeight + 13; + widgetHeight += 14; + } + if (widgets[WIDX_TEST_LIGHT].type != WindowWidgetType::Empty) + { + widgets[WIDX_TEST_LIGHT].top = widgetHeight; + widgets[WIDX_TEST_LIGHT].bottom = widgetHeight + 13; + widgetHeight += 14; + } + widgets[WIDX_OPEN_LIGHT].top = widgetHeight; + widgets[WIDX_OPEN_LIGHT].bottom = widgetHeight + 13; + widgetHeight += 14 - 24 + RCT1_LIGHT_OFFSET; + } + else + { + widgets[WIDX_OPEN].type = WindowWidgetType::FlatBtn; + widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::Empty; + widgets[WIDX_SIMULATE_LIGHT].type = WindowWidgetType::Empty; + widgets[WIDX_TEST_LIGHT].type = WindowWidgetType::Empty; + widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::Empty; + widgetHeight = 46; + } + for (i = WIDX_CLOSE_LIGHT; i <= WIDX_OPEN_LIGHT; i++) + { + widgets[i].left = width - 20; + widgets[i].right = width - 7; + } + for (i = WIDX_OPEN; i <= WIDX_DEMOLISH; i++, widgetHeight += 24) + { + widgets[i].left = width - 25; + widgets[i].right = width - 2; + widgets[i].top = widgetHeight; + widgets[i].bottom = widgetHeight + 23; + } + } + + StringId GetStatusOverallView(Formatter& ft) const + { + auto stringId = STR_NONE; + auto ride = GetRide(rideId); + if (ride != nullptr) + { + ride->FormatStatusTo(ft); + stringId = STR_BLACK_STRING; + if ((ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)) + { + stringId = STR_RED_OUTLINED_STRING; + } + } + return stringId; + } + + StringId GetStatusVehicle(Formatter& ft) const + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return STR_EMPTY; + + auto vehicle = GetEntity(ride->vehicles[_viewIndex - 1]); + if (vehicle == nullptr) + return STR_EMPTY; + + 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 (ride->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_BLOCK_BRAKES) && vehicle->velocity == 0) + { + ft.Add(STR_STOPPED_BY_BLOCK_BRAKES); + return STR_BLACK_STRING; + } + } + } + + if (ride->type == RIDE_TYPE_MINI_GOLF) + return STR_EMPTY; + + auto stringId = VehicleStatusNames[EnumValue(vehicle->status)]; + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_SINGLE_SESSION) + && vehicle->status <= Vehicle::Status::UnloadingPassengers) + { + stringId = SingleSessionVehicleStatusNames[EnumValue(vehicle->status)]; + } + + ft.Add(stringId); + uint16_t speedInMph = (abs(vehicle->velocity) * 9) >> 18; + ft.Add(speedInMph); + const RideComponentName stationName = GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.station); + ft.Add(ride->num_stations > 1 ? stationName.number : stationName.singular); + ft.Add(vehicle->current_station.ToUnderlying() + 1); + return stringId != STR_CRASHING && stringId != STR_CRASHED_0 ? STR_BLACK_STRING : STR_RED_OUTLINED_STRING; + } + + StringId GetStatusStation(Formatter& ft) const + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return STR_NONE; + + const auto stationIndex = GetStationIndexFromViewSelection(); + if (!stationIndex) + { + return STR_NONE; + } + + const auto& station = ride->GetStation(*stationIndex); + StringId stringId = STR_EMPTY; + // Entrance / exit + if (ride->status == RideStatus::Closed) + { + if (station.Entrance.IsNull()) + stringId = STR_NO_ENTRANCE; + else if (station.Exit.IsNull()) + stringId = STR_NO_EXIT; + } + else + { + if (station.Entrance.IsNull()) + stringId = STR_EXIT_ONLY; + } + // Queue length + if (stringId == STR_EMPTY) + { + stringId = STR_QUEUE_EMPTY; + uint16_t queueLength = ride->GetStation(*stationIndex).QueueLength; + if (queueLength == 1) + stringId = STR_QUEUE_ONE_PERSON; + else if (queueLength > 1) + stringId = STR_QUEUE_PEOPLE; + + ft.Add(stringId); + ft.Add(queueLength); + } + else + { + ft.Add(stringId); + } + + return STR_BLACK_STRING; + } + + StringId GetStatus(Formatter& ft) const + { + auto ride = GetRide(rideId); + if (_viewIndex == 0) + return GetStatusOverallView(ft); + if (ride != nullptr && _viewIndex <= ride->NumTrains) + return GetStatusVehicle(ft); + if (ride != nullptr && ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) + return GetStatusOverallView(ft); + return GetStatusStation(ft); + } + + void MainOnDraw(DrawPixelInfo& dpi) + { + WindowDrawWidgets(*this, dpi); + DrawTabImages(dpi); + + // Viewport and ear icon + if (viewport != nullptr) + { + WindowDrawViewport(dpi, *this); + if (viewport->flags & VIEWPORT_FLAG_SOUND_ON) + GfxDrawSprite(dpi, ImageId(SPR_HEARING_VIEWPORT), WindowGetViewportSoundIconPos(*this)); + } + + // View dropdown + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto ft = Formatter(); + if (_viewIndex != 0) + { + if (_viewIndex > ride->NumTrains) + { + ft.Add(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.station).number); + ft.Add(_viewIndex - ride->NumTrains); + } + else + { + ft.Add(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).number); + ft.Add(_viewIndex); + } + } + else + { + ft.Add(STR_OVERALL_VIEW); + } + + auto* widget = &widgets[WIDX_VIEW]; + DrawTextBasic( + dpi, { windowPos.x + (widget->left + widget->right - 11) / 2, windowPos.y + widget->top }, + STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); + + // Status + ft = Formatter(); + widget = &widgets[WIDX_STATUS]; + StringId rideStatus = GetStatus(ft); + DrawTextEllipsised( + dpi, windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top }, widget->width(), rideStatus, + ft, { TextAlignment::CENTRE }); + } + +#pragma endregion + +#pragma region Vehicle + + void VehicleOnMouseUp(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + case WIDX_TAB_8: + case WIDX_TAB_9: + case WIDX_TAB_10: + SetPage(widgetIndex - WIDX_TAB_1); + break; + } + } + + void VehicleResize() + { + WindowSetResize(*this, 316, 221, 316, 221); + } + + void VehicleOnMouseDown(WidgetIndex widgetIndex) + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + switch (widgetIndex) + { + case WIDX_VEHICLE_TYPE_DROPDOWN: + ShowVehicleTypeDropdown(&widgets[widgetIndex]); + break; + case WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX: + ride->SetReversedTrains(!ride->HasLifecycleFlag(RIDE_LIFECYCLE_REVERSED_TRAINS)); + break; + case WIDX_VEHICLE_TRAINS_INCREASE: + if (ride->NumTrains < OpenRCT2::Limits::MaxTrainsPerRide) + ride->SetNumTrains(ride->NumTrains + 1); + break; + case WIDX_VEHICLE_TRAINS_DECREASE: + if (ride->NumTrains > 1) + ride->SetNumTrains(ride->NumTrains - 1); + break; + case WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE: + if (ride->num_cars_per_train < OpenRCT2::Limits::MaxCarsPerTrain) + ride->SetNumCarsPerVehicle(ride->num_cars_per_train + 1); + break; + case WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE: + if (ride->num_cars_per_train > 1) + ride->SetNumCarsPerVehicle(ride->num_cars_per_train - 1); + break; + } + } + + void VehicleOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + if (dropdownIndex == -1) + return; + + switch (widgetIndex) + { + case WIDX_VEHICLE_TYPE_DROPDOWN: + if (dropdownIndex >= 0 && static_cast(dropdownIndex) < _vehicleDropdownData.size()) + { + auto ride = GetRide(rideId); + if (ride != nullptr) + { + auto newRideType = _vehicleDropdownData[dropdownIndex].SubTypeId; + ride->SetRideEntry(newRideType); + } + } + break; + } + } + + void VehicleUpdate() + { + frame_no++; + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_2); + } + + OpenRCT2String VehicleTooltip(const WidgetIndex widgetIndex, StringId fallback) + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return { STR_NONE, {} }; + + switch (widgetIndex) + { + case WIDX_VEHICLE_TRAINS: + case WIDX_VEHICLE_TRAINS_DECREASE: + case WIDX_VEHICLE_TRAINS_INCREASE: + { + auto ft = Formatter(); + ft.Increment(12); + + RideComponentType vehicleType = ride->GetRideTypeDescriptor().NameConvention.vehicle; + StringId stringId = GetRideComponentName(vehicleType).count; + if (ride->max_trains > 1) + { + stringId = GetRideComponentName(vehicleType).count_plural; + } + ft.Add(stringId); + ft.Add(ride->max_trains); + return { fallback, ft }; + } + case WIDX_VEHICLE_CARS_PER_TRAIN: + case WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE: + case WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE: + { + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr) + return { STR_NONE, {} }; + + auto ft = Formatter(); + ft.Increment(16); + ft.Add(std::max(uint8_t(1), ride->MaxCarsPerTrain) - rideEntry->zero_cars); + + StringId stringId = GetRideComponentName(RideComponentType::Car).singular; + if (ride->MaxCarsPerTrain - rideEntry->zero_cars > 1) + { + stringId = GetRideComponentName(RideComponentType::Car).plural; + } + ft.Add(stringId); + return { fallback, ft }; + } + } + return { fallback, {} }; + } + + void VehicleOnPrepareDraw() + { + StringId stringId; + int32_t carsPerTrain; + + auto* newWidgets = PageWidgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + const auto* rideEntry = ride->GetRideEntry(); + + widgets[WIDX_TITLE].text = STR_ARG_20_STRINGID; + + // Widget setup + carsPerTrain = ride->num_cars_per_train - rideEntry->zero_cars; + + // Vehicle type + widgets[WIDX_VEHICLE_TYPE].text = rideEntry->naming.Name; + + // Trains + if (rideEntry->cars_per_flat_ride > 1 || GetGameState().Cheats.DisableTrainLengthLimit) + { + widgets[WIDX_VEHICLE_TRAINS].type = WindowWidgetType::Spinner; + widgets[WIDX_VEHICLE_TRAINS_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_VEHICLE_TRAINS_DECREASE].type = WindowWidgetType::Button; + } + else + { + widgets[WIDX_VEHICLE_TRAINS].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_TRAINS_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_TRAINS_DECREASE].type = WindowWidgetType::Empty; + } + + // Cars per train + if (rideEntry->zero_cars + 1 < rideEntry->max_cars_in_train || GetGameState().Cheats.DisableTrainLengthLimit) + { + widgets[WIDX_VEHICLE_CARS_PER_TRAIN].type = WindowWidgetType::Spinner; + widgets[WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE].type = WindowWidgetType::Button; + } + else + { + widgets[WIDX_VEHICLE_CARS_PER_TRAIN].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE].type = WindowWidgetType::Empty; + } + + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_ALLOW_REVERSED_TRAINS) + || (GetGameState().Cheats.DisableTrainLengthLimit + && !ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE))) + { + widgets[WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX].type = WindowWidgetType::Checkbox; + if (ride->HasLifecycleFlag(RIDE_LIFECYCLE_REVERSED_TRAINS)) + { + pressed_widgets |= (1uLL << WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX); + } + else + { + pressed_widgets &= ~(1uLL << WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX); + } + } + else + { + widgets[WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX].type = WindowWidgetType::Empty; + } + + auto ft = Formatter::Common(); + ft.Increment(6); + ft.Add(carsPerTrain); + RideComponentType vehicleType = ride->GetRideTypeDescriptor().NameConvention.vehicle; + stringId = GetRideComponentName(vehicleType).count; + if (ride->NumTrains > 1) + { + stringId = GetRideComponentName(vehicleType).count_plural; + } + ft.Add(stringId); + ft.Add(ride->NumTrains); + + ft.Increment(8); + + ride->FormatNameTo(ft); + + AnchorBorderWidgets(); + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); + + if (abs(ride->num_cars_per_train - rideEntry->zero_cars) == 1) + { + widgets[WIDX_VEHICLE_CARS_PER_TRAIN].text = STR_1_CAR_PER_TRAIN; + } + else + { + widgets[WIDX_VEHICLE_CARS_PER_TRAIN].text = STR_X_CARS_PER_TRAIN; + } + } + + void VehicleOnDraw(DrawPixelInfo& dpi) + { + WindowDrawWidgets(*this, dpi); + DrawTabImages(dpi); auto ride = GetRide(rideId); if (ride == nullptr) @@ -1178,2681 +2789,945 @@ private: if (rideEntry == nullptr) return; - if (rideEntry->flags & RIDE_ENTRY_FLAG_VEHICLE_TAB_SCALE_HALF) - { - clipDPI.zoom_level = ZoomLevel{ 1 }; - clipDPI.width *= 2; - clipDPI.height *= 2; - screenCoords.x *= 2; - screenCoords.y *= 2; - clipDPI.x *= 2; - clipDPI.y *= 2; - } + auto screenCoords = windowPos + ScreenCoordsXY{ 8, 64 }; - // For any suspended rides, move image higher in the vehicle tab on the rides window - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SUSPENDED)) - { - screenCoords.y /= 4; - } - - const auto vehicle = RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, rideEntry->TabCar); - const auto& carEntry = rideEntry->Cars[vehicle]; - - auto vehicleId = ((ride->colour_scheme_type & 3) == VEHICLE_COLOUR_SCHEME_PER_VEHICLE) ? rideEntry->TabCar : 0; - VehicleColour vehicleColour = RideGetVehicleColour(*ride, vehicleId); - - // imageIndex represents a precision of 64 - auto imageIndex = OpenRCT2::Entity::Yaw::YawFrom4(2) * 2; - if (page == WINDOW_RIDE_PAGE_VEHICLE) - imageIndex += frame_no; - imageIndex = carEntry.SpriteByYaw(imageIndex / 2, SpriteGroupType::SlopeFlat); - imageIndex &= carEntry.TabRotationMask; - imageIndex *= carEntry.base_num_frames; - imageIndex += carEntry.base_image_id; - auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Tertiary); - GfxDrawSprite(clipDPI, imageId, screenCoords); - } - } - - void DrawTabCustomer(DrawPixelInfo& dpi) - { - WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast(WINDOW_RIDE_PAGE_CUSTOMER); - - if (!WidgetIsDisabled(*this, widgetIndex)) - { - const auto& widget = widgets[widgetIndex]; - int32_t spriteIndex = 0; - if (page == WINDOW_RIDE_PAGE_CUSTOMER) - spriteIndex = picked_peep_frame & ~3; - - spriteIndex += GetPeepAnimation(PeepSpriteType::Normal).base_image + 1; - - GfxDrawSprite( - dpi, ImageId(spriteIndex, COLOUR_BRIGHT_RED, COLOUR_TEAL), - windowPos + ScreenCoordsXY{ widget.midX(), widget.bottom - 6 }); - } - } - - void DrawTabImages(DrawPixelInfo& dpi) - { - DrawTabVehicle(dpi); - DrawTabImage(dpi, WINDOW_RIDE_PAGE_OPERATING, SPR_TAB_GEARS_0); - DrawTabImage(dpi, WINDOW_RIDE_PAGE_MAINTENANCE, SPR_TAB_WRENCH_0); - DrawTabImage(dpi, WINDOW_RIDE_PAGE_INCOME, SPR_TAB_ADMISSION_0); - DrawTabMain(dpi); - DrawTabImage(dpi, WINDOW_RIDE_PAGE_MEASUREMENTS, SPR_TAB_TIMER_0); - DrawTabImage(dpi, WINDOW_RIDE_PAGE_COLOUR, SPR_TAB_PAINT_0); - DrawTabImage(dpi, WINDOW_RIDE_PAGE_GRAPHS, SPR_TAB_GRAPH_A_0); - DrawTabCustomer(dpi); - DrawTabImage(dpi, WINDOW_RIDE_PAGE_MUSIC, SPR_TAB_MUSIC_0); - } - - void DisableTabs() - { - uint32_t disabledTabs = 0; - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - const auto& rtd = ride->GetRideTypeDescriptor(); - - if (!rtd.HasFlag(RIDE_TYPE_FLAG_HAS_DATA_LOGGING)) - disabledTabs |= (1uLL << WIDX_TAB_8); // 0x800 - - if (ride->type == RIDE_TYPE_MINI_GOLF) - disabledTabs |= (1uLL << WIDX_TAB_2 | 1uLL << WIDX_TAB_3 | 1uLL << WIDX_TAB_4); // 0xE0 - - if (rtd.HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)) - disabledTabs |= (1uLL << WIDX_TAB_2); // 0x20 - - if (!rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN) && !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL) - && !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS) && !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_VEHICLE_COLOURS) - && !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_ENTRANCE_EXIT)) - { - disabledTabs |= (1uLL << WIDX_TAB_5); // 0x100 - } - - if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY)) - disabledTabs |= (1uLL << WIDX_TAB_3 | 1uLL << WIDX_TAB_4 | 1uLL << WIDX_TAB_7); // 0x4C0 - - if (!rtd.HasFlag(RIDE_TYPE_FLAG_ALLOW_MUSIC)) - { - disabledTabs |= (1uLL << WIDX_TAB_6); // 0x200 - } - - if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_CASH_MACHINE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_FIRST_AID) - || (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) != 0) - disabledTabs |= (1uLL << WIDX_TAB_9); // 0x1000 - - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) != 0) - disabledTabs |= (1uLL << WIDX_TAB_4 | 1uLL << WIDX_TAB_6 | 1uLL << WIDX_TAB_9 | 1uLL << WIDX_TAB_10); // 0x3280 - - const auto* rideEntry = GetRideEntryByIndex(ride->subtype); - - if (rideEntry == nullptr) - { - disabledTabs |= 1uLL << WIDX_TAB_2 | 1uLL << WIDX_TAB_3 | 1uLL << WIDX_TAB_4 | 1uLL << WIDX_TAB_5 - | 1uLL << WIDX_TAB_6 | 1uLL << WIDX_TAB_7 | 1uLL << WIDX_TAB_8 | 1uLL << WIDX_TAB_9 | 1uLL << WIDX_TAB_10; - } - else if ((rideEntry->flags & RIDE_ENTRY_FLAG_DISABLE_COLOUR_TAB) != 0) - { - disabledTabs |= (1uLL << WIDX_TAB_5); - } - - disabled_widgets = disabledTabs; - } - - void UpdateOverallView(const Ride& ride) const - { - // Calculate x, y, z bounds of the entire ride using its track elements - TileElementIterator it; - - TileElementIteratorBegin(&it); - - CoordsXYZ min = { std::numeric_limits::max(), std::numeric_limits::max(), - std::numeric_limits::max() }; - CoordsXYZ max = { std::numeric_limits::min(), std::numeric_limits::min(), - std::numeric_limits::min() }; - - while (TileElementIteratorNext(&it)) - { - if (it.element->GetType() != TileElementType::Track) - continue; - - if (it.element->AsTrack()->GetRideIndex() != ride.id) - continue; - - auto location = TileCoordsXY(it.x, it.y).ToCoordsXY(); - int32_t baseZ = it.element->GetBaseZ(); - int32_t clearZ = it.element->GetClearanceZ(); - - min.x = std::min(min.x, location.x); - min.y = std::min(min.y, location.y); - min.z = std::min(min.z, baseZ); - - max.x = std::max(max.x, location.x); - max.y = std::max(max.y, location.y); - max.z = std::max(max.z, clearZ); - } - - const auto rideIndex = ride.id.ToUnderlying(); - if (rideIndex >= _rideOverallViewsCache.size()) - { - _rideOverallViewsCache.resize(rideIndex + 1); - } - - auto& view = _rideOverallViewsCache[rideIndex]; - view.loc = CoordsXYZ{ (min.x + max.x) / 2, (min.y + max.y) / 2, (min.z + max.z) / 2 } + CoordsXYZ{ 16, 16, -8 }; - - // Calculate size to determine from how far away to view the ride - const auto diff = max - min; - - const int32_t size = static_cast(std::sqrt(diff.x * diff.x + diff.y * diff.y + diff.z * diff.z)); - - if (size >= 80) - { - // Each farther zoom level shows twice as many tiles (log) - // Appropriate zoom is lowered by one to fill the entire view with the ride - const auto zoomValue = static_cast(std::ceil(std::log(size / 80)) - 1); - view.zoom = std::clamp(ZoomLevel{ zoomValue }, ZoomLevel{ 0 }, ZoomLevel::max()); - } - else - { - // Small rides or stalls are zoomed in all the way. - view.zoom = ZoomLevel{ 0 }; - } - } - - void SetPressedTab() - { - int32_t i; - for (i = 0; i < WINDOW_RIDE_PAGE_COUNT; i++) - pressed_widgets &= ~(1 << (WIDX_TAB_1 + i)); - pressed_widgets |= 1LL << (WIDX_TAB_1 + page); - } - - void AnchorBorderWidgets() - { - ResizeFrameWithPage(); - } - -#pragma region Main - - std::optional GetStationIndexFromViewSelection() const - { - const auto* ride = GetRide(RideId::FromUnderlying(number)); - if (ride == nullptr) - return std::nullopt; - - int32_t viewSelectionIndex = _viewIndex - 1 - ride->NumTrains; - if (viewSelectionIndex < 0) - { - return std::nullopt; - } - - for (const auto& station : ride->GetStations()) - { - if (!station.Start.IsNull() && viewSelectionIndex-- == 0) - { - const auto stationIndex = ride->GetStationIndex(&station); - return std::make_optional(stationIndex); - } - } - return std::nullopt; - } - - void InitViewport() - { - if (page != WINDOW_RIDE_PAGE_MAIN) - return; - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - int32_t viewSelectionIndex = _viewIndex - 1; - - std::optional newFocus; - - if (viewSelectionIndex >= 0 && viewSelectionIndex < ride->NumTrains && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK) - { - auto vehId = ride->vehicles[viewSelectionIndex]; - const auto* rideEntry = ride->GetRideEntry(); - if (rideEntry != nullptr && rideEntry->TabCar != 0) - { - Vehicle* vehicle = GetEntity(vehId); - if (vehicle == nullptr) - { - vehId = EntityId::GetNull(); - } - else if (!vehicle->next_vehicle_on_train.IsNull()) - { - vehId = vehicle->next_vehicle_on_train; - } - } - if (!vehId.IsNull()) - { - newFocus = Focus(vehId); - } - } - else if (viewSelectionIndex >= ride->NumTrains && viewSelectionIndex < (ride->NumTrains + ride->num_stations)) - { - auto stationIndex = GetStationIndexFromViewSelection(); - if (stationIndex) - { - const auto location = ride->GetStation(*stationIndex).GetStart(); - newFocus = Focus(location); - } - } - else - { - if (viewSelectionIndex > 0) - { - _viewIndex = 0; - } - if (number < _rideOverallViewsCache.size()) - { - const auto& view = _rideOverallViewsCache[number]; - newFocus = Focus(view.loc, view.zoom); - } - } - - uint16_t newViewportFlags = 0; - if (viewport != nullptr) - { - if (focus == newFocus) - { - return; - } - newViewportFlags = viewport->flags; - RemoveViewport(); - } - else if (gConfigGeneral.AlwaysShowGridlines) - { - newViewportFlags |= VIEWPORT_FLAG_GRIDLINES; - } - - OnPrepareDraw(); - - focus = newFocus; - - // rct2: 0x006aec9c only used here so brought it into the function - if (viewport == nullptr && !ride->overall_view.IsNull() && focus.has_value()) - { - const auto& viewWidget = widgets[WIDX_VIEWPORT]; - - auto screenPos = windowPos + ScreenCoordsXY{ viewWidget.left + 1, viewWidget.top + 1 }; - int32_t viewWidth = viewWidget.width() - 1; - int32_t viewHeight = viewWidget.height() - 1; - - ViewportCreate(this, screenPos, viewWidth, viewHeight, focus.value()); - - flags |= WF_NO_SCROLLING; - Invalidate(); - } - if (viewport != nullptr) - { - viewport->flags = newViewportFlags; - Invalidate(); - } - } - - void Rename() - { - auto ride = GetRide(rideId); - if (ride != nullptr) - { - auto rideName = ride->GetName(); - WindowTextInputRawOpen( - this, WIDX_RENAME, STR_RIDE_ATTRACTION_NAME, STR_ENTER_NEW_NAME_FOR_THIS_RIDE_ATTRACTION, {}, rideName.c_str(), - 32); - } - } - - void MainOnMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - case WIDX_TAB_8: - case WIDX_TAB_9: - case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_CONSTRUCTION: - { - auto ride = GetRide(rideId); - if (ride != nullptr) - { - RideConstructionStart(*ride); - if (WindowFindByNumber(WindowClass::RideConstruction, ride->id.ToUnderlying()) != nullptr) - { - Close(); - return; - } - } - break; - } - case WIDX_RENAME: - Rename(); - break; - case WIDX_DEMOLISH: - ContextOpenDetailWindow(WD_DEMOLISH_RIDE, number); - break; - case WIDX_CLOSE_LIGHT: - case WIDX_SIMULATE_LIGHT: - case WIDX_TEST_LIGHT: - case WIDX_OPEN_LIGHT: - { - auto ride = GetRide(rideId); - if (ride != nullptr) - { - RideStatus status; - switch (widgetIndex) - { - default: - case WIDX_CLOSE_LIGHT: - status = RideStatus::Closed; - break; - case WIDX_SIMULATE_LIGHT: - status = RideStatus::Simulating; - break; - case WIDX_TEST_LIGHT: - status = RideStatus::Testing; - break; - case WIDX_OPEN_LIGHT: - status = RideStatus::Open; - break; - } - auto gameAction = RideSetStatusAction(ride->id, status); - GameActions::Execute(&gameAction); - } - break; - } - } - } - - void MainResize() - { - int32_t minHeight = 180; - if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE) - { - minHeight += 20 + RCT1_LIGHT_OFFSET; - - auto ride = GetRide(rideId); - if (ride != nullptr) - { -#ifdef __SIMULATE_IN_RIDE_WINDOW__ - if (ride->SupportsStatus(RideStatus::Simulating)) - { - minHeight += 14; - } -#endif - if (ride->SupportsStatus(RideStatus::Testing)) - { - minHeight += 14; - } - } - } - if (gCheatsAllowArbitraryRideTypeChanges) - { - minHeight += 15; - } - - flags |= WF_RESIZABLE; - WindowSetResize(*this, 316, minHeight, 500, 450); - // Unlike with other windows, the focus needs to be recentred so it’s best to just reset it. - focus = std::nullopt; - InitViewport(); - } - - size_t GetNumPeepsInTrain(const Ride& ride, int32_t trainIndex) const - { - auto numPeepsInTrain = 0; - const auto* vehicle = TryGetVehicle(ride.vehicles[trainIndex]); - while (vehicle != nullptr) - { - numPeepsInTrain += vehicle->num_peeps; - vehicle = TryGetVehicle(vehicle->next_vehicle_on_train); - } - return numPeepsInTrain; - } - - bool TrainMustBeHidden(const Ride& ride, int32_t trainIndex) const - { - if (!(ride.lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) - return true; - - const auto* rideEntry = ride.GetRideEntry(); - if (rideEntry == nullptr) - return false; - - if (!(rideEntry->flags & RIDE_ENTRY_FLAG_HIDE_EMPTY_TRAINS)) - return false; - - return GetNumPeepsInTrain(ride, trainIndex) == 0; - } - - void ShowViewDropdown(Widget* widget) - { - Widget* dropdownWidget = widget - 1; - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - const auto& rtd = ride->GetRideTypeDescriptor(); - - int32_t numItems = 1; - if (!rtd.HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)) - { - numItems += ride->num_stations; - numItems += ride->NumTrains; - } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], - 0, 0, numItems, widget->right - dropdownWidget->left); - - // First item - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_OVERALL_VIEW; - int32_t currentItem = 1; - - // Vehicles - int32_t name = GetRideComponentName(rtd.NameConvention.vehicle).number; - for (int32_t i = 0; i < ride->NumTrains; i++) - { - gDropdownItems[currentItem].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[currentItem].Args = name | (currentItem << 16); - if (TrainMustBeHidden(*ride, i)) - { - Dropdown::SetDisabled(currentItem, true); - } - currentItem++; - } - - // Stations - name = GetRideComponentName(rtd.NameConvention.station).number; - for (int32_t i = 1; i <= ride->num_stations; i++) - { - gDropdownItems[currentItem].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[currentItem].Args = name | (i << 16); - currentItem++; - } - - // Set checked item - Dropdown::SetChecked(_viewIndex, true); - } - - RideStatus GetNextDefaultStatus(const Ride& ride) const - { - switch (ride.status) - { - default: - case RideStatus::Closed: - if ((ride.lifecycle_flags & RIDE_LIFECYCLE_CRASHED) - || (ride.lifecycle_flags & RIDE_LIFECYCLE_HAS_STALLED_VEHICLE)) - { - return RideStatus::Closed; - } - if (ride.SupportsStatus(RideStatus::Testing) && !(ride.lifecycle_flags & RIDE_LIFECYCLE_TESTED)) - { - return RideStatus::Testing; - } - return RideStatus::Open; - case RideStatus::Simulating: - return RideStatus::Testing; - case RideStatus::Testing: - return (ride.lifecycle_flags & RIDE_LIFECYCLE_TESTED) ? RideStatus::Open : RideStatus::Closed; - case RideStatus::Open: - return RideStatus::Closed; - } - } - - struct RideStatusDropdownInfo - { - struct Ride* Ride{}; - RideStatus CurrentStatus{}; - RideStatus DefaultStatus{}; - - int32_t NumItems{}; - int32_t CheckedIndex = -1; - int32_t DefaultIndex = -1; - }; - - void SetDropdown(RideStatusDropdownInfo& info, RideStatus status, StringId text) const - { - if (info.Ride->SupportsStatus(status)) - { - auto index = info.NumItems; - gDropdownItems[index].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[index].Args = text; - if (info.CurrentStatus == status) - { - info.CheckedIndex = index; - } - if (info.DefaultStatus == status) - { - info.DefaultIndex = index; - } - info.NumItems++; - } - } - - void ShowOpenDropdown(Widget* widget) - { - RideStatusDropdownInfo info; - info.Ride = GetRide(rideId); - if (info.Ride == nullptr) - return; - - info.CurrentStatus = info.Ride->status; - info.DefaultStatus = GetNextDefaultStatus(*info.Ride); - SetDropdown(info, RideStatus::Closed, STR_CLOSE_RIDE); -#ifdef __SIMULATE_IN_RIDE_WINDOW__ - SetDropdown(info, RideStatus::Simulating, STR_SIMULATE_RIDE); -#endif - 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); - Dropdown::SetChecked(info.CheckedIndex, true); - gDropdownDefaultIndex = info.DefaultIndex; - } - - static constexpr StringId GetRideTypeNameForDropdown(ride_type_t rideType) - { - switch (rideType) - { - case RIDE_TYPE_1D: - return STR_RIDE_NAME_1D; - case RIDE_TYPE_1F: - return STR_RIDE_NAME_1F; - case RIDE_TYPE_22: - return STR_RIDE_NAME_22; - case RIDE_TYPE_50: - return STR_RIDE_NAME_50; - case RIDE_TYPE_52: - return STR_RIDE_NAME_52; - case RIDE_TYPE_53: - return STR_RIDE_NAME_53; - case RIDE_TYPE_54: - return STR_RIDE_NAME_54; - case RIDE_TYPE_55: - return STR_RIDE_NAME_55; - case RIDE_TYPE_59: - return STR_RIDE_NAME_59; - default: - return GetRideTypeDescriptor(rideType).Naming.Name; - } - } - - void PopulateRideTypeDropdown() - { - auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); - if (_rideDropdownDataLanguage == ls.GetCurrentLanguage()) - return; - - _rideDropdownData.clear(); - - for (uint8_t i = 0; i < RIDE_TYPE_COUNT; i++) - { - auto name = GetRideTypeNameForDropdown(i); - _rideDropdownData.push_back({ i, name, u8string_view{ ls.GetString(name) } }); - } - - std::sort(_rideDropdownData.begin(), _rideDropdownData.end(), [](auto& a, auto& b) { - return a.LabelString.compare(b.LabelString) < 0; - }); - - _rideDropdownDataLanguage = ls.GetCurrentLanguage(); - } - - void ShowRideTypeDropdown(Widget* widget) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - PopulateRideTypeDropdown(); - - for (size_t i = 0; i < _rideDropdownData.size(); i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = _rideDropdownData[i].LabelId; - } - - Widget* dropdownWidget = widget - 1; - WindowDropdownShowText( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], - Dropdown::Flag::StayOpen, RIDE_TYPE_COUNT); - - // Find the current ride type in the ordered list. - int32_t pos = 0; - for (int32_t i = 0; i < RIDE_TYPE_COUNT; i++) - { - if (_rideDropdownData[i].RideTypeId == ride->type) - { - pos = i; - break; - } - } - - gDropdownHighlightedIndex = pos; - gDropdownDefaultIndex = pos; - Dropdown::SetChecked(pos, true); - } - - void ShowLocateDropdown(Widget* widget) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - gDropdownItems[0].Format = STR_LOCATE_SUBJECT_TIP; - gDropdownItems[1].Format = STR_FOLLOW_SUBJECT_TIP; - - WindowDropdownShowText( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 2); - gDropdownDefaultIndex = 0; - if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK) || _viewIndex == 0 || _viewIndex > ride->NumTrains) - { - // Disable if we're a flat ride, 'overall view' is selected or a station is selected - Dropdown::SetDisabled(1, true); - } - } - - void MainFollowRide() - { - auto* ride = GetRide(rideId); - if (ride != nullptr) - { - if (!(ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_MAIN)) - { - if (_viewIndex > 0) - { - if (_viewIndex <= ride->NumTrains) - { - Vehicle* vehicle = GetEntity(ride->vehicles[_viewIndex - 1]); - if (vehicle != nullptr) - { - auto headVehicleSpriteIndex = vehicle->Id; - WindowBase* w_main = WindowGetMain(); - WindowFollowSprite(*w_main, headVehicleSpriteIndex); - } - } - } - } - } - } - - void PopulateVehicleTypeDropdown(const Ride& ride, bool forceRefresh = false) - { - auto& objManager = GetContext()->GetObjectManager(); - const auto* rideEntry = ride.GetRideEntry(); - - bool selectionShouldBeExpanded; - int32_t rideTypeIterator, rideTypeIteratorMax; - - const auto& rtd = ride.GetRideTypeDescriptor(); - if (gCheatsShowVehiclesFromOtherTrackTypes - && !( - rtd.HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE) - || ride.type == RIDE_TYPE_MINI_GOLF)) - { - selectionShouldBeExpanded = true; - rideTypeIterator = 0; - rideTypeIteratorMax = RIDE_TYPE_COUNT - 1; - } - else - { - selectionShouldBeExpanded = false; - rideTypeIterator = ride.type; - rideTypeIteratorMax = ride.type; - } - - // Don't repopulate the list if we just did. - auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); - if (!forceRefresh && _vehicleDropdownExpanded == selectionShouldBeExpanded && _vehicleDropdownRideType == rideEntry - && _vehicleDropdownDataLanguage == ls.GetCurrentLanguage()) - return; - - _vehicleDropdownData.clear(); - - for (; rideTypeIterator <= rideTypeIteratorMax; rideTypeIterator++) - { - const auto& rtdIterator = GetRideTypeDescriptor(rideTypeIterator); - if (selectionShouldBeExpanded && rtdIterator.HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE)) - continue; - if (selectionShouldBeExpanded - && (rtdIterator.HasFlag(RIDE_TYPE_FLAG_IS_MAZE) || rideTypeIterator == RIDE_TYPE_MINI_GOLF)) - continue; - - auto& rideEntries = objManager.GetAllRideEntries(rideTypeIterator); - for (auto rideEntryIndex : rideEntries) - { - const auto* currentRideEntry = GetRideEntryByIndex(rideEntryIndex); - if (currentRideEntry == nullptr) - continue; - - // Skip if vehicle type has not been invented yet - if (!RideEntryIsInvented(rideEntryIndex) && !gCheatsIgnoreResearchStatus) - continue; - - auto name = currentRideEntry->naming.Name; - _vehicleDropdownData.push_back({ rideEntryIndex, name, u8string_view{ ls.GetString(name) } }); - } - } - - std::sort(_vehicleDropdownData.begin(), _vehicleDropdownData.end(), [](auto& a, auto& b) { - return a.LabelString.compare(b.LabelString) < 0; - }); - - _vehicleDropdownExpanded = selectionShouldBeExpanded; - _vehicleDropdownRideType = rideEntry; - _vehicleDropdownDataLanguage = ls.GetCurrentLanguage(); - } - - void ShowVehicleTypeDropdown(Widget* widget) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - PopulateVehicleTypeDropdown(*ride); - - size_t numItems = std::min(_vehicleDropdownData.size(), Dropdown::ItemsMaxSize); - - for (size_t i = 0; i < numItems; i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = _vehicleDropdownData[i].LabelId; - } - - Widget* dropdownWidget = widget - 1; - auto ddWidth = WindowDropDownHasMultipleColumns(numItems) ? dropdownWidget->width() - 24 : dropdownWidget->width(); - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], - 0, Dropdown::Flag::StayOpen, numItems, ddWidth); - - // Find the current vehicle type in the ordered list. - int32_t pos = 0; - for (int32_t i = 0; i < static_cast(_vehicleDropdownData.size()); i++) - { - if (_vehicleDropdownData[i].SubTypeId == ride->subtype) - { - pos = i; - break; - } - } - - gDropdownHighlightedIndex = pos; - gDropdownDefaultIndex = pos; - Dropdown::SetChecked(pos, true); - } - - void PopulateEntranceStyleDropdown() - { - auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); - if (_entranceDropdownDataLanguage == ls.GetCurrentLanguage()) - return; - - _entranceDropdownData.clear(); - - auto& objManager = GetContext()->GetObjectManager(); - - for (ObjectEntryIndex i = 0; i < MAX_STATION_OBJECTS; i++) - { - auto stationObj = static_cast(objManager.GetLoadedObject(ObjectType::Station, i)); - if (stationObj != nullptr) - { - auto name = stationObj->NameStringId; - _entranceDropdownData.push_back({ i, name, u8string_view{ ls.GetString(name) } }); - } - } - - std::sort(_entranceDropdownData.begin(), _entranceDropdownData.end(), [](auto& a, auto& b) { - return a.LabelString.compare(b.LabelString) < 0; - }); - - _entranceDropdownDataLanguage = ls.GetCurrentLanguage(); - } - - void ShowEntranceStyleDropdown() - { - auto dropdownWidget = &widgets[WIDX_ENTRANCE_STYLE_DROPDOWN] - 1; - auto ride = GetRide(rideId); - - PopulateEntranceStyleDropdown(); - - for (size_t i = 0; i < _entranceDropdownData.size(); i++) - { - gDropdownItems[i].Args = _entranceDropdownData[i].LabelId; - gDropdownItems[i].Format = _entranceDropdownData[i].EntranceTypeId == ride->entrance_style - ? STR_DROPDOWN_MENU_LABEL_SELECTED - : STR_DROPDOWN_MENU_LABEL; - } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], - 0, Dropdown::Flag::StayOpen, _entranceDropdownData.size(), - widgets[WIDX_ENTRANCE_STYLE_DROPDOWN].right - dropdownWidget->left); - } - - void MainOnMouseDown(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_VIEW_DROPDOWN: - ShowViewDropdown(&widgets[widgetIndex]); - break; - case WIDX_OPEN: - ShowOpenDropdown(&widgets[widgetIndex]); - break; - case WIDX_RIDE_TYPE_DROPDOWN: - ShowRideTypeDropdown(&widgets[widgetIndex]); - break; - case WIDX_LOCATE: - ShowLocateDropdown(&widgets[widgetIndex]); - break; - } - } - - void MainOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - switch (widgetIndex) - { - case WIDX_VIEW_DROPDOWN: - if (dropdownIndex == -1) - { - dropdownIndex = _viewIndex + 1; - auto ride = GetRide(rideId); - if (ride != nullptr) - { - if (dropdownIndex != 0 && dropdownIndex <= ride->NumTrains - && !(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) - { - dropdownIndex = ride->NumTrains + 1; - } - if (dropdownIndex >= gDropdownNumItems) - { - dropdownIndex = 0; - } - } - } - - _viewIndex = dropdownIndex; - InitViewport(); - Invalidate(); - break; - case WIDX_OPEN: - { - auto ride = GetRide(rideId); - if (ride != nullptr) - { - auto status = RideStatus::Closed; - if (dropdownIndex < 0) - { - dropdownIndex = gDropdownHighlightedIndex; - } - if (dropdownIndex < static_cast(std::size(gDropdownItems))) - { - switch (gDropdownItems[dropdownIndex].Args) - { - case STR_CLOSE_RIDE: - status = RideStatus::Closed; - break; - case STR_SIMULATE_RIDE: - status = RideStatus::Simulating; - break; - case STR_TEST_RIDE: - status = RideStatus::Testing; - break; - case STR_OPEN_RIDE: - status = RideStatus::Open; - break; - } - } - auto gameAction = RideSetStatusAction(ride->id, status); - GameActions::Execute(&gameAction); - } - break; - } - case WIDX_RIDE_TYPE_DROPDOWN: - if (dropdownIndex != -1 && dropdownIndex < RIDE_TYPE_COUNT) - { - auto rideLabelId = std::clamp(dropdownIndex, 0, RIDE_TYPE_COUNT - 1); - auto rideType = _rideDropdownData[rideLabelId].RideTypeId; - if (rideType < RIDE_TYPE_COUNT) - { - auto rideSetSetting = RideSetSettingAction(rideId, RideSetSetting::RideType, rideType); - rideSetSetting.SetCallback([](const GameAction* ga, const GameActions::Result* result) { - // Reset ghost track if ride construction window is open, prevents a crash - // Will get set to the correct Alternative variable during set_default_next_piece. - // TODO: Rework construction window to prevent the need for this. - _currentTrackAlternative = RIDE_TYPE_NO_ALTERNATIVES; - RideConstructionSetDefaultNextPiece(); - }); - GameActions::Execute(&rideSetSetting); - } - } - break; - case WIDX_LOCATE: - { - if (dropdownIndex == 0) - { - ScrollToViewport(); - } - else if (dropdownIndex == 1) - { - MainFollowRide(); - } - break; - } - } - } - - void MainUpdate() - { - // Update tab animation - frame_no++; - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_1); - - // Update status - auto ride = GetRide(rideId); - if (ride != nullptr) - { - if (!(ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_MAIN)) - { - if (_viewIndex == 0) - return; - - if (_viewIndex <= ride->NumTrains) - { - Vehicle* vehicle = GetEntity(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)) - { - return; - } - } - } - ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_MAIN; - } - WidgetInvalidate(*this, WIDX_STATUS); - } - - void MainOnTextInput(WidgetIndex widgetIndex, std::string_view text) - { - if (widgetIndex != WIDX_RENAME || text.empty()) - return; - - auto ride = GetRide(rideId); - if (ride != nullptr) - { - auto strText = std::string(text); - auto gameAction = RideSetNameAction(ride->id, strText); - GameActions::Execute(&gameAction); - } - } - - void MainViewportRotate() - { - InitViewport(); - } - - void MainOnPrepareDraw() - { - int32_t i, widgetHeight; - - auto* newWidgets = PageWidgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - InitScrollWidgets(); - } - - SetPressedTab(); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - disabled_widgets &= ~((1uLL << WIDX_DEMOLISH) | (1uLL << WIDX_CONSTRUCTION)); - if (ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) - && !gCheatsMakeAllDestructible) - disabled_widgets |= (1uLL << WIDX_DEMOLISH); - - auto ft = Formatter::Common(); - ride->FormatNameTo(ft); - - uint32_t spriteIds[] = { - SPR_CLOSED, - SPR_OPEN, - SPR_TESTING, - SPR_G2_SIMULATE, - }; - widgets[WIDX_OPEN].image = ImageId(spriteIds[EnumValue(ride->status)]); - -#ifdef __SIMULATE_IN_RIDE_WINDOW__ - widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + (ride->status == RideStatus::Closed) * 2 - + WidgetIsPressed(*this, WIDX_CLOSE_LIGHT); - widgets[WIDX_SIMULATE_LIGHT].image = SPR_G2_RCT1_SIMULATE_BUTTON_0 + (ride->status == RideStatus::Simulating) * 2 - + WidgetIsPressed(*w, WIDX_SIMULATE_LIGHT); - widgets[WIDX_TEST_LIGHT].image = SPR_G2_RCT1_TEST_BUTTON_0 + (ride->status == RideStatus::Testing) * 2 - + WidgetIsPressed(*this, WIDX_TEST_LIGHT); -#else - const auto closeLightImage = SPR_G2_RCT1_CLOSE_BUTTON_0 + (ride->status == RideStatus::Closed) * 2 - + WidgetIsPressed(*this, WIDX_CLOSE_LIGHT); - widgets[WIDX_CLOSE_LIGHT].image = ImageId(closeLightImage); - - auto baseSprite = ride->status == RideStatus::Simulating ? SPR_G2_RCT1_SIMULATE_BUTTON_0 : SPR_G2_RCT1_TEST_BUTTON_0; - const auto testLightImage = baseSprite - + (ride->status == RideStatus::Testing || ride->status == RideStatus::Simulating) * 2 - + WidgetIsPressed(*this, WIDX_TEST_LIGHT); - widgets[WIDX_TEST_LIGHT].image = ImageId(testLightImage); -#endif - const auto openLightImage = SPR_G2_RCT1_OPEN_BUTTON_0 + (ride->status == RideStatus::Open) * 2 - + WidgetIsPressed(*this, WIDX_OPEN_LIGHT); - widgets[WIDX_OPEN_LIGHT].image = ImageId(openLightImage); - - AnchorBorderWidgets(); - - const int32_t offset = gCheatsAllowArbitraryRideTypeChanges ? 15 : 0; - // Anchor main page specific widgets - widgets[WIDX_VIEWPORT].right = width - 26; - widgets[WIDX_VIEWPORT].bottom = height - (14 + offset); - widgets[WIDX_STATUS].right = width - 26; - widgets[WIDX_STATUS].top = height - (13 + offset); - widgets[WIDX_STATUS].bottom = height - (3 + offset); - widgets[WIDX_VIEW].right = width - 60; - widgets[WIDX_VIEW_DROPDOWN].right = width - 61; - widgets[WIDX_VIEW_DROPDOWN].left = width - 71; - widgets[WIDX_RIDE_TYPE].right = width - 26; - widgets[WIDX_RIDE_TYPE].top = height - 17; - widgets[WIDX_RIDE_TYPE].bottom = height - 4; - widgets[WIDX_RIDE_TYPE_DROPDOWN].left = width - 37; - widgets[WIDX_RIDE_TYPE_DROPDOWN].right = width - 27; - widgets[WIDX_RIDE_TYPE_DROPDOWN].top = height - 16; - widgets[WIDX_RIDE_TYPE_DROPDOWN].bottom = height - 5; - - if (!gCheatsAllowArbitraryRideTypeChanges) - { - widgets[WIDX_RIDE_TYPE].type = WindowWidgetType::Empty; - widgets[WIDX_RIDE_TYPE_DROPDOWN].type = WindowWidgetType::Empty; - } - else - { - widgets[WIDX_RIDE_TYPE].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_RIDE_TYPE].text = ride->GetRideTypeDescriptor().Naming.Name; - widgets[WIDX_RIDE_TYPE_DROPDOWN].type = WindowWidgetType::Button; - } - - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); - - if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE) - { - widgets[WIDX_OPEN].type = WindowWidgetType::Empty; - widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::ImgBtn; - widgets[WIDX_SIMULATE_LIGHT].type = WindowWidgetType::Empty; -#ifdef __SIMULATE_IN_RIDE_WINDOW__ - if (ride->SupportsStatus(RideStatus::Simulating)) - widgets[WIDX_SIMULATE_LIGHT].type = WindowWidgetType::ImgBtn; -#endif - widgets[WIDX_TEST_LIGHT].type = ride->SupportsStatus(RideStatus::Testing) ? WindowWidgetType::ImgBtn - : WindowWidgetType::Empty; - widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::ImgBtn; - - widgetHeight = 62; - if (widgets[WIDX_SIMULATE_LIGHT].type != WindowWidgetType::Empty) - { - widgets[WIDX_SIMULATE_LIGHT].top = widgetHeight; - widgets[WIDX_SIMULATE_LIGHT].bottom = widgetHeight + 13; - widgetHeight += 14; - } - if (widgets[WIDX_TEST_LIGHT].type != WindowWidgetType::Empty) - { - widgets[WIDX_TEST_LIGHT].top = widgetHeight; - widgets[WIDX_TEST_LIGHT].bottom = widgetHeight + 13; - widgetHeight += 14; - } - widgets[WIDX_OPEN_LIGHT].top = widgetHeight; - widgets[WIDX_OPEN_LIGHT].bottom = widgetHeight + 13; - widgetHeight += 14 - 24 + RCT1_LIGHT_OFFSET; - } - else - { - widgets[WIDX_OPEN].type = WindowWidgetType::FlatBtn; - widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::Empty; - widgets[WIDX_SIMULATE_LIGHT].type = WindowWidgetType::Empty; - widgets[WIDX_TEST_LIGHT].type = WindowWidgetType::Empty; - widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::Empty; - widgetHeight = 46; - } - for (i = WIDX_CLOSE_LIGHT; i <= WIDX_OPEN_LIGHT; i++) - { - widgets[i].left = width - 20; - widgets[i].right = width - 7; - } - for (i = WIDX_OPEN; i <= WIDX_DEMOLISH; i++, widgetHeight += 24) - { - widgets[i].left = width - 25; - widgets[i].right = width - 2; - widgets[i].top = widgetHeight; - widgets[i].bottom = widgetHeight + 23; - } - } - - StringId GetStatusOverallView(Formatter& ft) const - { - auto stringId = STR_NONE; - auto ride = GetRide(rideId); - if (ride != nullptr) - { - ride->FormatStatusTo(ft); - stringId = STR_BLACK_STRING; - if ((ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)) - { - stringId = STR_RED_OUTLINED_STRING; - } - } - return stringId; - } - - StringId GetStatusVehicle(Formatter& ft) const - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return STR_EMPTY; - - auto vehicle = GetEntity(ride->vehicles[_viewIndex - 1]); - if (vehicle == nullptr) - return STR_EMPTY; - - 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 (ride->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_BLOCK_BRAKES) && vehicle->velocity == 0) - { - ft.Add(STR_STOPPED_BY_BLOCK_BRAKES); - return STR_BLACK_STRING; - } - } - } - - if (ride->type == RIDE_TYPE_MINI_GOLF) - return STR_EMPTY; - - auto stringId = VehicleStatusNames[static_cast(vehicle->status)]; - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_SINGLE_SESSION) - && vehicle->status <= Vehicle::Status::UnloadingPassengers) - { - stringId = SingleSessionVehicleStatusNames[static_cast(vehicle->status)]; - } - - ft.Add(stringId); - uint16_t speedInMph = (abs(vehicle->velocity) * 9) >> 18; - ft.Add(speedInMph); - const RideComponentName stationName = GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.station); - ft.Add(ride->num_stations > 1 ? stationName.number : stationName.singular); - ft.Add(vehicle->current_station.ToUnderlying() + 1); - return stringId != STR_CRASHING && stringId != STR_CRASHED_0 ? STR_BLACK_STRING : STR_RED_OUTLINED_STRING; - } - - StringId GetStatusStation(Formatter& ft) const - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return STR_NONE; - - const auto stationIndex = GetStationIndexFromViewSelection(); - if (!stationIndex) - { - return STR_NONE; - } - - const auto& station = ride->GetStation(*stationIndex); - StringId stringId = STR_EMPTY; - // Entrance / exit - if (ride->status == RideStatus::Closed) - { - if (station.Entrance.IsNull()) - stringId = STR_NO_ENTRANCE; - else if (station.Exit.IsNull()) - stringId = STR_NO_EXIT; - } - else - { - if (station.Entrance.IsNull()) - stringId = STR_EXIT_ONLY; - } - // Queue length - if (stringId == STR_EMPTY) - { - stringId = STR_QUEUE_EMPTY; - uint16_t queueLength = ride->GetStation(*stationIndex).QueueLength; - if (queueLength == 1) - stringId = STR_QUEUE_ONE_PERSON; - else if (queueLength > 1) - stringId = STR_QUEUE_PEOPLE; - - ft.Add(stringId); - ft.Add(queueLength); - } - else - { - ft.Add(stringId); - } - - return STR_BLACK_STRING; - } - - StringId GetStatus(Formatter& ft) const - { - auto ride = GetRide(rideId); - if (_viewIndex == 0) - return GetStatusOverallView(ft); - if (ride != nullptr && _viewIndex <= ride->NumTrains) - return GetStatusVehicle(ft); - if (ride != nullptr && ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) - return GetStatusOverallView(ft); - return GetStatusStation(ft); - } - - void MainOnDraw(DrawPixelInfo& dpi) - { - WindowDrawWidgets(*this, dpi); - DrawTabImages(dpi); - - // Viewport and ear icon - if (viewport != nullptr) - { - WindowDrawViewport(dpi, *this); - if (viewport->flags & VIEWPORT_FLAG_SOUND_ON) - GfxDrawSprite(dpi, ImageId(SPR_HEARING_VIEWPORT), WindowGetViewportSoundIconPos(*this)); - } - - // View dropdown - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto ft = Formatter(); - if (_viewIndex != 0) - { - if (_viewIndex > ride->NumTrains) - { - ft.Add(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.station).number); - ft.Add(_viewIndex - ride->NumTrains); - } - else - { - ft.Add(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).number); - ft.Add(_viewIndex); - } - } - else - { - ft.Add(STR_OVERALL_VIEW); - } - - auto* widget = &widgets[WIDX_VIEW]; - DrawTextBasic( - dpi, { windowPos.x + (widget->left + widget->right - 11) / 2, windowPos.y + widget->top }, - STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); - - // Status - ft = Formatter(); - widget = &widgets[WIDX_STATUS]; - StringId rideStatus = GetStatus(ft); - DrawTextEllipsised( - dpi, windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top }, widget->width(), rideStatus, ft, - { TextAlignment::CENTRE }); - } - -#pragma endregion - -#pragma region Vehicle - - void VehicleOnMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - case WIDX_TAB_8: - case WIDX_TAB_9: - case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); - break; - } - } - - void VehicleResize() - { - WindowSetResize(*this, 316, 221, 316, 221); - } - - void VehicleOnMouseDown(WidgetIndex widgetIndex) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - switch (widgetIndex) - { - case WIDX_VEHICLE_TYPE_DROPDOWN: - ShowVehicleTypeDropdown(&widgets[widgetIndex]); - break; - case WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX: - ride->SetReversedTrains(!ride->HasLifecycleFlag(RIDE_LIFECYCLE_REVERSED_TRAINS)); - break; - case WIDX_VEHICLE_TRAINS_INCREASE: - if (ride->NumTrains < OpenRCT2::Limits::MaxTrainsPerRide) - ride->SetNumTrains(ride->NumTrains + 1); - break; - case WIDX_VEHICLE_TRAINS_DECREASE: - if (ride->NumTrains > 1) - ride->SetNumTrains(ride->NumTrains - 1); - break; - case WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE: - if (ride->num_cars_per_train < OpenRCT2::Limits::MaxCarsPerTrain) - ride->SetNumCarsPerVehicle(ride->num_cars_per_train + 1); - break; - case WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE: - if (ride->num_cars_per_train > 1) - ride->SetNumCarsPerVehicle(ride->num_cars_per_train - 1); - break; - } - } - - void VehicleOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - if (dropdownIndex == -1) - return; - - switch (widgetIndex) - { - case WIDX_VEHICLE_TYPE_DROPDOWN: - if (dropdownIndex >= 0 && static_cast(dropdownIndex) < _vehicleDropdownData.size()) - { - auto ride = GetRide(rideId); - if (ride != nullptr) - { - auto newRideType = _vehicleDropdownData[dropdownIndex].SubTypeId; - ride->SetRideEntry(newRideType); - } - } - break; - } - } - - void VehicleUpdate() - { - frame_no++; - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_2); - } - - OpenRCT2String VehicleTooltip(const WidgetIndex widgetIndex, StringId fallback) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return { STR_NONE, {} }; - - switch (widgetIndex) - { - case WIDX_VEHICLE_TRAINS: - case WIDX_VEHICLE_TRAINS_DECREASE: - case WIDX_VEHICLE_TRAINS_INCREASE: - { - auto ft = Formatter(); - ft.Increment(12); - - RideComponentType vehicleType = ride->GetRideTypeDescriptor().NameConvention.vehicle; - StringId stringId = GetRideComponentName(vehicleType).count; - if (ride->max_trains > 1) - { - stringId = GetRideComponentName(vehicleType).count_plural; - } - ft.Add(stringId); - ft.Add(ride->max_trains); - return { fallback, ft }; - } - case WIDX_VEHICLE_CARS_PER_TRAIN: - case WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE: - case WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE: - { - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr) - return { STR_NONE, {} }; - - auto ft = Formatter(); - ft.Increment(16); - ft.Add(std::max(uint8_t(1), ride->MaxCarsPerTrain) - rideEntry->zero_cars); - - StringId stringId = GetRideComponentName(RideComponentType::Car).singular; - if (ride->MaxCarsPerTrain - rideEntry->zero_cars > 1) - { - stringId = GetRideComponentName(RideComponentType::Car).plural; - } - ft.Add(stringId); - return { fallback, ft }; - } - } - return { fallback, {} }; - } - - void VehicleOnPrepareDraw() - { - StringId stringId; - int32_t carsPerTrain; - - auto* newWidgets = PageWidgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - InitScrollWidgets(); - } - - SetPressedTab(); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - const auto* rideEntry = ride->GetRideEntry(); - - widgets[WIDX_TITLE].text = STR_ARG_20_STRINGID; - - // Widget setup - carsPerTrain = ride->num_cars_per_train - rideEntry->zero_cars; - - // Vehicle type - widgets[WIDX_VEHICLE_TYPE].text = rideEntry->naming.Name; - - // Trains - if (rideEntry->cars_per_flat_ride > 1 || gCheatsDisableTrainLengthLimit) - { - widgets[WIDX_VEHICLE_TRAINS].type = WindowWidgetType::Spinner; - widgets[WIDX_VEHICLE_TRAINS_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_VEHICLE_TRAINS_DECREASE].type = WindowWidgetType::Button; - } - else - { - widgets[WIDX_VEHICLE_TRAINS].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_TRAINS_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_TRAINS_DECREASE].type = WindowWidgetType::Empty; - } - - // Cars per train - if (rideEntry->zero_cars + 1 < rideEntry->max_cars_in_train || gCheatsDisableTrainLengthLimit) - { - widgets[WIDX_VEHICLE_CARS_PER_TRAIN].type = WindowWidgetType::Spinner; - widgets[WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE].type = WindowWidgetType::Button; - } - else - { - widgets[WIDX_VEHICLE_CARS_PER_TRAIN].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE].type = WindowWidgetType::Empty; - } - - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_ALLOW_REVERSED_TRAINS) - || (gCheatsDisableTrainLengthLimit && !ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE))) - { - widgets[WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX].type = WindowWidgetType::Checkbox; - if (ride->HasLifecycleFlag(RIDE_LIFECYCLE_REVERSED_TRAINS)) - { - pressed_widgets |= (1uLL << WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX); - } - else - { - pressed_widgets &= ~(1uLL << WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX); - } - } - else - { - widgets[WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX].type = WindowWidgetType::Empty; - } - - auto ft = Formatter::Common(); - ft.Increment(6); - ft.Add(carsPerTrain); - RideComponentType vehicleType = ride->GetRideTypeDescriptor().NameConvention.vehicle; - stringId = GetRideComponentName(vehicleType).count; - if (ride->NumTrains > 1) - { - stringId = GetRideComponentName(vehicleType).count_plural; - } - ft.Add(stringId); - ft.Add(ride->NumTrains); - - ft.Increment(8); - - ride->FormatNameTo(ft); - - AnchorBorderWidgets(); - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); - - if (abs(ride->num_cars_per_train - rideEntry->zero_cars) == 1) - { - widgets[WIDX_VEHICLE_CARS_PER_TRAIN].text = STR_1_CAR_PER_TRAIN; - } - else - { - widgets[WIDX_VEHICLE_CARS_PER_TRAIN].text = STR_X_CARS_PER_TRAIN; - } - } - - void VehicleOnDraw(DrawPixelInfo& dpi) - { - WindowDrawWidgets(*this, dpi); - DrawTabImages(dpi); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr) - return; - - auto screenCoords = windowPos + ScreenCoordsXY{ 8, 64 }; - - // Description - auto ft = Formatter(); - ft.Add(rideEntry->naming.Description); - screenCoords.y += DrawTextWrapped(dpi, screenCoords, 300, STR_BLACK_STRING, ft, { TextAlignment::LEFT }); - screenCoords.y += 2; - - // Capacity - ft = Formatter(); - ft.Add(rideEntry->capacity); - DrawTextBasic(dpi, screenCoords, STR_CAPACITY, ft); - - // Excitement Factor - if (rideEntry->excitement_multiplier != 0) - { - screenCoords.y += LIST_ROW_HEIGHT; + // Description + auto ft = Formatter(); + ft.Add(rideEntry->naming.Description); + screenCoords.y += DrawTextWrapped(dpi, screenCoords, 300, STR_BLACK_STRING, ft, { TextAlignment::LEFT }); + screenCoords.y += 2; + // Capacity ft = Formatter(); - ft.Add(abs(rideEntry->excitement_multiplier)); - StringId stringId = rideEntry->excitement_multiplier > 0 ? STR_EXCITEMENT_FACTOR : STR_EXCITEMENT_FACTOR_NEGATIVE; - DrawTextBasic(dpi, screenCoords, stringId, ft); - } + ft.Add(rideEntry->capacity); + DrawTextBasic(dpi, screenCoords, STR_CAPACITY, ft); - // Intensity Factor - if (rideEntry->intensity_multiplier != 0) - { - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); - if (lineHeight != 10) - screenCoords.x += 150; - else + // Excitement Factor + if (rideEntry->excitement_multiplier != 0) + { screenCoords.y += LIST_ROW_HEIGHT; - ft = Formatter(); - ft.Add(abs(rideEntry->intensity_multiplier)); - StringId stringId = rideEntry->intensity_multiplier > 0 ? STR_INTENSITY_FACTOR : STR_INTENSITY_FACTOR_NEGATIVE; - DrawTextBasic(dpi, screenCoords, stringId, ft); - - if (lineHeight != 10) - screenCoords.x -= 150; - } - - // Nausea Factor - if (rideEntry->nausea_multiplier != 0) - { - screenCoords.y += LIST_ROW_HEIGHT; - - ft = Formatter(); - ft.Add(abs(rideEntry->nausea_multiplier)); - StringId stringId = rideEntry->nausea_multiplier > 0 ? STR_NAUSEA_FACTOR : STR_NAUSEA_FACTOR_NEGATIVE; - DrawTextBasic(dpi, screenCoords, stringId, ft); - } - } - - struct VehicleDrawInfo - { - int16_t x; - int16_t y; - ImageId imageId; - }; - - void VehicleOnScrollDraw(DrawPixelInfo& dpi, int32_t scrollIndex) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - const auto* rideEntry = ride->GetRideEntry(); - - // Background - GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }, PALETTE_INDEX_12); - - Widget* widget = &widgets[WIDX_VEHICLE_TRAINS_PREVIEW]; - int32_t startX = std::max(2, (widget->width() - ((ride->NumTrains - 1) * 36)) / 2 - 25); - int32_t startY = widget->height() - 4; - - bool isReversed = ride->HasLifecycleFlag(RIDE_LIFECYCLE_REVERSED_TRAINS); - int32_t carIndex = (isReversed) ? ride->num_cars_per_train - 1 : 0; - - const auto& firstCarEntry = rideEntry->Cars[RideEntryGetVehicleAtPosition( - ride->subtype, ride->num_cars_per_train, carIndex)]; - startY += firstCarEntry.tab_height; - - // For each train - for (int32_t i = 0; i < ride->NumTrains; i++) - { - VehicleDrawInfo trainCarImages[OpenRCT2::Limits::MaxCarsPerTrain]; - VehicleDrawInfo* nextSpriteToDraw = trainCarImages; - int32_t x = startX; - int32_t y = startY; - - // For each car in train - static_assert(std::numeric_limitsnum_cars_per_train)>::max() <= std::size(trainCarImages)); - for (int32_t j = 0; j < ride->num_cars_per_train; j++) - { - carIndex = (isReversed) ? (ride->num_cars_per_train - 1) - j : j; - - const auto& carEntry = rideEntry->Cars[RideEntryGetVehicleAtPosition( - ride->subtype, ride->num_cars_per_train, carIndex)]; - x += carEntry.spacing / 17432; - y -= (carEntry.spacing / 2) / 17432; - - // Get colour of vehicle - int32_t vehicleColourIndex = 0; - switch (ride->colour_scheme_type & 3) - { - case VEHICLE_COLOUR_SCHEME_SAME: - vehicleColourIndex = 0; - break; - case VEHICLE_COLOUR_SCHEME_PER_TRAIN: - vehicleColourIndex = i; - break; - case VEHICLE_COLOUR_SCHEME_PER_VEHICLE: - vehicleColourIndex = carIndex; - break; - } - VehicleColour vehicleColour = RideGetVehicleColour(*ride, vehicleColourIndex); - - ImageIndex imageIndex = carEntry.SpriteByYaw( - OpenRCT2::Entity::Yaw::BaseRotation / 2, SpriteGroupType::SlopeFlat); - if (isReversed) - { - auto baseRotation = carEntry.NumRotationSprites(SpriteGroupType::SlopeFlat); - imageIndex = carEntry.SpriteByYaw( - (imageIndex + (baseRotation / 2)) & (baseRotation - 1), SpriteGroupType::SlopeFlat); - } - - imageIndex &= carEntry.TabRotationMask; - imageIndex *= carEntry.base_num_frames; - imageIndex += carEntry.base_image_id; - - auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Tertiary); - - nextSpriteToDraw->x = x; - nextSpriteToDraw->y = y; - nextSpriteToDraw->imageId = imageId; - nextSpriteToDraw++; - - x += carEntry.spacing / 17432; - y -= (carEntry.spacing / 2) / 17432; + ft = Formatter(); + ft.Add(abs(rideEntry->excitement_multiplier)); + StringId stringId = rideEntry->excitement_multiplier > 0 ? STR_EXCITEMENT_FACTOR + : STR_EXCITEMENT_FACTOR_NEGATIVE; + DrawTextBasic(dpi, screenCoords, stringId, ft); } - if (ride->type == RIDE_TYPE_REVERSER_ROLLER_COASTER) + // Intensity Factor + if (rideEntry->intensity_multiplier != 0) { - VehicleDrawInfo tmp = *(nextSpriteToDraw - 1); - *(nextSpriteToDraw - 1) = *(nextSpriteToDraw - 2); - *(nextSpriteToDraw - 2) = tmp; + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + if (lineHeight != 10) + screenCoords.x += 150; + else + screenCoords.y += LIST_ROW_HEIGHT; + + ft = Formatter(); + ft.Add(abs(rideEntry->intensity_multiplier)); + StringId stringId = rideEntry->intensity_multiplier > 0 ? STR_INTENSITY_FACTOR : STR_INTENSITY_FACTOR_NEGATIVE; + DrawTextBasic(dpi, screenCoords, stringId, ft); + + if (lineHeight != 10) + screenCoords.x -= 150; } - VehicleDrawInfo* current = nextSpriteToDraw; - while (--current >= trainCarImages) - GfxDrawSprite(dpi, current->imageId, { current->x, current->y }); + // Nausea Factor + if (rideEntry->nausea_multiplier != 0) + { + screenCoords.y += LIST_ROW_HEIGHT; - startX += 36; + ft = Formatter(); + ft.Add(abs(rideEntry->nausea_multiplier)); + StringId stringId = rideEntry->nausea_multiplier > 0 ? STR_NAUSEA_FACTOR : STR_NAUSEA_FACTOR_NEGATIVE; + DrawTextBasic(dpi, screenCoords, stringId, ft); + } + } + + struct VehicleDrawInfo + { + int16_t x; + int16_t y; + ImageId imageId; + }; + + void VehicleOnScrollDraw(DrawPixelInfo& dpi, int32_t scrollIndex) + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + const auto* rideEntry = ride->GetRideEntry(); + + // Background + GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }, PALETTE_INDEX_12); + + Widget* widget = &widgets[WIDX_VEHICLE_TRAINS_PREVIEW]; + int32_t startX = std::max(2, (widget->width() - ((ride->NumTrains - 1) * 36)) / 2 - 25); + int32_t startY = widget->height() - 4; + + bool isReversed = ride->HasLifecycleFlag(RIDE_LIFECYCLE_REVERSED_TRAINS); + int32_t carIndex = (isReversed) ? ride->num_cars_per_train - 1 : 0; + + const auto& firstCarEntry = rideEntry->Cars[RideEntryGetVehicleAtPosition( + ride->subtype, ride->num_cars_per_train, carIndex)]; + startY += firstCarEntry.tab_height; + + // For each train + for (int32_t i = 0; i < ride->NumTrains; i++) + { + VehicleDrawInfo trainCarImages[OpenRCT2::Limits::MaxCarsPerTrain]; + VehicleDrawInfo* nextSpriteToDraw = trainCarImages; + int32_t x = startX; + int32_t y = startY; + + // For each car in train + static_assert(std::numeric_limitsnum_cars_per_train)>::max() <= std::size(trainCarImages)); + for (int32_t j = 0; j < ride->num_cars_per_train; j++) + { + carIndex = (isReversed) ? (ride->num_cars_per_train - 1) - j : j; + + const auto& carEntry = rideEntry->Cars[RideEntryGetVehicleAtPosition( + ride->subtype, ride->num_cars_per_train, carIndex)]; + x += carEntry.spacing / 17432; + y -= (carEntry.spacing / 2) / 17432; + + // Get colour of vehicle + int32_t vehicleColourIndex = 0; + switch (ride->colour_scheme_type & 3) + { + case VEHICLE_COLOUR_SCHEME_SAME: + vehicleColourIndex = 0; + break; + case VEHICLE_COLOUR_SCHEME_PER_TRAIN: + vehicleColourIndex = i; + break; + case VEHICLE_COLOUR_SCHEME_PER_VEHICLE: + vehicleColourIndex = carIndex; + break; + } + VehicleColour vehicleColour = RideGetVehicleColour(*ride, vehicleColourIndex); + + ImageIndex imageIndex = carEntry.SpriteByYaw( + OpenRCT2::Entity::Yaw::BaseRotation / 2, SpriteGroupType::SlopeFlat); + if (isReversed) + { + auto baseRotation = carEntry.NumRotationSprites(SpriteGroupType::SlopeFlat); + imageIndex = carEntry.SpriteByYaw( + (imageIndex + (baseRotation / 2)) & (baseRotation - 1), SpriteGroupType::SlopeFlat); + } + + imageIndex &= carEntry.TabRotationMask; + imageIndex *= carEntry.base_num_frames; + imageIndex += carEntry.base_image_id; + + auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Tertiary); + + nextSpriteToDraw->x = x; + nextSpriteToDraw->y = y; + nextSpriteToDraw->imageId = imageId; + nextSpriteToDraw++; + + x += carEntry.spacing / 17432; + y -= (carEntry.spacing / 2) / 17432; + } + + if (ride->type == RIDE_TYPE_REVERSER_ROLLER_COASTER) + { + VehicleDrawInfo tmp = *(nextSpriteToDraw - 1); + *(nextSpriteToDraw - 1) = *(nextSpriteToDraw - 2); + *(nextSpriteToDraw - 2) = tmp; + } + + VehicleDrawInfo* current = nextSpriteToDraw; + while (--current >= trainCarImages) + GfxDrawSprite(dpi, current->imageId, { current->x, current->y }); + + startX += 36; + } } - } #pragma endregion #pragma region Operating - void ModeTweakIncrease() - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - const auto& operatingSettings = ride->GetRideTypeDescriptor().OperatingSettings; - uint8_t maxValue = operatingSettings.MaxValue; - uint8_t minValue = gCheatsUnlockOperatingLimits ? 0 : operatingSettings.MinValue; - - if (gCheatsUnlockOperatingLimits) + void ModeTweakIncrease() { - maxValue = OpenRCT2::Limits::CheatsMaxOperatingLimit; - } + auto ride = GetRide(rideId); + if (ride == nullptr) + return; - uint8_t increment = ride->mode == RideMode::Dodgems ? 10 : 1; + const auto& operatingSettings = ride->GetRideTypeDescriptor().OperatingSettings; + uint8_t maxValue = operatingSettings.MaxValue; + uint8_t minValue = GetGameState().Cheats.UnlockOperatingLimits ? 0 : operatingSettings.MinValue; - SetOperatingSetting( - rideId, RideSetSetting::Operation, std::clamp(ride->operation_option + increment, minValue, maxValue)); - } - - void ModeTweakDecrease() - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - const auto& operatingSettings = ride->GetRideTypeDescriptor().OperatingSettings; - uint8_t maxValue = operatingSettings.MaxValue; - uint8_t minValue = gCheatsUnlockOperatingLimits ? 0 : operatingSettings.MinValue; - if (gCheatsUnlockOperatingLimits) - { - maxValue = OpenRCT2::Limits::CheatsMaxOperatingLimit; - } - - uint8_t decrement = ride->mode == RideMode::Dodgems ? 10 : 1; - - SetOperatingSetting( - rideId, RideSetSetting::Operation, std::clamp(ride->operation_option - decrement, minValue, maxValue)); - } - - void ModeDropdown(Widget* widget) - { - Widget* dropdownWidget; - - dropdownWidget = widget - 1; - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto availableModes = ride->GetAvailableModes(); - - // Create dropdown list - auto numAvailableModes = 0; - auto checkedIndex = -1; - for (auto i = 0; i < static_cast(RideMode::Count); i++) - { - if (availableModes & (1uLL << i)) + if (GetGameState().Cheats.UnlockOperatingLimits) { - gDropdownItems[numAvailableModes].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[numAvailableModes].Args = RideModeNames[i]; + maxValue = OpenRCT2::Limits::CheatsMaxOperatingLimit; + } - if (ride->mode == static_cast(i)) - checkedIndex = numAvailableModes; + uint8_t increment = ride->mode == RideMode::Dodgems ? 10 : 1; - numAvailableModes++; + SetOperatingSetting( + rideId, RideSetSetting::Operation, std::clamp(ride->operation_option + increment, minValue, maxValue)); + } + + void ModeTweakDecrease() + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + const auto& operatingSettings = ride->GetRideTypeDescriptor().OperatingSettings; + uint8_t maxValue = operatingSettings.MaxValue; + uint8_t minValue = GetGameState().Cheats.UnlockOperatingLimits ? 0 : operatingSettings.MinValue; + if (GetGameState().Cheats.UnlockOperatingLimits) + { + maxValue = OpenRCT2::Limits::CheatsMaxOperatingLimit; + } + + uint8_t decrement = ride->mode == RideMode::Dodgems ? 10 : 1; + + SetOperatingSetting( + rideId, RideSetSetting::Operation, std::clamp(ride->operation_option - decrement, minValue, maxValue)); + } + + void ModeDropdown(Widget* widget) + { + Widget* dropdownWidget; + + dropdownWidget = widget - 1; + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto availableModes = ride->GetAvailableModes(); + + // Create dropdown list + auto numAvailableModes = 0; + auto checkedIndex = -1; + for (auto i = 0; i < static_cast(RideMode::Count); i++) + { + if (availableModes & (1uLL << i)) + { + gDropdownItems[numAvailableModes].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[numAvailableModes].Args = RideModeNames[i]; + + if (ride->mode == static_cast(i)) + checkedIndex = numAvailableModes; + + numAvailableModes++; + } + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, numAvailableModes, widget->right - dropdownWidget->left); + + if (checkedIndex != -1) + { + Dropdown::SetChecked(checkedIndex, true); } } - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], - 0, Dropdown::Flag::StayOpen, numAvailableModes, widget->right - dropdownWidget->left); - - if (checkedIndex != -1) + void LoadDropdown(Widget* widget) { - Dropdown::SetChecked(checkedIndex, true); - } - } - - void LoadDropdown(Widget* widget) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto dropdownWidget = widget - 1; - for (auto i = 0; i < 5; i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = 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); - - Dropdown::SetChecked(ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK, true); - } - - void OperatingOnMouseUp(WidgetIndex widgetIndex) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); + auto ride = GetRide(rideId); + if (ride == nullptr) return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - case WIDX_TAB_8: - case WIDX_TAB_9: - case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_LOAD_CHECKBOX: - SetOperatingSetting(rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_WAIT_FOR_LOAD); - break; - case WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX: - SetOperatingSetting( - rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_LEAVE_WHEN_ANOTHER_ARRIVES); - break; - case WIDX_MINIMUM_LENGTH_CHECKBOX: - SetOperatingSetting( - rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_WAIT_FOR_MINIMUM_LENGTH); - break; - case WIDX_MAXIMUM_LENGTH_CHECKBOX: - SetOperatingSetting( - rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_WAIT_FOR_MAXIMUM_LENGTH); - break; - case WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX: - SetOperatingSetting( - rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_SYNCHRONISE_WITH_ADJACENT_STATIONS); - break; - } - } - void OperatingResize() - { - WindowSetResize(*this, 316, 186, 316, 186); - } - - void OperatingOnMouseDown(WidgetIndex widgetIndex) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - uint8_t upperBound, lowerBound; - switch (widgetIndex) - { - case WIDX_MODE_TWEAK: - OperatingTweakTextInput(*ride); - break; - case WIDX_MODE_TWEAK_INCREASE: - ModeTweakIncrease(); - break; - case WIDX_MODE_TWEAK_DECREASE: - ModeTweakDecrease(); - break; - case WIDX_LIFT_HILL_SPEED_INCREASE: - upperBound = gCheatsUnlockOperatingLimits ? OpenRCT2::Limits::CheatsMaxOperatingLimit - : ride->GetRideTypeDescriptor().LiftData.maximum_speed; - lowerBound = gCheatsUnlockOperatingLimits ? 0 : ride->GetRideTypeDescriptor().LiftData.minimum_speed; - SetOperatingSetting( - rideId, RideSetSetting::LiftHillSpeed, - std::clamp(ride->lift_hill_speed + 1, lowerBound, upperBound)); - break; - case WIDX_LIFT_HILL_SPEED_DECREASE: - upperBound = gCheatsUnlockOperatingLimits ? OpenRCT2::Limits::CheatsMaxOperatingLimit - : ride->GetRideTypeDescriptor().LiftData.maximum_speed; - lowerBound = gCheatsUnlockOperatingLimits ? 0 : ride->GetRideTypeDescriptor().LiftData.minimum_speed; - SetOperatingSetting( - rideId, RideSetSetting::LiftHillSpeed, - std::clamp(ride->lift_hill_speed - 1, lowerBound, upperBound)); - break; - case WIDX_MINIMUM_LENGTH: - OperatingLengthWindow(WIDX_MINIMUM_LENGTH); - break; - case WIDX_MAXIMUM_LENGTH: - OperatingLengthWindow(WIDX_MAXIMUM_LENGTH); - break; - case WIDX_MINIMUM_LENGTH_INCREASE: - upperBound = OpenRCT2::Limits::MaxWaitingTime; - lowerBound = 0; - SetOperatingSetting( - rideId, RideSetSetting::MinWaitingTime, - std::clamp(ride->min_waiting_time + 1, lowerBound, upperBound)); - break; - case WIDX_MINIMUM_LENGTH_DECREASE: - upperBound = OpenRCT2::Limits::MaxWaitingTime; - lowerBound = 0; - SetOperatingSetting( - rideId, RideSetSetting::MinWaitingTime, - std::clamp(ride->min_waiting_time - 1, lowerBound, upperBound)); - break; - case WIDX_MAXIMUM_LENGTH_INCREASE: - upperBound = OpenRCT2::Limits::MaxWaitingTime; - lowerBound = 0; - SetOperatingSetting( - rideId, RideSetSetting::MaxWaitingTime, - std::clamp(ride->max_waiting_time + 1, lowerBound, upperBound)); - break; - case WIDX_MAXIMUM_LENGTH_DECREASE: - upperBound = OpenRCT2::Limits::MaxWaitingTime; - lowerBound = 0; - SetOperatingSetting( - rideId, RideSetSetting::MaxWaitingTime, - std::clamp(ride->max_waiting_time - 1, lowerBound, upperBound)); - break; - case WIDX_MODE_DROPDOWN: - ModeDropdown(&widgets[widgetIndex]); - break; - case WIDX_LOAD_DROPDOWN: - LoadDropdown(&widgets[widgetIndex]); - break; - case WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE: - upperBound = gCheatsUnlockOperatingLimits ? OpenRCT2::Limits::CheatsMaxOperatingLimit - : OpenRCT2::Limits::MaxCircuitsPerRide; - lowerBound = 1; - SetOperatingSetting( - rideId, RideSetSetting::NumCircuits, std::clamp(ride->num_circuits + 1, lowerBound, upperBound)); - break; - case WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE: - upperBound = gCheatsUnlockOperatingLimits ? OpenRCT2::Limits::CheatsMaxOperatingLimit - : OpenRCT2::Limits::MaxCircuitsPerRide; - lowerBound = 1; - SetOperatingSetting( - rideId, RideSetSetting::NumCircuits, std::clamp(ride->num_circuits - 1, lowerBound, upperBound)); - break; - } - } - - void OperatingLengthWindow(WidgetIndex widgetIndex) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - uint8_t upperBound = OpenRCT2::Limits::MaxWaitingTime; - uint8_t lowerBound = 0; - Formatter ft; - ft.Add(lowerBound); - ft.Add(upperBound); - auto title = (widgetIndex == WIDX_MINIMUM_LENGTH) ? STR_MINIMUM_WAITING_TIME : STR_MAXIMUM_WAITING_TIME; - auto currentValue = (widgetIndex == WIDX_MINIMUM_LENGTH) ? ride->min_waiting_time : ride->max_waiting_time; - char buffer[5]{}; - snprintf(buffer, std::size(buffer), "%u", currentValue); - WindowTextInputRawOpen(this, widgetIndex, title, STR_ENTER_VALUE, ft, buffer, 4); - } - - void OperatingTweakTextInput(const Ride& ride) - { - switch (ride.mode) - { - case RideMode::PoweredLaunchPasstrough: - case RideMode::PoweredLaunch: - case RideMode::UpwardLaunch: - case RideMode::PoweredLaunchBlockSectioned: - case RideMode::StationToStation: - case RideMode::Dodgems: - return; - default: - break; - } - - const auto& operatingSettings = ride.GetRideTypeDescriptor().OperatingSettings; - int16_t maxValue = gCheatsUnlockOperatingLimits ? OpenRCT2::Limits::CheatsMaxOperatingLimit - : operatingSettings.MaxValue; - int16_t minValue = gCheatsUnlockOperatingLimits ? 0 : operatingSettings.MinValue; - - const auto& title = widgets[WIDX_MODE_TWEAK_LABEL].text; - Formatter ft; - ft.Add(minValue * operatingSettings.OperatingSettingMultiplier); - ft.Add(maxValue * operatingSettings.OperatingSettingMultiplier); - - uint16_t currentValue = static_cast(ride.operation_option) * operatingSettings.OperatingSettingMultiplier; - char buffer[6]{}; - snprintf(buffer, std::size(buffer), "%u", currentValue); - - WindowTextInputRawOpen(this, WIDX_MODE_TWEAK, title, STR_ENTER_VALUE, ft, buffer, 4); - } - - void OperatingOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - if (dropdownIndex == -1) - return; - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - switch (widgetIndex) - { - case WIDX_MODE_DROPDOWN: + auto dropdownWidget = widget - 1; + for (auto i = 0; i < 5; i++) { - RideMode rideMode = RideMode::NullMode; - auto availableModes = ride->GetAvailableModes(); - auto modeInDropdownIndex = -1; - for (RideMode rideModeIndex = RideMode::Normal; rideModeIndex < RideMode::Count; rideModeIndex++) + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = 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); + + Dropdown::SetChecked(ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK, true); + } + + void OperatingOnMouseUp(WidgetIndex widgetIndex) + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + case WIDX_TAB_8: + case WIDX_TAB_9: + case WIDX_TAB_10: + SetPage(widgetIndex - WIDX_TAB_1); + break; + case WIDX_LOAD_CHECKBOX: + SetOperatingSetting(rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_WAIT_FOR_LOAD); + break; + case WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX: + SetOperatingSetting( + rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_LEAVE_WHEN_ANOTHER_ARRIVES); + break; + case WIDX_MINIMUM_LENGTH_CHECKBOX: + SetOperatingSetting( + rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_WAIT_FOR_MINIMUM_LENGTH); + break; + case WIDX_MAXIMUM_LENGTH_CHECKBOX: + SetOperatingSetting( + rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_WAIT_FOR_MAXIMUM_LENGTH); + break; + case WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX: + SetOperatingSetting( + rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_SYNCHRONISE_WITH_ADJACENT_STATIONS); + break; + } + } + + void OperatingResize() + { + WindowSetResize(*this, 316, 186, 316, 186); + } + + void OperatingOnMouseDown(WidgetIndex widgetIndex) + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + uint8_t upperBound, lowerBound; + switch (widgetIndex) + { + case WIDX_MODE_TWEAK: + OperatingTweakTextInput(*ride); + break; + case WIDX_MODE_TWEAK_INCREASE: + ModeTweakIncrease(); + break; + case WIDX_MODE_TWEAK_DECREASE: + ModeTweakDecrease(); + break; + case WIDX_LIFT_HILL_SPEED_INCREASE: + upperBound = GetGameState().Cheats.UnlockOperatingLimits + ? OpenRCT2::Limits::CheatsMaxOperatingLimit + : ride->GetRideTypeDescriptor().LiftData.maximum_speed; + lowerBound = GetGameState().Cheats.UnlockOperatingLimits + ? 0 + : ride->GetRideTypeDescriptor().LiftData.minimum_speed; + SetOperatingSetting( + rideId, RideSetSetting::LiftHillSpeed, + std::clamp(ride->lift_hill_speed + 1, lowerBound, upperBound)); + break; + case WIDX_LIFT_HILL_SPEED_DECREASE: + upperBound = GetGameState().Cheats.UnlockOperatingLimits + ? OpenRCT2::Limits::CheatsMaxOperatingLimit + : ride->GetRideTypeDescriptor().LiftData.maximum_speed; + lowerBound = GetGameState().Cheats.UnlockOperatingLimits + ? 0 + : ride->GetRideTypeDescriptor().LiftData.minimum_speed; + SetOperatingSetting( + rideId, RideSetSetting::LiftHillSpeed, + std::clamp(ride->lift_hill_speed - 1, lowerBound, upperBound)); + break; + case WIDX_MINIMUM_LENGTH: + OperatingLengthWindow(WIDX_MINIMUM_LENGTH); + break; + case WIDX_MAXIMUM_LENGTH: + OperatingLengthWindow(WIDX_MAXIMUM_LENGTH); + break; + case WIDX_MINIMUM_LENGTH_INCREASE: + upperBound = OpenRCT2::Limits::MaxWaitingTime; + lowerBound = 0; + SetOperatingSetting( + rideId, RideSetSetting::MinWaitingTime, + std::clamp(ride->min_waiting_time + 1, lowerBound, upperBound)); + break; + case WIDX_MINIMUM_LENGTH_DECREASE: + upperBound = OpenRCT2::Limits::MaxWaitingTime; + lowerBound = 0; + SetOperatingSetting( + rideId, RideSetSetting::MinWaitingTime, + std::clamp(ride->min_waiting_time - 1, lowerBound, upperBound)); + break; + case WIDX_MAXIMUM_LENGTH_INCREASE: + upperBound = OpenRCT2::Limits::MaxWaitingTime; + lowerBound = 0; + SetOperatingSetting( + rideId, RideSetSetting::MaxWaitingTime, + std::clamp(ride->max_waiting_time + 1, lowerBound, upperBound)); + break; + case WIDX_MAXIMUM_LENGTH_DECREASE: + upperBound = OpenRCT2::Limits::MaxWaitingTime; + lowerBound = 0; + SetOperatingSetting( + rideId, RideSetSetting::MaxWaitingTime, + std::clamp(ride->max_waiting_time - 1, lowerBound, upperBound)); + break; + case WIDX_MODE_DROPDOWN: + ModeDropdown(&widgets[widgetIndex]); + break; + case WIDX_LOAD_DROPDOWN: + LoadDropdown(&widgets[widgetIndex]); + break; + case WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE: + upperBound = GetGameState().Cheats.UnlockOperatingLimits ? OpenRCT2::Limits::CheatsMaxOperatingLimit + : OpenRCT2::Limits::MaxCircuitsPerRide; + lowerBound = 1; + SetOperatingSetting( + rideId, RideSetSetting::NumCircuits, + std::clamp(ride->num_circuits + 1, lowerBound, upperBound)); + break; + case WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE: + upperBound = GetGameState().Cheats.UnlockOperatingLimits ? OpenRCT2::Limits::CheatsMaxOperatingLimit + : OpenRCT2::Limits::MaxCircuitsPerRide; + lowerBound = 1; + SetOperatingSetting( + rideId, RideSetSetting::NumCircuits, + std::clamp(ride->num_circuits - 1, lowerBound, upperBound)); + break; + } + } + + void OperatingLengthWindow(WidgetIndex widgetIndex) + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + uint8_t upperBound = OpenRCT2::Limits::MaxWaitingTime; + uint8_t lowerBound = 0; + Formatter ft; + ft.Add(lowerBound); + ft.Add(upperBound); + auto title = (widgetIndex == WIDX_MINIMUM_LENGTH) ? STR_MINIMUM_WAITING_TIME : STR_MAXIMUM_WAITING_TIME; + auto currentValue = (widgetIndex == WIDX_MINIMUM_LENGTH) ? ride->min_waiting_time : ride->max_waiting_time; + char buffer[5]{}; + snprintf(buffer, std::size(buffer), "%u", currentValue); + WindowTextInputRawOpen(this, widgetIndex, title, STR_ENTER_VALUE, ft, buffer, 4); + } + + void OperatingTweakTextInput(const Ride& ride) + { + switch (ride.mode) + { + case RideMode::PoweredLaunchPasstrough: + case RideMode::PoweredLaunch: + case RideMode::UpwardLaunch: + case RideMode::PoweredLaunchBlockSectioned: + case RideMode::StationToStation: + case RideMode::Dodgems: + return; + default: + break; + } + + const auto& operatingSettings = ride.GetRideTypeDescriptor().OperatingSettings; + int16_t maxValue = GetGameState().Cheats.UnlockOperatingLimits ? OpenRCT2::Limits::CheatsMaxOperatingLimit + : operatingSettings.MaxValue; + int16_t minValue = GetGameState().Cheats.UnlockOperatingLimits ? 0 : operatingSettings.MinValue; + + const auto& title = widgets[WIDX_MODE_TWEAK_LABEL].text; + Formatter ft; + ft.Add(minValue * operatingSettings.OperatingSettingMultiplier); + ft.Add(maxValue * operatingSettings.OperatingSettingMultiplier); + + uint16_t currentValue = static_cast(ride.operation_option) * operatingSettings.OperatingSettingMultiplier; + char buffer[6]{}; + snprintf(buffer, std::size(buffer), "%u", currentValue); + + WindowTextInputRawOpen(this, WIDX_MODE_TWEAK, title, STR_ENTER_VALUE, ft, buffer, 4); + } + + void OperatingOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + if (dropdownIndex == -1) + return; + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + switch (widgetIndex) + { + case WIDX_MODE_DROPDOWN: { - if (availableModes & EnumToFlag(rideModeIndex)) + RideMode rideMode = RideMode::NullMode; + auto availableModes = ride->GetAvailableModes(); + auto modeInDropdownIndex = -1; + for (RideMode rideModeIndex = RideMode::Normal; rideModeIndex < RideMode::Count; rideModeIndex++) { - modeInDropdownIndex++; - if (modeInDropdownIndex == dropdownIndex) + if (availableModes & EnumToFlag(rideModeIndex)) { - rideMode = rideModeIndex; - break; + modeInDropdownIndex++; + if (modeInDropdownIndex == dropdownIndex) + { + rideMode = rideModeIndex; + break; + } } } + if (rideMode != RideMode::NullMode) + SetOperatingSetting(rideId, RideSetSetting::Mode, static_cast(rideMode)); + break; } - if (rideMode != RideMode::NullMode) - SetOperatingSetting(rideId, RideSetSetting::Mode, static_cast(rideMode)); - break; + case WIDX_LOAD_DROPDOWN: + SetOperatingSetting( + rideId, RideSetSetting::Departure, + (ride->depart_flags & ~RIDE_DEPART_WAIT_FOR_LOAD_MASK) | dropdownIndex); + break; } - case WIDX_LOAD_DROPDOWN: - SetOperatingSetting( - rideId, RideSetSetting::Departure, (ride->depart_flags & ~RIDE_DEPART_WAIT_FOR_LOAD_MASK) | dropdownIndex); - break; } - } - void OperatingUpdate() - { - frame_no++; - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_3); - - auto ride = GetRide(rideId); - if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_OPERATING) + void OperatingUpdate() { - ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_OPERATING; - Invalidate(); + frame_no++; + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_3); + + auto ride = GetRide(rideId); + if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_OPERATING) + { + ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_OPERATING; + Invalidate(); + } } - } - void OperatingOnTextInput(WidgetIndex widgetIndex, std::string_view text) - { - if (text.empty()) - return; - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - if (widgetIndex == WIDX_MODE_TWEAK) + void OperatingOnTextInput(WidgetIndex widgetIndex, std::string_view text) { - const auto& operatingSettings = ride->GetRideTypeDescriptor().OperatingSettings; - uint32_t maxValue = gCheatsUnlockOperatingLimits ? OpenRCT2::Limits::CheatsMaxOperatingLimit - : operatingSettings.MaxValue; - uint32_t minValue = gCheatsUnlockOperatingLimits ? 0 : operatingSettings.MinValue; + if (text.empty()) + return; + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + if (widgetIndex == WIDX_MODE_TWEAK) + { + const auto& operatingSettings = ride->GetRideTypeDescriptor().OperatingSettings; + uint32_t maxValue = GetGameState().Cheats.UnlockOperatingLimits ? OpenRCT2::Limits::CheatsMaxOperatingLimit + : operatingSettings.MaxValue; + uint32_t minValue = GetGameState().Cheats.UnlockOperatingLimits ? 0 : operatingSettings.MinValue; + auto multiplier = ride->GetRideTypeDescriptor().OperatingSettings.OperatingSettingMultiplier; + + try + { + uint32_t origSize = std::stol(std::string(text)) / multiplier; + uint8_t size = static_cast(std::clamp(origSize, minValue, maxValue)); + SetOperatingSetting(ride->id, RideSetSetting::Operation, size); + } + catch (const std::logic_error&) + { + // std::stol can throw std::out_of_range or std::invalid_argument + } + } + else if (widgetIndex == WIDX_MINIMUM_LENGTH || widgetIndex == WIDX_MAXIMUM_LENGTH) + { + try + { + auto rideSetSetting = widgetIndex == WIDX_MINIMUM_LENGTH ? RideSetSetting::MinWaitingTime + : RideSetSetting::MaxWaitingTime; + + uint16_t upperBound = OpenRCT2::Limits::MaxWaitingTime; + uint16_t lowerBound = 0; + uint16_t size = std::stol(std::string(text)); + size = std::clamp(size, lowerBound, upperBound); + SetOperatingSetting(ride->id, rideSetSetting, size); + } + catch (const std::logic_error&) + { + // std::stol can throw std::out_of_range or std::invalid_argument + } + } + } + + void OperatingOnPrepareDraw() + { + StringId format, caption, tooltip; + + auto* newWidgets = PageWidgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto ft = Formatter::Common(); + ride->FormatNameTo(ft); + + // Widget setup + pressed_widgets &= ~( + (1uLL << WIDX_LOAD_CHECKBOX) | (1uLL << WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX) + | (1uLL << WIDX_MINIMUM_LENGTH_CHECKBOX) | (1uLL << WIDX_MAXIMUM_LENGTH_CHECKBOX) + | (1uLL << WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX)); + + // Sometimes, only one of the alternatives support lift hill pieces. Make sure to check both. + bool hasAlternativeType = ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_ALTERNATIVE_TRACK_TYPE); + if (ride->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_LIFT_HILL) + || (hasAlternativeType + && GetRideTypeDescriptor(ride->GetRideTypeDescriptor().AlternateType).SupportsTrackPiece(TRACK_LIFT_HILL))) + { + widgets[WIDX_LIFT_HILL_SPEED_LABEL].type = WindowWidgetType::Label; + widgets[WIDX_LIFT_HILL_SPEED].type = WindowWidgetType::Spinner; + widgets[WIDX_LIFT_HILL_SPEED_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_LIFT_HILL_SPEED_DECREASE].type = WindowWidgetType::Button; + ft.Rewind(); + ft.Increment(20); + ft.Add(ride->lift_hill_speed); + } + else + { + widgets[WIDX_LIFT_HILL_SPEED_LABEL].type = WindowWidgetType::Empty; + widgets[WIDX_LIFT_HILL_SPEED].type = WindowWidgetType::Empty; + widgets[WIDX_LIFT_HILL_SPEED_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_LIFT_HILL_SPEED_DECREASE].type = WindowWidgetType::Empty; + } + + // Number of circuits + if (ride->CanHaveMultipleCircuits()) + { + widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_LABEL].type = WindowWidgetType::Label; + widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS].type = WindowWidgetType::Spinner; + widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE].type = WindowWidgetType::Button; + ft.Rewind(); + ft.Increment(22); + ft.Add(ride->num_circuits); + } + else + { + widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_LABEL].type = WindowWidgetType::Empty; + widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS].type = WindowWidgetType::Empty; + widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE].type = WindowWidgetType::Empty; + } + + // Leave if another vehicle arrives at station + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_LEAVE_WHEN_ANOTHER_VEHICLE_ARRIVES_AT_STATION) + && ride->NumTrains > 1 && !ride->IsBlockSectioned()) + { + widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].type = WindowWidgetType::Checkbox; + widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].tooltip = STR_LEAVE_IF_ANOTHER_VEHICLE_ARRIVES_TIP; + widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].text = ride->GetRideTypeDescriptor().NameConvention.vehicle + == RideComponentType::Boat + ? STR_LEAVE_IF_ANOTHER_BOAT_ARRIVES + : STR_LEAVE_IF_ANOTHER_TRAIN_ARRIVES; + } + else + { + widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].type = WindowWidgetType::Empty; + } + + // Synchronise with adjacent stations + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_CAN_SYNCHRONISE_ADJACENT_STATIONS)) + { + widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].type = WindowWidgetType::Checkbox; + widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].text = STR_SYNCHRONISE_WITH_ADJACENT_STATIONS; + widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].tooltip = STR_SYNCHRONISE_WITH_ADJACENT_STATIONS_TIP; + } + else + { + widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].type = WindowWidgetType::Empty; + } + + // Mode + widgets[WIDX_MODE].text = RideModeNames[EnumValue(ride->mode)]; + + // Waiting + widgets[WIDX_LOAD].text = VehicleLoadNames[(ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK)]; + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_LOAD_OPTIONS)) + { + widgets[WIDX_LOAD_CHECKBOX].type = WindowWidgetType::Checkbox; + widgets[WIDX_LOAD].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_LOAD_DROPDOWN].type = WindowWidgetType::Button; + + widgets[WIDX_MINIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Checkbox; + widgets[WIDX_MINIMUM_LENGTH].type = WindowWidgetType::Spinner; + widgets[WIDX_MINIMUM_LENGTH_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_MINIMUM_LENGTH_DECREASE].type = WindowWidgetType::Button; + + widgets[WIDX_MAXIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Checkbox; + widgets[WIDX_MAXIMUM_LENGTH].type = WindowWidgetType::Spinner; + widgets[WIDX_MAXIMUM_LENGTH_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_MAXIMUM_LENGTH_DECREASE].type = WindowWidgetType::Button; + + ft.Rewind(); + ft.Increment(10); + ft.Add(STR_FORMAT_SECONDS); + ft.Add(ride->min_waiting_time); + ft.Add(STR_FORMAT_SECONDS); + ft.Add(ride->max_waiting_time); + + if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD) + pressed_widgets |= (1uLL << WIDX_LOAD_CHECKBOX); + } + else + { + widgets[WIDX_LOAD_CHECKBOX].type = WindowWidgetType::Empty; + widgets[WIDX_LOAD].type = WindowWidgetType::Empty; + widgets[WIDX_LOAD_DROPDOWN].type = WindowWidgetType::Empty; + + widgets[WIDX_MINIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Empty; + widgets[WIDX_MINIMUM_LENGTH].type = WindowWidgetType::Empty; + widgets[WIDX_MINIMUM_LENGTH_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_MINIMUM_LENGTH_DECREASE].type = WindowWidgetType::Empty; + + widgets[WIDX_MAXIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Empty; + widgets[WIDX_MAXIMUM_LENGTH].type = WindowWidgetType::Empty; + widgets[WIDX_MAXIMUM_LENGTH_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_MAXIMUM_LENGTH_DECREASE].type = WindowWidgetType::Empty; + } + + if (ride->depart_flags & RIDE_DEPART_LEAVE_WHEN_ANOTHER_ARRIVES) + pressed_widgets |= (1uLL << WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX); + if (ride->depart_flags & RIDE_DEPART_SYNCHRONISE_WITH_ADJACENT_STATIONS) + pressed_widgets |= (1uLL << WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX); + if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_MINIMUM_LENGTH) + pressed_widgets |= (1uLL << WIDX_MINIMUM_LENGTH_CHECKBOX); + if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_MAXIMUM_LENGTH) + pressed_widgets |= (1uLL << WIDX_MAXIMUM_LENGTH_CHECKBOX); + + // Mode specific functionality auto multiplier = ride->GetRideTypeDescriptor().OperatingSettings.OperatingSettingMultiplier; - - try - { - uint32_t origSize = std::stol(std::string(text)) / multiplier; - uint8_t size = static_cast(std::clamp(origSize, minValue, maxValue)); - SetOperatingSetting(ride->id, RideSetSetting::Operation, size); - } - catch (const std::logic_error&) - { - // std::stol can throw std::out_of_range or std::invalid_argument - } - } - else if (widgetIndex == WIDX_MINIMUM_LENGTH || widgetIndex == WIDX_MAXIMUM_LENGTH) - { - try - { - auto rideSetSetting = widgetIndex == WIDX_MINIMUM_LENGTH ? RideSetSetting::MinWaitingTime - : RideSetSetting::MaxWaitingTime; - - uint16_t upperBound = OpenRCT2::Limits::MaxWaitingTime; - uint16_t lowerBound = 0; - uint16_t size = std::stol(std::string(text)); - size = std::clamp(size, lowerBound, upperBound); - SetOperatingSetting(ride->id, rideSetSetting, size); - } - catch (const std::logic_error&) - { - // std::stol can throw std::out_of_range or std::invalid_argument - } - } - } - - void OperatingOnPrepareDraw() - { - StringId format, caption, tooltip; - - auto* newWidgets = PageWidgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - InitScrollWidgets(); - } - - SetPressedTab(); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto ft = Formatter::Common(); - ride->FormatNameTo(ft); - - // Widget setup - pressed_widgets &= ~( - (1uLL << WIDX_LOAD_CHECKBOX) | (1uLL << WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX) - | (1uLL << WIDX_MINIMUM_LENGTH_CHECKBOX) | (1uLL << WIDX_MAXIMUM_LENGTH_CHECKBOX) - | (1uLL << WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX)); - - // Sometimes, only one of the alternatives support lift hill pieces. Make sure to check both. - bool hasAlternativeType = ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_ALTERNATIVE_TRACK_TYPE); - if (ride->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_LIFT_HILL) - || (hasAlternativeType - && GetRideTypeDescriptor(ride->GetRideTypeDescriptor().AlternateType).SupportsTrackPiece(TRACK_LIFT_HILL))) - { - widgets[WIDX_LIFT_HILL_SPEED_LABEL].type = WindowWidgetType::Label; - widgets[WIDX_LIFT_HILL_SPEED].type = WindowWidgetType::Spinner; - widgets[WIDX_LIFT_HILL_SPEED_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_LIFT_HILL_SPEED_DECREASE].type = WindowWidgetType::Button; ft.Rewind(); - ft.Increment(20); - ft.Add(ride->lift_hill_speed); + ft.Increment(18); + ft.Add(static_cast(ride->operation_option) * multiplier); + switch (ride->mode) + { + case RideMode::PoweredLaunchPasstrough: + case RideMode::PoweredLaunch: + case RideMode::UpwardLaunch: + case RideMode::PoweredLaunchBlockSectioned: + ft.Rewind(); + ft.Increment(18); + ft.Add((ride->launch_speed * 9) / 4); + format = STR_RIDE_MODE_SPEED_VALUE; + caption = STR_LAUNCH_SPEED; + tooltip = STR_LAUNCH_SPEED_TIP; + break; + case RideMode::StationToStation: + ft.Rewind(); + ft.Increment(18); + ft.Add((ride->speed * 9) / 4); + format = STR_RIDE_MODE_SPEED_VALUE; + caption = STR_SPEED; + tooltip = STR_SPEED_TIP; + break; + case RideMode::Race: + ft.Rewind(); + ft.Increment(18); + ft.Add(ride->NumLaps); + format = STR_NUMBER_OF_LAPS_VALUE; + caption = STR_NUMBER_OF_LAPS; + tooltip = STR_NUMBER_OF_LAPS_TIP; + break; + case RideMode::Dodgems: + format = STR_RIDE_MODE_TIME_LIMIT_VALUE; + caption = STR_TIME_LIMIT; + tooltip = STR_TIME_LIMIT_TIP; + break; + case RideMode::Swing: + format = STR_RIDE_MODE_NUMBER_OF_SWINGS_VALUE; + caption = STR_NUMBER_OF_SWINGS; + tooltip = STR_NUMBER_OF_SWINGS_TIP; + break; + case RideMode::Rotation: + case RideMode::ForwardRotation: + case RideMode::BackwardRotation: + format = STR_NUMBER_OF_ROTATIONS_VALUE; + caption = STR_NUMBER_OF_ROTATIONS; + tooltip = STR_NUMBER_OF_ROTATIONS_TIP; + break; + default: + format = STR_MAX_PEOPLE_ON_RIDE_VALUE; + caption = STR_MAX_PEOPLE_ON_RIDE; + tooltip = STR_MAX_PEOPLE_ON_RIDE_TIP; + if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)) + format = 0; + break; + } + + if (format != 0) + { + widgets[WIDX_MODE_TWEAK_LABEL].type = WindowWidgetType::Label; + widgets[WIDX_MODE_TWEAK_LABEL].text = caption; + widgets[WIDX_MODE_TWEAK_LABEL].tooltip = tooltip; + widgets[WIDX_MODE_TWEAK].type = WindowWidgetType::Spinner; + widgets[WIDX_MODE_TWEAK].text = format; + widgets[WIDX_MODE_TWEAK_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_MODE_TWEAK_DECREASE].type = WindowWidgetType::Button; + pressed_widgets &= ~(1uLL << WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX); + } + else + { + widgets[WIDX_MODE_TWEAK_LABEL].type = WindowWidgetType::Empty; + widgets[WIDX_MODE_TWEAK].type = WindowWidgetType::Empty; + widgets[WIDX_MODE_TWEAK_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_MODE_TWEAK_DECREASE].type = WindowWidgetType::Empty; + } + + AnchorBorderWidgets(); + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); } - else + + void OperatingOnDraw(DrawPixelInfo& dpi) { - widgets[WIDX_LIFT_HILL_SPEED_LABEL].type = WindowWidgetType::Empty; - widgets[WIDX_LIFT_HILL_SPEED].type = WindowWidgetType::Empty; - widgets[WIDX_LIFT_HILL_SPEED_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_LIFT_HILL_SPEED_DECREASE].type = WindowWidgetType::Empty; + DrawWidgets(dpi); + DrawTabImages(dpi); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + // Horizontal rule between mode settings and depart settings + GfxFillRectInset( + dpi, + { windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, 103 }, + windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].right - 5, 104 } }, + colours[1], INSET_RECT_FLAG_BORDER_INSET); + + // Number of block sections + if (ride->IsBlockSectioned()) + { + auto ft = Formatter(); + ft.Add(ride->num_block_brakes + ride->num_stations); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 21, ride->mode == RideMode::PoweredLaunchBlockSectioned ? 89 : 61 }, + STR_BLOCK_SECTIONS, ft, COLOUR_BLACK); + } } - // Number of circuits - if (ride->CanHaveMultipleCircuits()) - { - widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_LABEL].type = WindowWidgetType::Label; - widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS].type = WindowWidgetType::Spinner; - widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE].type = WindowWidgetType::Button; - ft.Rewind(); - ft.Increment(22); - ft.Add(ride->num_circuits); - } - else - { - widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_LABEL].type = WindowWidgetType::Empty; - widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS].type = WindowWidgetType::Empty; - widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE].type = WindowWidgetType::Empty; - } - - // Leave if another vehicle arrives at station - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_LEAVE_WHEN_ANOTHER_VEHICLE_ARRIVES_AT_STATION) - && ride->NumTrains > 1 && !ride->IsBlockSectioned()) - { - widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].type = WindowWidgetType::Checkbox; - widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].tooltip = STR_LEAVE_IF_ANOTHER_VEHICLE_ARRIVES_TIP; - widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].text = ride->GetRideTypeDescriptor().NameConvention.vehicle - == RideComponentType::Boat - ? STR_LEAVE_IF_ANOTHER_BOAT_ARRIVES - : STR_LEAVE_IF_ANOTHER_TRAIN_ARRIVES; - } - else - { - widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].type = WindowWidgetType::Empty; - } - - // Synchronise with adjacent stations - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_CAN_SYNCHRONISE_ADJACENT_STATIONS)) - { - widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].type = WindowWidgetType::Checkbox; - widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].text = STR_SYNCHRONISE_WITH_ADJACENT_STATIONS; - widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].tooltip = STR_SYNCHRONISE_WITH_ADJACENT_STATIONS_TIP; - } - else - { - widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].type = WindowWidgetType::Empty; - } - - // Mode - widgets[WIDX_MODE].text = RideModeNames[static_cast(ride->mode)]; - - // Waiting - widgets[WIDX_LOAD].text = VehicleLoadNames[(ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK)]; - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_LOAD_OPTIONS)) - { - widgets[WIDX_LOAD_CHECKBOX].type = WindowWidgetType::Checkbox; - widgets[WIDX_LOAD].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_LOAD_DROPDOWN].type = WindowWidgetType::Button; - - widgets[WIDX_MINIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Checkbox; - widgets[WIDX_MINIMUM_LENGTH].type = WindowWidgetType::Spinner; - widgets[WIDX_MINIMUM_LENGTH_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_MINIMUM_LENGTH_DECREASE].type = WindowWidgetType::Button; - - widgets[WIDX_MAXIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Checkbox; - widgets[WIDX_MAXIMUM_LENGTH].type = WindowWidgetType::Spinner; - widgets[WIDX_MAXIMUM_LENGTH_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_MAXIMUM_LENGTH_DECREASE].type = WindowWidgetType::Button; - - ft.Rewind(); - ft.Increment(10); - ft.Add(STR_FORMAT_SECONDS); - ft.Add(ride->min_waiting_time); - ft.Add(STR_FORMAT_SECONDS); - ft.Add(ride->max_waiting_time); - - if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD) - pressed_widgets |= (1uLL << WIDX_LOAD_CHECKBOX); - } - else - { - widgets[WIDX_LOAD_CHECKBOX].type = WindowWidgetType::Empty; - widgets[WIDX_LOAD].type = WindowWidgetType::Empty; - widgets[WIDX_LOAD_DROPDOWN].type = WindowWidgetType::Empty; - - widgets[WIDX_MINIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Empty; - widgets[WIDX_MINIMUM_LENGTH].type = WindowWidgetType::Empty; - widgets[WIDX_MINIMUM_LENGTH_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_MINIMUM_LENGTH_DECREASE].type = WindowWidgetType::Empty; - - widgets[WIDX_MAXIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Empty; - widgets[WIDX_MAXIMUM_LENGTH].type = WindowWidgetType::Empty; - widgets[WIDX_MAXIMUM_LENGTH_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_MAXIMUM_LENGTH_DECREASE].type = WindowWidgetType::Empty; - } - - if (ride->depart_flags & RIDE_DEPART_LEAVE_WHEN_ANOTHER_ARRIVES) - pressed_widgets |= (1uLL << WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX); - if (ride->depart_flags & RIDE_DEPART_SYNCHRONISE_WITH_ADJACENT_STATIONS) - pressed_widgets |= (1uLL << WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX); - if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_MINIMUM_LENGTH) - pressed_widgets |= (1uLL << WIDX_MINIMUM_LENGTH_CHECKBOX); - if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_MAXIMUM_LENGTH) - pressed_widgets |= (1uLL << WIDX_MAXIMUM_LENGTH_CHECKBOX); - - // Mode specific functionality - auto multiplier = ride->GetRideTypeDescriptor().OperatingSettings.OperatingSettingMultiplier; - ft.Rewind(); - ft.Increment(18); - ft.Add(static_cast(ride->operation_option) * multiplier); - switch (ride->mode) - { - case RideMode::PoweredLaunchPasstrough: - case RideMode::PoweredLaunch: - case RideMode::UpwardLaunch: - case RideMode::PoweredLaunchBlockSectioned: - ft.Rewind(); - ft.Increment(18); - ft.Add((ride->launch_speed * 9) / 4); - format = STR_RIDE_MODE_SPEED_VALUE; - caption = STR_LAUNCH_SPEED; - tooltip = STR_LAUNCH_SPEED_TIP; - break; - case RideMode::StationToStation: - ft.Rewind(); - ft.Increment(18); - ft.Add((ride->speed * 9) / 4); - format = STR_RIDE_MODE_SPEED_VALUE; - caption = STR_SPEED; - tooltip = STR_SPEED_TIP; - break; - case RideMode::Race: - ft.Rewind(); - ft.Increment(18); - ft.Add(ride->NumLaps); - format = STR_NUMBER_OF_LAPS_VALUE; - caption = STR_NUMBER_OF_LAPS; - tooltip = STR_NUMBER_OF_LAPS_TIP; - break; - case RideMode::Dodgems: - format = STR_RIDE_MODE_TIME_LIMIT_VALUE; - caption = STR_TIME_LIMIT; - tooltip = STR_TIME_LIMIT_TIP; - break; - case RideMode::Swing: - format = STR_RIDE_MODE_NUMBER_OF_SWINGS_VALUE; - caption = STR_NUMBER_OF_SWINGS; - tooltip = STR_NUMBER_OF_SWINGS_TIP; - break; - case RideMode::Rotation: - case RideMode::ForwardRotation: - case RideMode::BackwardRotation: - format = STR_NUMBER_OF_ROTATIONS_VALUE; - caption = STR_NUMBER_OF_ROTATIONS; - tooltip = STR_NUMBER_OF_ROTATIONS_TIP; - break; - default: - format = STR_MAX_PEOPLE_ON_RIDE_VALUE; - caption = STR_MAX_PEOPLE_ON_RIDE; - tooltip = STR_MAX_PEOPLE_ON_RIDE_TIP; - if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)) - format = 0; - break; - } - - if (format != 0) - { - widgets[WIDX_MODE_TWEAK_LABEL].type = WindowWidgetType::Label; - widgets[WIDX_MODE_TWEAK_LABEL].text = caption; - widgets[WIDX_MODE_TWEAK_LABEL].tooltip = tooltip; - widgets[WIDX_MODE_TWEAK].type = WindowWidgetType::Spinner; - widgets[WIDX_MODE_TWEAK].text = format; - widgets[WIDX_MODE_TWEAK_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_MODE_TWEAK_DECREASE].type = WindowWidgetType::Button; - pressed_widgets &= ~(1uLL << WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX); - } - else - { - widgets[WIDX_MODE_TWEAK_LABEL].type = WindowWidgetType::Empty; - widgets[WIDX_MODE_TWEAK].type = WindowWidgetType::Empty; - widgets[WIDX_MODE_TWEAK_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_MODE_TWEAK_DECREASE].type = WindowWidgetType::Empty; - } - - AnchorBorderWidgets(); - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); - } - - void OperatingOnDraw(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - // Horizontal rule between mode settings and depart settings - GfxFillRectInset( - dpi, - { windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, 103 }, - windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].right - 5, 104 } }, - colours[1], INSET_RECT_FLAG_BORDER_INSET); - - // Number of block sections - if (ride->IsBlockSectioned()) - { - auto ft = Formatter(); - ft.Add(ride->num_block_brakes + ride->num_stations); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 21, ride->mode == RideMode::PoweredLaunchBlockSectioned ? 89 : 61 }, - STR_BLOCK_SECTIONS, ft, COLOUR_BLACK); - } - } - #pragma endregion #pragma region Maintenance - void LocateMechanic() - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - // First check if there is a mechanic assigned - Peep* mechanic = RideGetAssignedMechanic(*ride); - - // Otherwise find the closest mechanic - if (mechanic == nullptr) - mechanic = RideFindClosestMechanic(*ride, 1); - - if (mechanic == nullptr) - ContextShowError(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE, {}); - else + void LocateMechanic() { - auto intent = Intent(WindowClass::Peep); - intent.PutExtra(INTENT_EXTRA_PEEP, mechanic); - ContextOpenIntent(&intent); - } - } - - void MaintenanceDrawBar(DrawPixelInfo& dpi, const ScreenCoordsXY& coords, int32_t value, int32_t colour) const - { - GfxFillRectInset(dpi, { coords, coords + ScreenCoordsXY{ 149, 8 } }, colours[1], INSET_RECT_F_30); - if (colour & BAR_BLINK) - { - colour &= ~BAR_BLINK; - if (GameIsNotPaused() && (gCurrentRealTimeTicks & 8)) + auto ride = GetRide(rideId); + if (ride == nullptr) return; + + // First check if there is a mechanic assigned + Peep* mechanic = RideGetAssignedMechanic(*ride); + + // Otherwise find the closest mechanic + if (mechanic == nullptr) + mechanic = RideFindClosestMechanic(*ride, 1); + + if (mechanic == nullptr) + ContextShowError(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE, {}); + else + { + auto intent = Intent(WindowClass::Peep); + intent.PutExtra(INTENT_EXTRA_PEEP, mechanic); + ContextOpenIntent(&intent); + } } - value = ((186 * ((value * 2) & 0xFF)) >> 8) & 0xFF; - if (value > 2) + void MaintenanceDrawBar(DrawPixelInfo& dpi, const ScreenCoordsXY& coords, int32_t value, int32_t colour) const { - GfxFillRectInset(dpi, { coords + ScreenCoordsXY{ 2, 1 }, coords + ScreenCoordsXY{ value + 1, 7 } }, colour, 0); + GfxFillRectInset(dpi, { coords, coords + ScreenCoordsXY{ 149, 8 } }, colours[1], INSET_RECT_F_30); + if (colour & kBarBlink) + { + colour &= ~kBarBlink; + if (GameIsNotPaused() && (gCurrentRealTimeTicks & 8)) + return; + } + + value = ((186 * ((value * 2) & 0xFF)) >> 8) & 0xFF; + if (value > 2) + { + GfxFillRectInset(dpi, { coords + ScreenCoordsXY{ 2, 1 }, coords + ScreenCoordsXY{ value + 1, 7 } }, colour, 0); + } } - } - void MaintenanceOnMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void MaintenanceOnMouseUp(WidgetIndex widgetIndex) { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - case WIDX_TAB_8: - case WIDX_TAB_9: - case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_LOCATE_MECHANIC: - LocateMechanic(); - break; - case WIDX_REFURBISH_RIDE: - ContextOpenDetailWindow(WD_REFURBISH_RIDE, number); - break; - } - } - - void MaintenanceResize() - { - WindowSetResize(*this, 316, 135, 316, 135); - } - - void MaintenanceOnMouseDown(WidgetIndex widgetIndex) - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr) - return; - - Widget* dropdownWidget = &widgets[widgetIndex]; - int32_t j, numItems; - - switch (widgetIndex) - { - case WIDX_INSPECTION_INTERVAL_DROPDOWN: - dropdownWidget--; - for (int32_t i = 0; i < 7; i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = RideInspectionIntervalNames[i]; - } - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, 7, widgets[widgetIndex].right - dropdownWidget->left); - - Dropdown::SetChecked(ride->inspection_interval, true); - break; - - case WIDX_FORCE_BREAKDOWN: - numItems = 1; - for (j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++) - { - if (rideEntry->ride_type[j] != RIDE_TYPE_NULL) - break; - } - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_DEBUG_FIX_RIDE; - for (int32_t i = 0; i < 8; i++) - { - assert(j < static_cast(std::size(rideEntry->ride_type))); - if (GetRideTypeDescriptor(rideEntry->ride_type[j]).AvailableBreakdowns & static_cast(1 << i)) - { - if (i == BREAKDOWN_BRAKES_FAILURE && ride->IsBlockSectioned()) - { - if (ride->NumTrains != 1) - continue; - } - gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[numItems].Args = RideBreakdownReasonNames[i]; - numItems++; - } - } - if (numItems == 1) - { - ContextShowError(STR_DEBUG_NO_BREAKDOWNS_AVAILABLE, STR_NONE, {}); - } - else - { - WindowDropdownShowText( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], Dropdown::Flag::StayOpen, numItems); - - numItems = 1; - int32_t breakdownReason = ride->breakdown_reason_pending; - if (breakdownReason != BREAKDOWN_NONE && (ride->lifecycle_flags & RIDE_LIFECYCLE_BREAKDOWN_PENDING)) - { - for (int32_t i = 0; i < 8; i++) - { - if (GetRideTypeDescriptor(rideEntry->ride_type[j]).AvailableBreakdowns - & static_cast(1 << i)) - { - if (i == BREAKDOWN_BRAKES_FAILURE && ride->IsBlockSectioned()) - { - if (ride->NumTrains != 1) - continue; - } - if (i == breakdownReason) - { - Dropdown::SetChecked(numItems, true); - break; - } - gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[numItems].Args = RideBreakdownReasonNames[i]; - numItems++; - } - } - } - - if ((ride->lifecycle_flags & RIDE_LIFECYCLE_BREAKDOWN_PENDING) == 0) - { - Dropdown::SetDisabled(0, true); - } - } - break; - } - } - - void MaintenanceOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - if (dropdownIndex == -1) - return; - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr) - return; - - switch (widgetIndex) - { - case WIDX_INSPECTION_INTERVAL_DROPDOWN: - SetOperatingSetting(rideId, RideSetSetting::InspectionInterval, dropdownIndex); - break; - - case WIDX_FORCE_BREAKDOWN: - if (dropdownIndex == 0) - { - Vehicle* vehicle; - switch (ride->breakdown_reason_pending) - { - case BREAKDOWN_SAFETY_CUT_OUT: - if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) - break; - for (int32_t i = 0; i < ride->NumTrains; ++i) - { - for (vehicle = GetEntity(ride->vehicles[i]); vehicle != nullptr; - vehicle = GetEntity(vehicle->next_vehicle_on_train)) - { - vehicle->ClearFlag( - VehicleFlags::CarIsBroken | VehicleFlags::StoppedOnLift | VehicleFlags::TrainIsBroken); - } - } - break; - case BREAKDOWN_RESTRAINTS_STUCK_CLOSED: - case BREAKDOWN_RESTRAINTS_STUCK_OPEN: - case BREAKDOWN_DOORS_STUCK_CLOSED: - case BREAKDOWN_DOORS_STUCK_OPEN: - vehicle = GetEntity(ride->vehicles[ride->broken_vehicle]); - if (vehicle != nullptr) - { - vehicle->ClearFlag(VehicleFlags::CarIsBroken); - } - break; - case BREAKDOWN_VEHICLE_MALFUNCTION: - vehicle = GetEntity(ride->vehicles[ride->broken_vehicle]); - if (vehicle != nullptr) - { - vehicle->ClearFlag(VehicleFlags::TrainIsBroken); - } - break; - } - ride->lifecycle_flags &= ~(RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN); - WindowInvalidateByNumber(WindowClass::Ride, number); + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + case WIDX_TAB_8: + case WIDX_TAB_9: + case WIDX_TAB_10: + SetPage(widgetIndex - WIDX_TAB_1); break; - } - if (ride->lifecycle_flags - & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) - { - ContextShowError(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_ALREADY_BROKEN, {}); - } - else if (ride->status == RideStatus::Closed) - { - ContextShowError(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_IS_CLOSED, {}); - } - else - { - int32_t j; + case WIDX_LOCATE_MECHANIC: + LocateMechanic(); + break; + case WIDX_REFURBISH_RIDE: + ContextOpenDetailWindow(WD_REFURBISH_RIDE, number); + break; + } + } + + void MaintenanceResize() + { + WindowSetResize(*this, 316, 135, 316, 135); + } + + void MaintenanceOnMouseDown(WidgetIndex widgetIndex) + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr) + return; + + Widget* dropdownWidget = &widgets[widgetIndex]; + int32_t j, numItems; + + switch (widgetIndex) + { + case WIDX_INSPECTION_INTERVAL_DROPDOWN: + dropdownWidget--; + for (int32_t i = 0; i < 7; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = RideInspectionIntervalNames[i]; + } + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, 7, widgets[widgetIndex].right - dropdownWidget->left); + + Dropdown::SetChecked(ride->inspection_interval, true); + break; + + case WIDX_FORCE_BREAKDOWN: + numItems = 1; for (j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++) { if (rideEntry->ride_type[j] != RIDE_TYPE_NULL) break; } - int32_t i; - int32_t numItems = 1; - for (i = 0; i < BREAKDOWN_COUNT; i++) + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_DEBUG_FIX_RIDE; + for (int32_t i = 0; i < 8; i++) { assert(j < static_cast(std::size(rideEntry->ride_type))); if (GetRideTypeDescriptor(rideEntry->ride_type[j]).AvailableBreakdowns & static_cast(1 << i)) @@ -3862,1441 +3737,2806 @@ private: if (ride->NumTrains != 1) continue; } - if (numItems == dropdownIndex) - break; + gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[numItems].Args = RideBreakdownReasonNames[i]; numItems++; } } - RidePrepareBreakdown(*ride, i); - } - break; - } - } - - void MaintenanceUpdate() - { - frame_no++; - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_4); - - auto ride = GetRide(rideId); - if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_MAINTENANCE) - { - ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_MAINTENANCE; - Invalidate(); - } - } - - void MaintenanceOnPrepareDraw() - { - auto newWidgets = PageWidgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - InitScrollWidgets(); - } - - SetPressedTab(); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto ft = Formatter::Common(); - ride->FormatNameTo(ft); - - widgets[WIDX_INSPECTION_INTERVAL].text = RideInspectionIntervalNames[ride->inspection_interval]; - - AnchorBorderWidgets(); - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); - - if (gConfigGeneral.DebuggingTools && NetworkGetMode() == NETWORK_MODE_NONE) - { - widgets[WIDX_FORCE_BREAKDOWN].type = WindowWidgetType::FlatBtn; - } - else - { - widgets[WIDX_FORCE_BREAKDOWN].type = WindowWidgetType::Empty; - } - - if (ride->GetRideTypeDescriptor().AvailableBreakdowns == 0 - || !(ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED)) - { - disabled_widgets |= (1uLL << WIDX_REFURBISH_RIDE); - widgets[WIDX_REFURBISH_RIDE].tooltip = STR_CANT_REFURBISH_NOT_NEEDED; - } - else - { - disabled_widgets &= ~(1uLL << WIDX_REFURBISH_RIDE); - widgets[WIDX_REFURBISH_RIDE].tooltip = STR_REFURBISH_RIDE_TIP; - } - } - - void MaintenanceOnDraw(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - // Locate mechanic button image - Widget* widget = &widgets[WIDX_LOCATE_MECHANIC]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; - auto image = ImageId(SPR_MECHANIC, COLOUR_BLACK, GetGameState().StaffMechanicColour); - GfxDrawSprite(dpi, image, screenCoords); - - // Inspection label - widget = &widgets[WIDX_INSPECTION_INTERVAL]; - screenCoords = windowPos + ScreenCoordsXY{ 4, widget->top + 1 }; - DrawTextBasic(dpi, screenCoords, STR_INSPECTION); - - // Reliability - widget = &widgets[WIDX_PAGE_BACKGROUND]; - screenCoords = windowPos + ScreenCoordsXY{ widget->left + 4, widget->top + 4 }; - - uint16_t reliability = ride->reliability_percentage; - auto ft = Formatter(); - ft.Add(reliability); - DrawTextBasic(dpi, screenCoords, STR_RELIABILITY_LABEL_1757, ft); - MaintenanceDrawBar( - dpi, screenCoords + ScreenCoordsXY{ 103, 0 }, std::max(10, reliability), COLOUR_BRIGHT_GREEN); - screenCoords.y += 11; - - uint16_t downTime = ride->downtime; - ft = Formatter(); - ft.Add(downTime); - DrawTextBasic(dpi, screenCoords, STR_DOWN_TIME_LABEL_1889, ft); - MaintenanceDrawBar(dpi, screenCoords + ScreenCoordsXY{ 103, 0 }, downTime, COLOUR_BRIGHT_RED); - screenCoords.y += 26; - - // Last inspection - StringId stringId; - if (ride->last_inspection <= 1) - stringId = STR_TIME_SINCE_LAST_INSPECTION_MINUTE; - else if (ride->last_inspection <= 240) - stringId = STR_TIME_SINCE_LAST_INSPECTION_MINUTES; - else - stringId = STR_TIME_SINCE_LAST_INSPECTION_MORE_THAN_4_HOURS; - - ft = Formatter(); - ft.Add(ride->last_inspection); - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += 12; - - // Last / current breakdown - if (ride->breakdown_reason == BREAKDOWN_NONE) - return; - - stringId = (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) ? STR_CURRENT_BREAKDOWN : STR_LAST_BREAKDOWN; - ft = Formatter(); - ft.Add(RideBreakdownReasonNames[ride->breakdown_reason]); - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += 12; - - // Mechanic status - if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) - { - switch (ride->mechanic_status) - { - case RIDE_MECHANIC_STATUS_CALLING: - { - stringId = STR_NO_MECHANICS_ARE_HIRED_MESSAGE; - - for (auto peep : EntityList()) + if (numItems == 1) { - if (peep->IsMechanic()) + ContextShowError(STR_DEBUG_NO_BREAKDOWNS_AVAILABLE, STR_NONE, {}); + } + else + { + WindowDropdownShowText( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, + dropdownWidget->height() + 1, colours[1], Dropdown::Flag::StayOpen, numItems); + + numItems = 1; + int32_t breakdownReason = ride->breakdown_reason_pending; + if (breakdownReason != BREAKDOWN_NONE && (ride->lifecycle_flags & RIDE_LIFECYCLE_BREAKDOWN_PENDING)) { - stringId = STR_CALLING_MECHANIC; - break; + for (int32_t i = 0; i < 8; i++) + { + if (GetRideTypeDescriptor(rideEntry->ride_type[j]).AvailableBreakdowns + & static_cast(1 << i)) + { + if (i == BREAKDOWN_BRAKES_FAILURE && ride->IsBlockSectioned()) + { + if (ride->NumTrains != 1) + continue; + } + if (i == breakdownReason) + { + Dropdown::SetChecked(numItems, true); + break; + } + gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[numItems].Args = RideBreakdownReasonNames[i]; + numItems++; + } + } + } + + if ((ride->lifecycle_flags & RIDE_LIFECYCLE_BREAKDOWN_PENDING) == 0) + { + Dropdown::SetDisabled(0, true); } } break; - } - case RIDE_MECHANIC_STATUS_HEADING: - stringId = STR_MEHCANIC_IS_HEADING_FOR_THE_RIDE; + } + } + + void MaintenanceOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + if (dropdownIndex == -1) + return; + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr) + return; + + switch (widgetIndex) + { + case WIDX_INSPECTION_INTERVAL_DROPDOWN: + SetOperatingSetting(rideId, RideSetSetting::InspectionInterval, dropdownIndex); break; - case RIDE_MECHANIC_STATUS_FIXING: - case RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES: - stringId = STR_MEHCANIC_IS_FIXING_THE_RIDE; - break; - default: - stringId = STR_EMPTY; + + case WIDX_FORCE_BREAKDOWN: + if (dropdownIndex == 0) + { + Vehicle* vehicle; + switch (ride->breakdown_reason_pending) + { + case BREAKDOWN_SAFETY_CUT_OUT: + if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) + break; + for (int32_t i = 0; i < ride->NumTrains; ++i) + { + for (vehicle = GetEntity(ride->vehicles[i]); vehicle != nullptr; + vehicle = GetEntity(vehicle->next_vehicle_on_train)) + { + vehicle->ClearFlag( + VehicleFlags::CarIsBroken | VehicleFlags::StoppedOnLift + | VehicleFlags::TrainIsBroken); + } + } + break; + case BREAKDOWN_RESTRAINTS_STUCK_CLOSED: + case BREAKDOWN_RESTRAINTS_STUCK_OPEN: + case BREAKDOWN_DOORS_STUCK_CLOSED: + case BREAKDOWN_DOORS_STUCK_OPEN: + vehicle = GetEntity(ride->vehicles[ride->broken_vehicle]); + if (vehicle != nullptr) + { + vehicle->ClearFlag(VehicleFlags::CarIsBroken); + } + break; + case BREAKDOWN_VEHICLE_MALFUNCTION: + vehicle = GetEntity(ride->vehicles[ride->broken_vehicle]); + if (vehicle != nullptr) + { + vehicle->ClearFlag(VehicleFlags::TrainIsBroken); + } + break; + } + ride->lifecycle_flags &= ~(RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN); + WindowInvalidateByNumber(WindowClass::Ride, number); + break; + } + if (ride->lifecycle_flags + & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) + { + ContextShowError(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_ALREADY_BROKEN, {}); + } + else if (ride->status == RideStatus::Closed) + { + ContextShowError(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_IS_CLOSED, {}); + } + else + { + int32_t j; + for (j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++) + { + if (rideEntry->ride_type[j] != RIDE_TYPE_NULL) + break; + } + int32_t i; + int32_t numItems = 1; + for (i = 0; i < BREAKDOWN_COUNT; i++) + { + assert(j < static_cast(std::size(rideEntry->ride_type))); + if (GetRideTypeDescriptor(rideEntry->ride_type[j]).AvailableBreakdowns + & static_cast(1 << i)) + { + if (i == BREAKDOWN_BRAKES_FAILURE && ride->IsBlockSectioned()) + { + if (ride->NumTrains != 1) + continue; + } + if (numItems == dropdownIndex) + break; + numItems++; + } + } + RidePrepareBreakdown(*ride, i); + } break; } + } - if (stringId != STR_EMPTY) + void MaintenanceUpdate() + { + frame_no++; + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_4); + + auto ride = GetRide(rideId); + if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_MAINTENANCE) { - if (stringId == STR_CALLING_MECHANIC || stringId == STR_NO_MECHANICS_ARE_HIRED_MESSAGE) + ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_MAINTENANCE; + Invalidate(); + } + } + + void MaintenanceOnPrepareDraw() + { + auto newWidgets = PageWidgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto ft = Formatter::Common(); + ride->FormatNameTo(ft); + + widgets[WIDX_INSPECTION_INTERVAL].text = RideInspectionIntervalNames[ride->inspection_interval]; + + AnchorBorderWidgets(); + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); + + if (gConfigGeneral.DebuggingTools && NetworkGetMode() == NETWORK_MODE_NONE) + { + widgets[WIDX_FORCE_BREAKDOWN].type = WindowWidgetType::FlatBtn; + } + else + { + widgets[WIDX_FORCE_BREAKDOWN].type = WindowWidgetType::Empty; + } + + if (ride->GetRideTypeDescriptor().AvailableBreakdowns == 0 + || !(ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED)) + { + disabled_widgets |= (1uLL << WIDX_REFURBISH_RIDE); + widgets[WIDX_REFURBISH_RIDE].tooltip = STR_CANT_REFURBISH_NOT_NEEDED; + } + else + { + disabled_widgets &= ~(1uLL << WIDX_REFURBISH_RIDE); + widgets[WIDX_REFURBISH_RIDE].tooltip = STR_REFURBISH_RIDE_TIP; + } + } + + void MaintenanceOnDraw(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + // Locate mechanic button image + Widget* widget = &widgets[WIDX_LOCATE_MECHANIC]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; + auto image = ImageId(SPR_MECHANIC, COLOUR_BLACK, GetGameState().StaffMechanicColour); + GfxDrawSprite(dpi, image, screenCoords); + + // Inspection label + widget = &widgets[WIDX_INSPECTION_INTERVAL]; + screenCoords = windowPos + ScreenCoordsXY{ 4, widget->top + 1 }; + DrawTextBasic(dpi, screenCoords, STR_INSPECTION); + + // Reliability + widget = &widgets[WIDX_PAGE_BACKGROUND]; + screenCoords = windowPos + ScreenCoordsXY{ widget->left + 4, widget->top + 4 }; + + uint16_t reliability = ride->reliability_percentage; + auto ft = Formatter(); + ft.Add(reliability); + DrawTextBasic(dpi, screenCoords, STR_RELIABILITY_LABEL_1757, ft); + MaintenanceDrawBar( + dpi, screenCoords + ScreenCoordsXY{ 103, 0 }, std::max(10, reliability), COLOUR_BRIGHT_GREEN); + screenCoords.y += 11; + + uint16_t downTime = ride->downtime; + ft = Formatter(); + ft.Add(downTime); + DrawTextBasic(dpi, screenCoords, STR_DOWN_TIME_LABEL_1889, ft); + MaintenanceDrawBar(dpi, screenCoords + ScreenCoordsXY{ 103, 0 }, downTime, COLOUR_BRIGHT_RED); + screenCoords.y += 26; + + // Last inspection + StringId stringId; + if (ride->last_inspection <= 1) + stringId = STR_TIME_SINCE_LAST_INSPECTION_MINUTE; + else if (ride->last_inspection <= 240) + stringId = STR_TIME_SINCE_LAST_INSPECTION_MINUTES; + else + stringId = STR_TIME_SINCE_LAST_INSPECTION_MORE_THAN_4_HOURS; + + ft = Formatter(); + ft.Add(ride->last_inspection); + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += 12; + + // Last / current breakdown + if (ride->breakdown_reason == BREAKDOWN_NONE) + return; + + stringId = (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) ? STR_CURRENT_BREAKDOWN : STR_LAST_BREAKDOWN; + ft = Formatter(); + ft.Add(RideBreakdownReasonNames[ride->breakdown_reason]); + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += 12; + + // Mechanic status + if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) + { + switch (ride->mechanic_status) { - DrawTextWrapped(dpi, screenCoords, 280, stringId, {}, { TextAlignment::LEFT }); - } - else - { - auto staff = GetEntity(ride->mechanic); - if (staff != nullptr && staff->IsMechanic()) + case RIDE_MECHANIC_STATUS_CALLING: { - ft = Formatter(); - staff->FormatNameTo(ft); - DrawTextWrapped(dpi, screenCoords, 280, stringId, ft, { TextAlignment::LEFT }); + stringId = STR_NO_MECHANICS_ARE_HIRED_MESSAGE; + + for (auto peep : EntityList()) + { + if (peep->IsMechanic()) + { + stringId = STR_CALLING_MECHANIC; + break; + } + } + break; + } + case RIDE_MECHANIC_STATUS_HEADING: + stringId = STR_MEHCANIC_IS_HEADING_FOR_THE_RIDE; + break; + case RIDE_MECHANIC_STATUS_FIXING: + case RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES: + stringId = STR_MEHCANIC_IS_FIXING_THE_RIDE; + break; + default: + stringId = STR_EMPTY; + break; + } + + if (stringId != STR_EMPTY) + { + if (stringId == STR_CALLING_MECHANIC || stringId == STR_NO_MECHANICS_ARE_HIRED_MESSAGE) + { + DrawTextWrapped(dpi, screenCoords, 280, stringId, {}, { TextAlignment::LEFT }); + } + else + { + auto staff = GetEntity(ride->mechanic); + if (staff != nullptr && staff->IsMechanic()) + { + ft = Formatter(); + staff->FormatNameTo(ft); + DrawTextWrapped(dpi, screenCoords, 280, stringId, ft, { TextAlignment::LEFT }); + } } } } } - } #pragma endregion #pragma region Colour - int32_t HasTrackColour(const Ride& ride, int32_t trackColour) - { - // Get station flags (shops don't have them) - auto stationObjFlags = 0; - if (!ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY)) + int32_t HasTrackColour(const Ride& ride, int32_t trackColour) { - auto stationObj = ride.GetStationObject(); - if (stationObj != nullptr) + // Get station flags (shops don't have them) + auto stationObjFlags = 0; + if (!ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY)) { - stationObjFlags = stationObj->Flags; + auto stationObj = ride.GetStationObject(); + if (stationObj != nullptr) + { + stationObjFlags = stationObj->Flags; + } + } + + switch (trackColour) + { + case 0: + return (stationObjFlags & STATION_OBJECT_FLAGS::HAS_PRIMARY_COLOUR) + || ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN); + case 1: + return (stationObjFlags & STATION_OBJECT_FLAGS::HAS_SECONDARY_COLOUR) + || ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL); + case 2: + return ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS); + default: + return 0; } } - switch (trackColour) + void SetTrackColourScheme(const ScreenCoordsXY& screenPos) { - case 0: - return (stationObjFlags & STATION_OBJECT_FLAGS::HAS_PRIMARY_COLOUR) - || ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN); - case 1: - return (stationObjFlags & STATION_OBJECT_FLAGS::HAS_SECONDARY_COLOUR) - || ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL); - case 2: - return ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS); - default: - return 0; - } - } + auto newColourScheme = static_cast(_rideColour); + auto info = GetMapCoordinatesFromPos(screenPos, EnumsToFlags(ViewportInteractionItem::Ride)); - void SetTrackColourScheme(const ScreenCoordsXY& screenPos) - { - auto newColourScheme = static_cast(_rideColour); - auto info = GetMapCoordinatesFromPos(screenPos, EnumsToFlags(ViewportInteractionItem::Ride)); - - if (info.SpriteType != ViewportInteractionItem::Ride) - return; - if (info.Element->GetType() != TileElementType::Track) - return; - if (info.Element->AsTrack()->GetRideIndex() != rideId) - return; - if (info.Element->AsTrack()->GetColourScheme() == newColourScheme) - return; - - auto z = info.Element->GetBaseZ(); - auto direction = info.Element->GetDirection(); - auto gameAction = RideSetColourSchemeAction( - CoordsXYZD{ info.Loc, z, static_cast(direction) }, info.Element->AsTrack()->GetTrackType(), - newColourScheme); - GameActions::Execute(&gameAction); - } - - void ColourClose() - { - if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) - return; - - if (gCurrentToolWidget.window_classification != classification) - return; - - if (gCurrentToolWidget.window_number != number) - return; - - ToolCancel(); - } - - void ColourOnMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); + if (info.SpriteType != ViewportInteractionItem::Ride) return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - case WIDX_TAB_8: - case WIDX_TAB_9: - case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_PAINT_INDIVIDUAL_AREA: - ToolSet(*this, WIDX_PAINT_INDIVIDUAL_AREA, Tool::PaintDown); - break; - case WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX: - auto ride = GetRide(rideId); - if (ride != nullptr) + if (info.Element->GetType() != TileElementType::Track) + return; + if (info.Element->AsTrack()->GetRideIndex() != rideId) + return; + if (info.Element->AsTrack()->GetColourScheme() == newColourScheme) + return; + + auto z = info.Element->GetBaseZ(); + auto direction = info.Element->GetDirection(); + auto gameAction = RideSetColourSchemeAction( + CoordsXYZD{ info.Loc, z, static_cast(direction) }, info.Element->AsTrack()->GetTrackType(), + newColourScheme); + GameActions::Execute(&gameAction); + } + + void ColourClose() + { + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) + return; + + if (gCurrentToolWidget.window_classification != classification) + return; + + if (gCurrentToolWidget.window_number != number) + return; + + ToolCancel(); + } + + void ColourOnMouseUp(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + case WIDX_TAB_8: + case WIDX_TAB_9: + case WIDX_TAB_10: + SetPage(widgetIndex - WIDX_TAB_1); + break; + case WIDX_PAINT_INDIVIDUAL_AREA: + ToolSet(*this, WIDX_PAINT_INDIVIDUAL_AREA, Tool::PaintDown); + break; + case WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX: + auto ride = GetRide(rideId); + if (ride != nullptr) + { + const bool currentlyEnabled = ride->HasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS); + auto rideSetAppearanceAction = RideSetAppearanceAction( + rideId, RideSetAppearanceType::SellingItemColourIsRandom, currentlyEnabled ? 0 : 1, 0); + GameActions::Execute(&rideSetAppearanceAction); + } + break; + } + } + + void ColourResize() + { + WindowSetResize(*this, 316, 207, 316, 207); + } + + void ColourOnMouseDown(WidgetIndex widgetIndex) + { + VehicleColour vehicleColour; + int32_t i, numItems; + StringId stringId; + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr) + return; + + auto colourSchemeIndex = _rideColour; + auto dropdownWidget = &widgets[widgetIndex] - 1; + + switch (widgetIndex) + { + case WIDX_TRACK_COLOUR_SCHEME_DROPDOWN: + for (i = 0; i < OpenRCT2::Limits::NumColourSchemes; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = ColourSchemeNames[i]; + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, 4, widgets[widgetIndex].right - dropdownWidget->left); + + Dropdown::SetChecked(colourSchemeIndex, true); + break; + case WIDX_TRACK_MAIN_COLOUR: + WindowDropdownShowColour( + this, &widgets[widgetIndex], colours[1], ride->track_colour[colourSchemeIndex].main); + break; + case WIDX_TRACK_ADDITIONAL_COLOUR: + WindowDropdownShowColour( + this, &widgets[widgetIndex], colours[1], ride->track_colour[colourSchemeIndex].additional); + break; + case WIDX_TRACK_SUPPORT_COLOUR: + WindowDropdownShowColour( + this, &widgets[widgetIndex], colours[1], ride->track_colour[colourSchemeIndex].supports); + break; + case WIDX_MAZE_STYLE_DROPDOWN: + for (i = 0; i < 4; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = MazeOptions[i].text; + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, 4, widgets[widgetIndex].right - dropdownWidget->left); + + Dropdown::SetChecked(ride->track_colour[colourSchemeIndex].supports, true); + break; + case WIDX_ENTRANCE_STYLE_DROPDOWN: + ShowEntranceStyleDropdown(); + break; + case WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN: + for (i = 0; i < 3; i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = (GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle) + .singular + << 16) + | VehicleColourSchemeNames[i]; + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, rideEntry->max_cars_in_train > 1 ? 3 : 2, + widgets[widgetIndex].right - dropdownWidget->left); + + Dropdown::SetChecked(ride->colour_scheme_type & 3, true); + break; + case WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN: + numItems = ride->NumTrains; + if ((ride->colour_scheme_type & 3) != VEHICLE_COLOUR_SCHEME_PER_TRAIN) + numItems = ride->num_cars_per_train; + + stringId = (ride->colour_scheme_type & 3) == VEHICLE_COLOUR_SCHEME_PER_TRAIN + ? STR_RIDE_COLOUR_TRAIN_OPTION + : STR_RIDE_COLOUR_VEHICLE_OPTION; + for (i = 0; i < std::min(numItems, Dropdown::ItemsMaxSize); i++) + { + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = (static_cast(i + 1) << 32) + | ((GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).capitalised) << 16) + | stringId; + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, numItems, widgets[widgetIndex].right - dropdownWidget->left); + + Dropdown::SetChecked(_vehicleIndex, true); + break; + case WIDX_VEHICLE_BODY_COLOUR: + vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); + WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], vehicleColour.Body); + break; + case WIDX_VEHICLE_TRIM_COLOUR: + vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); + WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], vehicleColour.Trim); + break; + case WIDX_VEHICLE_TERTIARY_COLOUR: + vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); + WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], vehicleColour.Tertiary); + break; + } + } + + void ColourOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + if (dropdownIndex == -1) + return; + + switch (widgetIndex) + { + case WIDX_TRACK_COLOUR_SCHEME_DROPDOWN: + _rideColour = static_cast(dropdownIndex); + Invalidate(); + break; + case WIDX_TRACK_MAIN_COLOUR: { - const bool currentlyEnabled = ride->HasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS); auto rideSetAppearanceAction = RideSetAppearanceAction( - rideId, RideSetAppearanceType::SellingItemColourIsRandom, currentlyEnabled ? 0 : 1, 0); + rideId, RideSetAppearanceType::TrackColourMain, ColourDropDownIndexToColour(dropdownIndex), + _rideColour); GameActions::Execute(&rideSetAppearanceAction); } break; - } - } - - void ColourResize() - { - WindowSetResize(*this, 316, 207, 316, 207); - } - - void ColourOnMouseDown(WidgetIndex widgetIndex) - { - VehicleColour vehicleColour; - int32_t i, numItems; - StringId stringId; - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr) - return; - - auto colourSchemeIndex = _rideColour; - auto dropdownWidget = &widgets[widgetIndex] - 1; - - switch (widgetIndex) - { - case WIDX_TRACK_COLOUR_SCHEME_DROPDOWN: - for (i = 0; i < OpenRCT2::Limits::NumColourSchemes; i++) + case WIDX_TRACK_ADDITIONAL_COLOUR: { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = ColourSchemeNames[i]; + auto rideSetAppearanceAction = RideSetAppearanceAction( + rideId, RideSetAppearanceType::TrackColourAdditional, ColourDropDownIndexToColour(dropdownIndex), + _rideColour); + GameActions::Execute(&rideSetAppearanceAction); } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, 4, widgets[widgetIndex].right - dropdownWidget->left); - - Dropdown::SetChecked(colourSchemeIndex, true); break; - case WIDX_TRACK_MAIN_COLOUR: - WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], ride->track_colour[colourSchemeIndex].main); - break; - case WIDX_TRACK_ADDITIONAL_COLOUR: - WindowDropdownShowColour( - this, &widgets[widgetIndex], colours[1], ride->track_colour[colourSchemeIndex].additional); - break; - case WIDX_TRACK_SUPPORT_COLOUR: - WindowDropdownShowColour( - this, &widgets[widgetIndex], colours[1], ride->track_colour[colourSchemeIndex].supports); - break; - case WIDX_MAZE_STYLE_DROPDOWN: - for (i = 0; i < 4; i++) + case WIDX_TRACK_SUPPORT_COLOUR: { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = MazeOptions[i].text; + auto rideSetAppearanceAction = RideSetAppearanceAction( + rideId, RideSetAppearanceType::TrackColourSupports, ColourDropDownIndexToColour(dropdownIndex), + _rideColour); + GameActions::Execute(&rideSetAppearanceAction); } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, 4, widgets[widgetIndex].right - dropdownWidget->left); - - Dropdown::SetChecked(ride->track_colour[colourSchemeIndex].supports, true); break; - case WIDX_ENTRANCE_STYLE_DROPDOWN: - ShowEntranceStyleDropdown(); - break; - case WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN: - for (i = 0; i < 3; i++) + case WIDX_MAZE_STYLE_DROPDOWN: { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = (GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle) - .singular - << 16) - | VehicleColourSchemeNames[i]; + auto rideSetAppearanceAction = RideSetAppearanceAction( + rideId, RideSetAppearanceType::MazeStyle, dropdownIndex, _rideColour); + GameActions::Execute(&rideSetAppearanceAction); } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, rideEntry->max_cars_in_train > 1 ? 3 : 2, - widgets[widgetIndex].right - dropdownWidget->left); - - Dropdown::SetChecked(ride->colour_scheme_type & 3, true); break; - case WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN: - numItems = ride->NumTrains; - if ((ride->colour_scheme_type & 3) != VEHICLE_COLOUR_SCHEME_PER_TRAIN) - numItems = ride->num_cars_per_train; - - stringId = (ride->colour_scheme_type & 3) == VEHICLE_COLOUR_SCHEME_PER_TRAIN ? STR_RIDE_COLOUR_TRAIN_OPTION - : STR_RIDE_COLOUR_VEHICLE_OPTION; - for (i = 0; i < std::min(numItems, Dropdown::ItemsMaxSize); i++) - { - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = (static_cast(i + 1) << 32) - | ((GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).capitalised) << 16) - | stringId; - } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, numItems, widgets[widgetIndex].right - dropdownWidget->left); - - Dropdown::SetChecked(_vehicleIndex, true); - break; - case WIDX_VEHICLE_BODY_COLOUR: - vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); - WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], vehicleColour.Body); - break; - case WIDX_VEHICLE_TRIM_COLOUR: - vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); - WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], vehicleColour.Trim); - break; - case WIDX_VEHICLE_TERNARY_COLOUR: - vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); - WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], vehicleColour.Tertiary); - break; - } - } - - void ColourOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - if (dropdownIndex == -1) - return; - - switch (widgetIndex) - { - case WIDX_TRACK_COLOUR_SCHEME_DROPDOWN: - _rideColour = static_cast(dropdownIndex); - Invalidate(); - break; - case WIDX_TRACK_MAIN_COLOUR: - { - auto rideSetAppearanceAction = RideSetAppearanceAction( - rideId, RideSetAppearanceType::TrackColourMain, ColourDropDownIndexToColour(dropdownIndex), _rideColour); - GameActions::Execute(&rideSetAppearanceAction); - } - break; - case WIDX_TRACK_ADDITIONAL_COLOUR: - { - auto rideSetAppearanceAction = RideSetAppearanceAction( - rideId, RideSetAppearanceType::TrackColourAdditional, ColourDropDownIndexToColour(dropdownIndex), - _rideColour); - GameActions::Execute(&rideSetAppearanceAction); - } - break; - case WIDX_TRACK_SUPPORT_COLOUR: - { - auto rideSetAppearanceAction = RideSetAppearanceAction( - rideId, RideSetAppearanceType::TrackColourSupports, ColourDropDownIndexToColour(dropdownIndex), - _rideColour); - GameActions::Execute(&rideSetAppearanceAction); - } - break; - case WIDX_MAZE_STYLE_DROPDOWN: - { - auto rideSetAppearanceAction = RideSetAppearanceAction( - rideId, RideSetAppearanceType::MazeStyle, dropdownIndex, _rideColour); - GameActions::Execute(&rideSetAppearanceAction); - } - break; - case WIDX_ENTRANCE_STYLE_DROPDOWN: - { - if (static_cast(dropdownIndex) >= _entranceDropdownData.size()) + case WIDX_ENTRANCE_STYLE_DROPDOWN: { + if (static_cast(dropdownIndex) >= _entranceDropdownData.size()) + { + break; + } + auto objIndex = _entranceDropdownData[dropdownIndex].EntranceTypeId; + auto rideSetAppearanceAction = RideSetAppearanceAction( + rideId, RideSetAppearanceType::EntranceStyle, objIndex, 0); + rideSetAppearanceAction.SetCallback([objIndex](const GameAction*, const GameActions::Result* res) { + if (res->Error != GameActions::Status::Ok) + return; + GetGameState().LastEntranceStyle = objIndex; + }); + GameActions::Execute(&rideSetAppearanceAction); break; } - auto objIndex = _entranceDropdownData[dropdownIndex].EntranceTypeId; - auto rideSetAppearanceAction = RideSetAppearanceAction( - rideId, RideSetAppearanceType::EntranceStyle, objIndex, 0); - rideSetAppearanceAction.SetCallback([objIndex](const GameAction*, const GameActions::Result* res) { - if (res->Error != GameActions::Status::Ok) - return; - gLastEntranceStyle = objIndex; - }); - GameActions::Execute(&rideSetAppearanceAction); + case WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN: + { + auto rideSetAppearanceAction = RideSetAppearanceAction( + rideId, RideSetAppearanceType::VehicleColourScheme, dropdownIndex, 0); + GameActions::Execute(&rideSetAppearanceAction); + _vehicleIndex = 0; + } + break; + case WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN: + _vehicleIndex = dropdownIndex; + Invalidate(); + break; + case WIDX_VEHICLE_BODY_COLOUR: + { + auto rideSetAppearanceAction = RideSetAppearanceAction( + rideId, RideSetAppearanceType::VehicleColourBody, ColourDropDownIndexToColour(dropdownIndex), + _vehicleIndex); + GameActions::Execute(&rideSetAppearanceAction); + } + break; + case WIDX_VEHICLE_TRIM_COLOUR: + { + auto rideSetAppearanceAction = RideSetAppearanceAction( + rideId, RideSetAppearanceType::VehicleColourTrim, ColourDropDownIndexToColour(dropdownIndex), + _vehicleIndex); + GameActions::Execute(&rideSetAppearanceAction); + } + break; + case WIDX_VEHICLE_TERTIARY_COLOUR: + { + auto rideSetAppearanceAction = RideSetAppearanceAction( + rideId, RideSetAppearanceType::VehicleColourTertiary, ColourDropDownIndexToColour(dropdownIndex), + _vehicleIndex); + GameActions::Execute(&rideSetAppearanceAction); + } break; } - case WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN: + } + + void ColourUpdate() + { + frame_no++; + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_5); + WidgetInvalidate(*this, WIDX_VEHICLE_PREVIEW); + } + + void ColourOnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + { + if (widgetIndex == WIDX_PAINT_INDIVIDUAL_AREA) + SetTrackColourScheme(screenCoords); + } + + void ColourOnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + { + if (widgetIndex == WIDX_PAINT_INDIVIDUAL_AREA) + SetTrackColourScheme(screenCoords); + } + + void ColourOnPrepareDraw() + { + TrackColour trackColour; + VehicleColour vehicleColour; + + auto newWidgets = PageWidgets[page]; + if (widgets != newWidgets) { - auto rideSetAppearanceAction = RideSetAppearanceAction( - rideId, RideSetAppearanceType::VehicleColourScheme, dropdownIndex, 0); - GameActions::Execute(&rideSetAppearanceAction); - _vehicleIndex = 0; - } - break; - case WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN: - _vehicleIndex = dropdownIndex; - Invalidate(); - break; - case WIDX_VEHICLE_BODY_COLOUR: - { - auto rideSetAppearanceAction = RideSetAppearanceAction( - rideId, RideSetAppearanceType::VehicleColourBody, ColourDropDownIndexToColour(dropdownIndex), - _vehicleIndex); - GameActions::Execute(&rideSetAppearanceAction); - } - break; - case WIDX_VEHICLE_TRIM_COLOUR: - { - auto rideSetAppearanceAction = RideSetAppearanceAction( - rideId, RideSetAppearanceType::VehicleColourTrim, ColourDropDownIndexToColour(dropdownIndex), - _vehicleIndex); - GameActions::Execute(&rideSetAppearanceAction); - } - break; - case WIDX_VEHICLE_TERNARY_COLOUR: - { - auto rideSetAppearanceAction = RideSetAppearanceAction( - rideId, RideSetAppearanceType::VehicleColourTernary, ColourDropDownIndexToColour(dropdownIndex), - _vehicleIndex); - GameActions::Execute(&rideSetAppearanceAction); - } - break; - } - } - - void ColourUpdate() - { - frame_no++; - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_5); - WidgetInvalidate(*this, WIDX_VEHICLE_PREVIEW); - } - - void ColourOnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) - { - if (widgetIndex == WIDX_PAINT_INDIVIDUAL_AREA) - SetTrackColourScheme(screenCoords); - } - - void ColourOnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) - { - if (widgetIndex == WIDX_PAINT_INDIVIDUAL_AREA) - SetTrackColourScheme(screenCoords); - } - - void ColourOnPrepareDraw() - { - TrackColour trackColour; - VehicleColour vehicleColour; - - auto newWidgets = PageWidgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - InitScrollWidgets(); - } - - SetPressedTab(); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr) - return; - - widgets[WIDX_TITLE].text = STR_ARG_16_STRINGID; - auto ft = Formatter::Common(); - ft.Increment(16); - ride->FormatNameTo(ft); - - // Track colours - int32_t colourScheme = _rideColour; - trackColour = ride->track_colour[colourScheme]; - - // Maze style - const auto& rtd = ride->GetRideTypeDescriptor(); - if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) - { - widgets[WIDX_MAZE_STYLE].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_MAZE_STYLE_DROPDOWN].type = WindowWidgetType::Button; - widgets[WIDX_MAZE_STYLE].text = MazeOptions[trackColour.supports].text; - } - else - { - widgets[WIDX_MAZE_STYLE].type = WindowWidgetType::Empty; - widgets[WIDX_MAZE_STYLE_DROPDOWN].type = WindowWidgetType::Empty; - } - - // Track, multiple colour schemes - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_SUPPORTS_MULTIPLE_TRACK_COLOUR)) - { - widgets[WIDX_TRACK_COLOUR_SCHEME].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_TRACK_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Button; - widgets[WIDX_PAINT_INDIVIDUAL_AREA].type = WindowWidgetType::FlatBtn; - } - else - { - widgets[WIDX_TRACK_COLOUR_SCHEME].type = WindowWidgetType::Empty; - widgets[WIDX_TRACK_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Empty; - widgets[WIDX_PAINT_INDIVIDUAL_AREA].type = WindowWidgetType::Empty; - } - - // Track main colour - if (HasTrackColour(*ride, 0)) - { - widgets[WIDX_TRACK_MAIN_COLOUR].type = WindowWidgetType::ColourBtn; - widgets[WIDX_TRACK_MAIN_COLOUR].image = GetColourButtonImage(trackColour.main); - } - else - { - widgets[WIDX_TRACK_MAIN_COLOUR].type = WindowWidgetType::Empty; - } - - // Track additional colour - if (HasTrackColour(*ride, 1)) - { - widgets[WIDX_TRACK_ADDITIONAL_COLOUR].type = WindowWidgetType::ColourBtn; - widgets[WIDX_TRACK_ADDITIONAL_COLOUR].image = GetColourButtonImage(trackColour.additional); - } - else - { - widgets[WIDX_TRACK_ADDITIONAL_COLOUR].type = WindowWidgetType::Empty; - } - - // Selling item random colour checkbox - if (ride->HasRecolourableShopItems()) - { - widgets[WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX].type = WindowWidgetType::Checkbox; - if (ride->HasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS)) - { - pressed_widgets |= (1uLL << WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX); - } - else - { - pressed_widgets &= ~(1uLL << WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX); - } - } - else - { - widgets[WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX].type = WindowWidgetType::Empty; - } - - // Track supports colour - if (HasTrackColour(*ride, 2) && !rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) - { - widgets[WIDX_TRACK_SUPPORT_COLOUR].type = WindowWidgetType::ColourBtn; - widgets[WIDX_TRACK_SUPPORT_COLOUR].image = GetColourButtonImage(trackColour.supports); - } - else - { - widgets[WIDX_TRACK_SUPPORT_COLOUR].type = WindowWidgetType::Empty; - } - - // Track preview - if (ride->GetRideTypeDescriptor().HasFlag( - RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN | RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL - | RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS)) - widgets[WIDX_TRACK_PREVIEW].type = WindowWidgetType::Spinner; - else - widgets[WIDX_TRACK_PREVIEW].type = WindowWidgetType::Empty; - - // Entrance style - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_ENTRANCE_EXIT)) - { - widgets[WIDX_ENTRANCE_PREVIEW].type = WindowWidgetType::Spinner; - widgets[WIDX_ENTRANCE_STYLE].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_ENTRANCE_STYLE_DROPDOWN].type = WindowWidgetType::Button; - - auto stringId = STR_NONE; - auto stationObj = ride->GetStationObject(); - if (stationObj != nullptr) - { - stringId = stationObj->NameStringId; - } - widgets[WIDX_ENTRANCE_STYLE].text = stringId; - } - else - { - widgets[WIDX_ENTRANCE_PREVIEW].type = WindowWidgetType::Empty; - widgets[WIDX_ENTRANCE_STYLE].type = WindowWidgetType::Empty; - widgets[WIDX_ENTRANCE_STYLE_DROPDOWN].type = WindowWidgetType::Empty; - } - - // Vehicle colours - if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES) - && ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_VEHICLE_COLOURS)) - { - int32_t vehicleColourSchemeType = ride->colour_scheme_type & 3; - if (vehicleColourSchemeType == 0) - _vehicleIndex = 0; - - vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); - - widgets[WIDX_VEHICLE_PREVIEW].type = WindowWidgetType::Scroll; - widgets[WIDX_VEHICLE_BODY_COLOUR].type = WindowWidgetType::ColourBtn; - widgets[WIDX_VEHICLE_BODY_COLOUR].image = GetColourButtonImage(vehicleColour.Body); - - bool allowChangingTrimColour = false; - bool allowChangingTernaryColour = false; - - for (int32_t i = 0; i < ride->num_cars_per_train; i++) - { - uint8_t vehicleTypeIndex = RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, i); - - if (rideEntry->Cars[vehicleTypeIndex].flags & CAR_ENTRY_FLAG_ENABLE_TRIM_COLOUR) - { - allowChangingTrimColour = true; - } - if (rideEntry->Cars[vehicleTypeIndex].flags & CAR_ENTRY_FLAG_ENABLE_TERNARY_COLOUR) - { - allowChangingTernaryColour = true; - } + widgets = newWidgets; + InitScrollWidgets(); } - // Additional colours - if (allowChangingTrimColour) - { - widgets[WIDX_VEHICLE_TRIM_COLOUR].type = WindowWidgetType::ColourBtn; - widgets[WIDX_VEHICLE_TRIM_COLOUR].image = GetColourButtonImage(vehicleColour.Trim); - if (allowChangingTernaryColour) - { - widgets[WIDX_VEHICLE_TERNARY_COLOUR].type = WindowWidgetType::ColourBtn; - widgets[WIDX_VEHICLE_TERNARY_COLOUR].image = GetColourButtonImage(vehicleColour.Tertiary); - } - else - { - widgets[WIDX_VEHICLE_TERNARY_COLOUR].type = WindowWidgetType::Empty; - } - } - else - { - widgets[WIDX_VEHICLE_TRIM_COLOUR].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_TERNARY_COLOUR].type = WindowWidgetType::Empty; - } + SetPressedTab(); - // Vehicle colour scheme type - if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_VEHICLE_IS_INTEGRAL) - && (ride->num_cars_per_train | ride->NumTrains) > 1) - { - widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Button; - } - else - { - widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Empty; - } - ft.Rewind(); - ft.Increment(6); - ft.Add(VehicleColourSchemeNames[vehicleColourSchemeType]); - ft.Add(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).singular); - ft.Add(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).capitalised); - ft.Add(_vehicleIndex + 1); + auto ride = GetRide(rideId); + if (ride == nullptr) + return; - // Vehicle index - if (vehicleColourSchemeType != 0) - { - widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN].type = WindowWidgetType::Button; - widgets[WIDX_VEHICLE_COLOUR_INDEX].text = vehicleColourSchemeType == 1 ? STR_RIDE_COLOUR_TRAIN_VALUE - : STR_RIDE_COLOUR_VEHICLE_VALUE; - } - else - { - widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN].type = WindowWidgetType::Empty; - } - } - else - { - widgets[WIDX_VEHICLE_PREVIEW].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_BODY_COLOUR].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_TRIM_COLOUR].type = WindowWidgetType::Empty; - widgets[WIDX_VEHICLE_TERNARY_COLOUR].type = WindowWidgetType::Empty; - } + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr) + return; - ft.Rewind(); - ft.Increment(14); - ft.Add(ColourSchemeNames[colourScheme]); + widgets[WIDX_TITLE].text = STR_ARG_16_STRINGID; + auto ft = Formatter::Common(); + ft.Increment(16); + ride->FormatNameTo(ft); - AnchorBorderWidgets(); - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); - } + // Track colours + int32_t colourScheme = _rideColour; + trackColour = ride->track_colour[colourScheme]; - void ColourOnDraw(DrawPixelInfo& dpi) - { - // TODO: This should use lists and identified sprites - DrawPixelInfo clippedDpi; - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - DrawWidgets(dpi); - DrawTabImages(dpi); - - // Track / shop item preview - const auto& trackPreviewWidget = widgets[WIDX_TRACK_PREVIEW]; - if (trackPreviewWidget.type != WindowWidgetType::Empty) - GfxFillRect( - dpi, - { { windowPos + ScreenCoordsXY{ trackPreviewWidget.left + 1, trackPreviewWidget.top + 1 } }, - { windowPos + ScreenCoordsXY{ trackPreviewWidget.right - 1, trackPreviewWidget.bottom - 1 } } }, - PALETTE_INDEX_12); - - auto trackColour = ride->track_colour[_rideColour]; - - // - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr || rideEntry->shop_item[0] == ShopItem::None) - { - auto screenCoords = windowPos + ScreenCoordsXY{ trackPreviewWidget.left, trackPreviewWidget.top }; - - // Track + // Maze style const auto& rtd = ride->GetRideTypeDescriptor(); if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) { - GfxDrawSprite(dpi, ImageId(MazeOptions[trackColour.supports].sprite), screenCoords); + widgets[WIDX_MAZE_STYLE].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_MAZE_STYLE_DROPDOWN].type = WindowWidgetType::Button; + widgets[WIDX_MAZE_STYLE].text = MazeOptions[trackColour.supports].text; } else { - auto typeDescriptor = ride->GetRideTypeDescriptor(); - int32_t spriteIndex = typeDescriptor.ColourPreview.Track; - if (spriteIndex != 0) - { - GfxDrawSprite(dpi, ImageId(spriteIndex, trackColour.main, trackColour.additional), screenCoords); - } - - // Supports - spriteIndex = typeDescriptor.ColourPreview.Supports; - if (spriteIndex != 0) - { - GfxDrawSprite(dpi, ImageId(spriteIndex, trackColour.supports), screenCoords); - } + widgets[WIDX_MAZE_STYLE].type = WindowWidgetType::Empty; + widgets[WIDX_MAZE_STYLE_DROPDOWN].type = WindowWidgetType::Empty; } - } - else - { - auto screenCoords = windowPos - + ScreenCoordsXY{ (trackPreviewWidget.left + trackPreviewWidget.right) / 2 - 8, - (trackPreviewWidget.bottom + trackPreviewWidget.top) / 2 - 6 }; - ShopItem shopItem = rideEntry->shop_item[1] == ShopItem::None ? rideEntry->shop_item[0] : rideEntry->shop_item[1]; - if (ride->HasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS)) + // Track, multiple colour schemes + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_SUPPORTS_MULTIPLE_TRACK_COLOUR)) { - colour_t spriteColour = COLOUR_BLACK; - // Limit update rate of preview to avoid making people dizzy. - if ((GetGameState().CurrentTicks % 64) == 0) - { - spriteColour++; - if (spriteColour >= COLOUR_NUM_NORMAL) - { - spriteColour = COLOUR_BLACK; - } - } - - GfxDrawSprite(dpi, ImageId(GetShopItemDescriptor(shopItem).Image, spriteColour), screenCoords); + widgets[WIDX_TRACK_COLOUR_SCHEME].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_TRACK_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Button; + widgets[WIDX_PAINT_INDIVIDUAL_AREA].type = WindowWidgetType::FlatBtn; } else { - GfxDrawSprite(dpi, ImageId(GetShopItemDescriptor(shopItem).Image, ride->track_colour[0].main), screenCoords); + widgets[WIDX_TRACK_COLOUR_SCHEME].type = WindowWidgetType::Empty; + widgets[WIDX_TRACK_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Empty; + widgets[WIDX_PAINT_INDIVIDUAL_AREA].type = WindowWidgetType::Empty; } - } - // Entrance preview - trackColour = ride->track_colour[0]; - const auto& entrancePreviewWidget = widgets[WIDX_ENTRANCE_PREVIEW]; - if (entrancePreviewWidget.type != WindowWidgetType::Empty) - { - if (ClipDrawPixelInfo( - clippedDpi, dpi, - windowPos + ScreenCoordsXY{ entrancePreviewWidget.left + 1, entrancePreviewWidget.top + 1 }, - entrancePreviewWidget.width(), entrancePreviewWidget.height())) + // Track main colour + if (HasTrackColour(*ride, 0)) { - GfxClear(&clippedDpi, PALETTE_INDEX_12); + widgets[WIDX_TRACK_MAIN_COLOUR].type = WindowWidgetType::ColourBtn; + widgets[WIDX_TRACK_MAIN_COLOUR].image = GetColourButtonImage(trackColour.main); + } + else + { + widgets[WIDX_TRACK_MAIN_COLOUR].type = WindowWidgetType::Empty; + } + // Track additional colour + if (HasTrackColour(*ride, 1)) + { + widgets[WIDX_TRACK_ADDITIONAL_COLOUR].type = WindowWidgetType::ColourBtn; + widgets[WIDX_TRACK_ADDITIONAL_COLOUR].image = GetColourButtonImage(trackColour.additional); + } + else + { + widgets[WIDX_TRACK_ADDITIONAL_COLOUR].type = WindowWidgetType::Empty; + } + + // Selling item random colour checkbox + if (ride->HasRecolourableShopItems()) + { + widgets[WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX].type = WindowWidgetType::Checkbox; + if (ride->HasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS)) + { + pressed_widgets |= (1uLL << WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX); + } + else + { + pressed_widgets &= ~(1uLL << WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX); + } + } + else + { + widgets[WIDX_SELL_ITEM_RANDOM_COLOUR_CHECKBOX].type = WindowWidgetType::Empty; + } + + // Track supports colour + if (HasTrackColour(*ride, 2) && !rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) + { + widgets[WIDX_TRACK_SUPPORT_COLOUR].type = WindowWidgetType::ColourBtn; + widgets[WIDX_TRACK_SUPPORT_COLOUR].image = GetColourButtonImage(trackColour.supports); + } + else + { + widgets[WIDX_TRACK_SUPPORT_COLOUR].type = WindowWidgetType::Empty; + } + + // Track preview + if (ride->GetRideTypeDescriptor().HasFlag( + RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN | RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL + | RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS)) + widgets[WIDX_TRACK_PREVIEW].type = WindowWidgetType::Spinner; + else + widgets[WIDX_TRACK_PREVIEW].type = WindowWidgetType::Empty; + + // Entrance style + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_ENTRANCE_EXIT)) + { + widgets[WIDX_ENTRANCE_PREVIEW].type = WindowWidgetType::Spinner; + widgets[WIDX_ENTRANCE_STYLE].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_ENTRANCE_STYLE_DROPDOWN].type = WindowWidgetType::Button; + + auto stringId = STR_NONE; auto stationObj = ride->GetStationObject(); - if (stationObj != nullptr && stationObj->BaseImageId != ImageIndexUndefined) + if (stationObj != nullptr) { - auto imageId = ImageId(stationObj->BaseImageId, trackColour.main, trackColour.additional); + stringId = stationObj->NameStringId; + } + widgets[WIDX_ENTRANCE_STYLE].text = stringId; + } + else + { + widgets[WIDX_ENTRANCE_PREVIEW].type = WindowWidgetType::Empty; + widgets[WIDX_ENTRANCE_STYLE].type = WindowWidgetType::Empty; + widgets[WIDX_ENTRANCE_STYLE_DROPDOWN].type = WindowWidgetType::Empty; + } - // Back - GfxDrawSprite(clippedDpi, imageId, { 34, 20 }); + // Vehicle colours + if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES) + && ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_VEHICLE_COLOURS)) + { + int32_t vehicleColourSchemeType = ride->colour_scheme_type & 3; + if (vehicleColourSchemeType == 0) + _vehicleIndex = 0; - // Front - GfxDrawSprite(clippedDpi, imageId.WithIndexOffset(4), { 34, 20 }); + vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); - // Glass - if (stationObj->Flags & STATION_OBJECT_FLAGS::IS_TRANSPARENT) + widgets[WIDX_VEHICLE_PREVIEW].type = WindowWidgetType::Scroll; + widgets[WIDX_VEHICLE_BODY_COLOUR].type = WindowWidgetType::ColourBtn; + widgets[WIDX_VEHICLE_BODY_COLOUR].image = GetColourButtonImage(vehicleColour.Body); + + bool allowChangingTrimColour = false; + bool allowChangingTertiaryColour = false; + + for (int32_t i = 0; i < ride->num_cars_per_train; i++) + { + uint8_t vehicleTypeIndex = RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, i); + + if (rideEntry->Cars[vehicleTypeIndex].flags & CAR_ENTRY_FLAG_ENABLE_TRIM_COLOUR) { - auto glassImageId = ImageId(stationObj->BaseImageId + 20).WithTransparency(trackColour.main); - GfxDrawSprite(clippedDpi, glassImageId, { 34, 20 }); + allowChangingTrimColour = true; + } + if (rideEntry->Cars[vehicleTypeIndex].flags & CAR_ENTRY_FLAG_ENABLE_TERTIARY_COLOUR) + { + allowChangingTertiaryColour = true; + } + } + + // Additional colours + if (allowChangingTrimColour) + { + widgets[WIDX_VEHICLE_TRIM_COLOUR].type = WindowWidgetType::ColourBtn; + widgets[WIDX_VEHICLE_TRIM_COLOUR].image = GetColourButtonImage(vehicleColour.Trim); + if (allowChangingTertiaryColour) + { + widgets[WIDX_VEHICLE_TERTIARY_COLOUR].type = WindowWidgetType::ColourBtn; + widgets[WIDX_VEHICLE_TERTIARY_COLOUR].image = GetColourButtonImage(vehicleColour.Tertiary); + } + else + { + widgets[WIDX_VEHICLE_TERTIARY_COLOUR].type = WindowWidgetType::Empty; + } + } + else + { + widgets[WIDX_VEHICLE_TRIM_COLOUR].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_TERTIARY_COLOUR].type = WindowWidgetType::Empty; + } + + // Vehicle colour scheme type + if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_VEHICLE_IS_INTEGRAL) + && (ride->num_cars_per_train | ride->NumTrains) > 1) + { + widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Button; + } + else + { + widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Empty; + } + ft.Rewind(); + ft.Increment(6); + ft.Add(VehicleColourSchemeNames[vehicleColourSchemeType]); + ft.Add(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).singular); + ft.Add(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).capitalised); + ft.Add(_vehicleIndex + 1); + + // Vehicle index + if (vehicleColourSchemeType != 0) + { + widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN].type = WindowWidgetType::Button; + widgets[WIDX_VEHICLE_COLOUR_INDEX].text = vehicleColourSchemeType == 1 ? STR_RIDE_COLOUR_TRAIN_VALUE + : STR_RIDE_COLOUR_VEHICLE_VALUE; + } + else + { + widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN].type = WindowWidgetType::Empty; + } + } + else + { + widgets[WIDX_VEHICLE_PREVIEW].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_BODY_COLOUR].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_TRIM_COLOUR].type = WindowWidgetType::Empty; + widgets[WIDX_VEHICLE_TERTIARY_COLOUR].type = WindowWidgetType::Empty; + } + + ft.Rewind(); + ft.Increment(14); + ft.Add(ColourSchemeNames[colourScheme]); + + AnchorBorderWidgets(); + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); + } + + void ColourOnDraw(DrawPixelInfo& dpi) + { + // TODO: This should use lists and identified sprites + DrawPixelInfo clippedDpi; + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + DrawWidgets(dpi); + DrawTabImages(dpi); + + // Track / shop item preview + const auto& trackPreviewWidget = widgets[WIDX_TRACK_PREVIEW]; + if (trackPreviewWidget.type != WindowWidgetType::Empty) + GfxFillRect( + dpi, + { { windowPos + ScreenCoordsXY{ trackPreviewWidget.left + 1, trackPreviewWidget.top + 1 } }, + { windowPos + ScreenCoordsXY{ trackPreviewWidget.right - 1, trackPreviewWidget.bottom - 1 } } }, + PALETTE_INDEX_12); + + auto trackColour = ride->track_colour[_rideColour]; + + // + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr || rideEntry->shop_item[0] == ShopItem::None) + { + auto screenCoords = windowPos + ScreenCoordsXY{ trackPreviewWidget.left, trackPreviewWidget.top }; + + // Track + const auto& rtd = ride->GetRideTypeDescriptor(); + if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) + { + GfxDrawSprite(dpi, ImageId(MazeOptions[trackColour.supports].sprite), screenCoords); + } + else + { + auto typeDescriptor = ride->GetRideTypeDescriptor(); + int32_t spriteIndex = typeDescriptor.ColourPreview.Track; + if (spriteIndex != 0) + { + GfxDrawSprite(dpi, ImageId(spriteIndex, trackColour.main, trackColour.additional), screenCoords); + } + + // Supports + spriteIndex = typeDescriptor.ColourPreview.Supports; + if (spriteIndex != 0) + { + GfxDrawSprite(dpi, ImageId(spriteIndex, trackColour.supports), screenCoords); } } } + else + { + auto screenCoords = windowPos + + ScreenCoordsXY{ (trackPreviewWidget.left + trackPreviewWidget.right) / 2 - 8, + (trackPreviewWidget.bottom + trackPreviewWidget.top) / 2 - 6 }; - DrawTextEllipsised(dpi, { windowPos.x + 3, windowPos.y + 103 }, 97, STR_STATION_STYLE, {}); + ShopItem shopItem = rideEntry->shop_item[1] == ShopItem::None ? rideEntry->shop_item[0] + : rideEntry->shop_item[1]; + if (ride->HasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS)) + { + colour_t spriteColour = COLOUR_BLACK; + // Limit update rate of preview to avoid making people dizzy. + if ((GetGameState().CurrentTicks % 64) == 0) + { + spriteColour++; + if (spriteColour >= COLOUR_NUM_NORMAL) + { + spriteColour = COLOUR_BLACK; + } + } + + GfxDrawSprite(dpi, ImageId(GetShopItemDescriptor(shopItem).Image, spriteColour), screenCoords); + } + else + { + GfxDrawSprite( + dpi, ImageId(GetShopItemDescriptor(shopItem).Image, ride->track_colour[0].main), screenCoords); + } + } + + // Entrance preview + trackColour = ride->track_colour[0]; + const auto& entrancePreviewWidget = widgets[WIDX_ENTRANCE_PREVIEW]; + if (entrancePreviewWidget.type != WindowWidgetType::Empty) + { + if (ClipDrawPixelInfo( + clippedDpi, dpi, + windowPos + ScreenCoordsXY{ entrancePreviewWidget.left + 1, entrancePreviewWidget.top + 1 }, + entrancePreviewWidget.width(), entrancePreviewWidget.height())) + { + GfxClear(clippedDpi, PALETTE_INDEX_12); + + auto stationObj = ride->GetStationObject(); + if (stationObj != nullptr && stationObj->BaseImageId != ImageIndexUndefined) + { + auto imageId = ImageId(stationObj->BaseImageId, trackColour.main, trackColour.additional); + + // Back + GfxDrawSprite(clippedDpi, imageId, { 34, 20 }); + + // Front + GfxDrawSprite(clippedDpi, imageId.WithIndexOffset(4), { 34, 20 }); + + // Glass + if (stationObj->Flags & STATION_OBJECT_FLAGS::IS_TRANSPARENT) + { + auto glassImageId = ImageId(stationObj->BaseImageId + 20).WithTransparency(trackColour.main); + GfxDrawSprite(clippedDpi, glassImageId, { 34, 20 }); + } + } + } + + DrawTextEllipsised(dpi, { windowPos.x + 3, windowPos.y + 103 }, 97, STR_STATION_STYLE, {}); + } } - } - void ColourOnScrollDraw(DrawPixelInfo& dpi, int32_t scrollIndex) const - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; + void ColourOnScrollDraw(DrawPixelInfo& dpi, int32_t scrollIndex) const + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr) - return; + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr) + return; - auto vehiclePreviewWidget = &widgets[WIDX_VEHICLE_PREVIEW]; - auto vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); + auto vehiclePreviewWidget = &widgets[WIDX_VEHICLE_PREVIEW]; + auto vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); - // Background colour - GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, PALETTE_INDEX_12); + // Background colour + GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, PALETTE_INDEX_12); - // ? - auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 15 }; + // ? + auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 15 }; - // ? - auto trainCarIndex = (ride->colour_scheme_type & 3) == RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_CAR ? _vehicleIndex - : rideEntry->TabCar; + // ? + auto trainCarIndex = (ride->colour_scheme_type & 3) == RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_CAR + ? _vehicleIndex + : rideEntry->TabCar; - const auto& carEntry = rideEntry->Cars[RideEntryGetVehicleAtPosition( - ride->subtype, ride->num_cars_per_train, trainCarIndex)]; + const auto& carEntry = rideEntry->Cars[RideEntryGetVehicleAtPosition( + ride->subtype, ride->num_cars_per_train, trainCarIndex)]; - screenCoords.y += carEntry.tab_height; + screenCoords.y += carEntry.tab_height; - // Draw the coloured spinning vehicle - // frame_no represents a SpritePrecision of 64 - ImageIndex imageIndex = carEntry.SpriteByYaw(frame_no / 2, SpriteGroupType::SlopeFlat); - imageIndex &= carEntry.TabRotationMask; - imageIndex *= carEntry.base_num_frames; - imageIndex += carEntry.base_image_id; - auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Tertiary); - GfxDrawSprite(dpi, imageId, screenCoords); - } + // Draw the coloured spinning vehicle + // frame_no represents a SpritePrecision of 64 + ImageIndex imageIndex = carEntry.SpriteByYaw(frame_no / 2, SpriteGroupType::SlopeFlat); + imageIndex &= carEntry.TabRotationMask; + imageIndex *= carEntry.base_num_frames; + imageIndex += carEntry.base_image_id; + auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Tertiary); + GfxDrawSprite(dpi, imageId, screenCoords); + } #pragma endregion #pragma region Music - std::vector window_ride_current_music_style_order; + std::vector window_ride_current_music_style_order; - void ToggleMusic() - { - auto ride = GetRide(rideId); - if (ride != nullptr) + void ToggleMusic() { - int32_t activateMusic = (ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) ? 0 : 1; - SetOperatingSetting(rideId, RideSetSetting::Music, activateMusic); - } - } - - void MusicOnMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - case WIDX_TAB_8: - case WIDX_TAB_9: - case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_PLAY_MUSIC: - ToggleMusic(); - break; - } - } - - void MusicResize() - { - flags |= WF_RESIZABLE; - WindowSetResize(*this, 316, 81, 316, 81); - } - - static std::string GetMusicString(ObjectEntryIndex musicObjectIndex) - { - auto& objManager = GetContext()->GetObjectManager(); - auto musicObj = static_cast(objManager.GetLoadedObject(ObjectType::Music, musicObjectIndex)); - - auto name = musicObj->NameStringId; - return FormatStringID(name, {}); - } - - /** - * - * rct2: 0x006B1EFC - */ - void MusicOnMouseDown(WidgetIndex widgetIndex) - { - if (widgetIndex != WIDX_MUSIC_DROPDOWN) - return; - - auto dropdownWidget = &widgets[widgetIndex] - 1; - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - // Construct list of available music - auto& musicOrder = window_ride_current_music_style_order; - musicOrder.clear(); - auto& objManager = GetContext()->GetObjectManager(); - for (ObjectEntryIndex i = 0; i < MAX_MUSIC_OBJECTS; i++) - { - auto musicObj = static_cast(objManager.GetLoadedObject(ObjectType::Music, i)); - if (musicObj != nullptr) + auto ride = GetRide(rideId); + if (ride != nullptr) { - // Hide custom music if the WAV file does not exist - auto originalStyleId = musicObj->GetOriginalStyleId(); - if (originalStyleId.has_value() - && (originalStyleId == MUSIC_STYLE_CUSTOM_MUSIC_1 || originalStyleId == MUSIC_STYLE_CUSTOM_MUSIC_2)) + int32_t activateMusic = (ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) ? 0 : 1; + SetOperatingSetting(rideId, RideSetSetting::Music, activateMusic); + } + } + + void MusicOnMouseUp(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + case WIDX_TAB_8: + case WIDX_TAB_9: + case WIDX_TAB_10: + SetPage(widgetIndex - WIDX_TAB_1); + break; + case WIDX_PLAY_MUSIC: + ToggleMusic(); + break; + } + } + + void MusicResize() + { + flags |= WF_RESIZABLE; + WindowSetResize(*this, 316, 81, 316, 81); + } + + static std::string GetMusicString(ObjectEntryIndex musicObjectIndex) + { + auto& objManager = GetContext()->GetObjectManager(); + auto musicObj = static_cast(objManager.GetLoadedObject(ObjectType::Music, musicObjectIndex)); + + return LanguageGetString(musicObj->NameStringId); + } + + /** + * + * rct2: 0x006B1EFC + */ + void MusicOnMouseDown(WidgetIndex widgetIndex) + { + if (widgetIndex != WIDX_MUSIC_DROPDOWN) + return; + + auto dropdownWidget = &widgets[widgetIndex] - 1; + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + // Construct list of available music + auto& musicOrder = window_ride_current_music_style_order; + musicOrder.clear(); + auto& objManager = GetContext()->GetObjectManager(); + for (ObjectEntryIndex i = 0; i < MAX_MUSIC_OBJECTS; i++) + { + auto musicObj = static_cast(objManager.GetLoadedObject(ObjectType::Music, i)); + if (musicObj != nullptr) { - auto numTracks = musicObj->GetTrackCount(); - if (numTracks != 0) + // Hide custom music if the WAV file does not exist + auto originalStyleId = musicObj->GetOriginalStyleId(); + if (originalStyleId.has_value() + && (originalStyleId == MUSIC_STYLE_CUSTOM_MUSIC_1 || originalStyleId == MUSIC_STYLE_CUSTOM_MUSIC_2)) { - auto track0 = musicObj->GetTrack(0); - if (!track0->Asset.IsAvailable()) + auto numTracks = musicObj->GetTrackCount(); + if (numTracks != 0) + { + auto track0 = musicObj->GetTrack(0); + if (!track0->Asset.IsAvailable()) + { + continue; + } + } + else { continue; } } - else + + if (GetGameState().Cheats.UnlockOperatingLimits || musicObj->SupportsRideType(ride->type)) { - continue; + musicOrder.push_back(i); } } + } - if (gCheatsUnlockOperatingLimits || musicObj->SupportsRideType(ride->type)) + // Sort available music by the alphabetical order + std::stable_sort(musicOrder.begin(), musicOrder.end(), [](const ObjectEntryIndex& a, const ObjectEntryIndex& b) { + return String::Compare(GetMusicString(b), GetMusicString(a), false) > 0; + }); + + // Setup dropdown list + auto numItems = musicOrder.size(); + for (size_t i = 0; i < numItems; i++) + { + auto musicObj = static_cast(objManager.GetLoadedObject(ObjectType::Music, musicOrder[i])); + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Args = musicObj->NameStringId; + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, Dropdown::Flag::StayOpen, numItems, widgets[widgetIndex].right - dropdownWidget->left); + + // Set currently checked item + for (size_t i = 0; i < numItems; i++) + { + if (musicOrder[i] == ride->music) { - musicOrder.push_back(i); + Dropdown::SetChecked(static_cast(i), true); } } } - // Sort available music by the alphabetical order - std::stable_sort(musicOrder.begin(), musicOrder.end(), [](const ObjectEntryIndex& a, const ObjectEntryIndex& b) { - return String::Compare(GetMusicString(b), GetMusicString(a), false) > 0; - }); - - // Setup dropdown list - auto numItems = musicOrder.size(); - for (size_t i = 0; i < numItems; i++) + void MusicOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) { - auto musicObj = static_cast(objManager.GetLoadedObject(ObjectType::Music, musicOrder[i])); - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = musicObj->NameStringId; - } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], - 0, Dropdown::Flag::StayOpen, numItems, widgets[widgetIndex].right - dropdownWidget->left); - - // Set currently checked item - for (size_t i = 0; i < numItems; i++) - { - if (musicOrder[i] == ride->music) + if (widgetIndex == WIDX_MUSIC_DROPDOWN && dropdownIndex >= 0 + && static_cast(dropdownIndex) < window_ride_current_music_style_order.size()) { - Dropdown::SetChecked(static_cast(i), true); + auto musicStyle = window_ride_current_music_style_order[dropdownIndex]; + SetOperatingSetting(rideId, RideSetSetting::MusicType, musicStyle); } } - } - void MusicOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - if (widgetIndex == WIDX_MUSIC_DROPDOWN && dropdownIndex >= 0 - && static_cast(dropdownIndex) < window_ride_current_music_style_order.size()) + void MusicUpdate() { - auto musicStyle = window_ride_current_music_style_order[dropdownIndex]; - SetOperatingSetting(rideId, RideSetSetting::MusicType, musicStyle); - } - } - - void MusicUpdate() - { - frame_no++; - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_6); - } - - void MusicOnPrepareDraw() - { - auto newWidgets = PageWidgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - InitScrollWidgets(); + frame_no++; + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_6); } - SetPressedTab(); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto ft = Formatter::Common(); - ride->FormatNameTo(ft); - - // Set selected music - StringId musicName = STR_NONE; - auto& objManager = GetContext()->GetObjectManager(); - auto musicObj = static_cast(objManager.GetLoadedObject(ObjectType::Music, ride->music)); - if (musicObj != nullptr) + void MusicOnPrepareDraw() { - musicName = musicObj->NameStringId; - } - widgets[WIDX_MUSIC].text = musicName; + auto newWidgets = PageWidgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + InitScrollWidgets(); + } - // Set music activated - auto isMusicActivated = (ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) != 0; - if (isMusicActivated) - { - pressed_widgets |= (1uLL << WIDX_PLAY_MUSIC); - disabled_widgets &= ~(1uLL << WIDX_MUSIC); - disabled_widgets &= ~(1uLL << WIDX_MUSIC_DROPDOWN); - } - else - { - pressed_widgets &= ~(1uLL << WIDX_PLAY_MUSIC); - disabled_widgets |= (1uLL << WIDX_MUSIC); - disabled_widgets |= (1uLL << WIDX_MUSIC_DROPDOWN); + SetPressedTab(); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto ft = Formatter::Common(); + ride->FormatNameTo(ft); + + // Set selected music + StringId musicName = STR_NONE; + auto& objManager = GetContext()->GetObjectManager(); + auto musicObj = static_cast(objManager.GetLoadedObject(ObjectType::Music, ride->music)); + if (musicObj != nullptr) + { + musicName = musicObj->NameStringId; + } + widgets[WIDX_MUSIC].text = musicName; + + // Set music activated + auto isMusicActivated = (ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) != 0; + if (isMusicActivated) + { + pressed_widgets |= (1uLL << WIDX_PLAY_MUSIC); + disabled_widgets &= ~(1uLL << WIDX_MUSIC); + disabled_widgets &= ~(1uLL << WIDX_MUSIC_DROPDOWN); + } + else + { + pressed_widgets &= ~(1uLL << WIDX_PLAY_MUSIC); + disabled_widgets |= (1uLL << WIDX_MUSIC); + disabled_widgets |= (1uLL << WIDX_MUSIC_DROPDOWN); + } + + AnchorBorderWidgets(); + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); } - AnchorBorderWidgets(); - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); - } - - void MusicOnDraw(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - } + void MusicOnDraw(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + } #pragma endregion #pragma region Measurements - static constexpr StringId GetRatingName(ride_rating rating) - { - int32_t index = std::clamp(rating >> 8, 0, static_cast(std::size(RatingNames)) - 1); - return RatingNames[index]; - } - - void SetupScenerySelection() - { - if (gTrackDesignSaveMode) + static constexpr StringId GetRatingName(ride_rating rating) { - CancelScenerySelection(); + int32_t index = std::clamp(rating >> 8, 0, static_cast(std::size(RatingNames)) - 1); + return RatingNames[index]; } - while (ToolSet(*this, WIDX_BACKGROUND, Tool::Crosshair)) - ; - - gTrackDesignSaveRideIndex = rideId; - - TrackDesignSaveInit(); - gGamePaused |= GAME_PAUSED_SAVING_TRACK; - gTrackDesignSaveMode = true; - - OpenRCT2::Audio::StopAll(); - - WindowBase* w_main = WindowGetMain(); - if (w_main != nullptr) + void SetupScenerySelection() { - w_main->viewport->flags |= (VIEWPORT_FLAG_HIDE_VERTICAL | VIEWPORT_FLAG_HIDE_BASE); - } - - GfxInvalidateScreen(); - } - - void MeasurementsDesignReset() - { - TrackDesignSaveResetScenery(); - } - - void MeasurementsDesignSelectNearbyScenery() - { - TrackDesignSaveSelectNearbyScenery(gTrackDesignSaveRideIndex); - } - - void MeasurementsDesignCancel() - { - if (gTrackDesignSaveMode) - { - CancelScenerySelection(); - } - } - - static void TrackDesignCallback(int32_t result, [[maybe_unused]] const utf8* path) - { - if (result == MODAL_RESULT_OK) - { - TrackRepositoryScan(); - } - GfxInvalidateScreen(); - }; - - void MeasurementsDesignSave() - { - TrackDesignState tds{}; - - Ride* ride = GetRide(rideId); - _trackDesign = ride->SaveToTrackDesign(tds); - if (!_trackDesign) - { - return; - } - - if (gTrackDesignSaveMode) - { - auto errMessage = _trackDesign->CreateTrackDesignScenery(tds); - if (!errMessage.Successful) + if (gTrackDesignSaveMode) { - ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, errMessage.Message, {}); - return; + CancelScenerySelection(); } - if (errMessage.HasMessage()) + + while (ToolSet(*this, WIDX_BACKGROUND, Tool::Crosshair)) + ; + + gTrackDesignSaveRideIndex = rideId; + + TrackDesignSaveInit(); + gGamePaused |= GAME_PAUSED_SAVING_TRACK; + gTrackDesignSaveMode = true; + + OpenRCT2::Audio::StopAll(); + + WindowBase* w_main = WindowGetMain(); + if (w_main != nullptr) { - ContextShowError(errMessage.Message, STR_EMPTY, {}); + w_main->viewport->flags |= (VIEWPORT_FLAG_HIDE_VERTICAL | VIEWPORT_FLAG_HIDE_BASE); + } + + GfxInvalidateScreen(); + } + + void MeasurementsDesignReset() + { + TrackDesignSaveResetScenery(); + } + + void MeasurementsDesignSelectNearbyScenery() + { + TrackDesignSaveSelectNearbyScenery(gTrackDesignSaveRideIndex); + } + + void MeasurementsDesignCancel() + { + if (gTrackDesignSaveMode) + { + CancelScenerySelection(); } } - auto trackName = ride->GetName(); - auto intent = Intent(WindowClass::Loadsave); - intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK); - intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, _trackDesign.get()); - intent.PutExtra(INTENT_EXTRA_PATH, trackName); - intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(&TrackDesignCallback)); - - ContextOpenIntent(&intent); - } - - void MeasurementsClose() - { - MeasurementsDesignCancel(); - } - - void MeasurementsOnMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + static void TrackDesignCallback(int32_t result, [[maybe_unused]] const utf8* path) { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - case WIDX_TAB_8: - case WIDX_TAB_9: - case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_SELECT_NEARBY_SCENERY: - MeasurementsDesignSelectNearbyScenery(); - break; - case WIDX_RESET_SELECTION: - MeasurementsDesignReset(); - break; - case WIDX_SAVE_DESIGN: - MeasurementsDesignSave(); - break; - case WIDX_CANCEL_DESIGN: - MeasurementsDesignCancel(); - break; - } - } - - void MeasurementsResize() - { - WindowSetResize(*this, 316, 234, 316, 234); - } - - void MeasurementsOnMouseDown(WidgetIndex widgetIndex) - { - if (widgetIndex != WIDX_SAVE_TRACK_DESIGN) - return; - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - gDropdownItems[0].Format = STR_SAVE_TRACK_DESIGN_ITEM; - gDropdownItems[1].Format = STR_SAVE_TRACK_DESIGN_WITH_SCENERY_ITEM; - - WindowDropdownShowText( - { windowPos.x + widgets[widgetIndex].left, windowPos.y + widgets[widgetIndex].top }, - widgets[widgetIndex].height() + 1, colours[1], Dropdown::Flag::StayOpen, 2); - gDropdownDefaultIndex = 0; - if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) - { - // Disable saving without scenery if we're a flat ride - Dropdown::SetDisabled(0, true); - gDropdownDefaultIndex = 1; - } - } - - void MeasurementsOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - if (widgetIndex != WIDX_SAVE_TRACK_DESIGN) - return; - - if (dropdownIndex == -1) - dropdownIndex = gDropdownHighlightedIndex; - - if (dropdownIndex == 0) - { - MeasurementsDesignSave(); - } - else - SetupScenerySelection(); - } - - void MeasurementsUpdate() - { - frame_no++; - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_7); - } - - void MeasurementsOnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) - { - _lastSceneryX = screenCoords.x; - _lastSceneryY = screenCoords.y; - _collectTrackDesignScenery = true; // Default to true in case user does not select anything valid - - constexpr auto interactionFlags = EnumsToFlags( - ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall, - ViewportInteractionItem::LargeScenery); - auto info = GetMapCoordinatesFromPos(screenCoords, interactionFlags); - switch (info.SpriteType) - { - case ViewportInteractionItem::Scenery: - case ViewportInteractionItem::LargeScenery: - case ViewportInteractionItem::Wall: - case ViewportInteractionItem::Footpath: - _collectTrackDesignScenery = !TrackDesignSaveContainsTileElement(info.Element); - TrackDesignSaveSelectTileElement(info.SpriteType, info.Loc, info.Element, _collectTrackDesignScenery); - break; - default: - break; - } - } - - void MeasurementsOnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) - { - if (screenCoords.x == _lastSceneryX && screenCoords.y == _lastSceneryY) - return; - _lastSceneryX = screenCoords.x; - _lastSceneryY = screenCoords.y; - - auto interactionFlags = EnumsToFlags( - ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall, - ViewportInteractionItem::LargeScenery); - auto info = GetMapCoordinatesFromPos(screenCoords, interactionFlags); - switch (info.SpriteType) - { - case ViewportInteractionItem::Scenery: - case ViewportInteractionItem::LargeScenery: - case ViewportInteractionItem::Wall: - case ViewportInteractionItem::Footpath: - TrackDesignSaveSelectTileElement(info.SpriteType, info.Loc, info.Element, _collectTrackDesignScenery); - break; - default: - break; - } - } - - void MeasurementsOnToolAbort(WidgetIndex widgetIndex) - { - MeasurementsDesignCancel(); - } - - void MeasurementsOnPrepareDraw() - { - auto newWidgets = PageWidgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - InitScrollWidgets(); - } - - SetPressedTab(); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto ft = Formatter::Common(); - ride->FormatNameTo(ft); - - widgets[WIDX_SAVE_TRACK_DESIGN].tooltip = STR_SAVE_TRACK_DESIGN_NOT_POSSIBLE; - widgets[WIDX_SAVE_TRACK_DESIGN].type = WindowWidgetType::Empty; - if (gTrackDesignSaveMode && gTrackDesignSaveRideIndex == rideId) - { - widgets[WIDX_SELECT_NEARBY_SCENERY].type = WindowWidgetType::Button; - widgets[WIDX_RESET_SELECTION].type = WindowWidgetType::Button; - widgets[WIDX_SAVE_DESIGN].type = WindowWidgetType::Button; - widgets[WIDX_CANCEL_DESIGN].type = WindowWidgetType::Button; - } - else - { - widgets[WIDX_SELECT_NEARBY_SCENERY].type = WindowWidgetType::Empty; - widgets[WIDX_RESET_SELECTION].type = WindowWidgetType::Empty; - widgets[WIDX_SAVE_DESIGN].type = WindowWidgetType::Empty; - widgets[WIDX_CANCEL_DESIGN].type = WindowWidgetType::Empty; - - widgets[WIDX_SAVE_TRACK_DESIGN].type = WindowWidgetType::FlatBtn; - disabled_widgets |= (1uLL << WIDX_SAVE_TRACK_DESIGN); - if (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED) + if (result == MODAL_RESULT_OK) { - if (ride->excitement != RIDE_RATING_UNDEFINED) + TrackRepositoryScan(); + } + GfxInvalidateScreen(); + }; + + void MeasurementsDesignSave() + { + TrackDesignState tds{}; + + Ride* ride = GetRide(rideId); + _trackDesign = ride->SaveToTrackDesign(tds); + if (!_trackDesign) + { + return; + } + + if (gTrackDesignSaveMode) + { + auto errMessage = _trackDesign->CreateTrackDesignScenery(tds); + if (!errMessage.Successful) { - disabled_widgets &= ~(1uLL << WIDX_SAVE_TRACK_DESIGN); - widgets[WIDX_SAVE_TRACK_DESIGN].tooltip = STR_SAVE_TRACK_DESIGN; + ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, errMessage.Message, {}); + return; + } + if (errMessage.HasMessage()) + { + ContextShowError(errMessage.Message, STR_EMPTY, {}); + } + } + + auto trackName = ride->GetName(); + auto intent = Intent(WindowClass::Loadsave); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK); + intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, _trackDesign.get()); + intent.PutExtra(INTENT_EXTRA_PATH, trackName); + intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(&TrackDesignCallback)); + + ContextOpenIntent(&intent); + } + + void MeasurementsClose() + { + MeasurementsDesignCancel(); + } + + void MeasurementsOnMouseUp(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + case WIDX_TAB_8: + case WIDX_TAB_9: + case WIDX_TAB_10: + SetPage(widgetIndex - WIDX_TAB_1); + break; + case WIDX_SELECT_NEARBY_SCENERY: + MeasurementsDesignSelectNearbyScenery(); + break; + case WIDX_RESET_SELECTION: + MeasurementsDesignReset(); + break; + case WIDX_SAVE_DESIGN: + MeasurementsDesignSave(); + break; + case WIDX_CANCEL_DESIGN: + MeasurementsDesignCancel(); + break; + } + } + + void MeasurementsResize() + { + WindowSetResize(*this, 316, 234, 316, 234); + } + + void MeasurementsOnMouseDown(WidgetIndex widgetIndex) + { + if (widgetIndex != WIDX_SAVE_TRACK_DESIGN) + return; + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + gDropdownItems[0].Format = STR_SAVE_TRACK_DESIGN_ITEM; + gDropdownItems[1].Format = STR_SAVE_TRACK_DESIGN_WITH_SCENERY_ITEM; + + WindowDropdownShowText( + { windowPos.x + widgets[widgetIndex].left, windowPos.y + widgets[widgetIndex].top }, + widgets[widgetIndex].height() + 1, colours[1], Dropdown::Flag::StayOpen, 2); + gDropdownDefaultIndex = 0; + if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) + { + // Disable saving without scenery if we're a flat ride + Dropdown::SetDisabled(0, true); + gDropdownDefaultIndex = 1; + } + } + + void MeasurementsOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + if (widgetIndex != WIDX_SAVE_TRACK_DESIGN) + return; + + if (dropdownIndex == -1) + dropdownIndex = gDropdownHighlightedIndex; + + if (dropdownIndex == 0) + { + MeasurementsDesignSave(); + } + else + SetupScenerySelection(); + } + + void MeasurementsUpdate() + { + frame_no++; + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_7); + } + + void MeasurementsOnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + { + _lastSceneryX = screenCoords.x; + _lastSceneryY = screenCoords.y; + _collectTrackDesignScenery = true; // Default to true in case user does not select anything valid + + constexpr auto interactionFlags = EnumsToFlags( + ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall, + ViewportInteractionItem::LargeScenery); + auto info = GetMapCoordinatesFromPos(screenCoords, interactionFlags); + switch (info.SpriteType) + { + case ViewportInteractionItem::Scenery: + case ViewportInteractionItem::LargeScenery: + case ViewportInteractionItem::Wall: + case ViewportInteractionItem::Footpath: + _collectTrackDesignScenery = !TrackDesignSaveContainsTileElement(info.Element); + TrackDesignSaveSelectTileElement(info.SpriteType, info.Loc, info.Element, _collectTrackDesignScenery); + break; + default: + break; + } + } + + void MeasurementsOnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + { + if (screenCoords.x == _lastSceneryX && screenCoords.y == _lastSceneryY) + return; + _lastSceneryX = screenCoords.x; + _lastSceneryY = screenCoords.y; + + auto interactionFlags = EnumsToFlags( + ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall, + ViewportInteractionItem::LargeScenery); + auto info = GetMapCoordinatesFromPos(screenCoords, interactionFlags); + switch (info.SpriteType) + { + case ViewportInteractionItem::Scenery: + case ViewportInteractionItem::LargeScenery: + case ViewportInteractionItem::Wall: + case ViewportInteractionItem::Footpath: + TrackDesignSaveSelectTileElement(info.SpriteType, info.Loc, info.Element, _collectTrackDesignScenery); + break; + default: + break; + } + } + + void MeasurementsOnToolAbort(WidgetIndex widgetIndex) + { + MeasurementsDesignCancel(); + } + + void MeasurementsOnPrepareDraw() + { + auto newWidgets = PageWidgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto ft = Formatter::Common(); + ride->FormatNameTo(ft); + + widgets[WIDX_SAVE_TRACK_DESIGN].tooltip = STR_SAVE_TRACK_DESIGN_NOT_POSSIBLE; + widgets[WIDX_SAVE_TRACK_DESIGN].type = WindowWidgetType::Empty; + if (gTrackDesignSaveMode && gTrackDesignSaveRideIndex == rideId) + { + widgets[WIDX_SELECT_NEARBY_SCENERY].type = WindowWidgetType::Button; + widgets[WIDX_RESET_SELECTION].type = WindowWidgetType::Button; + widgets[WIDX_SAVE_DESIGN].type = WindowWidgetType::Button; + widgets[WIDX_CANCEL_DESIGN].type = WindowWidgetType::Button; + } + else + { + widgets[WIDX_SELECT_NEARBY_SCENERY].type = WindowWidgetType::Empty; + widgets[WIDX_RESET_SELECTION].type = WindowWidgetType::Empty; + widgets[WIDX_SAVE_DESIGN].type = WindowWidgetType::Empty; + widgets[WIDX_CANCEL_DESIGN].type = WindowWidgetType::Empty; + + widgets[WIDX_SAVE_TRACK_DESIGN].type = WindowWidgetType::FlatBtn; + disabled_widgets |= (1uLL << WIDX_SAVE_TRACK_DESIGN); + if (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED) + { + if (ride->excitement != kRideRatingUndefined) + { + disabled_widgets &= ~(1uLL << WIDX_SAVE_TRACK_DESIGN); + widgets[WIDX_SAVE_TRACK_DESIGN].tooltip = STR_SAVE_TRACK_DESIGN; + } + } + } + + AnchorBorderWidgets(); + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); + } + + void MeasurementsOnDraw(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + if (widgets[WIDX_SAVE_DESIGN].type == WindowWidgetType::Button) + { + Widget* widget = &widgets[WIDX_PAGE_BACKGROUND]; + + ScreenCoordsXY widgetCoords(windowPos.x + widget->width() / 2, windowPos.y + widget->top + 40); + DrawTextWrapped( + dpi, widgetCoords, width - 8, STR_CLICK_ITEMS_OF_SCENERY_TO_SELECT, {}, { TextAlignment::CENTRE }); + + widgetCoords.x = windowPos.x + 4; + widgetCoords.y = windowPos.y + widgets[WIDX_SELECT_NEARBY_SCENERY].bottom + 17; + GfxFillRectInset( + dpi, { widgetCoords, { windowPos.x + 312, widgetCoords.y + 1 } }, colours[1], INSET_RECT_FLAG_BORDER_INSET); + } + else + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; + + if (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED) + { + // Excitement + StringId ratingName = GetRatingName(ride->excitement); + auto ft = Formatter(); + ft.Add(ride->excitement); + ft.Add(ratingName); + StringId stringId = !RideHasRatings(*ride) ? STR_EXCITEMENT_RATING_NOT_YET_AVAILABLE + : STR_EXCITEMENT_RATING; + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Intensity + ratingName = GetRatingName(ride->intensity); + ft = Formatter(); + ft.Add(ride->intensity); + ft.Add(ratingName); + + stringId = STR_INTENSITY_RATING; + if (!RideHasRatings(*ride)) + stringId = STR_INTENSITY_RATING_NOT_YET_AVAILABLE; + else if (ride->intensity >= RIDE_RATING(10, 00)) + stringId = STR_INTENSITY_RATING_RED; + + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Nausea + ratingName = GetRatingName(ride->nausea); + ft = Formatter(); + ft.Add(ride->nausea); + ft.Add(ratingName); + stringId = !RideHasRatings(*ride) ? STR_NAUSEA_RATING_NOT_YET_AVAILABLE : STR_NAUSEA_RATING; + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += 2 * LIST_ROW_HEIGHT; + + // Horizontal rule + GfxFillRectInset( + dpi, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 303, -5 } }, colours[1], + INSET_RECT_FLAG_BORDER_INSET); + + if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_NO_RAW_STATS)) + { + if (ride->type == RIDE_TYPE_MINI_GOLF) + { + // Holes + ft = Formatter(); + ft.Add(ride->holes); + DrawTextBasic(dpi, screenCoords, STR_HOLES, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + else + { + // Max speed + ft = Formatter(); + ft.Add((ride->max_speed * 9) >> 18); + DrawTextBasic(dpi, screenCoords, STR_MAX_SPEED, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Average speed + ft = Formatter(); + ft.Add((ride->average_speed * 9) >> 18); + DrawTextBasic(dpi, screenCoords, STR_AVERAGE_SPEED, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Ride time + ft = Formatter(); + int32_t numTimes = 0; + // TODO: STR_RIDE_TIME only takes up to 4 stations modify to take more + // also if modified may need to be split into multiple format strings + // as formatter cannot take more than 256 bytes + for (int32_t i = 0; i < std::min(ride->num_stations, 4); i++) + { + StationIndex stationIndex = StationIndex::FromUnderlying(numTimes); + auto time = ride->GetStation(stationIndex).SegmentTime; + if (time != 0) + { + ft.Add(STR_RIDE_TIME_ENTRY_WITH_SEPARATOR); + ft.Add(time); + numTimes++; + } + } + if (numTimes == 0) + { + ft.Add(STR_RIDE_TIME_ENTRY); + ft.Add(0); + numTimes++; + } + else + { + // sadly, STR_RIDE_TIME_ENTRY_WITH_SEPARATOR are defined with the separator AFTER an entry + // therefore we set the last entry to use the no-separator format now, post-format + ft.Rewind(); + ft.Increment((numTimes - 1) * 4); + ft.Add(STR_RIDE_TIME_ENTRY); + } + ft.Rewind(); + ft.Increment(numTimes * 4); + ft.Add(0); + ft.Add(0); + ft.Add(0); + ft.Add(0); + DrawTextEllipsised(dpi, screenCoords, 308, STR_RIDE_TIME, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + + // Ride length + ft = Formatter(); + int32_t numLengths = 0; + // TODO: see above STR_RIDE_LENGTH is also only able to display max 4 + for (int32_t i = 0; i < std::min(ride->num_stations, 4); i++) + { + StationIndex stationIndex = StationIndex::FromUnderlying(i); + auto length = ride->GetStation(stationIndex).SegmentLength; + if (length != 0) + { + length >>= 16; + ft.Add(STR_RIDE_LENGTH_ENTRY_WITH_SEPARATOR); + ft.Add(length & 0xFFFF); + numLengths++; + } + } + if (numLengths == 0) + { + ft.Add(STR_RIDE_LENGTH_ENTRY); + ft.Add(0); + numLengths++; + } + else + { + // sadly, STR_RIDE_LENGTH_ENTRY_WITH_SEPARATOR are defined with the separator AFTER an entry + // therefore we set the last entry to use the no-separator format now, post-format + ft.Rewind(); + ft.Increment((numLengths - 1) * 4); + ft.Add(STR_RIDE_LENGTH_ENTRY); + } + ft.Rewind(); + ft.Increment(numLengths * 4); + ft.Add(0); + ft.Add(0); + ft.Add(0); + ft.Add(0); + DrawTextEllipsised(dpi, screenCoords, 308, STR_RIDE_LENGTH, ft); + + screenCoords.y += LIST_ROW_HEIGHT; + + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES)) + { + // Max. positive vertical G's + stringId = STR_MAX_POSITIVE_VERTICAL_G; + + ft = Formatter(); + ft.Add(ride->max_positive_vertical_g); + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Max. negative vertical G's + stringId = ride->max_negative_vertical_g <= RIDE_G_FORCES_RED_NEG_VERTICAL + ? STR_MAX_NEGATIVE_VERTICAL_G_RED + : STR_MAX_NEGATIVE_VERTICAL_G; + ft = Formatter(); + ft.Add(ride->max_negative_vertical_g); + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Max lateral G's + stringId = ride->max_lateral_g > RIDE_G_FORCES_RED_LATERAL ? STR_MAX_LATERAL_G_RED + : STR_MAX_LATERAL_G; + ft = Formatter(); + ft.Add(ride->max_lateral_g); + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Total 'air' time + ft = Formatter(); + ft.Add(ride->total_air_time * 3); + DrawTextBasic(dpi, screenCoords, STR_TOTAL_AIR_TIME, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_DROPS)) + { + // Drops + auto drops = ride->drops & 0x3F; + ft = Formatter(); + ft.Add(drops); + DrawTextBasic(dpi, screenCoords, STR_DROPS, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Highest drop height + auto highestDropHeight = (ride->highest_drop_height * 3) / 4; + ft = Formatter(); + ft.Add(highestDropHeight); + DrawTextBasic(dpi, screenCoords, STR_HIGHEST_DROP_HEIGHT, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + + if (ride->type != RIDE_TYPE_MINI_GOLF) + { + // Inversions + if (ride->inversions != 0) + { + ft = Formatter(); + ft.Add(ride->inversions); + DrawTextBasic(dpi, screenCoords, STR_INVERSIONS, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + } + } + } + else + { + DrawTextBasic(dpi, screenCoords, STR_NO_TEST_RESULTS_YET); } } } - AnchorBorderWidgets(); - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); - } +#pragma endregion - void MeasurementsOnDraw(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); +#pragma region Graphs - if (widgets[WIDX_SAVE_DESIGN].type == WindowWidgetType::Button) + enum { - Widget* widget = &widgets[WIDX_PAGE_BACKGROUND]; + GRAPH_VELOCITY, + GRAPH_ALTITUDE, + GRAPH_VERTICAL, + GRAPH_LATERAL + }; - ScreenCoordsXY widgetCoords(windowPos.x + widget->width() / 2, windowPos.y + widget->top + 40); - DrawTextWrapped(dpi, widgetCoords, width - 8, STR_CLICK_ITEMS_OF_SCENERY_TO_SELECT, {}, { TextAlignment::CENTRE }); - - widgetCoords.x = windowPos.x + 4; - widgetCoords.y = windowPos.y + widgets[WIDX_SELECT_NEARBY_SCENERY].bottom + 17; - GfxFillRectInset( - dpi, { widgetCoords, { windowPos.x + 312, widgetCoords.y + 1 } }, colours[1], INSET_RECT_FLAG_BORDER_INSET); + void SetGraph(int32_t type) + { + if (list_information_type == type) + { + _autoScrollGraph = !_autoScrollGraph; + } + else + { + list_information_type = type; + } + Invalidate(); } - else + + void GraphsOnMouseUp(WidgetIndex widgetIndex) { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + case WIDX_TAB_8: + case WIDX_TAB_9: + case WIDX_TAB_10: + SetPage(widgetIndex - WIDX_TAB_1); + break; + } + } + + void GraphsResize() + { + WindowSetResize(*this, 316, 182, 500, 450); + } + + void GraphsOnMouseDown(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_GRAPH_VELOCITY: + SetGraph(GRAPH_VELOCITY); + break; + case WIDX_GRAPH_ALTITUDE: + SetGraph(GRAPH_ALTITUDE); + break; + case WIDX_GRAPH_VERTICAL: + SetGraph(GRAPH_VERTICAL); + break; + case WIDX_GRAPH_LATERAL: + SetGraph(GRAPH_LATERAL); + break; + } + } + + void GraphsUpdate() + { + Widget* widget; + int32_t x; + + frame_no++; + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_8); + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_GRAPH); + + widget = &widgets[WIDX_GRAPH]; + x = scrolls[0].h_left; + if (_autoScrollGraph) + { + auto ride = GetRide(rideId); + if (ride != nullptr) + { + RideMeasurement* measurement{}; + std::tie(measurement, std::ignore) = ride->GetMeasurement(); + x = measurement == nullptr ? 0 : measurement->current_item - ((widget->width() / 4) * 3); + } + } + + scrolls[0].h_left = std::clamp(x, 0, scrolls[0].h_right - (widget->width() - 2)); + WidgetScrollUpdateThumbs(*this, WIDX_GRAPH); + } + + ScreenSize GraphsScrollGetSize(int32_t scrollIndex) + { + OnPrepareDraw(); + + ScreenSize size{}; + // Set minimum size + size.width = widgets[WIDX_GRAPH].width() - 2; + + // Get measurement size + auto ride = GetRide(rideId); + if (ride != nullptr) + { + RideMeasurement* measurement{}; + std::tie(measurement, std::ignore) = ride->GetMeasurement(); + if (measurement != nullptr) + { + size.width = std::max(size.width, measurement->num_items); + } + } + return size; + } + + void GraphsOnScrollSelect(int32_t scrollIndex, int32_t scrollAreaType) + { + _autoScrollGraph = false; + } + + OpenRCT2String GraphsTooltip(const WidgetIndex widgetIndex, const StringId fallback) + { + if (widgetIndex == WIDX_GRAPH) + { + auto ride = GetRide(rideId); + if (ride != nullptr) + { + auto [measurement, message] = ride->GetMeasurement(); + if (measurement != nullptr && (measurement->flags & RIDE_MEASUREMENT_FLAG_RUNNING)) + { + auto ft = Formatter(); + ft.Increment(2); + ft.Add(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).number); + ft.Add(measurement->vehicle_index + 1); + return { fallback, ft }; + } + + return message; + } + } + else + { + return { STR_NONE, {} }; + } + return { fallback, {} }; + } + + void GraphsOnPrepareDraw() + { + auto newWidgets = PageWidgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto ft = Formatter::Common(); + ride->FormatNameTo(ft); + + // Set pressed graph button type + pressed_widgets &= ~(1uLL << WIDX_GRAPH_VELOCITY); + pressed_widgets &= ~(1uLL << WIDX_GRAPH_ALTITUDE); + pressed_widgets &= ~(1uLL << WIDX_GRAPH_VERTICAL); + pressed_widgets &= ~(1uLL << WIDX_GRAPH_LATERAL); + pressed_widgets |= (1LL << (WIDX_GRAPH_VELOCITY + list_information_type)); + + // Hide graph buttons that are not applicable + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES)) + { + widgets[WIDX_GRAPH_VERTICAL].type = WindowWidgetType::Button; + widgets[WIDX_GRAPH_LATERAL].type = WindowWidgetType::Button; + } + else + { + widgets[WIDX_GRAPH_VERTICAL].type = WindowWidgetType::Empty; + widgets[WIDX_GRAPH_LATERAL].type = WindowWidgetType::Empty; + } + + // Anchor graph widget + auto x = width - 4; + auto y = height - BUTTON_FACE_HEIGHT - 8; + + widgets[WIDX_GRAPH].right = x; + widgets[WIDX_GRAPH].bottom = y; + y += 3; + widgets[WIDX_GRAPH_VELOCITY].top = y; + widgets[WIDX_GRAPH_ALTITUDE].top = y; + widgets[WIDX_GRAPH_VERTICAL].top = y; + widgets[WIDX_GRAPH_LATERAL].top = y; + y += BUTTON_FACE_HEIGHT + 1; + widgets[WIDX_GRAPH_VELOCITY].bottom = y; + widgets[WIDX_GRAPH_ALTITUDE].bottom = y; + widgets[WIDX_GRAPH_VERTICAL].bottom = y; + widgets[WIDX_GRAPH_LATERAL].bottom = y; + + AnchorBorderWidgets(); + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); + } + + void GraphsOnDraw(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + DrawTabImages(dpi); + } + + void GraphsOnScrollDraw(DrawPixelInfo& dpi, int32_t scrollIndex) + { + GfxClear(dpi, ColourMapA[COLOUR_SATURATED_GREEN].darker); + + auto widget = &widgets[WIDX_GRAPH]; + auto ride = GetRide(rideId); + if (ride == nullptr) + { + return; + } + + auto [measurement, message] = ride->GetMeasurement(); + + if (measurement == nullptr) + { + // No measurement message + ScreenCoordsXY stringCoords(widget->width() / 2, widget->height() / 2 - 5); + int32_t txtWidth = widget->width() - 2; + DrawTextWrapped(dpi, stringCoords, txtWidth, message.str, message.args, { TextAlignment::CENTRE }); + return; + } + + // Vertical grid lines + const uint8_t lightColour = ColourMapA[COLOUR_SATURATED_GREEN].mid_light; + const uint8_t darkColour = ColourMapA[COLOUR_SATURATED_GREEN].mid_dark; + + int32_t time = 0; + for (int32_t x = 0; x < dpi.x + dpi.width; x += 80) + { + if (x + 80 >= dpi.x) + { + auto coord1 = ScreenCoordsXY{ x, dpi.y }; + auto coord2 = ScreenCoordsXY{ x, dpi.y + dpi.height - 1 }; + GfxFillRect(dpi, { coord1, coord2 }, lightColour); + GfxFillRect(dpi, { coord1 + ScreenCoordsXY{ 16, 0 }, coord2 + ScreenCoordsXY{ 16, 0 } }, darkColour); + GfxFillRect(dpi, { coord1 + ScreenCoordsXY{ 32, 0 }, coord2 + ScreenCoordsXY{ 32, 0 } }, darkColour); + GfxFillRect(dpi, { coord1 + ScreenCoordsXY{ 48, 0 }, coord2 + ScreenCoordsXY{ 48, 0 } }, darkColour); + GfxFillRect(dpi, { coord1 + ScreenCoordsXY{ 64, 0 }, coord2 + ScreenCoordsXY{ 64, 0 } }, darkColour); + } + time += 5; + } + + // Horizontal grid lines + int32_t listType = list_information_type; + int16_t yUnit = GraphsYAxisDetails[listType].unit; + StringId stringID = GraphsYAxisDetails[listType].label; + int16_t yUnitInterval = GraphsYAxisDetails[listType].unit_interval; + int16_t yInterval = GraphsYAxisDetails[listType].interval; + + // Scale modifier + if (listType == GRAPH_ALTITUDE) + { + yUnit -= kMapBaseZ * 3; + } + + for (int32_t y = widget->height() - 13; y >= 8; y -= yInterval, yUnit += yUnitInterval) + { + // Minor / major line + int32_t colour = yUnit == 0 ? lightColour : darkColour; + GfxFillRect(dpi, { { dpi.x, y }, { dpi.x + dpi.width - 1, y } }, colour); + + int16_t scaled_yUnit = yUnit; + // Scale modifier + if (listType == GRAPH_ALTITUDE) + scaled_yUnit /= 2; + + auto ft = Formatter(); + ft.Add(scaled_yUnit); + + DrawTextBasic(dpi, { scrolls[0].h_left + 1, y - 4 }, stringID, ft, { FontStyle::Small }); + } + + // Time marks + time = 0; + for (int32_t x = 0; x < dpi.x + dpi.width; x += 80) + { + auto ft = Formatter(); + ft.Add(time); + if (x + 80 >= dpi.x) + DrawTextBasic(dpi, { x + 2, 1 }, STR_RIDE_STATS_TIME, ft, { FontStyle::Small }); + time += 5; + } + + // Plot + int32_t x = dpi.x; + int32_t firstPoint, secondPoint; + // Uses the force limits (used to draw extreme G's in red on measurement tab) to determine if line should be drawn + // red. + int32_t intensityThresholdPositive = 0; + int32_t intensityThresholdNegative = 0; + for (int32_t graphWidth = 0; graphWidth < dpi.width; graphWidth++, x++) + { + if (x < 0 || x >= measurement->num_items - 1) + continue; + + constexpr int32_t VerticalGraphHeightOffset = 39; + constexpr int32_t LateralGraphHeightOffset = 52; + + switch (listType) + { + case GRAPH_VELOCITY: + firstPoint = measurement->velocity[x] / 2; + secondPoint = measurement->velocity[x + 1] / 2; + break; + case GRAPH_ALTITUDE: + firstPoint = measurement->altitude[x]; + secondPoint = measurement->altitude[x + 1]; + break; + case GRAPH_VERTICAL: + firstPoint = measurement->vertical[x] + VerticalGraphHeightOffset; + secondPoint = measurement->vertical[x + 1] + VerticalGraphHeightOffset; + intensityThresholdNegative = (RIDE_G_FORCES_RED_NEG_VERTICAL / 8) + VerticalGraphHeightOffset; + break; + case GRAPH_LATERAL: + firstPoint = measurement->lateral[x] + LateralGraphHeightOffset; + secondPoint = measurement->lateral[x + 1] + LateralGraphHeightOffset; + intensityThresholdPositive = (RIDE_G_FORCES_RED_LATERAL / 8) + LateralGraphHeightOffset; + intensityThresholdNegative = -(RIDE_G_FORCES_RED_LATERAL / 8) + LateralGraphHeightOffset; + break; + default: + LOG_ERROR("Wrong graph type %d", listType); + firstPoint = secondPoint = 0; + break; + } + + // Adjust line to match graph widget position. + firstPoint = widget->height() - firstPoint - 13; + secondPoint = widget->height() - secondPoint - 13; + if (firstPoint > secondPoint) + { + std::swap(firstPoint, secondPoint); + } + + // Adjust threshold line position as well + if (listType == GRAPH_VERTICAL || listType == GRAPH_LATERAL) + { + intensityThresholdPositive = widget->height() - intensityThresholdPositive - 13; + intensityThresholdNegative = widget->height() - intensityThresholdNegative - 13; + } + + const bool previousMeasurement = x > measurement->current_item; + + // Draw the current line in grey. + GfxFillRect( + dpi, { { x, firstPoint }, { x, secondPoint } }, previousMeasurement ? PALETTE_INDEX_17 : PALETTE_INDEX_21); + + // Draw red over extreme values (if supported by graph type). + if (listType == GRAPH_VERTICAL || listType == GRAPH_LATERAL) + { + const auto redLineColour = previousMeasurement ? PALETTE_INDEX_171 : PALETTE_INDEX_173; + + // Line exceeds negative threshold (at bottom of graph). + if (secondPoint >= intensityThresholdNegative) + { + const auto redLineTop = ScreenCoordsXY{ x, std::max(firstPoint, intensityThresholdNegative) }; + const auto redLineBottom = ScreenCoordsXY{ x, std::max(secondPoint, intensityThresholdNegative) }; + GfxFillRect(dpi, { redLineTop, redLineBottom }, redLineColour); + } + + // Line exceeds positive threshold (at top of graph). + if (listType == GRAPH_LATERAL && firstPoint < intensityThresholdPositive) + { + const auto redLineTop = ScreenCoordsXY{ x, std::min(firstPoint, intensityThresholdPositive) }; + const auto redLineBottom = ScreenCoordsXY{ x, std::min(secondPoint, intensityThresholdPositive) }; + GfxFillRect(dpi, { redLineTop, redLineBottom }, redLineColour); + } + } + } + } + +#pragma endregion + +#pragma region Income + + static void UpdateSamePriceThroughoutFlags(ShopItem shop_item) + { + const auto& gameState = GetGameState(); + const auto existingFlags = gameState.SamePriceThroughoutPark; + + auto newFlags = existingFlags; + if (GetShopItemDescriptor(shop_item).IsPhoto()) + { + if (existingFlags & EnumToFlag(shop_item)) + newFlags &= ~EnumsToFlags(ShopItem::Photo, ShopItem::Photo2, ShopItem::Photo3, ShopItem::Photo4); + else + newFlags |= EnumsToFlags(ShopItem::Photo, ShopItem::Photo2, ShopItem::Photo3, ShopItem::Photo4); + } + else + { + newFlags ^= EnumToFlag(shop_item); + } + + auto parkSetParameter = ParkSetParameterAction(ParkParameter::SamePriceInPark, newFlags); + GameActions::Execute(&parkSetParameter); + } + + void IncomeTogglePrimaryPrice() + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + ShopItem shopItem; + const auto& rtd = ride->GetRideTypeDescriptor(); + if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET)) + { + shopItem = ShopItem::Admission; + } + else + { + auto rideEntry = GetRideEntryByIndex(ride->subtype); + if (rideEntry != nullptr) + { + shopItem = rideEntry->shop_item[0]; + if (shopItem == ShopItem::None) + return; + } + else + { + return; + } + } + + UpdateSamePriceThroughoutFlags(shopItem); + + auto rideSetPriceAction = RideSetPriceAction(rideId, ride->price[0], true); + GameActions::Execute(&rideSetPriceAction); + } + + void IncomeToggleSecondaryPrice() + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto rideEntry = GetRideEntryByIndex(ride->subtype); + if (rideEntry == nullptr) + return; + + auto shop_item = rideEntry->shop_item[1]; + if (shop_item == ShopItem::None) + shop_item = ride->GetRideTypeDescriptor().PhotoItem; + + UpdateSamePriceThroughoutFlags(shop_item); + + auto rideSetPriceAction = RideSetPriceAction(rideId, ride->price[1], false); + GameActions::Execute(&rideSetPriceAction); + } + + void IncomeSetPrimaryPrice(money64 price) + { + auto rideSetPriceAction = RideSetPriceAction(rideId, price, true); + GameActions::Execute(&rideSetPriceAction); + } + + void IncomeIncreasePrimaryPrice() + { + if (!IncomeCanModifyPrimaryPrice()) + return; + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto price = ride->price[0]; + if (price < 20.00_GBP) + price++; + + IncomeSetPrimaryPrice(price); + } + + void IncomeDecreasePrimaryPrice() + { + if (!IncomeCanModifyPrimaryPrice()) + return; + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto price = ride->price[0]; + if (price > 0.00_GBP) + price--; + + IncomeSetPrimaryPrice(price); + } + + money64 IncomeGetSecondaryPrice() + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return 0; + + return ride->price[1]; + } + + void IncomeSetSecondaryPrice(money64 price) + { + auto rideSetPriceAction = RideSetPriceAction(rideId, price, false); + GameActions::Execute(&rideSetPriceAction); + } + + bool IncomeCanModifyPrimaryPrice() + { + auto ride = GetRide(rideId); + if (ride == nullptr) + return false; + + auto rideEntry = ride->GetRideEntry(); + const auto& rtd = ride->GetRideTypeDescriptor(); + return ParkRidePricesUnlocked() || rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET) + || (rideEntry != nullptr && rideEntry->shop_item[0] != ShopItem::None); + } + + void IncomeIncreaseSecondaryPrice() + { + auto price = IncomeGetSecondaryPrice(); + + if (price < 20.00_GBP) + price++; + + IncomeSetSecondaryPrice(price); + } + + void IncomeDecreaseSecondaryPrice() + { + auto price = IncomeGetSecondaryPrice(); + + if (price > 0.00_GBP) + price--; + + IncomeSetSecondaryPrice(price); + } + + void IncomeOnMouseUp(WidgetIndex widgetIndex) + { + utf8 _moneyInputText[MONEY_STRING_MAXLENGTH] = {}; + + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + case WIDX_TAB_8: + case WIDX_TAB_9: + case WIDX_TAB_10: + SetPage(widgetIndex - WIDX_TAB_1); + break; + case WIDX_PRIMARY_PRICE: + { + if (!IncomeCanModifyPrimaryPrice()) + return; + + auto ride = GetRide(rideId); + if (ride != nullptr) + { + MoneyToString(ride->price[0], _moneyInputText, MONEY_STRING_MAXLENGTH, true); + WindowTextInputRawOpen( + this, WIDX_PRIMARY_PRICE, STR_ENTER_NEW_VALUE, STR_ENTER_NEW_VALUE, {}, _moneyInputText, + MONEY_STRING_MAXLENGTH); + } + break; + } + case WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK: + IncomeTogglePrimaryPrice(); + break; + case WIDX_SECONDARY_PRICE: + { + auto price64 = IncomeGetSecondaryPrice(); + + MoneyToString(price64, _moneyInputText, MONEY_STRING_MAXLENGTH, true); + WindowTextInputRawOpen( + this, WIDX_SECONDARY_PRICE, STR_ENTER_NEW_VALUE, STR_ENTER_NEW_VALUE, {}, _moneyInputText, + MONEY_STRING_MAXLENGTH); + } + break; + case WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK: + IncomeToggleSecondaryPrice(); + break; + } + } + + void IncomeResize() + { + WindowSetResize(*this, 316, 194, 316, 194); + } + + void IncomeOnMouseDown(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_PRIMARY_PRICE_INCREASE: + IncomeIncreasePrimaryPrice(); + break; + case WIDX_PRIMARY_PRICE_DECREASE: + IncomeDecreasePrimaryPrice(); + break; + case WIDX_SECONDARY_PRICE_INCREASE: + IncomeIncreaseSecondaryPrice(); + break; + case WIDX_SECONDARY_PRICE_DECREASE: + IncomeDecreaseSecondaryPrice(); + break; + } + } + + void IncomeUpdate() + { + frame_no++; + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_9); + + auto ride = GetRide(rideId); + if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_INCOME) + { + ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_INCOME; + Invalidate(); + } + } + + void IncomeOnTextInput(WidgetIndex widgetIndex, std::string_view text) + { + if ((widgetIndex != WIDX_PRIMARY_PRICE && widgetIndex != WIDX_SECONDARY_PRICE) || text.empty()) + return; + + std::string strText{ text }; + money64 price = StringToMoney(strText.c_str()); + if (price == kMoney64Undefined) + { + return; + } + + price = std::clamp(price, 0.00_GBP, 20.00_GBP); + + if (widgetIndex == WIDX_PRIMARY_PRICE) + { + IncomeSetPrimaryPrice(price); + } + else + { + IncomeSetSecondaryPrice(price); + } + } + + void IncomeOnPrepareDraw() + { + auto newWidgets = PageWidgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + widgets[WIDX_TITLE].text = STR_ARG_18_STRINGID; + + auto ft = Formatter::Common(); + ft.Increment(18); + ride->FormatNameTo(ft); + + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr) + return; + + // Primary item + pressed_widgets &= ~(1uLL << WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK); + disabled_widgets &= ~(1uLL << WIDX_PRIMARY_PRICE); + + widgets[WIDX_PRIMARY_PRICE_LABEL].tooltip = STR_NONE; + widgets[WIDX_PRIMARY_PRICE].tooltip = STR_NONE; + + // If ride prices are locked, do not allow setting the price, unless we're dealing with a shop or toilet. + const auto& rtd = ride->GetRideTypeDescriptor(); + if (!ParkRidePricesUnlocked() && rideEntry->shop_item[0] == ShopItem::None + && !rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET)) + { + disabled_widgets |= (1uLL << WIDX_PRIMARY_PRICE); + widgets[WIDX_PRIMARY_PRICE_LABEL].tooltip = STR_RIDE_INCOME_ADMISSION_PAY_FOR_ENTRY_TIP; + widgets[WIDX_PRIMARY_PRICE].tooltip = STR_RIDE_INCOME_ADMISSION_PAY_FOR_ENTRY_TIP; + } + + widgets[WIDX_PRIMARY_PRICE_LABEL].text = STR_RIDE_INCOME_ADMISSION_PRICE; + widgets[WIDX_SECONDARY_PRICE_LABEL].text = STR_SHOP_ITEM_PRICE_LABEL_ON_RIDE_PHOTO; + widgets[WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Empty; + + widgets[WIDX_PRIMARY_PRICE].text = STR_BOTTOM_TOOLBAR_CASH; + auto ridePrimaryPrice = RideGetPrice(*ride); + ft.Rewind(); + ft.Add(ridePrimaryPrice); + if (ridePrimaryPrice == 0) + widgets[WIDX_PRIMARY_PRICE].text = STR_FREE; + + ShopItem primaryItem = ShopItem::Admission; + if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET) || ((primaryItem = rideEntry->shop_item[0]) != ShopItem::None)) + { + widgets[WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Checkbox; + + if (ShopItemHasCommonPrice(primaryItem)) + pressed_widgets |= (1uLL << WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK); + + widgets[WIDX_PRIMARY_PRICE_LABEL].text = GetShopItemDescriptor(primaryItem).Naming.PriceLabel; + } + + // Get secondary item + auto secondaryItem = ride->GetRideTypeDescriptor().PhotoItem; + if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO)) + { + if ((secondaryItem = rideEntry->shop_item[1]) != ShopItem::None) + { + widgets[WIDX_SECONDARY_PRICE_LABEL].text = GetShopItemDescriptor(secondaryItem).Naming.PriceLabel; + } + } + + if (secondaryItem == ShopItem::None) + { + // Hide secondary item widgets + widgets[WIDX_SECONDARY_PRICE_LABEL].type = WindowWidgetType::Empty; + widgets[WIDX_SECONDARY_PRICE].type = WindowWidgetType::Empty; + widgets[WIDX_SECONDARY_PRICE_INCREASE].type = WindowWidgetType::Empty; + widgets[WIDX_SECONDARY_PRICE_DECREASE].type = WindowWidgetType::Empty; + widgets[WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Empty; + } + else + { + // Set same price throughout park checkbox + pressed_widgets &= ~(1uLL << WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK); + if (ShopItemHasCommonPrice(secondaryItem)) + pressed_widgets |= (1uLL << WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK); + + // Show widgets + widgets[WIDX_SECONDARY_PRICE_LABEL].type = WindowWidgetType::Label; + widgets[WIDX_SECONDARY_PRICE].type = WindowWidgetType::Spinner; + widgets[WIDX_SECONDARY_PRICE_INCREASE].type = WindowWidgetType::Button; + widgets[WIDX_SECONDARY_PRICE_DECREASE].type = WindowWidgetType::Button; + widgets[WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Checkbox; + + // Set secondary item price + widgets[WIDX_SECONDARY_PRICE].text = STR_RIDE_SECONDARY_PRICE_VALUE; + ft.Rewind(); + ft.Increment(10); + ft.Add(ride->price[1]); + if (ride->price[1] == 0) + widgets[WIDX_SECONDARY_PRICE].text = STR_FREE; + } + + AnchorBorderWidgets(); + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); + } + + void IncomeOnDraw(DrawPixelInfo& dpi) + { + StringId stringId; + money64 profit; + ShopItem primaryItem, secondaryItem; + + DrawWidgets(dpi); + DrawTabImages(dpi); + + auto ride = GetRide(rideId); + if (ride == nullptr) + return; + + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr) + return; + + auto screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 33 }; + + // Primary item profit / loss per item sold + primaryItem = rideEntry->shop_item[0]; + if (primaryItem != ShopItem::None) + { + profit = ride->price[0]; + + stringId = STR_PROFIT_PER_ITEM_SOLD; + profit -= GetShopItemDescriptor(primaryItem).Cost; + if (profit < 0) + { + profit *= -1; + stringId = STR_LOSS_PER_ITEM_SOLD; + } + + auto ft = Formatter(); + ft.Add(profit); + + DrawTextBasic(dpi, screenCoords, stringId, ft); + } + screenCoords.y += 44; + + // Secondary item profit / loss per item sold + secondaryItem = ride->GetRideTypeDescriptor().PhotoItem; + if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO)) + secondaryItem = rideEntry->shop_item[1]; + + if (secondaryItem != ShopItem::None) + { + profit = ride->price[1]; + + stringId = STR_PROFIT_PER_ITEM_SOLD; + profit -= GetShopItemDescriptor(secondaryItem).Cost; + if (profit < 0) + { + profit *= -1; + stringId = STR_LOSS_PER_ITEM_SOLD; + } + + auto ft = Formatter(); + ft.Add(profit); + + DrawTextBasic(dpi, screenCoords, stringId, ft); + } + screenCoords.y += 18; + + // Income per hour + if (ride->income_per_hour != kMoney64Undefined) + { + auto ft = Formatter(); + ft.Add(ride->income_per_hour); + + DrawTextBasic(dpi, screenCoords, STR_INCOME_PER_HOUR, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + + // Running cost per hour + money64 costPerHour = ride->upkeep_cost * 16; + stringId = ride->upkeep_cost == kMoney64Undefined ? STR_RUNNING_COST_UNKNOWN : STR_RUNNING_COST_PER_HOUR; + auto ft = Formatter(); + ft.Add(costPerHour); + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Profit per hour + if (ride->profit != kMoney64Undefined) + { + ft = Formatter(); + ft.Add(ride->profit); + DrawTextBasic(dpi, screenCoords, STR_PROFIT_PER_HOUR, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + screenCoords.y += 5; + + // Total profit + ft = Formatter(); + ft.Add(ride->total_profit); + DrawTextBasic(dpi, screenCoords, STR_TOTAL_PROFIT, ft); + } + +#pragma endregion + +#pragma region Customer + + void CustomerOnMouseUp(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + case WIDX_TAB_8: + case WIDX_TAB_9: + case WIDX_TAB_10: + SetPage(widgetIndex - WIDX_TAB_1); + break; + case WIDX_SHOW_GUESTS_THOUGHTS: + { + auto intent = Intent(WindowClass::GuestList); + intent.PutExtra( + INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsThinkingAboutRide)); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, number); + ContextOpenIntent(&intent); + break; + } + case WIDX_SHOW_GUESTS_ON_RIDE: + { + auto intent = Intent(WindowClass::GuestList); + intent.PutExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsOnRide)); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, number); + ContextOpenIntent(&intent); + break; + } + case WIDX_SHOW_GUESTS_QUEUING: + { + auto intent = Intent(WindowClass::GuestList); + intent.PutExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsInQueue)); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, number); + ContextOpenIntent(&intent); + break; + } + } + } + + void CustomerResize() + { + flags |= WF_RESIZABLE; + WindowSetResize(*this, 316, 163, 316, 163); + } + + void CustomerUpdate() + { + picked_peep_frame++; + if (picked_peep_frame >= 24) + picked_peep_frame = 0; + + OnPrepareDraw(); + WidgetInvalidate(*this, WIDX_TAB_10); + + auto ride = GetRide(rideId); + if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_CUSTOMER) + { + ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_CUSTOMER; + Invalidate(); + } + } + + void CustomerOnPrepareDraw() + { + auto newWidgets = PageWidgets[page]; + if (widgets != newWidgets) + { + widgets = newWidgets; + InitScrollWidgets(); + } + + SetPressedTab(); + + auto ride = GetRide(rideId); + if (ride != nullptr) + { + auto ft = Formatter::Common(); + ride->FormatNameTo(ft); + + widgets[WIDX_SHOW_GUESTS_THOUGHTS].type = WindowWidgetType::FlatBtn; + if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY)) + { + widgets[WIDX_SHOW_GUESTS_ON_RIDE].type = WindowWidgetType::Empty; + widgets[WIDX_SHOW_GUESTS_QUEUING].type = WindowWidgetType::Empty; + } + else + { + widgets[WIDX_SHOW_GUESTS_ON_RIDE].type = WindowWidgetType::FlatBtn; + widgets[WIDX_SHOW_GUESTS_QUEUING].type = WindowWidgetType::FlatBtn; + } + + AnchorBorderWidgets(); + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); + } + } + + void CustomerOnDraw(DrawPixelInfo& dpi) + { + ShopItem shopItem; + int16_t popularity, satisfaction, queueTime; + StringId stringId; + + DrawWidgets(dpi); + DrawTabImages(dpi); + auto ride = GetRide(rideId); if (ride == nullptr) return; @@ -5304,1484 +6544,181 @@ private: auto screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - if (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED) + // Customers currently on ride + if (ride->IsRide()) { - // Excitement - StringId ratingName = GetRatingName(ride->excitement); auto ft = Formatter(); - ft.Add(ride->excitement); - ft.Add(ratingName); - StringId stringId = !RideHasRatings(*ride) ? STR_EXCITEMENT_RATING_NOT_YET_AVAILABLE : STR_EXCITEMENT_RATING; - DrawTextBasic(dpi, screenCoords, stringId, ft); + ft.Add(ride->num_riders); + DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_ON_RIDE, ft); screenCoords.y += LIST_ROW_HEIGHT; + } - // Intensity - ratingName = GetRatingName(ride->intensity); - ft = Formatter(); - ft.Add(ride->intensity); - ft.Add(ratingName); + // Customers per hour + auto ft = Formatter(); + ft.Add(RideCustomersPerHour(*ride)); + DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_PER_HOUR, ft); + screenCoords.y += LIST_ROW_HEIGHT; - stringId = STR_INTENSITY_RATING; - if (!RideHasRatings(*ride)) - stringId = STR_INTENSITY_RATING_NOT_YET_AVAILABLE; - else if (ride->intensity >= RIDE_RATING(10, 00)) - stringId = STR_INTENSITY_RATING_RED; - - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Nausea - ratingName = GetRatingName(ride->nausea); - ft = Formatter(); - ft.Add(ride->nausea); - ft.Add(ratingName); - stringId = !RideHasRatings(*ride) ? STR_NAUSEA_RATING_NOT_YET_AVAILABLE : STR_NAUSEA_RATING; - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += 2 * LIST_ROW_HEIGHT; - - // Horizontal rule - GfxFillRectInset( - dpi, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 303, -5 } }, colours[1], - INSET_RECT_FLAG_BORDER_INSET); - - if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_NO_RAW_STATS)) - { - if (ride->type == RIDE_TYPE_MINI_GOLF) - { - // Holes - ft = Formatter(); - ft.Add(ride->holes); - DrawTextBasic(dpi, screenCoords, STR_HOLES, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - else - { - // Max speed - ft = Formatter(); - ft.Add((ride->max_speed * 9) >> 18); - DrawTextBasic(dpi, screenCoords, STR_MAX_SPEED, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Average speed - ft = Formatter(); - ft.Add((ride->average_speed * 9) >> 18); - DrawTextBasic(dpi, screenCoords, STR_AVERAGE_SPEED, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Ride time - ft = Formatter(); - int32_t numTimes = 0; - // TODO: STR_RIDE_TIME only takes up to 4 stations modify to take more - // also if modified may need to be split into multiple format strings - // as formatter cannot take more than 256 bytes - for (int32_t i = 0; i < std::min(ride->num_stations, 4); i++) - { - StationIndex stationIndex = StationIndex::FromUnderlying(numTimes); - auto time = ride->GetStation(stationIndex).SegmentTime; - if (time != 0) - { - ft.Add(STR_RIDE_TIME_ENTRY_WITH_SEPARATOR); - ft.Add(time); - numTimes++; - } - } - if (numTimes == 0) - { - ft.Add(STR_RIDE_TIME_ENTRY); - ft.Add(0); - numTimes++; - } - else - { - // sadly, STR_RIDE_TIME_ENTRY_WITH_SEPARATOR are defined with the separator AFTER an entry - // therefore we set the last entry to use the no-separator format now, post-format - ft.Rewind(); - ft.Increment((numTimes - 1) * 4); - ft.Add(STR_RIDE_TIME_ENTRY); - } - ft.Rewind(); - ft.Increment(numTimes * 4); - ft.Add(0); - ft.Add(0); - ft.Add(0); - ft.Add(0); - DrawTextEllipsised(dpi, screenCoords, 308, STR_RIDE_TIME, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - // Ride length - ft = Formatter(); - int32_t numLengths = 0; - // TODO: see above STR_RIDE_LENGTH is also only able to display max 4 - for (int32_t i = 0; i < std::min(ride->num_stations, 4); i++) - { - StationIndex stationIndex = StationIndex::FromUnderlying(i); - auto length = ride->GetStation(stationIndex).SegmentLength; - if (length != 0) - { - length >>= 16; - ft.Add(STR_RIDE_LENGTH_ENTRY_WITH_SEPARATOR); - ft.Add(length & 0xFFFF); - numLengths++; - } - } - if (numLengths == 0) - { - ft.Add(STR_RIDE_LENGTH_ENTRY); - ft.Add(0); - numLengths++; - } - else - { - // sadly, STR_RIDE_LENGTH_ENTRY_WITH_SEPARATOR are defined with the separator AFTER an entry - // therefore we set the last entry to use the no-separator format now, post-format - ft.Rewind(); - ft.Increment((numLengths - 1) * 4); - ft.Add(STR_RIDE_LENGTH_ENTRY); - } - ft.Rewind(); - ft.Increment(numLengths * 4); - ft.Add(0); - ft.Add(0); - ft.Add(0); - ft.Add(0); - DrawTextEllipsised(dpi, screenCoords, 308, STR_RIDE_LENGTH, ft); - - screenCoords.y += LIST_ROW_HEIGHT; - - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES)) - { - // Max. positive vertical G's - stringId = STR_MAX_POSITIVE_VERTICAL_G; - - ft = Formatter(); - ft.Add(ride->max_positive_vertical_g); - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Max. negative vertical G's - stringId = ride->max_negative_vertical_g <= RIDE_G_FORCES_RED_NEG_VERTICAL - ? STR_MAX_NEGATIVE_VERTICAL_G_RED - : STR_MAX_NEGATIVE_VERTICAL_G; - ft = Formatter(); - ft.Add(ride->max_negative_vertical_g); - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Max lateral G's - stringId = ride->max_lateral_g > RIDE_G_FORCES_RED_LATERAL ? STR_MAX_LATERAL_G_RED : STR_MAX_LATERAL_G; - ft = Formatter(); - ft.Add(ride->max_lateral_g); - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Total 'air' time - ft = Formatter(); - ft.Add(ride->total_air_time * 3); - DrawTextBasic(dpi, screenCoords, STR_TOTAL_AIR_TIME, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_DROPS)) - { - // Drops - auto drops = ride->drops & 0x3F; - ft = Formatter(); - ft.Add(drops); - DrawTextBasic(dpi, screenCoords, STR_DROPS, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Highest drop height - auto highestDropHeight = (ride->highest_drop_height * 3) / 4; - ft = Formatter(); - ft.Add(highestDropHeight); - DrawTextBasic(dpi, screenCoords, STR_HIGHEST_DROP_HEIGHT, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - if (ride->type != RIDE_TYPE_MINI_GOLF) - { - // Inversions - if (ride->inversions != 0) - { - ft = Formatter(); - ft.Add(ride->inversions); - DrawTextBasic(dpi, screenCoords, STR_INVERSIONS, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - } - } + // Popularity + popularity = ride->popularity; + if (popularity == 255) + { + stringId = STR_POPULARITY_UNKNOWN; } else { - DrawTextBasic(dpi, screenCoords, STR_NO_TEST_RESULTS_YET); + stringId = STR_POPULARITY_PERCENT; + popularity *= 4; } + ft = Formatter(); + ft.Add(popularity); + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Satisfaction + satisfaction = ride->satisfaction; + if (satisfaction == 255) + { + stringId = STR_SATISFACTION_UNKNOWN; + } + else + { + stringId = STR_SATISFACTION_PERCENT; + satisfaction *= 5; + } + ft = Formatter(); + ft.Add(satisfaction); + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Queue time + if (ride->IsRide()) + { + queueTime = ride->GetMaxQueueTime(); + stringId = queueTime == 1 ? STR_QUEUE_TIME_MINUTE : STR_QUEUE_TIME_MINUTES; + ft = Formatter(); + ft.Add(queueTime); + screenCoords.y += DrawTextWrapped(dpi, screenCoords, 308, stringId, ft, { TextAlignment::LEFT }); + screenCoords.y += 5; + } + + // Primary shop items sold + shopItem = ride->GetRideEntry()->shop_item[0]; + if (shopItem != ShopItem::None) + { + ft = Formatter(); + ft.Add(GetShopItemDescriptor(shopItem).Naming.Plural); + ft.Add(ride->no_primary_items_sold); + DrawTextBasic(dpi, screenCoords, STR_ITEMS_SOLD, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + + // Secondary shop items sold / on-ride photos sold + shopItem = (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) ? ride->GetRideTypeDescriptor().PhotoItem + : ride->GetRideEntry()->shop_item[1]; + if (shopItem != ShopItem::None) + { + ft = Formatter(); + ft.Add(GetShopItemDescriptor(shopItem).Naming.Plural); + ft.Add(ride->no_secondary_items_sold); + DrawTextBasic(dpi, screenCoords, STR_ITEMS_SOLD, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + + // Total customers + ft = Formatter(); + ft.Add(ride->total_customers); + DrawTextBasic(dpi, screenCoords, STR_TOTAL_CUSTOMERS, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + // Guests favourite + if (ride->IsRide()) + { + ft = Formatter(); + ft.Add(ride->guests_favourite); + stringId = ride->guests_favourite == 1 ? STR_FAVOURITE_RIDE_OF_GUEST : STR_FAVOURITE_RIDE_OF_GUESTS; + DrawTextBasic(dpi, screenCoords, stringId, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } + screenCoords.y += 2; + + // Age + // If the ride has a build date that is in the future, show it as built this year. + int16_t age = std::max(DateGetYear(ride->GetAge()), 0); + stringId = age == 0 ? STR_BUILT_THIS_YEAR : age == 1 ? STR_BUILT_LAST_YEAR : STR_BUILT_YEARS_AGO; + ft = Formatter(); + ft.Add(age); + DrawTextBasic(dpi, screenCoords, stringId, ft); } - } #pragma endregion - -#pragma region Graphs - - enum - { - GRAPH_VELOCITY, - GRAPH_ALTITUDE, - GRAPH_VERTICAL, - GRAPH_LATERAL }; - void SetGraph(int32_t type) + /** + * + * rct2: 0x006AEAB4 + */ + static RideWindow* WindowRideOpen(const Ride& ride) { - if (list_information_type == type) - { - _autoScrollGraph = !_autoScrollGraph; - } - else - { - list_information_type = type; - } - Invalidate(); + return WindowCreate(WindowClass::Ride, 316, 207, WF_10 | WF_RESIZABLE, ride); } - void GraphsOnMouseUp(WidgetIndex widgetIndex) + /** + * + * rct2: 0x006ACC28 + */ + WindowBase* RideMainOpen(const Ride& ride) { - switch (widgetIndex) + if (ride.type >= RIDE_TYPE_COUNT) { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - case WIDX_TAB_8: - case WIDX_TAB_9: - case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); - break; + return nullptr; } - } - void GraphsResize() - { - WindowSetResize(*this, 316, 182, 500, 450); - } - - void GraphsOnMouseDown(WidgetIndex widgetIndex) - { - switch (widgetIndex) + RideWindow* w = static_cast(WindowBringToFrontByNumber(WindowClass::Ride, ride.id.ToUnderlying())); + if (w == nullptr) { - case WIDX_GRAPH_VELOCITY: - SetGraph(GRAPH_VELOCITY); - break; - case WIDX_GRAPH_ALTITUDE: - SetGraph(GRAPH_ALTITUDE); - break; - case WIDX_GRAPH_VERTICAL: - SetGraph(GRAPH_VERTICAL); - break; - case WIDX_GRAPH_LATERAL: - SetGraph(GRAPH_LATERAL); - break; + w = WindowRideOpen(ride); + w->SetViewIndex(0); } - } - - void GraphsUpdate() - { - Widget* widget; - int32_t x; - - frame_no++; - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_8); - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_GRAPH); - - widget = &widgets[WIDX_GRAPH]; - x = scrolls[0].h_left; - if (_autoScrollGraph) + else if (w->GetViewIndex() >= (1 + ride.NumTrains + ride.num_stations)) { - auto ride = GetRide(rideId); - if (ride != nullptr) + w->SetViewIndex(0); + } + + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) + { + if (w->classification == gCurrentToolWidget.window_classification && w->number == gCurrentToolWidget.window_number) { - RideMeasurement* measurement{}; - std::tie(measurement, std::ignore) = ride->GetMeasurement(); - x = measurement == nullptr ? 0 : measurement->current_item - ((widget->width() / 4) * 3); + ToolCancel(); } } - scrolls[0].h_left = std::clamp(x, 0, scrolls[0].h_right - (widget->width() - 2)); - WidgetScrollUpdateThumbs(*this, WIDX_GRAPH); + if (w->page != WINDOW_RIDE_PAGE_MAIN) + { + w->SetPage(WINDOW_RIDE_PAGE_MAIN); + } + + w->OnViewportRotate(); + return w; } - ScreenSize GraphsScrollGetSize(int32_t scrollIndex) + /** + * + * rct2: 0x006ACCCE + */ + static WindowBase* WindowRideOpenStation(const Ride& ride, StationIndex stationIndex) { - OnPrepareDraw(); + if (ride.type >= RIDE_TYPE_COUNT) + return nullptr; - ScreenSize size{}; - // Set minimum size - size.width = widgets[WIDX_GRAPH].width() - 2; + if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)) + return RideMainOpen(ride); - // Get measurement size - auto ride = GetRide(rideId); - if (ride != nullptr) + auto* w = static_cast(WindowBringToFrontByNumber(WindowClass::Ride, ride.id.ToUnderlying())); + if (w == nullptr) { - RideMeasurement* measurement{}; - std::tie(measurement, std::ignore) = ride->GetMeasurement(); - if (measurement != nullptr) - { - size.width = std::max(size.width, measurement->num_items); - } + w = WindowRideOpen(ride); } - return size; - } - - void GraphsOnScrollSelect(int32_t scrollIndex, int32_t scrollAreaType) - { - _autoScrollGraph = false; - } - - OpenRCT2String GraphsTooltip(const WidgetIndex widgetIndex, const StringId fallback) - { - if (widgetIndex == WIDX_GRAPH) - { - auto ride = GetRide(rideId); - if (ride != nullptr) - { - auto [measurement, message] = ride->GetMeasurement(); - if (measurement != nullptr && (measurement->flags & RIDE_MEASUREMENT_FLAG_RUNNING)) - { - auto ft = Formatter(); - ft.Increment(2); - ft.Add(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).number); - ft.Add(measurement->vehicle_index + 1); - return { fallback, ft }; - } - - return message; - } - } - else - { - return { STR_NONE, {} }; - } - return { fallback, {} }; - } - - void GraphsOnPrepareDraw() - { - auto newWidgets = PageWidgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - InitScrollWidgets(); - } - - SetPressedTab(); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto ft = Formatter::Common(); - ride->FormatNameTo(ft); - - // Set pressed graph button type - pressed_widgets &= ~(1uLL << WIDX_GRAPH_VELOCITY); - pressed_widgets &= ~(1uLL << WIDX_GRAPH_ALTITUDE); - pressed_widgets &= ~(1uLL << WIDX_GRAPH_VERTICAL); - pressed_widgets &= ~(1uLL << WIDX_GRAPH_LATERAL); - pressed_widgets |= (1LL << (WIDX_GRAPH_VELOCITY + list_information_type)); - - // Hide graph buttons that are not applicable - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES)) - { - widgets[WIDX_GRAPH_VERTICAL].type = WindowWidgetType::Button; - widgets[WIDX_GRAPH_LATERAL].type = WindowWidgetType::Button; - } - else - { - widgets[WIDX_GRAPH_VERTICAL].type = WindowWidgetType::Empty; - widgets[WIDX_GRAPH_LATERAL].type = WindowWidgetType::Empty; - } - - // Anchor graph widget - auto x = width - 4; - auto y = height - BUTTON_FACE_HEIGHT - 8; - - widgets[WIDX_GRAPH].right = x; - widgets[WIDX_GRAPH].bottom = y; - y += 3; - widgets[WIDX_GRAPH_VELOCITY].top = y; - widgets[WIDX_GRAPH_ALTITUDE].top = y; - widgets[WIDX_GRAPH_VERTICAL].top = y; - widgets[WIDX_GRAPH_LATERAL].top = y; - y += BUTTON_FACE_HEIGHT + 1; - widgets[WIDX_GRAPH_VELOCITY].bottom = y; - widgets[WIDX_GRAPH_ALTITUDE].bottom = y; - widgets[WIDX_GRAPH_VERTICAL].bottom = y; - widgets[WIDX_GRAPH_LATERAL].bottom = y; - - AnchorBorderWidgets(); - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); - } - - void GraphsOnDraw(DrawPixelInfo& dpi) - { - DrawWidgets(dpi); - DrawTabImages(dpi); - } - - void GraphsOnScrollDraw(DrawPixelInfo& dpi, int32_t scrollIndex) - { - GfxClear(&dpi, ColourMapA[COLOUR_SATURATED_GREEN].darker); - - auto widget = &widgets[WIDX_GRAPH]; - auto ride = GetRide(rideId); - if (ride == nullptr) - { - return; - } - - auto [measurement, message] = ride->GetMeasurement(); - - if (measurement == nullptr) - { - // No measurement message - ScreenCoordsXY stringCoords(widget->width() / 2, widget->height() / 2 - 5); - int32_t txtWidth = widget->width() - 2; - DrawTextWrapped(dpi, stringCoords, txtWidth, message.str, message.args, { TextAlignment::CENTRE }); - return; - } - - // Vertical grid lines - const uint8_t lightColour = ColourMapA[COLOUR_SATURATED_GREEN].mid_light; - const uint8_t darkColour = ColourMapA[COLOUR_SATURATED_GREEN].mid_dark; - - int32_t time = 0; - for (int32_t x = 0; x < dpi.x + dpi.width; x += 80) - { - if (x + 80 >= dpi.x) - { - auto coord1 = ScreenCoordsXY{ x, dpi.y }; - auto coord2 = ScreenCoordsXY{ x, dpi.y + dpi.height - 1 }; - GfxFillRect(dpi, { coord1, coord2 }, lightColour); - GfxFillRect(dpi, { coord1 + ScreenCoordsXY{ 16, 0 }, coord2 + ScreenCoordsXY{ 16, 0 } }, darkColour); - GfxFillRect(dpi, { coord1 + ScreenCoordsXY{ 32, 0 }, coord2 + ScreenCoordsXY{ 32, 0 } }, darkColour); - GfxFillRect(dpi, { coord1 + ScreenCoordsXY{ 48, 0 }, coord2 + ScreenCoordsXY{ 48, 0 } }, darkColour); - GfxFillRect(dpi, { coord1 + ScreenCoordsXY{ 64, 0 }, coord2 + ScreenCoordsXY{ 64, 0 } }, darkColour); - } - time += 5; - } - - // Horizontal grid lines - int32_t listType = list_information_type; - int16_t yUnit = GraphsYAxisDetails[listType].unit; - StringId stringID = GraphsYAxisDetails[listType].label; - int16_t yUnitInterval = GraphsYAxisDetails[listType].unit_interval; - int16_t yInterval = GraphsYAxisDetails[listType].interval; - - // Scale modifier - if (listType == GRAPH_ALTITUDE) - { - yUnit -= kMapBaseZ * 3; - } - - for (int32_t y = widget->height() - 13; y >= 8; y -= yInterval, yUnit += yUnitInterval) - { - // Minor / major line - int32_t colour = yUnit == 0 ? lightColour : darkColour; - GfxFillRect(dpi, { { dpi.x, y }, { dpi.x + dpi.width - 1, y } }, colour); - - int16_t scaled_yUnit = yUnit; - // Scale modifier - if (listType == GRAPH_ALTITUDE) - scaled_yUnit /= 2; - - auto ft = Formatter(); - ft.Add(scaled_yUnit); - - DrawTextBasic(dpi, { scrolls[0].h_left + 1, y - 4 }, stringID, ft, { FontStyle::Small }); - } - - // Time marks - time = 0; - for (int32_t x = 0; x < dpi.x + dpi.width; x += 80) - { - auto ft = Formatter(); - ft.Add(time); - if (x + 80 >= dpi.x) - DrawTextBasic(dpi, { x + 2, 1 }, STR_RIDE_STATS_TIME, ft, { FontStyle::Small }); - time += 5; - } - - // Plot - int32_t x = dpi.x; - int32_t firstPoint, secondPoint; - // Uses the force limits (used to draw extreme G's in red on measurement tab) to determine if line should be drawn red. - int32_t intensityThresholdPositive = 0; - int32_t intensityThresholdNegative = 0; - for (int32_t graphWidth = 0; graphWidth < dpi.width; graphWidth++, x++) - { - if (x < 0 || x >= measurement->num_items - 1) - continue; - - constexpr int32_t VerticalGraphHeightOffset = 39; - constexpr int32_t LateralGraphHeightOffset = 52; - - switch (listType) - { - case GRAPH_VELOCITY: - firstPoint = measurement->velocity[x] / 2; - secondPoint = measurement->velocity[x + 1] / 2; - break; - case GRAPH_ALTITUDE: - firstPoint = measurement->altitude[x]; - secondPoint = measurement->altitude[x + 1]; - break; - case GRAPH_VERTICAL: - firstPoint = measurement->vertical[x] + VerticalGraphHeightOffset; - secondPoint = measurement->vertical[x + 1] + VerticalGraphHeightOffset; - intensityThresholdNegative = (RIDE_G_FORCES_RED_NEG_VERTICAL / 8) + VerticalGraphHeightOffset; - break; - case GRAPH_LATERAL: - firstPoint = measurement->lateral[x] + LateralGraphHeightOffset; - secondPoint = measurement->lateral[x + 1] + LateralGraphHeightOffset; - intensityThresholdPositive = (RIDE_G_FORCES_RED_LATERAL / 8) + LateralGraphHeightOffset; - intensityThresholdNegative = -(RIDE_G_FORCES_RED_LATERAL / 8) + LateralGraphHeightOffset; - break; - default: - LOG_ERROR("Wrong graph type %d", listType); - firstPoint = secondPoint = 0; - break; - } - - // Adjust line to match graph widget position. - firstPoint = widget->height() - firstPoint - 13; - secondPoint = widget->height() - secondPoint - 13; - if (firstPoint > secondPoint) - { - std::swap(firstPoint, secondPoint); - } - - // Adjust threshold line position as well - if (listType == GRAPH_VERTICAL || listType == GRAPH_LATERAL) - { - intensityThresholdPositive = widget->height() - intensityThresholdPositive - 13; - intensityThresholdNegative = widget->height() - intensityThresholdNegative - 13; - } - - const bool previousMeasurement = x > measurement->current_item; - - // Draw the current line in grey. - GfxFillRect( - dpi, { { x, firstPoint }, { x, secondPoint } }, previousMeasurement ? PALETTE_INDEX_17 : PALETTE_INDEX_21); - - // Draw red over extreme values (if supported by graph type). - if (listType == GRAPH_VERTICAL || listType == GRAPH_LATERAL) - { - const auto redLineColour = previousMeasurement ? PALETTE_INDEX_171 : PALETTE_INDEX_173; - - // Line exceeds negative threshold (at bottom of graph). - if (secondPoint >= intensityThresholdNegative) - { - const auto redLineTop = ScreenCoordsXY{ x, std::max(firstPoint, intensityThresholdNegative) }; - const auto redLineBottom = ScreenCoordsXY{ x, std::max(secondPoint, intensityThresholdNegative) }; - GfxFillRect(dpi, { redLineTop, redLineBottom }, redLineColour); - } - - // Line exceeds positive threshold (at top of graph). - if (listType == GRAPH_LATERAL && firstPoint < intensityThresholdPositive) - { - const auto redLineTop = ScreenCoordsXY{ x, std::min(firstPoint, intensityThresholdPositive) }; - const auto redLineBottom = ScreenCoordsXY{ x, std::min(secondPoint, intensityThresholdPositive) }; - GfxFillRect(dpi, { redLineTop, redLineBottom }, redLineColour); - } - } - } - } - -#pragma endregion - -#pragma region Income - - static void UpdateSamePriceThroughoutFlags(ShopItem shop_item) - { - if (GetShopItemDescriptor(shop_item).IsPhoto()) - { - auto newFlags = gSamePriceThroughoutPark; - if (gSamePriceThroughoutPark & EnumToFlag(shop_item)) - newFlags &= ~EnumsToFlags(ShopItem::Photo, ShopItem::Photo2, ShopItem::Photo3, ShopItem::Photo4); - else - newFlags |= EnumsToFlags(ShopItem::Photo, ShopItem::Photo2, ShopItem::Photo3, ShopItem::Photo4); - auto parkSetParameter = ParkSetParameterAction(ParkParameter::SamePriceInPark, newFlags); - GameActions::Execute(&parkSetParameter); - } - else - { - auto newFlags = gSamePriceThroughoutPark; - newFlags ^= EnumToFlag(shop_item); - auto parkSetParameter = ParkSetParameterAction(ParkParameter::SamePriceInPark, newFlags); - GameActions::Execute(&parkSetParameter); - } - } - - void IncomeTogglePrimaryPrice() - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - ShopItem shopItem; - const auto& rtd = ride->GetRideTypeDescriptor(); - if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET)) - { - shopItem = ShopItem::Admission; - } - else - { - auto rideEntry = GetRideEntryByIndex(ride->subtype); - if (rideEntry != nullptr) - { - shopItem = rideEntry->shop_item[0]; - if (shopItem == ShopItem::None) - return; - } - else - { - return; - } - } - - UpdateSamePriceThroughoutFlags(shopItem); - - auto rideSetPriceAction = RideSetPriceAction(rideId, ride->price[0], true); - GameActions::Execute(&rideSetPriceAction); - } - - void IncomeToggleSecondaryPrice() - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto rideEntry = GetRideEntryByIndex(ride->subtype); - if (rideEntry == nullptr) - return; - - auto shop_item = rideEntry->shop_item[1]; - if (shop_item == ShopItem::None) - shop_item = ride->GetRideTypeDescriptor().PhotoItem; - - UpdateSamePriceThroughoutFlags(shop_item); - - auto rideSetPriceAction = RideSetPriceAction(rideId, ride->price[1], false); - GameActions::Execute(&rideSetPriceAction); - } - - void IncomeSetPrimaryPrice(money64 price) - { - auto rideSetPriceAction = RideSetPriceAction(rideId, price, true); - GameActions::Execute(&rideSetPriceAction); - } - - void IncomeIncreasePrimaryPrice() - { - if (!IncomeCanModifyPrimaryPrice()) - return; - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto price = ride->price[0]; - if (price < 20.00_GBP) - price++; - - IncomeSetPrimaryPrice(price); - } - - void IncomeDecreasePrimaryPrice() - { - if (!IncomeCanModifyPrimaryPrice()) - return; - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto price = ride->price[0]; - if (price > 0.00_GBP) - price--; - - IncomeSetPrimaryPrice(price); - } - - money64 IncomeGetSecondaryPrice() - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return 0; - - return ride->price[1]; - } - - void IncomeSetSecondaryPrice(money64 price) - { - auto rideSetPriceAction = RideSetPriceAction(rideId, price, false); - GameActions::Execute(&rideSetPriceAction); - } - - bool IncomeCanModifyPrimaryPrice() - { - auto ride = GetRide(rideId); - if (ride == nullptr) - return false; - - auto rideEntry = ride->GetRideEntry(); - const auto& rtd = ride->GetRideTypeDescriptor(); - return ParkRidePricesUnlocked() || rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET) - || (rideEntry != nullptr && rideEntry->shop_item[0] != ShopItem::None); - } - - void IncomeIncreaseSecondaryPrice() - { - auto price = IncomeGetSecondaryPrice(); - - if (price < 20.00_GBP) - price++; - - IncomeSetSecondaryPrice(price); - } - - void IncomeDecreaseSecondaryPrice() - { - auto price = IncomeGetSecondaryPrice(); - - if (price > 0.00_GBP) - price--; - - IncomeSetSecondaryPrice(price); - } - - void IncomeOnMouseUp(WidgetIndex widgetIndex) - { - utf8 _moneyInputText[MONEY_STRING_MAXLENGTH] = {}; - - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - case WIDX_TAB_8: - case WIDX_TAB_9: - case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_PRIMARY_PRICE: - { - if (!IncomeCanModifyPrimaryPrice()) - return; - - auto ride = GetRide(rideId); - if (ride != nullptr) - { - MoneyToString(ride->price[0], _moneyInputText, MONEY_STRING_MAXLENGTH, true); - WindowTextInputRawOpen( - this, WIDX_PRIMARY_PRICE, STR_ENTER_NEW_VALUE, STR_ENTER_NEW_VALUE, {}, _moneyInputText, - MONEY_STRING_MAXLENGTH); - } - break; - } - case WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK: - IncomeTogglePrimaryPrice(); - break; - case WIDX_SECONDARY_PRICE: - { - auto price64 = IncomeGetSecondaryPrice(); - - MoneyToString(price64, _moneyInputText, MONEY_STRING_MAXLENGTH, true); - WindowTextInputRawOpen( - this, WIDX_SECONDARY_PRICE, STR_ENTER_NEW_VALUE, STR_ENTER_NEW_VALUE, {}, _moneyInputText, - MONEY_STRING_MAXLENGTH); - } - break; - case WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK: - IncomeToggleSecondaryPrice(); - break; - } - } - - void IncomeResize() - { - WindowSetResize(*this, 316, 194, 316, 194); - } - - void IncomeOnMouseDown(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_PRIMARY_PRICE_INCREASE: - IncomeIncreasePrimaryPrice(); - break; - case WIDX_PRIMARY_PRICE_DECREASE: - IncomeDecreasePrimaryPrice(); - break; - case WIDX_SECONDARY_PRICE_INCREASE: - IncomeIncreaseSecondaryPrice(); - break; - case WIDX_SECONDARY_PRICE_DECREASE: - IncomeDecreaseSecondaryPrice(); - break; - } - } - - void IncomeUpdate() - { - frame_no++; - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_9); - - auto ride = GetRide(rideId); - if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_INCOME) - { - ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_INCOME; - Invalidate(); - } - } - - void IncomeOnTextInput(WidgetIndex widgetIndex, std::string_view text) - { - if ((widgetIndex != WIDX_PRIMARY_PRICE && widgetIndex != WIDX_SECONDARY_PRICE) || text.empty()) - return; - - std::string strText{ text }; - money64 price = StringToMoney(strText.c_str()); - if (price == kMoney64Undefined) - { - return; - } - - price = std::clamp(price, 0.00_GBP, 20.00_GBP); - - if (widgetIndex == WIDX_PRIMARY_PRICE) - { - IncomeSetPrimaryPrice(price); - } - else - { - IncomeSetSecondaryPrice(price); - } - } - - void IncomeOnPrepareDraw() - { - auto newWidgets = PageWidgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - InitScrollWidgets(); - } - - SetPressedTab(); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - widgets[WIDX_TITLE].text = STR_ARG_18_STRINGID; - - auto ft = Formatter::Common(); - ft.Increment(18); - ride->FormatNameTo(ft); - - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr) - return; - - // Primary item - pressed_widgets &= ~(1uLL << WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK); - disabled_widgets &= ~(1uLL << WIDX_PRIMARY_PRICE); - - widgets[WIDX_PRIMARY_PRICE_LABEL].tooltip = STR_NONE; - widgets[WIDX_PRIMARY_PRICE].tooltip = STR_NONE; - - // If ride prices are locked, do not allow setting the price, unless we're dealing with a shop or toilet. - const auto& rtd = ride->GetRideTypeDescriptor(); - if (!ParkRidePricesUnlocked() && rideEntry->shop_item[0] == ShopItem::None && !rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET)) - { - disabled_widgets |= (1uLL << WIDX_PRIMARY_PRICE); - widgets[WIDX_PRIMARY_PRICE_LABEL].tooltip = STR_RIDE_INCOME_ADMISSION_PAY_FOR_ENTRY_TIP; - widgets[WIDX_PRIMARY_PRICE].tooltip = STR_RIDE_INCOME_ADMISSION_PAY_FOR_ENTRY_TIP; - } - - widgets[WIDX_PRIMARY_PRICE_LABEL].text = STR_RIDE_INCOME_ADMISSION_PRICE; - widgets[WIDX_SECONDARY_PRICE_LABEL].text = STR_SHOP_ITEM_PRICE_LABEL_ON_RIDE_PHOTO; - widgets[WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Empty; - - widgets[WIDX_PRIMARY_PRICE].text = STR_BOTTOM_TOOLBAR_CASH; - auto ridePrimaryPrice = RideGetPrice(*ride); - ft.Rewind(); - ft.Add(ridePrimaryPrice); - if (ridePrimaryPrice == 0) - widgets[WIDX_PRIMARY_PRICE].text = STR_FREE; - - ShopItem primaryItem = ShopItem::Admission; - if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET) || ((primaryItem = rideEntry->shop_item[0]) != ShopItem::None)) - { - widgets[WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Checkbox; - - if (ShopItemHasCommonPrice(primaryItem)) - pressed_widgets |= (1uLL << WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK); - - widgets[WIDX_PRIMARY_PRICE_LABEL].text = GetShopItemDescriptor(primaryItem).Naming.PriceLabel; - } - - // Get secondary item - auto secondaryItem = ride->GetRideTypeDescriptor().PhotoItem; - if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO)) - { - if ((secondaryItem = rideEntry->shop_item[1]) != ShopItem::None) - { - widgets[WIDX_SECONDARY_PRICE_LABEL].text = GetShopItemDescriptor(secondaryItem).Naming.PriceLabel; - } - } - - if (secondaryItem == ShopItem::None) - { - // Hide secondary item widgets - widgets[WIDX_SECONDARY_PRICE_LABEL].type = WindowWidgetType::Empty; - widgets[WIDX_SECONDARY_PRICE].type = WindowWidgetType::Empty; - widgets[WIDX_SECONDARY_PRICE_INCREASE].type = WindowWidgetType::Empty; - widgets[WIDX_SECONDARY_PRICE_DECREASE].type = WindowWidgetType::Empty; - widgets[WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Empty; - } - else - { - // Set same price throughout park checkbox - pressed_widgets &= ~(1uLL << WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK); - if (ShopItemHasCommonPrice(secondaryItem)) - pressed_widgets |= (1uLL << WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK); - - // Show widgets - widgets[WIDX_SECONDARY_PRICE_LABEL].type = WindowWidgetType::Label; - widgets[WIDX_SECONDARY_PRICE].type = WindowWidgetType::Spinner; - widgets[WIDX_SECONDARY_PRICE_INCREASE].type = WindowWidgetType::Button; - widgets[WIDX_SECONDARY_PRICE_DECREASE].type = WindowWidgetType::Button; - widgets[WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Checkbox; - - // Set secondary item price - widgets[WIDX_SECONDARY_PRICE].text = STR_RIDE_SECONDARY_PRICE_VALUE; - ft.Rewind(); - ft.Increment(10); - ft.Add(ride->price[1]); - if (ride->price[1] == 0) - widgets[WIDX_SECONDARY_PRICE].text = STR_FREE; - } - - AnchorBorderWidgets(); - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); - } - - void IncomeOnDraw(DrawPixelInfo& dpi) - { - StringId stringId; - money64 profit; - ShopItem primaryItem, secondaryItem; - - DrawWidgets(dpi); - DrawTabImages(dpi); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr) - return; - - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 33 }; - - // Primary item profit / loss per item sold - primaryItem = rideEntry->shop_item[0]; - if (primaryItem != ShopItem::None) - { - profit = ride->price[0]; - - stringId = STR_PROFIT_PER_ITEM_SOLD; - profit -= GetShopItemDescriptor(primaryItem).Cost; - if (profit < 0) - { - profit *= -1; - stringId = STR_LOSS_PER_ITEM_SOLD; - } - - auto ft = Formatter(); - ft.Add(profit); - - DrawTextBasic(dpi, screenCoords, stringId, ft); - } - screenCoords.y += 44; - - // Secondary item profit / loss per item sold - secondaryItem = ride->GetRideTypeDescriptor().PhotoItem; - if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO)) - secondaryItem = rideEntry->shop_item[1]; - - if (secondaryItem != ShopItem::None) - { - profit = ride->price[1]; - - stringId = STR_PROFIT_PER_ITEM_SOLD; - profit -= GetShopItemDescriptor(secondaryItem).Cost; - if (profit < 0) - { - profit *= -1; - stringId = STR_LOSS_PER_ITEM_SOLD; - } - - auto ft = Formatter(); - ft.Add(profit); - - DrawTextBasic(dpi, screenCoords, stringId, ft); - } - screenCoords.y += 18; - - // Income per hour - if (ride->income_per_hour != kMoney64Undefined) - { - auto ft = Formatter(); - ft.Add(ride->income_per_hour); - - DrawTextBasic(dpi, screenCoords, STR_INCOME_PER_HOUR, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - // Running cost per hour - money64 costPerHour = ride->upkeep_cost * 16; - stringId = ride->upkeep_cost == kMoney64Undefined ? STR_RUNNING_COST_UNKNOWN : STR_RUNNING_COST_PER_HOUR; - auto ft = Formatter(); - ft.Add(costPerHour); - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Profit per hour - if (ride->profit != kMoney64Undefined) - { - ft = Formatter(); - ft.Add(ride->profit); - DrawTextBasic(dpi, screenCoords, STR_PROFIT_PER_HOUR, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - screenCoords.y += 5; - - // Total profit - ft = Formatter(); - ft.Add(ride->total_profit); - DrawTextBasic(dpi, screenCoords, STR_TOTAL_PROFIT, ft); - } - -#pragma endregion - -#pragma region Customer - - void CustomerOnMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - case WIDX_TAB_8: - case WIDX_TAB_9: - case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); - break; - case WIDX_SHOW_GUESTS_THOUGHTS: - { - auto intent = Intent(WindowClass::GuestList); - intent.PutExtra( - INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsThinkingAboutRide)); - intent.PutExtra(INTENT_EXTRA_RIDE_ID, number); - ContextOpenIntent(&intent); - break; - } - case WIDX_SHOW_GUESTS_ON_RIDE: - { - auto intent = Intent(WindowClass::GuestList); - intent.PutExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsOnRide)); - intent.PutExtra(INTENT_EXTRA_RIDE_ID, number); - ContextOpenIntent(&intent); - break; - } - case WIDX_SHOW_GUESTS_QUEUING: - { - auto intent = Intent(WindowClass::GuestList); - intent.PutExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsInQueue)); - intent.PutExtra(INTENT_EXTRA_RIDE_ID, number); - ContextOpenIntent(&intent); - break; - } - } - } - - void CustomerResize() - { - flags |= WF_RESIZABLE; - WindowSetResize(*this, 316, 163, 316, 163); - } - - void CustomerUpdate() - { - picked_peep_frame++; - if (picked_peep_frame >= 24) - picked_peep_frame = 0; - - OnPrepareDraw(); - WidgetInvalidate(*this, WIDX_TAB_10); - - auto ride = GetRide(rideId); - if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_CUSTOMER) - { - ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_CUSTOMER; - Invalidate(); - } - } - - void CustomerOnPrepareDraw() - { - auto newWidgets = PageWidgets[page]; - if (widgets != newWidgets) - { - widgets = newWidgets; - InitScrollWidgets(); - } - - SetPressedTab(); - - auto ride = GetRide(rideId); - if (ride != nullptr) - { - auto ft = Formatter::Common(); - ride->FormatNameTo(ft); - - widgets[WIDX_SHOW_GUESTS_THOUGHTS].type = WindowWidgetType::FlatBtn; - if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY)) - { - widgets[WIDX_SHOW_GUESTS_ON_RIDE].type = WindowWidgetType::Empty; - widgets[WIDX_SHOW_GUESTS_QUEUING].type = WindowWidgetType::Empty; - } - else - { - widgets[WIDX_SHOW_GUESTS_ON_RIDE].type = WindowWidgetType::FlatBtn; - widgets[WIDX_SHOW_GUESTS_QUEUING].type = WindowWidgetType::FlatBtn; - } - - AnchorBorderWidgets(); - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10); - } - } - - void CustomerOnDraw(DrawPixelInfo& dpi) - { - ShopItem shopItem; - int16_t popularity, satisfaction, queueTime; - StringId stringId; - - DrawWidgets(dpi); - DrawTabImages(dpi); - - auto ride = GetRide(rideId); - if (ride == nullptr) - return; - - auto screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - - // Customers currently on ride - if (ride->IsRide()) - { - auto ft = Formatter(); - ft.Add(ride->num_riders); - DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_ON_RIDE, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - // Customers per hour - auto ft = Formatter(); - ft.Add(RideCustomersPerHour(*ride)); - DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_PER_HOUR, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Popularity - popularity = ride->popularity; - if (popularity == 255) - { - stringId = STR_POPULARITY_UNKNOWN; - } - else - { - stringId = STR_POPULARITY_PERCENT; - popularity *= 4; - } - ft = Formatter(); - ft.Add(popularity); - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Satisfaction - satisfaction = ride->satisfaction; - if (satisfaction == 255) - { - stringId = STR_SATISFACTION_UNKNOWN; - } - else - { - stringId = STR_SATISFACTION_PERCENT; - satisfaction *= 5; - } - ft = Formatter(); - ft.Add(satisfaction); - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Queue time - if (ride->IsRide()) - { - queueTime = ride->GetMaxQueueTime(); - stringId = queueTime == 1 ? STR_QUEUE_TIME_MINUTE : STR_QUEUE_TIME_MINUTES; - ft = Formatter(); - ft.Add(queueTime); - screenCoords.y += DrawTextWrapped(dpi, screenCoords, 308, stringId, ft, { TextAlignment::LEFT }); - screenCoords.y += 5; - } - - // Primary shop items sold - shopItem = ride->GetRideEntry()->shop_item[0]; - if (shopItem != ShopItem::None) - { - ft = Formatter(); - ft.Add(GetShopItemDescriptor(shopItem).Naming.Plural); - ft.Add(ride->no_primary_items_sold); - DrawTextBasic(dpi, screenCoords, STR_ITEMS_SOLD, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - // Secondary shop items sold / on-ride photos sold - shopItem = (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) ? ride->GetRideTypeDescriptor().PhotoItem - : ride->GetRideEntry()->shop_item[1]; - if (shopItem != ShopItem::None) - { - ft = Formatter(); - ft.Add(GetShopItemDescriptor(shopItem).Naming.Plural); - ft.Add(ride->no_secondary_items_sold); - DrawTextBasic(dpi, screenCoords, STR_ITEMS_SOLD, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - // Total customers - ft = Formatter(); - ft.Add(ride->total_customers); - DrawTextBasic(dpi, screenCoords, STR_TOTAL_CUSTOMERS, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - // Guests favourite - if (ride->IsRide()) - { - ft = Formatter(); - ft.Add(ride->guests_favourite); - stringId = ride->guests_favourite == 1 ? STR_FAVOURITE_RIDE_OF_GUEST : STR_FAVOURITE_RIDE_OF_GUESTS; - DrawTextBasic(dpi, screenCoords, stringId, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - screenCoords.y += 2; - - // Age - // If the ride has a build date that is in the future, show it as built this year. - int16_t age = std::max(DateGetYear(ride->GetAge()), 0); - stringId = age == 0 ? STR_BUILT_THIS_YEAR : age == 1 ? STR_BUILT_LAST_YEAR : STR_BUILT_YEARS_AGO; - ft = Formatter(); - ft.Add(age); - DrawTextBasic(dpi, screenCoords, stringId, ft); - } - -#pragma endregion -}; - -/** - * - * rct2: 0x006AEAB4 - */ -static RideWindow* WindowRideOpen(const Ride& ride) -{ - return WindowCreate(WindowClass::Ride, 316, 207, WF_10 | WF_RESIZABLE, ride); -} - -/** - * - * rct2: 0x006ACC28 - */ -WindowBase* WindowRideMainOpen(const Ride& ride) -{ - if (ride.type >= RIDE_TYPE_COUNT) - { - return nullptr; - } - - RideWindow* w = static_cast(WindowBringToFrontByNumber(WindowClass::Ride, ride.id.ToUnderlying())); - if (w == nullptr) - { - w = WindowRideOpen(ride); - w->SetViewIndex(0); - } - else if (w->GetViewIndex() >= (1 + ride.NumTrains + ride.num_stations)) - { - w->SetViewIndex(0); - } - - if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) - { - if (w->classification == gCurrentToolWidget.window_classification && w->number == gCurrentToolWidget.window_number) - { - ToolCancel(); - } - } - - if (w->page != WINDOW_RIDE_PAGE_MAIN) - { - w->SetPage(WINDOW_RIDE_PAGE_MAIN); - } - - w->OnViewportRotate(); - return w; -} - -/** - * - * rct2: 0x006ACCCE - */ -static WindowBase* WindowRideOpenStation(const Ride& ride, StationIndex stationIndex) -{ - if (ride.type >= RIDE_TYPE_COUNT) - return nullptr; - - if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)) - return WindowRideMainOpen(ride); - - auto* w = static_cast(WindowBringToFrontByNumber(WindowClass::Ride, ride.id.ToUnderlying())); - if (w == nullptr) - { - w = WindowRideOpen(ride); - } - - if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == w->classification - && gCurrentToolWidget.window_number == w->number) - { - ToolCancel(); - } - - // View - for (int32_t i = stationIndex.ToUnderlying(); i >= 0; i--) - { - if (ride.GetStations()[i].Start.IsNull()) - { - stationIndex = StationIndex::FromUnderlying(stationIndex.ToUnderlying() - 1); - } - } - - w->SetViewIndex(1 + ride.NumTrains + stationIndex.ToUnderlying()); - - return w; -} - -WindowBase* WindowRideOpenTrack(TileElement* tileElement) -{ - assert(tileElement != nullptr); - auto rideIndex = tileElement->GetRideIndex(); - if (!rideIndex.IsNull()) - { - auto ride = GetRide(rideIndex); - if (ride != nullptr) - { - const auto type = tileElement->GetType(); - if (type == TileElementType::Entrance) - { - // Open ride window in station view - auto entranceElement = tileElement->AsEntrance(); - auto stationIndex = entranceElement->GetStationIndex(); - return WindowRideOpenStation(*ride, stationIndex); - } - else if (type == TileElementType::Track) - { - // Open ride window in station view - auto trackElement = tileElement->AsTrack(); - auto trackType = trackElement->GetTrackType(); - const auto& ted = GetTrackElementDescriptor(trackType); - if (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) - { - auto stationIndex = trackElement->GetStationIndex(); - return WindowRideOpenStation(*ride, stationIndex); - } - } - - // Open ride window in overview mode - return WindowRideMainOpen(*ride); - } - } - return nullptr; -} - -/** - * - * rct2: 0x006ACAC2 - */ -WindowBase* WindowRideOpenVehicle(Vehicle* vehicle) -{ - if (vehicle == nullptr) - return nullptr; - - Vehicle* headVehicle = vehicle->TrainHead(); - if (headVehicle == nullptr) - return nullptr; - - EntityId headVehicleSpriteIndex = headVehicle->Id; - auto ride = headVehicle->GetRide(); - if (ride == nullptr) - return nullptr; - - // Get view index - int16_t view = 1; - for (int32_t i = 0; i <= OpenRCT2::Limits::MaxTrainsPerRide; i++) - { - if (ride->vehicles[i] == headVehicleSpriteIndex) - break; - - view++; - } - - auto* w = static_cast(WindowFindByNumber(WindowClass::Ride, ride->id.ToUnderlying())); - if (w != nullptr) - { - w->Invalidate(); if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == w->classification && gCurrentToolWidget.window_number == w->number) @@ -6789,96 +6726,187 @@ WindowBase* WindowRideOpenVehicle(Vehicle* vehicle) ToolCancel(); } - int32_t openedPeepWindow = 0; - if (w->GetViewIndex() == view) + // View + for (int32_t i = stationIndex.ToUnderlying(); i >= 0; i--) { - int32_t numPeepsLeft = vehicle->num_peeps; - for (int32_t i = 0; i < 32 && numPeepsLeft > 0; i++) + if (ride.GetStations()[i].Start.IsNull()) { - Peep* peep = GetEntity(vehicle->peep[i]); - if (peep == nullptr) - continue; - - numPeepsLeft--; - WindowBase* w2 = WindowFindByNumber(WindowClass::Peep, vehicle->peep[i]); - if (w2 == nullptr) - { - auto intent = Intent(WindowClass::Peep); - intent.PutExtra(INTENT_EXTRA_PEEP, peep); - ContextOpenIntent(&intent); - openedPeepWindow = 1; - - break; - } + stationIndex = StationIndex::FromUnderlying(stationIndex.ToUnderlying() - 1); } } - w = static_cast( - openedPeepWindow ? WindowFindByNumber(WindowClass::Ride, ride->id.ToUnderlying()) - : WindowBringToFrontByNumber(WindowClass::Ride, ride->id.ToUnderlying())); + w->SetViewIndex(1 + ride.NumTrains + stationIndex.ToUnderlying()); + + return w; } - if (w == nullptr) + WindowBase* RideOpenTrack(TileElement* tileElement) { - w = WindowRideOpen(*ride); - } - - w->SetViewIndex(view); - w->Invalidate(); - - return w; -} - -void WindowRideInvalidateVehicle(const Vehicle& vehicle) -{ - auto* w = static_cast(WindowFindByNumber(WindowClass::Ride, vehicle.ride.ToUnderlying())); - if (w == nullptr) - return; - - auto ride = vehicle.GetRide(); - auto viewVehicleIndex = w->GetViewIndex() - 1; - if (ride == nullptr || viewVehicleIndex < 0 || viewVehicleIndex >= ride->NumTrains) - return; - - if (vehicle.Id != ride->vehicles[viewVehicleIndex]) - return; - - w->Invalidate(); -} - -void WindowRidePaintResetVehicle(RideId rideIndex) -{ - auto w = static_cast(WindowFindByNumber(WindowClass::Ride, rideIndex.ToUnderlying())); - if (w != nullptr) - { - if (w->page == 4) // WINDOW_RIDE_PAGE_COLOUR + assert(tileElement != nullptr); + auto rideIndex = tileElement->GetRideIndex(); + if (!rideIndex.IsNull()) { - w->ResetVehicleIndex(); + auto ride = GetRide(rideIndex); + if (ride != nullptr) + { + const auto type = tileElement->GetType(); + if (type == TileElementType::Entrance) + { + // Open ride window in station view + auto entranceElement = tileElement->AsEntrance(); + auto stationIndex = entranceElement->GetStationIndex(); + return WindowRideOpenStation(*ride, stationIndex); + } + else if (type == TileElementType::Track) + { + // Open ride window in station view + auto trackElement = tileElement->AsTrack(); + auto trackType = trackElement->GetTrackType(); + const auto& ted = GetTrackElementDescriptor(trackType); + if (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) + { + auto stationIndex = trackElement->GetStationIndex(); + return WindowRideOpenStation(*ride, stationIndex); + } + } + + // Open ride window in overview mode + return RideMainOpen(*ride); + } } + return nullptr; + } + + /** + * + * rct2: 0x006ACAC2 + */ + WindowBase* RideOpenVehicle(Vehicle* vehicle) + { + if (vehicle == nullptr) + return nullptr; + + Vehicle* headVehicle = vehicle->TrainHead(); + if (headVehicle == nullptr) + return nullptr; + + EntityId headVehicleSpriteIndex = headVehicle->Id; + auto ride = headVehicle->GetRide(); + if (ride == nullptr) + return nullptr; + + // Get view index + int16_t view = 1; + for (int32_t i = 0; i <= OpenRCT2::Limits::MaxTrainsPerRide; i++) + { + if (ride->vehicles[i] == headVehicleSpriteIndex) + break; + + view++; + } + + auto* w = static_cast(WindowFindByNumber(WindowClass::Ride, ride->id.ToUnderlying())); + if (w != nullptr) + { + w->Invalidate(); + + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == w->classification + && gCurrentToolWidget.window_number == w->number) + { + ToolCancel(); + } + + int32_t openedPeepWindow = 0; + if (w->GetViewIndex() == view) + { + int32_t numPeepsLeft = vehicle->num_peeps; + for (int32_t i = 0; i < 32 && numPeepsLeft > 0; i++) + { + Peep* peep = GetEntity(vehicle->peep[i]); + if (peep == nullptr) + continue; + + numPeepsLeft--; + WindowBase* w2 = WindowFindByNumber(WindowClass::Peep, vehicle->peep[i]); + if (w2 == nullptr) + { + auto intent = Intent(WindowClass::Peep); + intent.PutExtra(INTENT_EXTRA_PEEP, peep); + ContextOpenIntent(&intent); + openedPeepWindow = 1; + + break; + } + } + } + + w = static_cast( + openedPeepWindow ? WindowFindByNumber(WindowClass::Ride, ride->id.ToUnderlying()) + : WindowBringToFrontByNumber(WindowClass::Ride, ride->id.ToUnderlying())); + } + + if (w == nullptr) + { + w = WindowRideOpen(*ride); + } + + w->SetViewIndex(view); + w->Invalidate(); + + return w; + } + + void WindowRideInvalidateVehicle(const Vehicle& vehicle) + { + auto* w = static_cast(WindowFindByNumber(WindowClass::Ride, vehicle.ride.ToUnderlying())); + if (w == nullptr) + return; + + auto ride = vehicle.GetRide(); + auto viewVehicleIndex = w->GetViewIndex() - 1; + if (ride == nullptr || viewVehicleIndex < 0 || viewVehicleIndex >= ride->NumTrains) + return; + + if (vehicle.Id != ride->vehicles[viewVehicleIndex]) + return; + w->Invalidate(); } -} -static void CancelScenerySelection() -{ - gGamePaused &= ~GAME_PAUSED_SAVING_TRACK; - gTrackDesignSaveMode = false; - OpenRCT2::Audio::Resume(); - - WindowBase* main_w = WindowGetMain(); - if (main_w != nullptr) + void WindowRidePaintResetVehicle(RideId rideIndex) { - main_w->viewport->flags &= ~(VIEWPORT_FLAG_HIDE_VERTICAL | VIEWPORT_FLAG_HIDE_BASE); + auto w = static_cast(WindowFindByNumber(WindowClass::Ride, rideIndex.ToUnderlying())); + if (w != nullptr) + { + if (w->page == 4) // WINDOW_RIDE_PAGE_COLOUR + { + w->ResetVehicleIndex(); + } + w->Invalidate(); + } } - GfxInvalidateScreen(); - ToolCancel(); -} - -void WindowRideMeasurementsDesignCancel() -{ - if (gTrackDesignSaveMode) + static void CancelScenerySelection() { - CancelScenerySelection(); + gGamePaused &= ~GAME_PAUSED_SAVING_TRACK; + gTrackDesignSaveMode = false; + OpenRCT2::Audio::Resume(); + + WindowBase* main_w = WindowGetMain(); + if (main_w != nullptr) + { + main_w->viewport->flags &= ~(VIEWPORT_FLAG_HIDE_VERTICAL | VIEWPORT_FLAG_HIDE_BASE); + } + + GfxInvalidateScreen(); + ToolCancel(); } -} + + void WindowRideMeasurementsDesignCancel() + { + if (gTrackDesignSaveMode) + { + CancelScenerySelection(); + } + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 1df39a2bd9..da0e4f13d1 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -47,73 +47,73 @@ #include #include -using namespace OpenRCT2; using namespace OpenRCT2::TrackMetaData; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_RIDE_CONSTRUCTION_WINDOW_TITLE; + static constexpr int32_t WH = 394; + static constexpr int32_t WW = 210; -static constexpr StringId WINDOW_TITLE = STR_RIDE_CONSTRUCTION_WINDOW_TITLE; -static constexpr int32_t WH = 394; -static constexpr int32_t WW = 210; - -static constexpr uint16_t ARROW_PULSE_DURATION = 200; -// Width of the group boxes, e.g. “Banking” -static constexpr int32_t GW = WW - 6; + static constexpr uint16_t ARROW_PULSE_DURATION = 200; + // Width of the group boxes, e.g. “Banking” + static constexpr int32_t GW = WW - 6; #pragma region Widgets -enum -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_DIRECTION_GROUPBOX, - WIDX_SLOPE_GROUPBOX, - WIDX_BANKING_GROUPBOX, - WIDX_LEFT_CURVE_VERY_SMALL, - WIDX_LEFT_CURVE_SMALL, - WIDX_LEFT_CURVE, - WIDX_LEFT_CURVE_LARGE, - WIDX_STRAIGHT, - WIDX_RIGHT_CURVE_LARGE, - WIDX_RIGHT_CURVE, - WIDX_RIGHT_CURVE_SMALL, - WIDX_RIGHT_CURVE_VERY_SMALL, - WIDX_SPECIAL_TRACK_DROPDOWN, - WIDX_SLOPE_DOWN_STEEP, - WIDX_SLOPE_DOWN, - WIDX_LEVEL, - WIDX_SLOPE_UP, - WIDX_SLOPE_UP_STEEP, - WIDX_CHAIN_LIFT, - WIDX_BANK_LEFT, - WIDX_BANK_STRAIGHT, - WIDX_BANK_RIGHT, - WIDX_CONSTRUCT, - WIDX_DEMOLISH, - WIDX_PREVIOUS_SECTION, - WIDX_NEXT_SECTION, - WIDX_ENTRANCE_EXIT_GROUPBOX, - WIDX_ENTRANCE, - WIDX_EXIT, - WIDX_ROTATE, - WIDX_U_TRACK, - WIDX_O_TRACK, - WIDX_SEAT_ROTATION_GROUPBOX, - WIDX_SEAT_ROTATION_ANGLE_SPINNER, - WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP, - WIDX_SEAT_ROTATION_ANGLE_SPINNER_DOWN, - WIDX_SIMULATE, - WIDX_SPEED_GROUPBOX = WIDX_BANKING_GROUPBOX, - WIDX_SPEED_SETTING_SPINNER = WIDX_BANK_LEFT, - WIDX_SPEED_SETTING_SPINNER_UP = WIDX_BANK_STRAIGHT, - WIDX_SPEED_SETTING_SPINNER_DOWN = WIDX_BANK_RIGHT, -}; + enum + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_DIRECTION_GROUPBOX, + WIDX_SLOPE_GROUPBOX, + WIDX_BANKING_GROUPBOX, + WIDX_LEFT_CURVE_VERY_SMALL, + WIDX_LEFT_CURVE_SMALL, + WIDX_LEFT_CURVE, + WIDX_LEFT_CURVE_LARGE, + WIDX_STRAIGHT, + WIDX_RIGHT_CURVE_LARGE, + WIDX_RIGHT_CURVE, + WIDX_RIGHT_CURVE_SMALL, + WIDX_RIGHT_CURVE_VERY_SMALL, + WIDX_SPECIAL_TRACK_DROPDOWN, + WIDX_SLOPE_DOWN_STEEP, + WIDX_SLOPE_DOWN, + WIDX_LEVEL, + WIDX_SLOPE_UP, + WIDX_SLOPE_UP_STEEP, + WIDX_CHAIN_LIFT, + WIDX_BANK_LEFT, + WIDX_BANK_STRAIGHT, + WIDX_BANK_RIGHT, + WIDX_CONSTRUCT, + WIDX_DEMOLISH, + WIDX_PREVIOUS_SECTION, + WIDX_NEXT_SECTION, + WIDX_ENTRANCE_EXIT_GROUPBOX, + WIDX_ENTRANCE, + WIDX_EXIT, + WIDX_ROTATE, + WIDX_U_TRACK, + WIDX_O_TRACK, + WIDX_SEAT_ROTATION_GROUPBOX, + WIDX_SEAT_ROTATION_ANGLE_SPINNER, + WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP, + WIDX_SEAT_ROTATION_ANGLE_SPINNER_DOWN, + WIDX_SIMULATE, + WIDX_SPEED_GROUPBOX = WIDX_BANKING_GROUPBOX, + WIDX_SPEED_SETTING_SPINNER = WIDX_BANK_LEFT, + WIDX_SPEED_SETTING_SPINNER_UP = WIDX_BANK_STRAIGHT, + WIDX_SPEED_SETTING_SPINNER_DOWN = WIDX_BANK_RIGHT, + }; -validate_global_widx(WC_RIDE_CONSTRUCTION, WIDX_CONSTRUCT); -validate_global_widx(WC_RIDE_CONSTRUCTION, WIDX_ENTRANCE); -validate_global_widx(WC_RIDE_CONSTRUCTION, WIDX_EXIT); -validate_global_widx(WC_RIDE_CONSTRUCTION, WIDX_ROTATE); + validate_global_widx(WC_RIDE_CONSTRUCTION, WIDX_CONSTRUCT); + validate_global_widx(WC_RIDE_CONSTRUCTION, WIDX_ENTRANCE); + validate_global_widx(WC_RIDE_CONSTRUCTION, WIDX_EXIT); + validate_global_widx(WC_RIDE_CONSTRUCTION, WIDX_ROTATE); -// clang-format off + // clang-format off static Widget _rideConstructionWidgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget ({ 3, 17}, { GW, 57}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_DIRECTION ), @@ -151,207 +151,217 @@ static Widget _rideConstructionWidgets[] = { MakeWidget ({118, 120}, { 89, 41}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_SEAT_ROT ), MakeSpinnerWidgets({123, 138}, { 58, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, 0, STR_RIDE_CONSTRUCTION_SELECT_SEAT_ROTATION_ANGLE_TIP), MakeWidget ({161, 338}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_SIMULATE), STR_SIMULATE_RIDE_TIP ), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on #pragma endregion -static bool _trackPlaceCtrlState; -static int32_t _trackPlaceCtrlZ; -static bool _trackPlaceShiftState; -static ScreenCoordsXY _trackPlaceShiftStart; -static int32_t _trackPlaceShiftZ; -static int32_t _trackPlaceZ; -static money64 _trackPlaceCost; -static StringId _trackPlaceErrorMessage; -static bool _autoRotatingShop; -static bool _gotoStartPlacementMode = false; + static bool _trackPlaceCtrlState; + static int32_t _trackPlaceCtrlZ; + static bool _trackPlaceShiftState; + static ScreenCoordsXY _trackPlaceShiftStart; + static int32_t _trackPlaceShiftZ; + static int32_t _trackPlaceZ; + static money64 _trackPlaceCost; + static StringId _trackPlaceErrorMessage; + static bool _autoRotatingShop; + static bool _gotoStartPlacementMode = false; -static constexpr StringId RideConstructionSeatAngleRotationStrings[] = { - STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_180, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_135, - STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_90, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_45, - STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_0, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_45, - STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_90, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_135, - STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_180, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_225, - STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_270, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_315, - STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_360, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_405, - STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_450, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_495, -}; + static constexpr StringId RideConstructionSeatAngleRotationStrings[] = { + STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_180, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_135, + STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_90, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_45, + STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_0, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_45, + STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_90, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_135, + STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_180, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_225, + STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_270, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_315, + STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_360, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_405, + STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_450, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_495, + }; -static void WindowRideConstructionMouseUpDemolishNextPiece(const CoordsXYZD& piecePos, int32_t type); + static void WindowRideConstructionMouseUpDemolishNextPiece(const CoordsXYZD& piecePos, int32_t type); -static int32_t RideGetAlternativeType(const Ride& ride) -{ - return (_currentTrackAlternative & RIDE_TYPE_ALTERNATIVE_TRACK_TYPE) ? ride.GetRideTypeDescriptor().AlternateType - : ride.type; -} - -/* move to ride.c */ -static void CloseRideWindowForConstruction(RideId rideId) -{ - WindowBase* w = WindowFindByNumber(WindowClass::Ride, rideId.ToUnderlying()); - if (w != nullptr && w->page == 1) - WindowClose(*w); -} - -static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const GameActions::Result* result); -static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const GameActions::Result* result); -static void CloseConstructWindowOnCompletion(const Ride& ride); - -class RideConstructionWindow final : public Window -{ -private: - uint8_t _currentlyShowingBrakeOrBoosterSpeed{}; - SpecialElementsDropdownState _specialElementDropdownState; - bool _autoOpeningShop{}; - -public: - void OnOpen() override + static int32_t RideGetAlternativeType(const Ride& ride) { - auto currentRide = GetRide(_currentRideIndex); - if (currentRide == nullptr) - { - return; - } - - widgets = _rideConstructionWidgets; - number = _currentRideIndex.ToUnderlying(); - - InitScrollWidgets(); - - WindowPushOthersRight(*this); - ShowGridlines(); - - _currentTrackPrice = kMoney64Undefined; - _currentBrakeSpeed2 = 8; - _currentSeatRotationAngle = 4; - - _currentTrackCurve = currentRide->GetRideTypeDescriptor().StartTrackPiece | RideConstructionSpecialPieceSelected; - _currentTrackPitchEnd = TrackPitch::None; - _currentTrackRollEnd = TrackRoll::None; - _currentTrackLiftHill = 0; - _currentTrackAlternative = RIDE_TYPE_NO_ALTERNATIVES; - - if (currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_START_CONSTRUCTION_INVERTED)) - _currentTrackAlternative |= RIDE_TYPE_ALTERNATIVE_TRACK_TYPE; - - _previousTrackRollEnd = TrackRoll::None; - _previousTrackPitchEnd = TrackPitch::None; - - _currentTrackPieceDirection = 0; - _rideConstructionState = RideConstructionState::Place; - _currentTrackSelectionFlags = 0; - _autoOpeningShop = false; - _autoRotatingShop = true; - _trackPlaceCtrlState = false; - _trackPlaceShiftState = false; + return (_currentTrackAlternative & RIDE_TYPE_ALTERNATIVE_TRACK_TYPE) ? ride.GetRideTypeDescriptor().AlternateType + : ride.type; } - void OnClose() override + /* move to ride.c */ + static void CloseRideWindowForConstruction(RideId rideId) { - RideConstructionInvalidateCurrentTrack(); - ViewportSetVisibility(ViewportVisibility::Default); + WindowBase* w = WindowFindByNumber(WindowClass::Ride, rideId.ToUnderlying()); + if (w != nullptr && w->page == 1) + WindowClose(*w); + } - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const GameActions::Result* result); + static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const GameActions::Result* result); + static void CloseConstructWindowOnCompletion(const Ride& ride); - // In order to cancel the yellow arrow correctly the - // selection tool should be cancelled. Don't do a tool cancel if - // another window has already taken control of tool. - if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) - ToolCancel(); + class RideConstructionWindow final : public Window + { + private: + uint8_t _currentlyShowingBrakeOrBoosterSpeed{}; + SpecialElementsDropdownState _specialElementDropdownState; + bool _autoOpeningShop{}; - HideGridlines(); - - // If we demolish a currentRide all windows will be closed including the construction window, - // the currentRide at this point is already gone. - auto currentRide = GetRide(_currentRideIndex); - if (currentRide == nullptr) + public: + void OnOpen() override { - return; + auto currentRide = GetRide(_currentRideIndex); + if (currentRide == nullptr) + { + return; + } + + widgets = _rideConstructionWidgets; + number = _currentRideIndex.ToUnderlying(); + + InitScrollWidgets(); + + WindowPushOthersRight(*this); + ShowGridlines(); + + _currentTrackPrice = kMoney64Undefined; + _currentBrakeSpeed2 = 8; + _currentSeatRotationAngle = 4; + + _currentTrackCurve = currentRide->GetRideTypeDescriptor().StartTrackPiece | RideConstructionSpecialPieceSelected; + _currentTrackPitchEnd = TrackPitch::None; + _currentTrackRollEnd = TrackRoll::None; + _currentTrackLiftHill = 0; + _currentTrackAlternative = RIDE_TYPE_NO_ALTERNATIVES; + + if (currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_START_CONSTRUCTION_INVERTED)) + _currentTrackAlternative |= RIDE_TYPE_ALTERNATIVE_TRACK_TYPE; + + _previousTrackRollEnd = TrackRoll::None; + _previousTrackPitchEnd = TrackPitch::None; + + _currentTrackPieceDirection = 0; + _rideConstructionState = RideConstructionState::Place; + _currentTrackSelectionFlags = 0; + _autoOpeningShop = false; + _autoRotatingShop = true; + _trackPlaceCtrlState = false; + _trackPlaceShiftState = false; } - if (RideTryGetOriginElement(*currentRide, nullptr)) + void OnClose() override { - // Auto open shops if required. - if (currentRide->mode == RideMode::ShopStall && gConfigGeneral.AutoOpenShops) + RideConstructionInvalidateCurrentTrack(); + ViewportSetVisibility(ViewportVisibility::Default); + + MapInvalidateMapSelectionTiles(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + + // In order to cancel the yellow arrow correctly the + // selection tool should be cancelled. Don't do a tool cancel if + // another window has already taken control of tool. + if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) + ToolCancel(); + + HideGridlines(); + + // If we demolish a currentRide all windows will be closed including the construction window, + // the currentRide at this point is already gone. + auto currentRide = GetRide(_currentRideIndex); + if (currentRide == nullptr) { - // HACK: Until we find a good a way to defer the game command for opening the shop, stop this - // from getting stuck in an infinite loop as opening the currentRide will try to close this window - if (!_autoOpeningShop) + return; + } + + if (RideTryGetOriginElement(*currentRide, nullptr)) + { + // Auto open shops if required. + if (currentRide->mode == RideMode::ShopStall && gConfigGeneral.AutoOpenShops) { - _autoOpeningShop = true; - auto gameAction = RideSetStatusAction(currentRide->id, RideStatus::Open); - GameActions::Execute(&gameAction); - _autoOpeningShop = false; + // HACK: Until we find a good a way to defer the game command for opening the shop, stop this + // from getting stuck in an infinite loop as opening the currentRide will try to close this window + if (!_autoOpeningShop) + { + _autoOpeningShop = true; + auto gameAction = RideSetStatusAction(currentRide->id, RideStatus::Open); + GameActions::Execute(&gameAction); + _autoOpeningShop = false; + } + } + + currentRide->SetToDefaultInspectionInterval(); + auto intent = Intent(WindowClass::Ride); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); + ContextOpenIntent(&intent); + } + else + { + auto gameAction = RideDemolishAction(currentRide->id, RIDE_MODIFY_DEMOLISH); + gameAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); + GameActions::Execute(&gameAction); + } + } + + void OnResize() override + { + ResizeFrame(); + WindowRideConstructionUpdateEnabledTrackPieces(); + + auto currentRide = GetRide(_currentRideIndex); + if (currentRide == nullptr) + { + return; + } + + int32_t rideType = RideGetAlternativeType(*currentRide); + + uint64_t disabledWidgets = 0; + + if (_currentTrackCurve & RideConstructionSpecialPieceSelected) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_GROUPBOX) | (1uLL << WIDX_BANKING_GROUPBOX) + | (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL) + | (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP) | (1uLL << WIDX_CHAIN_LIFT) + | (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_STRAIGHT) | (1uLL << WIDX_BANK_RIGHT); + } + + // Disable large curves if the start or end of the track is sloped and large sloped curves are not available + if ((_previousTrackPitchEnd != TrackPitch::None || _currentTrackPitchEnd != TrackPitch::None)) + { + if (!IsTrackEnabled(TRACK_SLOPE_CURVE_LARGE) + || !(_previousTrackPitchEnd == TrackPitch::Up25 || _previousTrackPitchEnd == TrackPitch::Down25) + || !(_currentTrackPitchEnd == TrackPitch::Up25 || _currentTrackPitchEnd == TrackPitch::Down25)) + { + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_LARGE); } } - - currentRide->SetToDefaultInspectionInterval(); - auto intent = Intent(WindowClass::Ride); - intent.PutExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); - ContextOpenIntent(&intent); - } - else - { - auto gameAction = RideDemolishAction(currentRide->id, RIDE_MODIFY_DEMOLISH); - gameAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); - GameActions::Execute(&gameAction); - } - } - - void OnResize() override - { - ResizeFrame(); - WindowRideConstructionUpdateEnabledTrackPieces(); - - auto currentRide = GetRide(_currentRideIndex); - if (currentRide == nullptr) - { - return; - } - - int32_t rideType = RideGetAlternativeType(*currentRide); - - uint64_t disabledWidgets = 0; - - if (_currentTrackCurve & RideConstructionSpecialPieceSelected) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_GROUPBOX) | (1uLL << WIDX_BANKING_GROUPBOX) | (1uLL << WIDX_SLOPE_DOWN_STEEP) - | (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP) - | (1uLL << WIDX_CHAIN_LIFT) | (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_STRAIGHT) - | (1uLL << WIDX_BANK_RIGHT); - } - - // Disable large curves if the start or end of the track is sloped and large sloped curves are not available - if ((_previousTrackPitchEnd != TrackPitch::None || _currentTrackPitchEnd != TrackPitch::None)) - { - if (!IsTrackEnabled(TRACK_SLOPE_CURVE_LARGE) - || !(_previousTrackPitchEnd == TrackPitch::Up25 || _previousTrackPitchEnd == TrackPitch::Down25) - || !(_currentTrackPitchEnd == TrackPitch::Up25 || _currentTrackPitchEnd == TrackPitch::Down25)) + if (IsTrackEnabled(TRACK_SLOPE_CURVE) && IsTrackEnabled(TRACK_CURVE_VERY_SMALL)) { - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_LARGE); - } - } - if (IsTrackEnabled(TRACK_SLOPE_CURVE) && IsTrackEnabled(TRACK_CURVE_VERY_SMALL)) - { - // Disable small curves if the start or end of the track is sloped. - if (_previousTrackPitchEnd != TrackPitch::None || _currentTrackPitchEnd != TrackPitch::None) - { - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) - | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); - } - } - if (!IsTrackEnabled(TRACK_SLOPE_CURVE)) - { - if (IsTrackEnabled(TRACK_CURVE_VERTICAL)) - { - // Disable all curves only on vertical track - if (_previousTrackPitchEnd != TrackPitch::Up90 || _currentTrackPitchEnd != TrackPitch::Up90) + // Disable small curves if the start or end of the track is sloped. + if (_previousTrackPitchEnd != TrackPitch::None || _currentTrackPitchEnd != TrackPitch::None) { - if (_previousTrackPitchEnd != TrackPitch::Down90 || _currentTrackPitchEnd != TrackPitch::Down90) + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); + } + } + if (!IsTrackEnabled(TRACK_SLOPE_CURVE)) + { + if (IsTrackEnabled(TRACK_CURVE_VERTICAL)) + { + // Disable all curves only on vertical track + if (_previousTrackPitchEnd != TrackPitch::Up90 || _currentTrackPitchEnd != TrackPitch::Up90) + { + if (_previousTrackPitchEnd != TrackPitch::Down90 || _currentTrackPitchEnd != TrackPitch::Down90) + { + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) + | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) + | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); + } + } + } + else + { + // Disable all curves on sloped track + if (_previousTrackPitchEnd != TrackPitch::None || _currentTrackPitchEnd != TrackPitch::None) { disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) @@ -359,2913 +369,2962 @@ public: } } } - else + if (!IsTrackEnabled(TRACK_FLAT_ROLL_BANKING)) { - // Disable all curves on sloped track - if (_previousTrackPitchEnd != TrackPitch::None || _currentTrackPitchEnd != TrackPitch::None) - { - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) - | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) - | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); - } + // Disable banking + disabledWidgets |= (1uLL << WIDX_BANKING_GROUPBOX) | (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_STRAIGHT) + | (1uLL << WIDX_BANK_RIGHT); } - } - if (!IsTrackEnabled(TRACK_FLAT_ROLL_BANKING)) - { - // Disable banking - disabledWidgets |= (1uLL << WIDX_BANKING_GROUPBOX) | (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_STRAIGHT) - | (1uLL << WIDX_BANK_RIGHT); - } - // Disable banking if the start track is steep and the end of the track becomes flat. - if ((_previousTrackPitchEnd == TrackPitch::Down60 || _previousTrackPitchEnd == TrackPitch::Up60) - && _currentTrackPitchEnd == TrackPitch::None) - { - disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); - } - if (!IsTrackEnabled(TRACK_SLOPE) && !IsTrackEnabled(TRACK_SLOPE_STEEP_DOWN) && !IsTrackEnabled(TRACK_SLOPE_STEEP_UP)) - { - if (!currentRide->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_REVERSE_FREEFALL)) - { - // Disable all slopes - disabledWidgets |= (1uLL << WIDX_SLOPE_GROUPBOX) | (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN) - | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP); - } - } - // If ride type does not have access to diagonal sloped turns, disallow simultaneous use of banked and sloped diagonals - if (!IsTrackEnabled(TRACK_SLOPE_CURVE_LARGE) && TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection)) - { - if (_currentTrackPitchEnd != TrackPitch::None) + // Disable banking if the start track is steep and the end of the track becomes flat. + if ((_previousTrackPitchEnd == TrackPitch::Down60 || _previousTrackPitchEnd == TrackPitch::Up60) + && _currentTrackPitchEnd == TrackPitch::None) { disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); } - else if (_currentTrackRollEnd != TrackRoll::None) + if (!IsTrackEnabled(TRACK_SLOPE) && !IsTrackEnabled(TRACK_SLOPE_STEEP_DOWN) + && !IsTrackEnabled(TRACK_SLOPE_STEEP_UP)) { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP); + if (!currentRide->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_REVERSE_FREEFALL)) + { + // Disable all slopes + disabledWidgets |= (1uLL << WIDX_SLOPE_GROUPBOX) | (1uLL << WIDX_SLOPE_DOWN_STEEP) + | (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP) + | (1uLL << WIDX_SLOPE_UP_STEEP); + } } - } - if (currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_UP_INCLINE_REQUIRES_LIFT) - && !gCheatsEnableAllDrawableTrackPieces) - { - // Disable lift hill toggle and banking if current track piece is uphill - if (_previousTrackPitchEnd == TrackPitch::Up25 || _previousTrackPitchEnd == TrackPitch::Up60 - || _currentTrackPitchEnd == TrackPitch::Up25 || _currentTrackPitchEnd == TrackPitch::Up60) - disabledWidgets |= 1uLL << WIDX_CHAIN_LIFT | (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); - // Disable upward slope if current track piece is not flat - if ((_previousTrackPitchEnd != TrackPitch::None || _previousTrackRollEnd != TrackRoll::None) - && !(_currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED)) - disabledWidgets |= (1uLL << WIDX_SLOPE_UP); - } - if (_rideConstructionState == RideConstructionState::State0) - { - disabledWidgets |= (1uLL << WIDX_CONSTRUCT) | (1uLL << WIDX_DEMOLISH) | (1uLL << WIDX_PREVIOUS_SECTION) - | (1uLL << WIDX_NEXT_SECTION); - } - switch (_currentTrackCurve) - { - case EnumValue(TrackCurve::LeftVerySmall): - case EnumValue(TrackCurve::LeftSmall): - case EnumValue(TrackCurve::Left): - case EnumValue(TrackCurve::LeftLarge): - disabledWidgets |= (1uLL << WIDX_BANK_RIGHT); - if (_previousTrackRollEnd == TrackRoll::None) + // If ride type does not have access to diagonal sloped turns, disallow simultaneous use of banked and sloped + // diagonals + if (!IsTrackEnabled(TRACK_SLOPE_CURVE_LARGE) && TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection)) + { + if (_currentTrackPitchEnd != TrackPitch::None) { - disabledWidgets |= (1uLL << WIDX_BANK_LEFT); + disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); } - else + else if (_currentTrackRollEnd != TrackRoll::None) { - disabledWidgets |= (1uLL << WIDX_BANK_STRAIGHT); + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP); } - break; - case EnumValue(TrackCurve::RightLarge): - case EnumValue(TrackCurve::Right): - case EnumValue(TrackCurve::RightSmall): - case EnumValue(TrackCurve::RightVerySmall): - disabledWidgets |= (1uLL << WIDX_BANK_LEFT); - if (_previousTrackRollEnd == TrackRoll::None) - { + } + if (currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_UP_INCLINE_REQUIRES_LIFT) + && !GetGameState().Cheats.EnableAllDrawableTrackPieces) + { + // Disable lift hill toggle and banking if current track piece is uphill + if (_previousTrackPitchEnd == TrackPitch::Up25 || _previousTrackPitchEnd == TrackPitch::Up60 + || _currentTrackPitchEnd == TrackPitch::Up25 || _currentTrackPitchEnd == TrackPitch::Up60) + disabledWidgets |= 1uLL << WIDX_CHAIN_LIFT | (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); + // Disable upward slope if current track piece is not flat + if ((_previousTrackPitchEnd != TrackPitch::None || _previousTrackRollEnd != TrackRoll::None) + && !(_currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED)) + disabledWidgets |= (1uLL << WIDX_SLOPE_UP); + } + if (_rideConstructionState == RideConstructionState::State0) + { + disabledWidgets |= (1uLL << WIDX_CONSTRUCT) | (1uLL << WIDX_DEMOLISH) | (1uLL << WIDX_PREVIOUS_SECTION) + | (1uLL << WIDX_NEXT_SECTION); + } + switch (_currentTrackCurve) + { + case EnumValue(TrackCurve::LeftVerySmall): + case EnumValue(TrackCurve::LeftSmall): + case EnumValue(TrackCurve::Left): + case EnumValue(TrackCurve::LeftLarge): disabledWidgets |= (1uLL << WIDX_BANK_RIGHT); - } - else + if (_previousTrackRollEnd == TrackRoll::None) + { + disabledWidgets |= (1uLL << WIDX_BANK_LEFT); + } + else + { + disabledWidgets |= (1uLL << WIDX_BANK_STRAIGHT); + } + break; + case EnumValue(TrackCurve::RightLarge): + case EnumValue(TrackCurve::Right): + case EnumValue(TrackCurve::RightSmall): + case EnumValue(TrackCurve::RightVerySmall): + disabledWidgets |= (1uLL << WIDX_BANK_LEFT); + if (_previousTrackRollEnd == TrackRoll::None) + { + disabledWidgets |= (1uLL << WIDX_BANK_RIGHT); + } + else + { + disabledWidgets |= (1uLL << WIDX_BANK_STRAIGHT); + } + break; + } + if (!IsTrackEnabled(TRACK_SLOPE_ROLL_BANKING)) + { + if (_currentTrackRollEnd != TrackRoll::None) { - disabledWidgets |= (1uLL << WIDX_BANK_STRAIGHT); + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP); } - break; - } - if (!IsTrackEnabled(TRACK_SLOPE_ROLL_BANKING)) - { - if (_currentTrackRollEnd != TrackRoll::None) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP); } - } - if (_previousTrackPitchEnd == _currentTrackPitchEnd) - { - switch (_currentTrackPitchEnd) + if (_previousTrackPitchEnd == _currentTrackPitchEnd) { - case TrackPitch::Up60: - case TrackPitch::Down60: - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE) - | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); - if (!IsTrackEnabled(TRACK_SLOPE_CURVE_STEEP)) - { - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE_SMALL); - } - break; - case TrackPitch::Up90: - case TrackPitch::Down90: - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE) - | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); - if (!IsTrackEnabled(TRACK_CURVE_VERTICAL)) - { - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE_SMALL); - } - break; - default: - break; + switch (_currentTrackPitchEnd) + { + case TrackPitch::Up60: + case TrackPitch::Down60: + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE) + | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); + if (!IsTrackEnabled(TRACK_SLOPE_CURVE_STEEP)) + { + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE_SMALL); + } + break; + case TrackPitch::Up90: + case TrackPitch::Down90: + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE) + | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); + if (!IsTrackEnabled(TRACK_CURVE_VERTICAL)) + { + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE_SMALL); + } + break; + default: + break; + } + } + else + { + // Disable all curves + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) + | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) + | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); } - } - else - { - // Disable all curves - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) - | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) - | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); - } - switch (_previousTrackPitchEnd) - { - case TrackPitch::None: - if (_currentTrackCurve != EnumValue(TrackCurve::None) - || (IsTrackEnabled(TRACK_SLOPE_STEEP_LONG) && TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection))) + switch (_previousTrackPitchEnd) + { + case TrackPitch::None: + if (_currentTrackCurve != EnumValue(TrackCurve::None) + || (IsTrackEnabled(TRACK_SLOPE_STEEP_LONG) + && TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection))) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP); + } + break; + case TrackPitch::Down25: + disabledWidgets |= (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP); + break; + case TrackPitch::Down60: + disabledWidgets |= (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP); + if (!IsTrackEnabled(TRACK_SLOPE_LONG) + && !( + IsTrackEnabled(TRACK_SLOPE_STEEP_LONG) + && !TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection))) + { + disabledWidgets |= (1uLL << WIDX_LEVEL); + } + break; + case TrackPitch::Up25: + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN); + break; + case TrackPitch::Up60: + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN); + if (!IsTrackEnabled(TRACK_SLOPE_LONG) + && !( + IsTrackEnabled(TRACK_SLOPE_STEEP_LONG) + && !TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection))) + { + disabledWidgets |= (1uLL << WIDX_LEVEL); + } + break; + case TrackPitch::Down90: + case TrackPitch::Up90: + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP); + break; + } + if (_previousTrackPitchEnd == TrackPitch::None) + { + if (!IsTrackEnabled(TRACK_SLOPE_LONG) && !IsTrackEnabled(TRACK_SLOPE_STEEP_LONG)) { disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP); } - break; - case TrackPitch::Down25: - disabledWidgets |= (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP); - break; - case TrackPitch::Down60: - disabledWidgets |= (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP); - if (!IsTrackEnabled(TRACK_SLOPE_LONG) - && !(IsTrackEnabled(TRACK_SLOPE_STEEP_LONG) && !TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection))) + } + if (IsTrackEnabled(TRACK_SLOPE_VERTICAL)) + { + if (_previousTrackPitchEnd == TrackPitch::Up60 && _currentTrackPieceDirection < 4) { - disabledWidgets |= (1uLL << WIDX_LEVEL); + disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP); } - break; - case TrackPitch::Up25: - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN); - break; - case TrackPitch::Up60: - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN); - if (!IsTrackEnabled(TRACK_SLOPE_LONG) - && !(IsTrackEnabled(TRACK_SLOPE_STEEP_LONG) && !TrackPieceDirectionIsDiagonal(_currentTrackPieceDirection))) + if (_previousTrackPitchEnd == TrackPitch::Up90) { - disabledWidgets |= (1uLL << WIDX_LEVEL); + disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP); } - break; - case TrackPitch::Down90: - case TrackPitch::Up90: - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP); - break; - } - if (_previousTrackPitchEnd == TrackPitch::None) - { - if (!IsTrackEnabled(TRACK_SLOPE_LONG) && !IsTrackEnabled(TRACK_SLOPE_STEEP_LONG)) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP); - } - } - if (IsTrackEnabled(TRACK_SLOPE_VERTICAL)) - { - if (_previousTrackPitchEnd == TrackPitch::Up60 && _currentTrackPieceDirection < 4) - { - disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP); - } - if (_previousTrackPitchEnd == TrackPitch::Up90) - { - disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP); - } - if (_previousTrackPitchEnd == TrackPitch::Down60 && _currentTrackPieceDirection < 4) - { - disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP_STEEP); - } - } - if (_previousTrackRollEnd == TrackRoll::Left) - { - disabledWidgets |= (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_LARGE) - | (1uLL << WIDX_BANK_RIGHT); - } - if (_previousTrackRollEnd == TrackRoll::Right) - { - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_LEFT_CURVE_LARGE) - | (1uLL << WIDX_BANK_LEFT); - } - if (_currentTrackRollEnd != _previousTrackRollEnd) - { - disabledWidgets |= (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_LARGE) - | (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_LEFT_CURVE_LARGE); - } - if (_currentTrackPitchEnd != TrackPitch::None) - { - if (IsTrackEnabled(TRACK_SLOPE_ROLL_BANKING)) - { - if (_previousTrackPitchEnd == TrackPitch::None) + if (_previousTrackPitchEnd == TrackPitch::Down60 && _currentTrackPieceDirection < 4) { - if (_currentTrackPitchEnd != TrackPitch::Up25 && _currentTrackPitchEnd != TrackPitch::Down25) - { - disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); - } + disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP_STEEP); } - else + } + if (_previousTrackRollEnd == TrackRoll::Left) + { + disabledWidgets |= (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE) + | (1uLL << WIDX_RIGHT_CURVE_LARGE) | (1uLL << WIDX_BANK_RIGHT); + } + if (_previousTrackRollEnd == TrackRoll::Right) + { + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_LEFT_CURVE_LARGE) + | (1uLL << WIDX_BANK_LEFT); + } + if (_currentTrackRollEnd != _previousTrackRollEnd) + { + disabledWidgets |= (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE) + | (1uLL << WIDX_RIGHT_CURVE_LARGE) | (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE) + | (1uLL << WIDX_LEFT_CURVE_LARGE); + } + if (_currentTrackPitchEnd != TrackPitch::None) + { + if (IsTrackEnabled(TRACK_SLOPE_ROLL_BANKING)) { - if (_currentTrackPitchEnd != _previousTrackPitchEnd) - { - disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); - } - else + if (_previousTrackPitchEnd == TrackPitch::None) { if (_currentTrackPitchEnd != TrackPitch::Up25 && _currentTrackPitchEnd != TrackPitch::Down25) { disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); } } - } - } - else - { - disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); - } - } - if (_currentTrackRollEnd != TrackRoll::None || _previousTrackRollEnd != TrackRoll::None) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP) | (1uLL << WIDX_CHAIN_LIFT); - } - if (_currentTrackCurve != EnumValue(TrackCurve::None)) - { - if (!IsTrackEnabled(TRACK_LIFT_HILL_CURVE)) - { - disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); - } - if (_currentTrackPitchEnd == TrackPitch::None) - { - disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); - } - if (_currentTrackPitchEnd == TrackPitch::Up60) - { - disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); - } - if (_currentTrackPitchEnd == TrackPitch::Down60) - { - disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); - } - } - if (_currentTrackPitchEnd == TrackPitch::Up90 || _previousTrackPitchEnd == TrackPitch::Up90) - { - disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); - } - if (!IsTrackEnabled(TRACK_LIFT_HILL_STEEP)) - { - if (_previousTrackPitchEnd == TrackPitch::Up60 || _currentTrackPitchEnd == TrackPitch::Up60) - { - disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); - } - } - if (_previousTrackRollEnd == TrackRoll::UpsideDown) - { - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_LEFT_CURVE_LARGE) - | (1uLL << WIDX_STRAIGHT) | (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE) - | (1uLL << WIDX_RIGHT_CURVE_LARGE); - } - if (_currentTrackCurve != EnumValue(TrackCurve::None)) - { - if (_currentTrackPitchEnd == TrackPitch::None) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP); - } - if (_currentTrackPitchEnd == _previousTrackPitchEnd) - { - if (_currentTrackPitchEnd == TrackPitch::Up25) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_UP_STEEP); - if (_currentTrackCurve == EnumValue(TrackCurve::Left) || _currentTrackCurve == EnumValue(TrackCurve::Right) - || _rideConstructionState != RideConstructionState::Back || !IsTrackEnabled(TRACK_SLOPE_CURVE_BANKED)) + else { - disabledWidgets |= (1uLL << WIDX_LEVEL); + if (_currentTrackPitchEnd != _previousTrackPitchEnd) + { + disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); + } + else + { + if (_currentTrackPitchEnd != TrackPitch::Up25 && _currentTrackPitchEnd != TrackPitch::Down25) + { + disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); + } + } } } - if (_currentTrackPitchEnd == TrackPitch::Down25) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP); - if (_currentTrackCurve == EnumValue(TrackCurve::Left) || _currentTrackCurve == EnumValue(TrackCurve::Right) - || _rideConstructionState != RideConstructionState::Front || !IsTrackEnabled(TRACK_SLOPE_CURVE_BANKED)) - { - disabledWidgets |= (1uLL << WIDX_LEVEL); - } - } - } - else if (IsTrackEnabled(TRACK_SLOPE_CURVE_BANKED)) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP); - if (_currentTrackRollEnd == TrackRoll::Left) - { - disabledWidgets |= (1uLL << WIDX_BANK_STRAIGHT) | (1uLL << WIDX_BANK_RIGHT); - disabledWidgets &= ~(1uLL << WIDX_BANK_LEFT); - } - if (_currentTrackRollEnd == TrackRoll::Right) - { - disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_STRAIGHT); - disabledWidgets &= ~(1uLL << WIDX_BANK_RIGHT); - } - if (_currentTrackRollEnd == TrackRoll::None) + else { disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); - disabledWidgets &= ~(1uLL << WIDX_BANK_STRAIGHT); + } + } + if (_currentTrackRollEnd != TrackRoll::None || _previousTrackRollEnd != TrackRoll::None) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP) | (1uLL << WIDX_CHAIN_LIFT); + } + if (_currentTrackCurve != EnumValue(TrackCurve::None)) + { + if (!IsTrackEnabled(TRACK_LIFT_HILL_CURVE)) + { + disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); } if (_currentTrackPitchEnd == TrackPitch::None) { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP); - disabledWidgets &= ~(1uLL << WIDX_LEVEL); + disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); } - if (_currentTrackPitchEnd == TrackPitch::Up25) + if (_currentTrackPitchEnd == TrackPitch::Up60) { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL); - disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP); + disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); } - if (_currentTrackPitchEnd == TrackPitch::Down25) + if (_currentTrackPitchEnd == TrackPitch::Down60) { - disabledWidgets |= (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP); - disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN); - } - if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall)) - { - disabledWidgets &= ~(1uLL << WIDX_LEFT_CURVE_SMALL); - } - if (_currentTrackCurve == EnumValue(TrackCurve::RightSmall)) - { - disabledWidgets &= ~(1uLL << WIDX_RIGHT_CURVE_SMALL); + disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); } } - } - if (_currentTrackCurve != EnumValue(TrackCurve::None) && _currentTrackPitchEnd == TrackPitch::Up60) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_UP); - } - if (_currentTrackCurve != EnumValue(TrackCurve::None) && _currentTrackPitchEnd == TrackPitch::Down60) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN); - } - if ((_currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED) && !gCheatsEnableChainLiftOnAllTrack) - { - if (_currentTrackPitchEnd != TrackPitch::None && !IsTrackEnabled(TRACK_LIFT_HILL_CURVE)) + if (_currentTrackPitchEnd == TrackPitch::Up90 || _previousTrackPitchEnd == TrackPitch::Up90) { - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_LEFT_CURVE_LARGE) - | (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_LARGE); + disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); } if (!IsTrackEnabled(TRACK_LIFT_HILL_STEEP)) { - if (widgets[WIDX_SLOPE_UP_STEEP].tooltip == STR_RIDE_CONSTRUCTION_STEEP_SLOPE_UP_TIP) + if (_previousTrackPitchEnd == TrackPitch::Up60 || _currentTrackPitchEnd == TrackPitch::Up60) + { + disabledWidgets |= (1uLL << WIDX_CHAIN_LIFT); + } + } + if (_previousTrackRollEnd == TrackRoll::UpsideDown) + { + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_LEFT_CURVE_LARGE) + | (1uLL << WIDX_STRAIGHT) | (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE) + | (1uLL << WIDX_RIGHT_CURVE_LARGE); + } + if (_currentTrackCurve != EnumValue(TrackCurve::None)) + { + if (_currentTrackPitchEnd == TrackPitch::None) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP); + } + if (_currentTrackPitchEnd == _previousTrackPitchEnd) + { + if (_currentTrackPitchEnd == TrackPitch::Up25) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_UP_STEEP); + if (_currentTrackCurve == EnumValue(TrackCurve::Left) + || _currentTrackCurve == EnumValue(TrackCurve::Right) + || _rideConstructionState != RideConstructionState::Back + || !IsTrackEnabled(TRACK_SLOPE_CURVE_BANKED)) + { + disabledWidgets |= (1uLL << WIDX_LEVEL); + } + } + if (_currentTrackPitchEnd == TrackPitch::Down25) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP); + if (_currentTrackCurve == EnumValue(TrackCurve::Left) + || _currentTrackCurve == EnumValue(TrackCurve::Right) + || _rideConstructionState != RideConstructionState::Front + || !IsTrackEnabled(TRACK_SLOPE_CURVE_BANKED)) + { + disabledWidgets |= (1uLL << WIDX_LEVEL); + } + } + } + else if (IsTrackEnabled(TRACK_SLOPE_CURVE_BANKED)) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_UP_STEEP); + if (_currentTrackRollEnd == TrackRoll::Left) + { + disabledWidgets |= (1uLL << WIDX_BANK_STRAIGHT) | (1uLL << WIDX_BANK_RIGHT); + disabledWidgets &= ~(1uLL << WIDX_BANK_LEFT); + } + if (_currentTrackRollEnd == TrackRoll::Right) + { + disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_STRAIGHT); + disabledWidgets &= ~(1uLL << WIDX_BANK_RIGHT); + } + if (_currentTrackRollEnd == TrackRoll::None) + { + disabledWidgets |= (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_RIGHT); + disabledWidgets &= ~(1uLL << WIDX_BANK_STRAIGHT); + } + if (_currentTrackPitchEnd == TrackPitch::None) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_SLOPE_UP); + disabledWidgets &= ~(1uLL << WIDX_LEVEL); + } + if (_currentTrackPitchEnd == TrackPitch::Up25) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN) | (1uLL << WIDX_LEVEL); + disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP); + } + if (_currentTrackPitchEnd == TrackPitch::Down25) + { + disabledWidgets |= (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP); + disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN); + } + if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall)) + { + disabledWidgets &= ~(1uLL << WIDX_LEFT_CURVE_SMALL); + } + if (_currentTrackCurve == EnumValue(TrackCurve::RightSmall)) + { + disabledWidgets &= ~(1uLL << WIDX_RIGHT_CURVE_SMALL); + } + } + } + if (_currentTrackCurve != EnumValue(TrackCurve::None) && _currentTrackPitchEnd == TrackPitch::Up60) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_UP); + } + if (_currentTrackCurve != EnumValue(TrackCurve::None) && _currentTrackPitchEnd == TrackPitch::Down60) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN); + } + if ((_currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED) && !GetGameState().Cheats.EnableChainLiftOnAllTrack) + { + if (_currentTrackPitchEnd != TrackPitch::None && !IsTrackEnabled(TRACK_LIFT_HILL_CURVE)) + { + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE) + | (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE) + | (1uLL << WIDX_RIGHT_CURVE_LARGE); + } + if (!IsTrackEnabled(TRACK_LIFT_HILL_STEEP)) + { + if (widgets[WIDX_SLOPE_UP_STEEP].tooltip == STR_RIDE_CONSTRUCTION_STEEP_SLOPE_UP_TIP) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_UP_STEEP); + } + } + } + if (_previousTrackPitchEnd == TrackPitch::Up60 && _currentTrackCurve != EnumValue(TrackCurve::None)) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_LEVEL); + } + if (_previousTrackPitchEnd == TrackPitch::Down60 && _currentTrackCurve != EnumValue(TrackCurve::None)) + { + disabledWidgets |= (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP_STEEP); + } + if (_currentTrackPitchEnd == TrackPitch::Up90 || _previousTrackPitchEnd == TrackPitch::Up90) + { + if (_currentTrackCurve != EnumValue(TrackCurve::None)) { disabledWidgets |= (1uLL << WIDX_SLOPE_UP_STEEP); } + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_LARGE); + if (currentRide->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_REVERSE_FREEFALL)) + { + disabledWidgets |= (1uLL << WIDX_STRAIGHT) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) + | (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE); + } } - } - if (_previousTrackPitchEnd == TrackPitch::Up60 && _currentTrackCurve != EnumValue(TrackCurve::None)) - { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_LEVEL); - } - if (_previousTrackPitchEnd == TrackPitch::Down60 && _currentTrackCurve != EnumValue(TrackCurve::None)) - { - disabledWidgets |= (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP_STEEP); - } - if (_currentTrackPitchEnd == TrackPitch::Up90 || _previousTrackPitchEnd == TrackPitch::Up90) - { - if (_currentTrackCurve != EnumValue(TrackCurve::None)) + else if (_currentTrackPitchEnd == TrackPitch::Down90 || _previousTrackPitchEnd == TrackPitch::Down90) { - disabledWidgets |= (1uLL << WIDX_SLOPE_UP_STEEP); + if (_currentTrackCurve != EnumValue(TrackCurve::None)) + { + disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP); + } + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_LARGE); + if (currentRide->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_REVERSE_FREEFALL)) + { + disabledWidgets |= (1uLL << WIDX_STRAIGHT) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) + | (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE); + } } - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_LARGE); - if (currentRide->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_REVERSE_FREEFALL)) + // If the previous track is flat and the next track is flat, attempt to show buttons for helixes + if (_currentTrackPitchEnd == TrackPitch::None && _currentTrackPitchEnd == _previousTrackPitchEnd) { - disabledWidgets |= (1uLL << WIDX_STRAIGHT) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) - | (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE); + // If the bank is none, attempt to show unbanked quarter helixes + if (_currentTrackRollEnd == TrackRoll::None + && (_currentTrackCurve == EnumValue(TrackCurve::Left) + || _currentTrackCurve == EnumValue(TrackCurve::Right))) + { + if (IsTrackEnabled(TRACK_HELIX_DOWN_UNBANKED_QUARTER)) + disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP); + if (IsTrackEnabled(TRACK_HELIX_UP_UNBANKED_QUARTER)) + disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP_STEEP); + } + // If the track is banked left or right and curvature is standard size (2.5 tile radius), attempt to show + // buttons for half or quarter helixes + else if ( + (_currentTrackRollEnd == TrackRoll::Left || _currentTrackRollEnd == TrackRoll::Right) + && (_currentTrackCurve == EnumValue(TrackCurve::Left) + || _currentTrackCurve == EnumValue(TrackCurve::Right))) + { + if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_QUARTER)) + disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP); + if (IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_QUARTER)) + disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP_STEEP); + } + // If the track is banked left or right and curvature is small size (1.5 tile radius), attempt to show buttons + // for half helixes + else if ( + (_currentTrackRollEnd == TrackRoll::Left || _currentTrackRollEnd == TrackRoll::Right) + && (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall) + || _currentTrackCurve == EnumValue(TrackCurve::RightSmall))) + { + if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF)) + disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP); + if (IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF)) + disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP_STEEP); + } } - } - else if (_currentTrackPitchEnd == TrackPitch::Down90 || _previousTrackPitchEnd == TrackPitch::Down90) - { - if (_currentTrackCurve != EnumValue(TrackCurve::None)) + if (IsTrackEnabled(TRACK_SLOPE_CURVE_BANKED)) { - disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN_STEEP); + if (_rideConstructionState == RideConstructionState::Front) + { + if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall) + || _currentTrackCurve == EnumValue(TrackCurve::RightSmall)) + { + if (_currentTrackPitchEnd == TrackPitch::None && _previousTrackRollEnd != TrackRoll::None + && (!currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_UP_INCLINE_REQUIRES_LIFT) + || GetGameState().Cheats.EnableAllDrawableTrackPieces)) + { + disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP); + } + } + } + else if (_rideConstructionState == RideConstructionState::Back) + { + if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall) + || _currentTrackCurve == EnumValue(TrackCurve::RightSmall)) + { + if (_currentTrackPitchEnd == TrackPitch::None && _previousTrackRollEnd != TrackRoll::None) + { + disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN); + } + } + } } - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_LARGE); - if (currentRide->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_REVERSE_FREEFALL)) + if (_currentTrackPieceDirection >= 4) { - disabledWidgets |= (1uLL << WIDX_STRAIGHT) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) - | (1uLL << WIDX_LEFT_CURVE_SMALL) | (1uLL << WIDX_LEFT_CURVE); + disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) + | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) + | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); } - } - // If the previous track is flat and the next track is flat, attempt to show buttons for helixes - if (_currentTrackPitchEnd == TrackPitch::None && _currentTrackPitchEnd == _previousTrackPitchEnd) - { - // If the bank is none, attempt to show unbanked quarter helixes - if (_currentTrackRollEnd == TrackRoll::None - && (_currentTrackCurve == EnumValue(TrackCurve::Left) || _currentTrackCurve == EnumValue(TrackCurve::Right))) - { - if (IsTrackEnabled(TRACK_HELIX_DOWN_UNBANKED_QUARTER)) - disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP); - if (IsTrackEnabled(TRACK_HELIX_UP_UNBANKED_QUARTER)) - disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP_STEEP); - } - // If the track is banked left or right and curvature is standard size (2.5 tile radius), attempt to show buttons - // for half or quarter helixes - else if ( - (_currentTrackRollEnd == TrackRoll::Left || _currentTrackRollEnd == TrackRoll::Right) - && (_currentTrackCurve == EnumValue(TrackCurve::Left) || _currentTrackCurve == EnumValue(TrackCurve::Right))) - { - if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_QUARTER)) - disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP); - if (IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_QUARTER)) - disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP_STEEP); - } - // If the track is banked left or right and curvature is small size (1.5 tile radius), attempt to show buttons for - // half helixes - else if ( - (_currentTrackRollEnd == TrackRoll::Left || _currentTrackRollEnd == TrackRoll::Right) - && (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall) - || _currentTrackCurve == EnumValue(TrackCurve::RightSmall))) - { - if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF)) - disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN_STEEP); - if (IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF)) - disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP_STEEP); - } - } - if (IsTrackEnabled(TRACK_SLOPE_CURVE_BANKED)) - { if (_rideConstructionState == RideConstructionState::Front) { - if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall) - || _currentTrackCurve == EnumValue(TrackCurve::RightSmall)) + disabledWidgets |= (1uLL << WIDX_NEXT_SECTION); + if (WindowRideConstructionUpdateState(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)) { - if (_currentTrackPitchEnd == TrackPitch::None && _previousTrackRollEnd != TrackRoll::None - && (!currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_UP_INCLINE_REQUIRES_LIFT) - || gCheatsEnableAllDrawableTrackPieces)) - { - disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP); - } + disabledWidgets |= (1uLL << WIDX_CONSTRUCT); } } else if (_rideConstructionState == RideConstructionState::Back) { - if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall) - || _currentTrackCurve == EnumValue(TrackCurve::RightSmall)) + disabledWidgets |= (1uLL << WIDX_PREVIOUS_SECTION); + if (WindowRideConstructionUpdateState(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)) { - if (_currentTrackPitchEnd == TrackPitch::None && _previousTrackRollEnd != TrackRoll::None) - { - disabledWidgets &= ~(1uLL << WIDX_SLOPE_DOWN); - } + disabledWidgets |= (1uLL << WIDX_CONSTRUCT); } } - } - if (_currentTrackPieceDirection >= 4) - { - disabledWidgets |= (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) - | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_RIGHT_CURVE) | (1uLL << WIDX_RIGHT_CURVE_SMALL) - | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL); - } - if (_rideConstructionState == RideConstructionState::Front) - { - disabledWidgets |= (1uLL << WIDX_NEXT_SECTION); - if (WindowRideConstructionUpdateState(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)) + if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_TRACK_ELEMENTS_HAVE_TWO_VARIETIES)) { - disabledWidgets |= (1uLL << WIDX_CONSTRUCT); + disabledWidgets &= ~(1uLL << WIDX_BANKING_GROUPBOX); } - } - else if (_rideConstructionState == RideConstructionState::Back) - { - disabledWidgets |= (1uLL << WIDX_PREVIOUS_SECTION); - if (WindowRideConstructionUpdateState(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)) + if (_rideConstructionState == RideConstructionState::EntranceExit + || _rideConstructionState == RideConstructionState::Selected) { - disabledWidgets |= (1uLL << WIDX_CONSTRUCT); + disabledWidgets |= (1uLL << WIDX_DIRECTION_GROUPBOX) | (1uLL << WIDX_SLOPE_GROUPBOX) + | (1uLL << WIDX_BANKING_GROUPBOX) | (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) + | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_STRAIGHT) | (1uLL << WIDX_RIGHT_CURVE) + | (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL) + | (1uLL << WIDX_SPECIAL_TRACK_DROPDOWN) | (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN) + | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP) | (1uLL << WIDX_CHAIN_LIFT) + | (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_STRAIGHT) | (1uLL << WIDX_BANK_RIGHT) + | (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_LARGE); } - } - if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_TRACK_ELEMENTS_HAVE_TWO_VARIETIES)) - { - disabledWidgets &= ~(1uLL << WIDX_BANKING_GROUPBOX); - } - if (_rideConstructionState == RideConstructionState::EntranceExit - || _rideConstructionState == RideConstructionState::Selected) - { - disabledWidgets |= (1uLL << WIDX_DIRECTION_GROUPBOX) | (1uLL << WIDX_SLOPE_GROUPBOX) - | (1uLL << WIDX_BANKING_GROUPBOX) | (1uLL << WIDX_LEFT_CURVE_VERY_SMALL) | (1uLL << WIDX_LEFT_CURVE_SMALL) - | (1uLL << WIDX_LEFT_CURVE) | (1uLL << WIDX_STRAIGHT) | (1uLL << WIDX_RIGHT_CURVE) - | (1uLL << WIDX_RIGHT_CURVE_SMALL) | (1uLL << WIDX_RIGHT_CURVE_VERY_SMALL) - | (1uLL << WIDX_SPECIAL_TRACK_DROPDOWN) | (1uLL << WIDX_SLOPE_DOWN_STEEP) | (1uLL << WIDX_SLOPE_DOWN) - | (1uLL << WIDX_LEVEL) | (1uLL << WIDX_SLOPE_UP) | (1uLL << WIDX_SLOPE_UP_STEEP) | (1uLL << WIDX_CHAIN_LIFT) - | (1uLL << WIDX_BANK_LEFT) | (1uLL << WIDX_BANK_STRAIGHT) | (1uLL << WIDX_BANK_RIGHT) - | (1uLL << WIDX_LEFT_CURVE_LARGE) | (1uLL << WIDX_RIGHT_CURVE_LARGE); - } - if (_currentlyShowingBrakeOrBoosterSpeed) - { - disabledWidgets &= ~(1uLL << WIDX_BANKING_GROUPBOX); - disabledWidgets &= ~(1uLL << WIDX_BANK_LEFT); - disabledWidgets &= ~(1uLL << WIDX_BANK_STRAIGHT); - disabledWidgets &= ~(1uLL << WIDX_BANK_RIGHT); - } - - // If chain lift cheat is enabled then show the chain lift widget no matter what - if (gCheatsEnableChainLiftOnAllTrack) - { - disabledWidgets &= ~(1uLL << WIDX_CHAIN_LIFT); - } - - // Set and invalidate the changed widgets - uint64_t currentDisabledWidgets = disabled_widgets; - if (currentDisabledWidgets == disabledWidgets) - return; - - for (WidgetIndex i = 0; i < 64; i++) - { - if ((disabledWidgets & (1uLL << i)) != (currentDisabledWidgets & (1uLL << i))) + if (_currentlyShowingBrakeOrBoosterSpeed) { - WidgetInvalidate(*this, i); + disabledWidgets &= ~(1uLL << WIDX_BANKING_GROUPBOX); + disabledWidgets &= ~(1uLL << WIDX_BANK_LEFT); + disabledWidgets &= ~(1uLL << WIDX_BANK_STRAIGHT); + disabledWidgets &= ~(1uLL << WIDX_BANK_RIGHT); } - } - disabled_widgets = disabledWidgets; - } - void OnUpdate() override - { - auto currentRide = GetRide(_currentRideIndex); - if (currentRide == nullptr) - { - return; + // If chain lift cheat is enabled then show the chain lift widget no matter what + if (GetGameState().Cheats.EnableChainLiftOnAllTrack) + { + disabledWidgets &= ~(1uLL << WIDX_CHAIN_LIFT); + } + + // Set and invalidate the changed widgets + uint64_t currentDisabledWidgets = disabled_widgets; + if (currentDisabledWidgets == disabledWidgets) + return; + + for (WidgetIndex i = 0; i < 64; i++) + { + if ((disabledWidgets & (1uLL << i)) != (currentDisabledWidgets & (1uLL << i))) + { + WidgetInvalidate(*this, i); + } + } + disabled_widgets = disabledWidgets; } - // Close construction window if currentRide is not closed, - // editing currentRide while open will cause many issues until properly handled - if (currentRide->status != RideStatus::Closed && currentRide->status != RideStatus::Simulating) + void OnUpdate() override { - Close(); - return; - } + auto currentRide = GetRide(_currentRideIndex); + if (currentRide == nullptr) + { + return; + } - switch (_currentTrackCurve) - { - case TrackElemType::SpinningTunnel | RideConstructionSpecialPieceSelected: - case TrackElemType::Whirlpool | RideConstructionSpecialPieceSelected: - case TrackElemType::Rapids | RideConstructionSpecialPieceSelected: - case TrackElemType::Waterfall | RideConstructionSpecialPieceSelected: - WidgetInvalidate(*this, WIDX_CONSTRUCT); - break; - } - - if (_rideConstructionState == RideConstructionState::Place) - { - if (!WidgetIsActiveTool(*this, WIDX_CONSTRUCT)) + // Close construction window if currentRide is not closed, + // editing currentRide while open will cause many issues until properly handled + if (currentRide->status != RideStatus::Closed && currentRide->status != RideStatus::Simulating) { Close(); return; } + + switch (_currentTrackCurve) + { + case TrackElemType::SpinningTunnel | RideConstructionSpecialPieceSelected: + case TrackElemType::Whirlpool | RideConstructionSpecialPieceSelected: + case TrackElemType::Rapids | RideConstructionSpecialPieceSelected: + case TrackElemType::Waterfall | RideConstructionSpecialPieceSelected: + WidgetInvalidate(*this, WIDX_CONSTRUCT); + break; + } + + if (_rideConstructionState == RideConstructionState::Place) + { + if (!WidgetIsActiveTool(*this, WIDX_CONSTRUCT)) + { + Close(); + return; + } + } + + if (_rideConstructionState == RideConstructionState::EntranceExit) + { + if (!WidgetIsActiveTool(*this, WIDX_ENTRANCE) && !WidgetIsActiveTool(*this, WIDX_EXIT)) + { + _rideConstructionState = gRideEntranceExitPlacePreviousRideConstructionState; + WindowRideConstructionUpdateActiveElements(); + } + } + + switch (_rideConstructionState) + { + case RideConstructionState::Front: + case RideConstructionState::Back: + case RideConstructionState::Selected: + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) + && gCurrentToolWidget.window_classification == WindowClass::RideConstruction) + { + ToolCancel(); + } + break; + default: + break; + } + + UpdateGhostTrackAndArrow(); } - if (_rideConstructionState == RideConstructionState::EntranceExit) + void OnMouseUp(WidgetIndex widgetIndex) override { - if (!WidgetIsActiveTool(*this, WIDX_ENTRANCE) && !WidgetIsActiveTool(*this, WIDX_EXIT)) + WindowRideConstructionUpdateEnabledTrackPieces(); + switch (widgetIndex) { - _rideConstructionState = gRideEntranceExitPlacePreviousRideConstructionState; - WindowRideConstructionUpdateActiveElements(); + case WIDX_CLOSE: + Close(); + break; + case WIDX_NEXT_SECTION: + RideSelectNextSection(); + break; + case WIDX_PREVIOUS_SECTION: + RideSelectPreviousSection(); + break; + case WIDX_CONSTRUCT: + Construct(); + // Force any footpath construction to recheck the area. + gProvisionalFootpath.Flags |= PROVISIONAL_PATH_FLAG_2; + break; + case WIDX_DEMOLISH: + MouseUpDemolish(); + break; + case WIDX_ROTATE: + Rotate(); + break; + case WIDX_ENTRANCE: + EntranceClick(); + break; + case WIDX_EXIT: + ExitClick(); + break; + case WIDX_SIMULATE: + { + auto currentRide = GetRide(_currentRideIndex); + if (currentRide != nullptr) + { + auto status = currentRide->status == RideStatus::Simulating ? RideStatus::Closed + : RideStatus::Simulating; + auto gameAction = RideSetStatusAction(currentRide->id, status); + GameActions::Execute(&gameAction); + } + break; + } } } - switch (_rideConstructionState) + void OnMouseDown(WidgetIndex widgetIndex) override { - case RideConstructionState::Front: - case RideConstructionState::Back: - case RideConstructionState::Selected: - if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) - && gCurrentToolWidget.window_classification == WindowClass::RideConstruction) - { - ToolCancel(); - } - break; - default: - break; - } - - UpdateGhostTrackAndArrow(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - WindowRideConstructionUpdateEnabledTrackPieces(); - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_NEXT_SECTION: - RideSelectNextSection(); - break; - case WIDX_PREVIOUS_SECTION: - RideSelectPreviousSection(); - break; - case WIDX_CONSTRUCT: - Construct(); - // Force any footpath construction to recheck the area. - gProvisionalFootpath.Flags |= PROVISIONAL_PATH_FLAG_2; - break; - case WIDX_DEMOLISH: - MouseUpDemolish(); - break; - case WIDX_ROTATE: - Rotate(); - break; - case WIDX_ENTRANCE: - EntranceClick(); - break; - case WIDX_EXIT: - ExitClick(); - break; - case WIDX_SIMULATE: + auto currentRide = GetRide(_currentRideIndex); + if (currentRide == nullptr) { - auto currentRide = GetRide(_currentRideIndex); - if (currentRide != nullptr) - { - auto status = currentRide->status == RideStatus::Simulating ? RideStatus::Closed : RideStatus::Simulating; - auto gameAction = RideSetStatusAction(currentRide->id, status); - GameActions::Execute(&gameAction); - } - break; + return; } - } - } - void OnMouseDown(WidgetIndex widgetIndex) override - { - auto currentRide = GetRide(_currentRideIndex); - if (currentRide == nullptr) - { - return; - } - - WindowRideConstructionUpdateEnabledTrackPieces(); - switch (widgetIndex) - { - case WIDX_LEFT_CURVE: - RideConstructionInvalidateCurrentTrack(); - _currentTrackCurve = EnumValue(TrackCurve::Left); - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_RIGHT_CURVE: - RideConstructionInvalidateCurrentTrack(); - _currentTrackCurve = EnumValue(TrackCurve::Right); - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_LEFT_CURVE_SMALL: - RideConstructionInvalidateCurrentTrack(); - _currentTrackCurve = EnumValue(TrackCurve::LeftSmall); - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_RIGHT_CURVE_SMALL: - RideConstructionInvalidateCurrentTrack(); - _currentTrackCurve = EnumValue(TrackCurve::RightSmall); - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_LEFT_CURVE_VERY_SMALL: - RideConstructionInvalidateCurrentTrack(); - _currentTrackCurve = EnumValue(TrackCurve::LeftVerySmall); - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_RIGHT_CURVE_VERY_SMALL: - RideConstructionInvalidateCurrentTrack(); - _currentTrackCurve = EnumValue(TrackCurve::RightVerySmall); - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_LEFT_CURVE_LARGE: - RideConstructionInvalidateCurrentTrack(); - _currentTrackCurve = EnumValue(TrackCurve::LeftLarge); - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_RIGHT_CURVE_LARGE: - RideConstructionInvalidateCurrentTrack(); - _currentTrackCurve = EnumValue(TrackCurve::RightLarge); - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_STRAIGHT: - RideConstructionInvalidateCurrentTrack(); - if (_currentTrackCurve != EnumValue(TrackCurve::None)) - _currentTrackRollEnd = TrackRoll::None; - _currentTrackCurve = EnumValue(TrackCurve::None); - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_SLOPE_DOWN_STEEP: - RideConstructionInvalidateCurrentTrack(); - if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF)) - { - if (_currentTrackCurve == EnumValue(TrackCurve::Left) && _currentTrackRollEnd == TrackRoll::Left) + WindowRideConstructionUpdateEnabledTrackPieces(); + switch (widgetIndex) + { + case WIDX_LEFT_CURVE: + RideConstructionInvalidateCurrentTrack(); + _currentTrackCurve = EnumValue(TrackCurve::Left); + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_RIGHT_CURVE: + RideConstructionInvalidateCurrentTrack(); + _currentTrackCurve = EnumValue(TrackCurve::Right); + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_LEFT_CURVE_SMALL: + RideConstructionInvalidateCurrentTrack(); + _currentTrackCurve = EnumValue(TrackCurve::LeftSmall); + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_RIGHT_CURVE_SMALL: + RideConstructionInvalidateCurrentTrack(); + _currentTrackCurve = EnumValue(TrackCurve::RightSmall); + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_LEFT_CURVE_VERY_SMALL: + RideConstructionInvalidateCurrentTrack(); + _currentTrackCurve = EnumValue(TrackCurve::LeftVerySmall); + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_RIGHT_CURVE_VERY_SMALL: + RideConstructionInvalidateCurrentTrack(); + _currentTrackCurve = EnumValue(TrackCurve::RightVerySmall); + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_LEFT_CURVE_LARGE: + RideConstructionInvalidateCurrentTrack(); + _currentTrackCurve = EnumValue(TrackCurve::LeftLarge); + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_RIGHT_CURVE_LARGE: + RideConstructionInvalidateCurrentTrack(); + _currentTrackCurve = EnumValue(TrackCurve::RightLarge); + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_STRAIGHT: + RideConstructionInvalidateCurrentTrack(); + if (_currentTrackCurve != EnumValue(TrackCurve::None)) + _currentTrackRollEnd = TrackRoll::None; + _currentTrackCurve = EnumValue(TrackCurve::None); + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_SLOPE_DOWN_STEEP: + RideConstructionInvalidateCurrentTrack(); + if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF)) { - _currentTrackCurve = TrackElemType::LeftHalfBankedHelixDownLarge | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - if (_currentTrackCurve == EnumValue(TrackCurve::Right) && _currentTrackRollEnd == TrackRoll::Right) - { - _currentTrackCurve = TrackElemType::RightHalfBankedHelixDownLarge - | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall) && _currentTrackRollEnd == TrackRoll::Left) - { - _currentTrackCurve = TrackElemType::LeftHalfBankedHelixDownSmall | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - if (_currentTrackCurve == EnumValue(TrackCurve::RightSmall) && _currentTrackRollEnd == TrackRoll::Right) - { - _currentTrackCurve = TrackElemType::RightHalfBankedHelixDownSmall - | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - } - if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_QUARTER)) - { - if (_currentTrackCurve == EnumValue(TrackCurve::Left) && _currentTrackRollEnd == TrackRoll::Left) - { - _currentTrackCurve = TrackElemType::LeftQuarterBankedHelixLargeDown - | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - if (_currentTrackCurve == EnumValue(TrackCurve::Right) && _currentTrackRollEnd == TrackRoll::Right) - { - _currentTrackCurve = TrackElemType::RightQuarterBankedHelixLargeDown - | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - } - if (IsTrackEnabled(TRACK_HELIX_DOWN_UNBANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_UNBANKED_QUARTER)) - { - if (_currentTrackRollEnd == TrackRoll::None) - { - if (_currentTrackCurve == EnumValue(TrackCurve::Left)) + if (_currentTrackCurve == EnumValue(TrackCurve::Left) && _currentTrackRollEnd == TrackRoll::Left) { - _currentTrackCurve = TrackElemType::LeftQuarterHelixLargeDown + _currentTrackCurve = TrackElemType::LeftHalfBankedHelixDownLarge | RideConstructionSpecialPieceSelected; _currentTrackPrice = kMoney64Undefined; WindowRideConstructionUpdateActiveElements(); break; } - if (_currentTrackCurve == EnumValue(TrackCurve::Right)) + if (_currentTrackCurve == EnumValue(TrackCurve::Right) && _currentTrackRollEnd == TrackRoll::Right) { - _currentTrackCurve = TrackElemType::RightQuarterHelixLargeDown + _currentTrackCurve = TrackElemType::RightHalfBankedHelixDownLarge + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall) && _currentTrackRollEnd == TrackRoll::Left) + { + _currentTrackCurve = TrackElemType::LeftHalfBankedHelixDownSmall + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + if (_currentTrackCurve == EnumValue(TrackCurve::RightSmall) && _currentTrackRollEnd == TrackRoll::Right) + { + _currentTrackCurve = TrackElemType::RightHalfBankedHelixDownSmall | RideConstructionSpecialPieceSelected; _currentTrackPrice = kMoney64Undefined; WindowRideConstructionUpdateActiveElements(); break; } } - } - if (widgets[WIDX_SLOPE_DOWN_STEEP].tooltip == STR_RIDE_CONSTRUCTION_STEEP_SLOPE_DOWN_TIP) - { - UpdateLiftHillSelected(TrackPitch::Down60); - } - else - { - UpdateLiftHillSelected(TrackPitch::Up90); - } - break; - case WIDX_SLOPE_DOWN: - RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState == RideConstructionState::Back && _currentTrackRollEnd != TrackRoll::None) - { - _currentTrackRollEnd = TrackRoll::None; - } - UpdateLiftHillSelected(TrackPitch::Down25); - break; - case WIDX_LEVEL: - RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState == RideConstructionState::Front && _previousTrackPitchEnd == TrackPitch::Down25) - { - if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall)) + if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_QUARTER)) { - _currentTrackRollEnd = TrackRoll::Left; - } - else if (_currentTrackCurve == EnumValue(TrackCurve::RightSmall)) - { - _currentTrackRollEnd = TrackRoll::Right; - } - } - else if (_rideConstructionState == RideConstructionState::Back && _previousTrackPitchEnd == TrackPitch::Up25) - { - if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall)) - { - _currentTrackRollEnd = TrackRoll::Left; - } - else if (_currentTrackCurve == EnumValue(TrackCurve::RightSmall)) - { - _currentTrackRollEnd = TrackRoll::Right; - } - } - UpdateLiftHillSelected(TrackPitch::None); - break; - case WIDX_SLOPE_UP: - RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState == RideConstructionState::Front && _currentTrackRollEnd != TrackRoll::None) - { - _currentTrackRollEnd = TrackRoll::None; - } - if (currentRide->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_REVERSE_FREEFALL)) - { - if (_rideConstructionState == RideConstructionState::Front - && _currentTrackCurve == EnumValue(TrackCurve::None)) - { - _currentTrackCurve = TrackElemType::ReverseFreefallSlope | RideConstructionSpecialPieceSelected; - WindowRideConstructionUpdateActiveElements(); - } - } - else - { - UpdateLiftHillSelected(TrackPitch::Up25); - } - break; - case WIDX_SLOPE_UP_STEEP: - RideConstructionInvalidateCurrentTrack(); - if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF)) - { - if (_currentTrackCurve == EnumValue(TrackCurve::Left) && _currentTrackRollEnd == TrackRoll::Left) - { - _currentTrackCurve = TrackElemType::LeftHalfBankedHelixUpLarge | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - if (_currentTrackCurve == EnumValue(TrackCurve::Right) && _currentTrackRollEnd == TrackRoll::Right) - { - _currentTrackCurve = TrackElemType::RightHalfBankedHelixUpLarge | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall) && _currentTrackRollEnd == TrackRoll::Left) - { - _currentTrackCurve = TrackElemType::LeftHalfBankedHelixUpSmall | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - if (_currentTrackCurve == EnumValue(TrackCurve::RightSmall) && _currentTrackRollEnd == TrackRoll::Right) - { - _currentTrackCurve = TrackElemType::RightHalfBankedHelixUpSmall | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - } - if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_QUARTER)) - { - if (_currentTrackCurve == EnumValue(TrackCurve::Left) && _currentTrackRollEnd == TrackRoll::Left) - { - _currentTrackCurve = TrackElemType::LeftQuarterBankedHelixLargeUp - | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - if (_currentTrackCurve == EnumValue(TrackCurve::Right) && _currentTrackRollEnd == TrackRoll::Right) - { - _currentTrackCurve = TrackElemType::RightQuarterBankedHelixLargeUp - | RideConstructionSpecialPieceSelected; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - } - } - if (IsTrackEnabled(TRACK_HELIX_DOWN_UNBANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_UNBANKED_QUARTER)) - { - if (_currentTrackRollEnd == TrackRoll::None) - { - if (_currentTrackCurve == EnumValue(TrackCurve::Left)) + if (_currentTrackCurve == EnumValue(TrackCurve::Left) && _currentTrackRollEnd == TrackRoll::Left) { - _currentTrackCurve = TrackElemType::LeftQuarterHelixLargeUp | RideConstructionSpecialPieceSelected; + _currentTrackCurve = TrackElemType::LeftQuarterBankedHelixLargeDown + | RideConstructionSpecialPieceSelected; _currentTrackPrice = kMoney64Undefined; WindowRideConstructionUpdateActiveElements(); break; } - if (_currentTrackCurve == EnumValue(TrackCurve::Right)) + if (_currentTrackCurve == EnumValue(TrackCurve::Right) && _currentTrackRollEnd == TrackRoll::Right) { - _currentTrackCurve = TrackElemType::RightQuarterHelixLargeUp | RideConstructionSpecialPieceSelected; + _currentTrackCurve = TrackElemType::RightQuarterBankedHelixLargeDown + | RideConstructionSpecialPieceSelected; _currentTrackPrice = kMoney64Undefined; WindowRideConstructionUpdateActiveElements(); break; } } - } - if (widgets[WIDX_SLOPE_UP_STEEP].tooltip == STR_RIDE_CONSTRUCTION_STEEP_SLOPE_UP_TIP) - { - UpdateLiftHillSelected(TrackPitch::Up60); - } - else - { - UpdateLiftHillSelected(TrackPitch::Down90); - } - break; - case WIDX_CHAIN_LIFT: - RideConstructionInvalidateCurrentTrack(); - _currentTrackLiftHill ^= CONSTRUCTION_LIFT_HILL_SELECTED; - if ((_currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED) && !gCheatsEnableChainLiftOnAllTrack) + if (IsTrackEnabled(TRACK_HELIX_DOWN_UNBANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_UNBANKED_QUARTER)) + { + if (_currentTrackRollEnd == TrackRoll::None) + { + if (_currentTrackCurve == EnumValue(TrackCurve::Left)) + { + _currentTrackCurve = TrackElemType::LeftQuarterHelixLargeDown + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + if (_currentTrackCurve == EnumValue(TrackCurve::Right)) + { + _currentTrackCurve = TrackElemType::RightQuarterHelixLargeDown + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + } + } + if (widgets[WIDX_SLOPE_DOWN_STEEP].tooltip == STR_RIDE_CONSTRUCTION_STEEP_SLOPE_DOWN_TIP) + { + UpdateLiftHillSelected(TrackPitch::Down60); + } + else + { + UpdateLiftHillSelected(TrackPitch::Up90); + } + break; + case WIDX_SLOPE_DOWN: + RideConstructionInvalidateCurrentTrack(); + if (_rideConstructionState == RideConstructionState::Back && _currentTrackRollEnd != TrackRoll::None) + { + _currentTrackRollEnd = TrackRoll::None; + } + UpdateLiftHillSelected(TrackPitch::Down25); + break; + case WIDX_LEVEL: + RideConstructionInvalidateCurrentTrack(); + if (_rideConstructionState == RideConstructionState::Front && _previousTrackPitchEnd == TrackPitch::Down25) + { + if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall)) + { + _currentTrackRollEnd = TrackRoll::Left; + } + else if (_currentTrackCurve == EnumValue(TrackCurve::RightSmall)) + { + _currentTrackRollEnd = TrackRoll::Right; + } + } + else if ( + _rideConstructionState == RideConstructionState::Back && _previousTrackPitchEnd == TrackPitch::Up25) + { + if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall)) + { + _currentTrackRollEnd = TrackRoll::Left; + } + else if (_currentTrackCurve == EnumValue(TrackCurve::RightSmall)) + { + _currentTrackRollEnd = TrackRoll::Right; + } + } + UpdateLiftHillSelected(TrackPitch::None); + break; + case WIDX_SLOPE_UP: + RideConstructionInvalidateCurrentTrack(); + if (_rideConstructionState == RideConstructionState::Front && _currentTrackRollEnd != TrackRoll::None) + { + _currentTrackRollEnd = TrackRoll::None; + } + if (currentRide->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_REVERSE_FREEFALL)) + { + if (_rideConstructionState == RideConstructionState::Front + && _currentTrackCurve == EnumValue(TrackCurve::None)) + { + _currentTrackCurve = TrackElemType::ReverseFreefallSlope | RideConstructionSpecialPieceSelected; + WindowRideConstructionUpdateActiveElements(); + } + } + else + { + UpdateLiftHillSelected(TrackPitch::Up25); + } + break; + case WIDX_SLOPE_UP_STEEP: + RideConstructionInvalidateCurrentTrack(); + if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF)) + { + if (_currentTrackCurve == EnumValue(TrackCurve::Left) && _currentTrackRollEnd == TrackRoll::Left) + { + _currentTrackCurve = TrackElemType::LeftHalfBankedHelixUpLarge + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + if (_currentTrackCurve == EnumValue(TrackCurve::Right) && _currentTrackRollEnd == TrackRoll::Right) + { + _currentTrackCurve = TrackElemType::RightHalfBankedHelixUpLarge + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + if (_currentTrackCurve == EnumValue(TrackCurve::LeftSmall) && _currentTrackRollEnd == TrackRoll::Left) + { + _currentTrackCurve = TrackElemType::LeftHalfBankedHelixUpSmall + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + if (_currentTrackCurve == EnumValue(TrackCurve::RightSmall) && _currentTrackRollEnd == TrackRoll::Right) + { + _currentTrackCurve = TrackElemType::RightHalfBankedHelixUpSmall + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + } + if (IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_QUARTER)) + { + if (_currentTrackCurve == EnumValue(TrackCurve::Left) && _currentTrackRollEnd == TrackRoll::Left) + { + _currentTrackCurve = TrackElemType::LeftQuarterBankedHelixLargeUp + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + if (_currentTrackCurve == EnumValue(TrackCurve::Right) && _currentTrackRollEnd == TrackRoll::Right) + { + _currentTrackCurve = TrackElemType::RightQuarterBankedHelixLargeUp + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + } + if (IsTrackEnabled(TRACK_HELIX_DOWN_UNBANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_UNBANKED_QUARTER)) + { + if (_currentTrackRollEnd == TrackRoll::None) + { + if (_currentTrackCurve == EnumValue(TrackCurve::Left)) + { + _currentTrackCurve = TrackElemType::LeftQuarterHelixLargeUp + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + if (_currentTrackCurve == EnumValue(TrackCurve::Right)) + { + _currentTrackCurve = TrackElemType::RightQuarterHelixLargeUp + | RideConstructionSpecialPieceSelected; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + } + } + } + if (widgets[WIDX_SLOPE_UP_STEEP].tooltip == STR_RIDE_CONSTRUCTION_STEEP_SLOPE_UP_TIP) + { + UpdateLiftHillSelected(TrackPitch::Up60); + } + else + { + UpdateLiftHillSelected(TrackPitch::Down90); + } + break; + case WIDX_CHAIN_LIFT: + RideConstructionInvalidateCurrentTrack(); + _currentTrackLiftHill ^= CONSTRUCTION_LIFT_HILL_SELECTED; + if ((_currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED) + && !GetGameState().Cheats.EnableChainLiftOnAllTrack) + _currentTrackAlternative &= ~RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_BANK_LEFT: + RideConstructionInvalidateCurrentTrack(); + if (!_currentlyShowingBrakeOrBoosterSpeed) + { + _currentTrackRollEnd = TrackRoll::Left; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + } + break; + case WIDX_BANK_STRAIGHT: + RideConstructionInvalidateCurrentTrack(); + if (!_currentlyShowingBrakeOrBoosterSpeed) + { + _currentTrackRollEnd = TrackRoll::None; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + } + else + { + uint8_t* brakesSpeedPtr = &_currentBrakeSpeed2; + uint8_t maxBrakesSpeed = 30; + uint8_t brakesSpeed = *brakesSpeedPtr + 2; + if (brakesSpeed <= maxBrakesSpeed) + { + if (_rideConstructionState == RideConstructionState::Selected) + { + SetBrakeSpeed(brakesSpeed); + } + else + { + *brakesSpeedPtr = brakesSpeed; + WindowRideConstructionUpdateActiveElements(); + } + } + } + break; + case WIDX_BANK_RIGHT: + RideConstructionInvalidateCurrentTrack(); + if (!_currentlyShowingBrakeOrBoosterSpeed) + { + _currentTrackRollEnd = TrackRoll::Right; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + } + else + { + uint8_t* brakesSpeedPtr = &_currentBrakeSpeed2; + uint8_t brakesSpeed = *brakesSpeedPtr - 2; + if (brakesSpeed >= 2) + { + if (_rideConstructionState == RideConstructionState::Selected) + { + SetBrakeSpeed(brakesSpeed); + } + else + { + *brakesSpeedPtr = brakesSpeed; + WindowRideConstructionUpdateActiveElements(); + } + } + } + break; + case WIDX_SPECIAL_TRACK_DROPDOWN: + ShowSpecialTrackDropdown(&widgets[widgetIndex]); + break; + case WIDX_U_TRACK: + RideConstructionInvalidateCurrentTrack(); _currentTrackAlternative &= ~RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_BANK_LEFT: - RideConstructionInvalidateCurrentTrack(); - if (!_currentlyShowingBrakeOrBoosterSpeed) - { - _currentTrackRollEnd = TrackRoll::Left; _currentTrackPrice = kMoney64Undefined; WindowRideConstructionUpdateActiveElements(); - } - break; - case WIDX_BANK_STRAIGHT: - RideConstructionInvalidateCurrentTrack(); - if (!_currentlyShowingBrakeOrBoosterSpeed) - { + break; + case WIDX_O_TRACK: + RideConstructionInvalidateCurrentTrack(); + _currentTrackAlternative |= RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; + if (!GetGameState().Cheats.EnableChainLiftOnAllTrack) + _currentTrackLiftHill &= ~CONSTRUCTION_LIFT_HILL_SELECTED; + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + break; + case WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP: + if (_currentSeatRotationAngle < 15) + { + if (_rideConstructionState == RideConstructionState::Selected) + { + RideSelectedTrackSetSeatRotation(_currentSeatRotationAngle + 1); + } + else + { + _currentSeatRotationAngle++; + WindowRideConstructionUpdateActiveElements(); + } + } + break; + case WIDX_SEAT_ROTATION_ANGLE_SPINNER_DOWN: + if (_currentSeatRotationAngle > 0) + { + if (_rideConstructionState == RideConstructionState::Selected) + { + RideSelectedTrackSetSeatRotation(_currentSeatRotationAngle - 1); + } + else + { + _currentSeatRotationAngle--; + WindowRideConstructionUpdateActiveElements(); + } + } + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + if (widgetIndex != WIDX_SPECIAL_TRACK_DROPDOWN) + return; + if (selectedIndex == -1) + return; + + RideConstructionInvalidateCurrentTrack(); + _currentTrackPrice = kMoney64Undefined; + track_type_t trackPiece = _specialElementDropdownState.Elements[selectedIndex].TrackType; + switch (trackPiece) + { + case TrackElemType::EndStation: + case TrackElemType::SBendLeft: + case TrackElemType::SBendRight: + _currentTrackPitchEnd = TrackPitch::None; + break; + case TrackElemType::LeftVerticalLoop: + case TrackElemType::RightVerticalLoop: _currentTrackRollEnd = TrackRoll::None; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - } - else - { - uint8_t* brakesSpeedPtr = &_currentBrakeSpeed2; - uint8_t maxBrakesSpeed = 30; - uint8_t brakesSpeed = *brakesSpeedPtr + 2; - if (brakesSpeed <= maxBrakesSpeed) - { - if (_rideConstructionState == RideConstructionState::Selected) - { - SetBrakeSpeed(brakesSpeed); - } - else - { - *brakesSpeedPtr = brakesSpeed; - WindowRideConstructionUpdateActiveElements(); - } - } - } - break; - case WIDX_BANK_RIGHT: - RideConstructionInvalidateCurrentTrack(); - if (!_currentlyShowingBrakeOrBoosterSpeed) - { - _currentTrackRollEnd = TrackRoll::Right; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - } - else - { - uint8_t* brakesSpeedPtr = &_currentBrakeSpeed2; - uint8_t brakesSpeed = *brakesSpeedPtr - 2; - if (brakesSpeed >= 2) - { - if (_rideConstructionState == RideConstructionState::Selected) - { - SetBrakeSpeed(brakesSpeed); - } - else - { - *brakesSpeedPtr = brakesSpeed; - WindowRideConstructionUpdateActiveElements(); - } - } - } - break; - case WIDX_SPECIAL_TRACK_DROPDOWN: - ShowSpecialTrackDropdown(&widgets[widgetIndex]); - break; - case WIDX_U_TRACK: - RideConstructionInvalidateCurrentTrack(); - _currentTrackAlternative &= ~RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_O_TRACK: - RideConstructionInvalidateCurrentTrack(); - _currentTrackAlternative |= RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; - if (!gCheatsEnableChainLiftOnAllTrack) _currentTrackLiftHill &= ~CONSTRUCTION_LIFT_HILL_SELECTED; - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - break; - case WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP: - if (_currentSeatRotationAngle < 15) - { - if (_rideConstructionState == RideConstructionState::Selected) - { - RideSelectedTrackSetSeatRotation(_currentSeatRotationAngle + 1); - } - else - { - _currentSeatRotationAngle++; - WindowRideConstructionUpdateActiveElements(); - } - } - break; - case WIDX_SEAT_ROTATION_ANGLE_SPINNER_DOWN: - if (_currentSeatRotationAngle > 0) - { - if (_rideConstructionState == RideConstructionState::Selected) - { - RideSelectedTrackSetSeatRotation(_currentSeatRotationAngle - 1); - } - else - { - _currentSeatRotationAngle--; - WindowRideConstructionUpdateActiveElements(); - } - } - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - if (widgetIndex != WIDX_SPECIAL_TRACK_DROPDOWN) - return; - if (selectedIndex == -1) - return; - - RideConstructionInvalidateCurrentTrack(); - _currentTrackPrice = kMoney64Undefined; - track_type_t trackPiece = _specialElementDropdownState.Elements[selectedIndex].TrackType; - switch (trackPiece) - { - case TrackElemType::EndStation: - case TrackElemType::SBendLeft: - case TrackElemType::SBendRight: - _currentTrackPitchEnd = TrackPitch::None; - break; - case TrackElemType::LeftVerticalLoop: - case TrackElemType::RightVerticalLoop: - _currentTrackRollEnd = TrackRoll::None; - _currentTrackLiftHill &= ~CONSTRUCTION_LIFT_HILL_SELECTED; - break; - case TrackElemType::BlockBrakes: - case TrackElemType::DiagBlockBrakes: - _currentBrakeSpeed2 = kRCT2DefaultBlockBrakeSpeed; - } - _currentTrackCurve = trackPiece | RideConstructionSpecialPieceSelected; - WindowRideConstructionUpdateActiveElements(); - } - - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (widgetIndex) - { - case WIDX_CONSTRUCT: - RideConstructionToolupdateConstruct(screenCoords); - break; - case WIDX_ENTRANCE: - case WIDX_EXIT: - RideConstructionToolupdateEntranceExit(screenCoords); - break; - } - } - - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (widgetIndex) - { - case WIDX_CONSTRUCT: - RideConstructionTooldownConstruct(screenCoords); - break; - case WIDX_ENTRANCE: - case WIDX_EXIT: - ToolDownEntranceExit(screenCoords); - break; - } - } - - void OnPrepareDraw() override - { - auto currentRide = GetRide(_currentRideIndex); - if (currentRide == nullptr) - { - return; + break; + case TrackElemType::BlockBrakes: + case TrackElemType::DiagBlockBrakes: + _currentBrakeSpeed2 = kRCT2DefaultBlockBrakeSpeed; + } + _currentTrackCurve = trackPiece | RideConstructionSpecialPieceSelected; + WindowRideConstructionUpdateActiveElements(); } - StringId stringId = STR_RIDE_CONSTRUCTION_SPECIAL; - if (_currentTrackCurve & RideConstructionSpecialPieceSelected) + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - const auto& rtd = currentRide->GetRideTypeDescriptor(); - const auto& ted = GetTrackElementDescriptor(_currentTrackCurve & ~RideConstructionSpecialPieceSelected); - stringId = ted.Description; - if (stringId == STR_RAPIDS && rtd.Category != RIDE_CATEGORY_WATER) + switch (widgetIndex) { - stringId = STR_LOG_BUMPS; + case WIDX_CONSTRUCT: + RideConstructionToolupdateConstruct(screenCoords); + break; + case WIDX_ENTRANCE: + case WIDX_EXIT: + RideConstructionToolupdateEntranceExit(screenCoords); + break; } } - auto ft = Formatter::Common(); - ft.Add(stringId); - if (_currentlyShowingBrakeOrBoosterSpeed) + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - uint16_t brakeSpeed2 = ((_currentBrakeSpeed2 * 9) >> 2) & 0xFFFF; - if (TrackTypeIsBooster(_selectedTrackType) - || TrackTypeIsBooster(_currentTrackCurve & ~RideConstructionSpecialPieceSelected)) + switch (widgetIndex) { - brakeSpeed2 = GetBoosterSpeed(currentRide->type, brakeSpeed2); + case WIDX_CONSTRUCT: + RideConstructionTooldownConstruct(screenCoords); + break; + case WIDX_ENTRANCE: + case WIDX_EXIT: + ToolDownEntranceExit(screenCoords); + break; } - ft.Add(brakeSpeed2); } - widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER].text = RideConstructionSeatAngleRotationStrings[_currentSeatRotationAngle]; - - // Simulate button - auto& simulateWidget = widgets[WIDX_SIMULATE]; - simulateWidget.type = WindowWidgetType::Empty; - if (currentRide->SupportsStatus(RideStatus::Simulating)) + void OnPrepareDraw() override { - simulateWidget.type = WindowWidgetType::FlatBtn; - if (currentRide->status == RideStatus::Simulating) + auto currentRide = GetRide(_currentRideIndex); + if (currentRide == nullptr) { - pressed_widgets |= (1uLL << WIDX_SIMULATE); + return; + } + + StringId stringId = STR_RIDE_CONSTRUCTION_SPECIAL; + if (_currentTrackCurve & RideConstructionSpecialPieceSelected) + { + const auto& rtd = currentRide->GetRideTypeDescriptor(); + const auto& ted = GetTrackElementDescriptor(_currentTrackCurve & ~RideConstructionSpecialPieceSelected); + stringId = ted.Description; + if (stringId == STR_RAPIDS && rtd.Category != RIDE_CATEGORY_WATER) + { + stringId = STR_LOG_BUMPS; + } + } + auto ft = Formatter::Common(); + ft.Add(stringId); + + if (_currentlyShowingBrakeOrBoosterSpeed) + { + uint16_t brakeSpeed2 = ((_currentBrakeSpeed2 * 9) >> 2) & 0xFFFF; + if (TrackTypeIsBooster(_selectedTrackType) + || TrackTypeIsBooster(_currentTrackCurve & ~RideConstructionSpecialPieceSelected)) + { + brakeSpeed2 = GetBoosterSpeed(currentRide->type, brakeSpeed2); + } + ft.Add(brakeSpeed2); + } + + widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER].text = RideConstructionSeatAngleRotationStrings + [_currentSeatRotationAngle]; + + // Simulate button + auto& simulateWidget = widgets[WIDX_SIMULATE]; + simulateWidget.type = WindowWidgetType::Empty; + if (currentRide->SupportsStatus(RideStatus::Simulating)) + { + simulateWidget.type = WindowWidgetType::FlatBtn; + if (currentRide->status == RideStatus::Simulating) + { + pressed_widgets |= (1uLL << WIDX_SIMULATE); + } + else + { + pressed_widgets &= ~(1uLL << WIDX_SIMULATE); + } + } + + // Set window title arguments + ft = Formatter::Common(); + ft.Increment(4); + currentRide->FormatNameTo(ft); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawPixelInfo clipdpi; + Widget* widget; + int32_t widgetWidth, widgetHeight; + + DrawWidgets(dpi); + + widget = &widgets[WIDX_CONSTRUCT]; + if (widget->type == WindowWidgetType::Empty) + return; + + RideId rideIndex; + int32_t trackType, trackDirection, liftHillAndInvertedState; + if (WindowRideConstructionUpdateState( + &trackType, &trackDirection, &rideIndex, &liftHillAndInvertedState, nullptr, nullptr)) + return; + + // Draw track piece + auto screenCoords = ScreenCoordsXY{ windowPos.x + widget->left + 1, windowPos.y + widget->top + 1 }; + widgetWidth = widget->width() - 1; + widgetHeight = widget->height() - 1; + if (ClipDrawPixelInfo(clipdpi, dpi, screenCoords, widgetWidth, widgetHeight)) + { + DrawTrackPiece( + clipdpi, rideIndex, trackType, trackDirection, liftHillAndInvertedState, widgetWidth, widgetHeight); + } + + // Draw cost + screenCoords = { windowPos.x + widget->midX(), windowPos.y + widget->bottom - 23 }; + if (_rideConstructionState != RideConstructionState::Place) + DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); + + screenCoords.y += 11; + if (_currentTrackPrice != kMoney64Undefined && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + auto ft = Formatter(); + ft.Add(_currentTrackPrice); + DrawTextBasic(dpi, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); + } + } + + void UpdateWidgets() + { + auto currentRide = GetRide(_currentRideIndex); + if (currentRide == nullptr) + { + return; + } + int32_t rideType = RideGetAlternativeType(*currentRide); + + hold_down_widgets = 0; + if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY) || !currentRide->HasStation()) + { + widgets[WIDX_ENTRANCE_EXIT_GROUPBOX].type = WindowWidgetType::Empty; + widgets[WIDX_ENTRANCE].type = WindowWidgetType::Empty; + widgets[WIDX_EXIT].type = WindowWidgetType::Empty; } else { - pressed_widgets &= ~(1uLL << WIDX_SIMULATE); + widgets[WIDX_ENTRANCE_EXIT_GROUPBOX].type = WindowWidgetType::Groupbox; + widgets[WIDX_ENTRANCE].type = WindowWidgetType::Button; + widgets[WIDX_EXIT].type = WindowWidgetType::Button; } - } - // Set window title arguments - ft = Formatter::Common(); - ft.Increment(4); - currentRide->FormatNameTo(ft); - } + if (_specialElementDropdownState.HasActiveElements) + { + widgets[WIDX_SPECIAL_TRACK_DROPDOWN].type = WindowWidgetType::Button; + } + else + { + widgets[WIDX_SPECIAL_TRACK_DROPDOWN].type = WindowWidgetType::Empty; + } - void OnDraw(DrawPixelInfo& dpi) override - { - DrawPixelInfo clipdpi; - Widget* widget; - int32_t widgetWidth, widgetHeight; + if (IsTrackEnabled(TRACK_STRAIGHT)) + { + widgets[WIDX_STRAIGHT].type = WindowWidgetType::FlatBtn; + } + else + { + widgets[WIDX_STRAIGHT].type = WindowWidgetType::Empty; + } - DrawWidgets(dpi); + if (IsTrackEnabled(TRACK_CURVE_LARGE)) + { + widgets[WIDX_LEFT_CURVE_LARGE].type = WindowWidgetType::FlatBtn; + widgets[WIDX_RIGHT_CURVE_LARGE].type = WindowWidgetType::FlatBtn; + } + else + { + widgets[WIDX_LEFT_CURVE_LARGE].type = WindowWidgetType::Empty; + widgets[WIDX_RIGHT_CURVE_LARGE].type = WindowWidgetType::Empty; + } - widget = &widgets[WIDX_CONSTRUCT]; - if (widget->type == WindowWidgetType::Empty) - return; + widgets[WIDX_LEFT_CURVE].type = WindowWidgetType::Empty; + widgets[WIDX_RIGHT_CURVE].type = WindowWidgetType::Empty; + widgets[WIDX_LEFT_CURVE_SMALL].type = WindowWidgetType::Empty; + widgets[WIDX_RIGHT_CURVE_SMALL].type = WindowWidgetType::Empty; + widgets[WIDX_LEFT_CURVE_VERY_SMALL].type = WindowWidgetType::Empty; + widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type = WindowWidgetType::Empty; + if (IsTrackEnabled(TRACK_CURVE_VERTICAL)) + { + widgets[WIDX_LEFT_CURVE_SMALL].type = WindowWidgetType::FlatBtn; + widgets[WIDX_RIGHT_CURVE_SMALL].type = WindowWidgetType::FlatBtn; + } + if (IsTrackEnabled(TRACK_CURVE)) + { + widgets[WIDX_LEFT_CURVE].type = WindowWidgetType::FlatBtn; + widgets[WIDX_RIGHT_CURVE].type = WindowWidgetType::FlatBtn; + } + if (IsTrackEnabled(TRACK_CURVE_SMALL)) + { + widgets[WIDX_LEFT_CURVE_SMALL].type = WindowWidgetType::FlatBtn; + widgets[WIDX_RIGHT_CURVE_SMALL].type = WindowWidgetType::FlatBtn; + } + if (IsTrackEnabled(TRACK_CURVE_VERY_SMALL)) + { + widgets[WIDX_LEFT_CURVE_VERY_SMALL].type = WindowWidgetType::FlatBtn; + widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type = WindowWidgetType::FlatBtn; + } - RideId rideIndex; - int32_t trackType, trackDirection, liftHillAndInvertedState; - if (WindowRideConstructionUpdateState( - &trackType, &trackDirection, &rideIndex, &liftHillAndInvertedState, nullptr, nullptr)) - return; + widgets[WIDX_SLOPE_DOWN_STEEP].type = WindowWidgetType::Empty; + widgets[WIDX_SLOPE_DOWN].type = WindowWidgetType::Empty; + widgets[WIDX_LEVEL].type = WindowWidgetType::Empty; + widgets[WIDX_SLOPE_UP].type = WindowWidgetType::Empty; + widgets[WIDX_SLOPE_UP_STEEP].type = WindowWidgetType::Empty; + widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_DOWN_STEEP); + widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_STEEP_SLOPE_DOWN_TIP; + widgets[WIDX_SLOPE_UP_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_UP_STEEP); + widgets[WIDX_SLOPE_UP_STEEP].tooltip = STR_RIDE_CONSTRUCTION_STEEP_SLOPE_UP_TIP; + if (GetRideTypeDescriptor(rideType).SupportsTrackPiece(TRACK_REVERSE_FREEFALL)) + { + widgets[WIDX_LEVEL].type = WindowWidgetType::FlatBtn; + widgets[WIDX_SLOPE_UP].type = WindowWidgetType::FlatBtn; + } + if (IsTrackEnabled(TRACK_SLOPE) || IsTrackEnabled(TRACK_SLOPE_STEEP_DOWN) || IsTrackEnabled(TRACK_SLOPE_STEEP_UP)) + { + widgets[WIDX_LEVEL].type = WindowWidgetType::FlatBtn; + } + if (IsTrackEnabled(TRACK_SLOPE)) + { + widgets[WIDX_SLOPE_DOWN].type = WindowWidgetType::FlatBtn; + widgets[WIDX_SLOPE_UP].type = WindowWidgetType::FlatBtn; + } + if ((IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF)) + && _currentTrackRollEnd != TrackRoll::None && _currentTrackPitchEnd == TrackPitch::None) + { + if (_currentTrackCurve >= EnumValue(TrackCurve::Left) + && _currentTrackCurve <= EnumValue(TrackCurve::RightSmall)) + { + // Enable helix + widgets[WIDX_SLOPE_DOWN_STEEP].type = WindowWidgetType::FlatBtn; + if (rideType != RIDE_TYPE_SPLASH_BOATS && rideType != RIDE_TYPE_RIVER_RAFTS) + widgets[WIDX_SLOPE_UP_STEEP].type = WindowWidgetType::FlatBtn; + } + } - // Draw track piece - auto screenCoords = ScreenCoordsXY{ windowPos.x + widget->left + 1, windowPos.y + widget->top + 1 }; - widgetWidth = widget->width() - 1; - widgetHeight = widget->height() - 1; - if (ClipDrawPixelInfo(clipdpi, dpi, screenCoords, widgetWidth, widgetHeight)) - { - DrawTrackPiece(clipdpi, rideIndex, trackType, trackDirection, liftHillAndInvertedState, widgetWidth, widgetHeight); - } - - // Draw cost - screenCoords = { windowPos.x + widget->midX(), windowPos.y + widget->bottom - 23 }; - if (_rideConstructionState != RideConstructionState::Place) - DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); - - screenCoords.y += 11; - if (_currentTrackPrice != kMoney64Undefined && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) - { - auto ft = Formatter(); - ft.Add(_currentTrackPrice); - DrawTextBasic(dpi, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); - } - } - - void UpdateWidgets() - { - auto currentRide = GetRide(_currentRideIndex); - if (currentRide == nullptr) - { - return; - } - int32_t rideType = RideGetAlternativeType(*currentRide); - - hold_down_widgets = 0; - if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY) || !currentRide->HasStation()) - { - widgets[WIDX_ENTRANCE_EXIT_GROUPBOX].type = WindowWidgetType::Empty; - widgets[WIDX_ENTRANCE].type = WindowWidgetType::Empty; - widgets[WIDX_EXIT].type = WindowWidgetType::Empty; - } - else - { - widgets[WIDX_ENTRANCE_EXIT_GROUPBOX].type = WindowWidgetType::Groupbox; - widgets[WIDX_ENTRANCE].type = WindowWidgetType::Button; - widgets[WIDX_EXIT].type = WindowWidgetType::Button; - } - - if (_specialElementDropdownState.HasActiveElements) - { - widgets[WIDX_SPECIAL_TRACK_DROPDOWN].type = WindowWidgetType::Button; - } - else - { - widgets[WIDX_SPECIAL_TRACK_DROPDOWN].type = WindowWidgetType::Empty; - } - - if (IsTrackEnabled(TRACK_STRAIGHT)) - { - widgets[WIDX_STRAIGHT].type = WindowWidgetType::FlatBtn; - } - else - { - widgets[WIDX_STRAIGHT].type = WindowWidgetType::Empty; - } - - if (IsTrackEnabled(TRACK_CURVE_LARGE)) - { - widgets[WIDX_LEFT_CURVE_LARGE].type = WindowWidgetType::FlatBtn; - widgets[WIDX_RIGHT_CURVE_LARGE].type = WindowWidgetType::FlatBtn; - } - else - { - widgets[WIDX_LEFT_CURVE_LARGE].type = WindowWidgetType::Empty; - widgets[WIDX_RIGHT_CURVE_LARGE].type = WindowWidgetType::Empty; - } - - widgets[WIDX_LEFT_CURVE].type = WindowWidgetType::Empty; - widgets[WIDX_RIGHT_CURVE].type = WindowWidgetType::Empty; - widgets[WIDX_LEFT_CURVE_SMALL].type = WindowWidgetType::Empty; - widgets[WIDX_RIGHT_CURVE_SMALL].type = WindowWidgetType::Empty; - widgets[WIDX_LEFT_CURVE_VERY_SMALL].type = WindowWidgetType::Empty; - widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type = WindowWidgetType::Empty; - if (IsTrackEnabled(TRACK_CURVE_VERTICAL)) - { - widgets[WIDX_LEFT_CURVE_SMALL].type = WindowWidgetType::FlatBtn; - widgets[WIDX_RIGHT_CURVE_SMALL].type = WindowWidgetType::FlatBtn; - } - if (IsTrackEnabled(TRACK_CURVE)) - { - widgets[WIDX_LEFT_CURVE].type = WindowWidgetType::FlatBtn; - widgets[WIDX_RIGHT_CURVE].type = WindowWidgetType::FlatBtn; - } - if (IsTrackEnabled(TRACK_CURVE_SMALL)) - { - widgets[WIDX_LEFT_CURVE_SMALL].type = WindowWidgetType::FlatBtn; - widgets[WIDX_RIGHT_CURVE_SMALL].type = WindowWidgetType::FlatBtn; - } - if (IsTrackEnabled(TRACK_CURVE_VERY_SMALL)) - { - widgets[WIDX_LEFT_CURVE_VERY_SMALL].type = WindowWidgetType::FlatBtn; - widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type = WindowWidgetType::FlatBtn; - } - - widgets[WIDX_SLOPE_DOWN_STEEP].type = WindowWidgetType::Empty; - widgets[WIDX_SLOPE_DOWN].type = WindowWidgetType::Empty; - widgets[WIDX_LEVEL].type = WindowWidgetType::Empty; - widgets[WIDX_SLOPE_UP].type = WindowWidgetType::Empty; - widgets[WIDX_SLOPE_UP_STEEP].type = WindowWidgetType::Empty; - widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_DOWN_STEEP); - widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_STEEP_SLOPE_DOWN_TIP; - widgets[WIDX_SLOPE_UP_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_UP_STEEP); - widgets[WIDX_SLOPE_UP_STEEP].tooltip = STR_RIDE_CONSTRUCTION_STEEP_SLOPE_UP_TIP; - if (GetRideTypeDescriptor(rideType).SupportsTrackPiece(TRACK_REVERSE_FREEFALL)) - { - widgets[WIDX_LEVEL].type = WindowWidgetType::FlatBtn; - widgets[WIDX_SLOPE_UP].type = WindowWidgetType::FlatBtn; - } - if (IsTrackEnabled(TRACK_SLOPE) || IsTrackEnabled(TRACK_SLOPE_STEEP_DOWN) || IsTrackEnabled(TRACK_SLOPE_STEEP_UP)) - { - widgets[WIDX_LEVEL].type = WindowWidgetType::FlatBtn; - } - if (IsTrackEnabled(TRACK_SLOPE)) - { - widgets[WIDX_SLOPE_DOWN].type = WindowWidgetType::FlatBtn; - widgets[WIDX_SLOPE_UP].type = WindowWidgetType::FlatBtn; - } - if ((IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF)) - && _currentTrackRollEnd != TrackRoll::None && _currentTrackPitchEnd == TrackPitch::None) - { - if (_currentTrackCurve >= EnumValue(TrackCurve::Left) && _currentTrackCurve <= EnumValue(TrackCurve::RightSmall)) + if (IsTrackEnabled(TRACK_SLOPE_STEEP_DOWN)) { - // Enable helix widgets[WIDX_SLOPE_DOWN_STEEP].type = WindowWidgetType::FlatBtn; - if (rideType != RIDE_TYPE_SPLASH_BOATS && rideType != RIDE_TYPE_RIVER_RAFTS) - widgets[WIDX_SLOPE_UP_STEEP].type = WindowWidgetType::FlatBtn; } - } - - if (IsTrackEnabled(TRACK_SLOPE_STEEP_DOWN)) - { - widgets[WIDX_SLOPE_DOWN_STEEP].type = WindowWidgetType::FlatBtn; - } - if (IsTrackEnabled(TRACK_SLOPE_STEEP_UP)) - { - widgets[WIDX_SLOPE_UP_STEEP].type = WindowWidgetType::FlatBtn; - } - - if (currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_UP_INCLINE_REQUIRES_LIFT) - && (_currentTrackPitchEnd == TrackPitch::Up25 || _currentTrackPitchEnd == TrackPitch::Up60) - && !gCheatsEnableAllDrawableTrackPieces) - { - _currentTrackLiftHill |= CONSTRUCTION_LIFT_HILL_SELECTED; - } - - if ((IsTrackEnabled(TRACK_LIFT_HILL) && (_currentTrackCurve & RideConstructionSpecialPieceSelected) == 0) - || (gCheatsEnableChainLiftOnAllTrack && currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK))) - { - widgets[WIDX_CHAIN_LIFT].type = WindowWidgetType::FlatBtn; - } - else - { - widgets[WIDX_CHAIN_LIFT].type = WindowWidgetType::Empty; - } - - int32_t x = 45; - for (int32_t i = WIDX_SLOPE_DOWN_STEEP; i <= WIDX_SLOPE_UP_STEEP; i++) - { - widgets[i].left = x; - widgets[i].right = x + 23; - x += 24; - } - - widgets[WIDX_SLOPE_UP_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_UP_STEEP); - widgets[WIDX_SLOPE_UP_STEEP].tooltip = STR_RIDE_CONSTRUCTION_STEEP_SLOPE_UP_TIP; - widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_DOWN_STEEP); - widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_STEEP_SLOPE_DOWN_TIP; - if (IsTrackEnabled(TRACK_SLOPE_VERTICAL)) - { - if (_previousTrackPitchEnd == TrackPitch::Up60 || _previousTrackPitchEnd == TrackPitch::Up90) + if (IsTrackEnabled(TRACK_SLOPE_STEEP_UP)) { - int32_t originalSlopeUpSteepLeft = widgets[WIDX_SLOPE_UP_STEEP].left; - int32_t originalSlopeUpSteepRight = widgets[WIDX_SLOPE_UP_STEEP].right; - for (int32_t i = WIDX_SLOPE_UP_STEEP; i > WIDX_SLOPE_DOWN_STEEP; i--) + widgets[WIDX_SLOPE_UP_STEEP].type = WindowWidgetType::FlatBtn; + } + + if (currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_UP_INCLINE_REQUIRES_LIFT) + && (_currentTrackPitchEnd == TrackPitch::Up25 || _currentTrackPitchEnd == TrackPitch::Up60) + && !GetGameState().Cheats.EnableAllDrawableTrackPieces) + { + _currentTrackLiftHill |= CONSTRUCTION_LIFT_HILL_SELECTED; + } + + if ((IsTrackEnabled(TRACK_LIFT_HILL) && (_currentTrackCurve & RideConstructionSpecialPieceSelected) == 0) + || (GetGameState().Cheats.EnableChainLiftOnAllTrack + && currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK))) + { + widgets[WIDX_CHAIN_LIFT].type = WindowWidgetType::FlatBtn; + } + else + { + widgets[WIDX_CHAIN_LIFT].type = WindowWidgetType::Empty; + } + + int32_t x = 45; + for (int32_t i = WIDX_SLOPE_DOWN_STEEP; i <= WIDX_SLOPE_UP_STEEP; i++) + { + widgets[i].left = x; + widgets[i].right = x + 23; + x += 24; + } + + widgets[WIDX_SLOPE_UP_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_UP_STEEP); + widgets[WIDX_SLOPE_UP_STEEP].tooltip = STR_RIDE_CONSTRUCTION_STEEP_SLOPE_UP_TIP; + widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_DOWN_STEEP); + widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_STEEP_SLOPE_DOWN_TIP; + if (IsTrackEnabled(TRACK_SLOPE_VERTICAL)) + { + if (_previousTrackPitchEnd == TrackPitch::Up60 || _previousTrackPitchEnd == TrackPitch::Up90) { - widgets[i].left = widgets[i - 1].left; - widgets[i].right = widgets[i - 1].right; - } - widgets[WIDX_SLOPE_DOWN_STEEP].left = originalSlopeUpSteepLeft; - widgets[WIDX_SLOPE_DOWN_STEEP].right = originalSlopeUpSteepRight; - widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_VERTICAL_RISE); - widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_VERTICAL_RISE_TIP; - } - else if (_previousTrackPitchEnd == TrackPitch::Down60 || _previousTrackPitchEnd == TrackPitch::Down90) - { - int32_t originalSlopeDownSteepLeft = widgets[WIDX_SLOPE_DOWN_STEEP].left; - int32_t originalSlopeDownSteepRight = widgets[WIDX_SLOPE_DOWN_STEEP].right; - for (int32_t i = WIDX_SLOPE_DOWN_STEEP; i < WIDX_SLOPE_UP_STEEP; i++) - { - widgets[i].left = widgets[i + 1].left; - widgets[i].right = widgets[i + 1].right; - } - widgets[WIDX_SLOPE_UP_STEEP].left = originalSlopeDownSteepLeft; - widgets[WIDX_SLOPE_UP_STEEP].right = originalSlopeDownSteepRight; - widgets[WIDX_SLOPE_UP_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_VERTICAL_DROP); - widgets[WIDX_SLOPE_UP_STEEP].tooltip = STR_RIDE_CONSTRUCTION_VERTICAL_DROP_TIP; - } - } - - if ((IsTrackEnabled(TRACK_HELIX_DOWN_UNBANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_UNBANKED_QUARTER)) - && _currentTrackPitchEnd == TrackPitch::None && _currentTrackRollEnd == TrackRoll::None - && (_currentTrackCurve == EnumValue(TrackCurve::Left) || _currentTrackCurve == EnumValue(TrackCurve::Right))) - { - widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_HELIX_DOWN); - widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_HELIX_DOWN_TIP; - widgets[WIDX_SLOPE_UP_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_HELIX_UP); - widgets[WIDX_SLOPE_UP_STEEP].tooltip = STR_RIDE_CONSTRUCTION_HELIX_UP_TIP; - - int32_t tmp = widgets[WIDX_SLOPE_DOWN_STEEP].left; - widgets[WIDX_SLOPE_DOWN_STEEP].left = widgets[WIDX_SLOPE_DOWN].left; - widgets[WIDX_SLOPE_DOWN].left = tmp; - - tmp = widgets[WIDX_SLOPE_DOWN_STEEP].right; - widgets[WIDX_SLOPE_DOWN_STEEP].right = widgets[WIDX_SLOPE_DOWN].right; - widgets[WIDX_SLOPE_DOWN].right = tmp; - - tmp = widgets[WIDX_SLOPE_UP_STEEP].left; - widgets[WIDX_SLOPE_UP_STEEP].left = widgets[WIDX_SLOPE_UP].left; - widgets[WIDX_SLOPE_UP].left = tmp; - - tmp = widgets[WIDX_SLOPE_UP_STEEP].right; - widgets[WIDX_SLOPE_UP_STEEP].right = widgets[WIDX_SLOPE_UP].right; - widgets[WIDX_SLOPE_UP].right = tmp; - } - - if ((IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_QUARTER) - || IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF)) - && (_currentTrackCurve >= EnumValue(TrackCurve::Left) && _currentTrackCurve <= EnumValue(TrackCurve::RightSmall)) - && _currentTrackPitchEnd == TrackPitch::None && _currentTrackRollEnd != TrackRoll::None) - { - widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_HELIX_DOWN); - widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_HELIX_DOWN_TIP; - widgets[WIDX_SLOPE_UP_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_HELIX_UP); - widgets[WIDX_SLOPE_UP_STEEP].tooltip = STR_RIDE_CONSTRUCTION_HELIX_UP_TIP; - - int32_t tmp = widgets[WIDX_SLOPE_DOWN_STEEP].left; - widgets[WIDX_SLOPE_DOWN_STEEP].left = widgets[WIDX_SLOPE_DOWN].left; - widgets[WIDX_SLOPE_DOWN].left = tmp; - - tmp = widgets[WIDX_SLOPE_DOWN_STEEP].right; - widgets[WIDX_SLOPE_DOWN_STEEP].right = widgets[WIDX_SLOPE_DOWN].right; - widgets[WIDX_SLOPE_DOWN].right = tmp; - - tmp = widgets[WIDX_SLOPE_UP_STEEP].left; - widgets[WIDX_SLOPE_UP_STEEP].left = widgets[WIDX_SLOPE_UP].left; - widgets[WIDX_SLOPE_UP].left = tmp; - - tmp = widgets[WIDX_SLOPE_UP_STEEP].right; - widgets[WIDX_SLOPE_UP_STEEP].right = widgets[WIDX_SLOPE_UP].right; - widgets[WIDX_SLOPE_UP].right = tmp; - } - - widgets[WIDX_BANKING_GROUPBOX].image = ImageId(STR_RIDE_CONSTRUCTION_ROLL_BANKING); - widgets[WIDX_BANK_LEFT].image = ImageId(SPR_RIDE_CONSTRUCTION_LEFT_BANK); - widgets[WIDX_BANK_LEFT].tooltip = STR_RIDE_CONSTRUCTION_ROLL_FOR_LEFT_CURVE_TIP; - widgets[WIDX_BANK_LEFT].left = 69; - widgets[WIDX_BANK_LEFT].right = 92; - widgets[WIDX_BANK_LEFT].top = 132; - widgets[WIDX_BANK_LEFT].bottom = 155; - widgets[WIDX_BANK_STRAIGHT].image = ImageId(SPR_RIDE_CONSTRUCTION_NO_BANK); - widgets[WIDX_BANK_STRAIGHT].tooltip = STR_RIDE_CONSTRUCTION_NO_ROLL_TIP; - widgets[WIDX_BANK_STRAIGHT].left = 93; - widgets[WIDX_BANK_STRAIGHT].right = 116; - widgets[WIDX_BANK_STRAIGHT].top = 132; - widgets[WIDX_BANK_STRAIGHT].bottom = 155; - widgets[WIDX_BANK_RIGHT].image = ImageId(SPR_RIDE_CONSTRUCTION_RIGHT_BANK); - widgets[WIDX_BANK_RIGHT].tooltip = STR_RIDE_CONSTRUCTION_ROLL_FOR_RIGHT_CURVE_TIP; - widgets[WIDX_BANK_RIGHT].left = 117; - widgets[WIDX_BANK_RIGHT].right = 140; - widgets[WIDX_BANK_RIGHT].top = 132; - widgets[WIDX_BANK_RIGHT].bottom = 155; - widgets[WIDX_BANK_LEFT].type = WindowWidgetType::Empty; - widgets[WIDX_BANK_STRAIGHT].type = WindowWidgetType::Empty; - widgets[WIDX_BANK_RIGHT].type = WindowWidgetType::Empty; - widgets[WIDX_U_TRACK].type = WindowWidgetType::Empty; - widgets[WIDX_O_TRACK].type = WindowWidgetType::Empty; - - bool trackHasSpeedSetting = TrackTypeHasSpeedSetting(_selectedTrackType) - || TrackTypeHasSpeedSetting(_currentTrackCurve & ~RideConstructionSpecialPieceSelected); - bool boosterTrackSelected = TrackTypeIsBooster(_selectedTrackType) - || TrackTypeIsBooster(_currentTrackCurve & ~RideConstructionSpecialPieceSelected); - - // Only necessary because TD6 writes speed and seat rotation to the same bits. Remove for new track design format. - bool trackHasSpeedAndSeatRotation = _selectedTrackType == TrackElemType::BlockBrakes - || _currentTrackCurve == (RideConstructionSpecialPieceSelected | TrackElemType::BlockBrakes) - || _selectedTrackType > TrackElemType::HighestAlias - || _currentTrackCurve > (RideConstructionSpecialPieceSelected | TrackElemType::HighestAlias); - - const auto& rtd = GetRideTypeDescriptor(rideType); - bool rideHasSeatRotation = rtd.HasFlag(RIDE_TYPE_FLAG_HAS_SEAT_ROTATION); - - if (!trackHasSpeedSetting) - { - if (IsTrackEnabled(TRACK_FLAT_ROLL_BANKING)) - { - widgets[WIDX_BANK_LEFT].type = WindowWidgetType::FlatBtn; - widgets[WIDX_BANK_STRAIGHT].type = WindowWidgetType::FlatBtn; - widgets[WIDX_BANK_RIGHT].type = WindowWidgetType::FlatBtn; - } - if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_TRACK_ELEMENTS_HAVE_TWO_VARIETIES)) - { - if (rideType == RIDE_TYPE_WATER_COASTER) - { - widgets[WIDX_U_TRACK].image = ImageId(SPR_RIDE_CONSTRUCTION_RC_TRACK); - widgets[WIDX_O_TRACK].image = ImageId(SPR_RIDE_CONSTRUCTION_WATER_CHANNEL); - widgets[WIDX_U_TRACK].tooltip = STR_RIDE_CONSTRUCTION_STANDARD_RC_TRACK_TIP; - widgets[WIDX_O_TRACK].tooltip = STR_RIDE_CONSTRUCTION_WATER_CHANNEL_TIP; - if ((_currentTrackCurve < EnumValue(TrackCurve::LeftSmall) - || _currentTrackCurve == (RideConstructionSpecialPieceSelected | TrackElemType::SBendLeft) - || _currentTrackCurve == (RideConstructionSpecialPieceSelected | TrackElemType::SBendRight)) - && _currentTrackPitchEnd == TrackPitch::None && _currentTrackRollEnd == TrackRoll::None) + int32_t originalSlopeUpSteepLeft = widgets[WIDX_SLOPE_UP_STEEP].left; + int32_t originalSlopeUpSteepRight = widgets[WIDX_SLOPE_UP_STEEP].right; + for (int32_t i = WIDX_SLOPE_UP_STEEP; i > WIDX_SLOPE_DOWN_STEEP; i--) { + widgets[i].left = widgets[i - 1].left; + widgets[i].right = widgets[i - 1].right; + } + widgets[WIDX_SLOPE_DOWN_STEEP].left = originalSlopeUpSteepLeft; + widgets[WIDX_SLOPE_DOWN_STEEP].right = originalSlopeUpSteepRight; + widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_VERTICAL_RISE); + widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_VERTICAL_RISE_TIP; + } + else if (_previousTrackPitchEnd == TrackPitch::Down60 || _previousTrackPitchEnd == TrackPitch::Down90) + { + int32_t originalSlopeDownSteepLeft = widgets[WIDX_SLOPE_DOWN_STEEP].left; + int32_t originalSlopeDownSteepRight = widgets[WIDX_SLOPE_DOWN_STEEP].right; + for (int32_t i = WIDX_SLOPE_DOWN_STEEP; i < WIDX_SLOPE_UP_STEEP; i++) + { + widgets[i].left = widgets[i + 1].left; + widgets[i].right = widgets[i + 1].right; + } + widgets[WIDX_SLOPE_UP_STEEP].left = originalSlopeDownSteepLeft; + widgets[WIDX_SLOPE_UP_STEEP].right = originalSlopeDownSteepRight; + widgets[WIDX_SLOPE_UP_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_VERTICAL_DROP); + widgets[WIDX_SLOPE_UP_STEEP].tooltip = STR_RIDE_CONSTRUCTION_VERTICAL_DROP_TIP; + } + } + + if ((IsTrackEnabled(TRACK_HELIX_DOWN_UNBANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_UNBANKED_QUARTER)) + && _currentTrackPitchEnd == TrackPitch::None && _currentTrackRollEnd == TrackRoll::None + && (_currentTrackCurve == EnumValue(TrackCurve::Left) || _currentTrackCurve == EnumValue(TrackCurve::Right))) + { + widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_HELIX_DOWN); + widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_HELIX_DOWN_TIP; + widgets[WIDX_SLOPE_UP_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_HELIX_UP); + widgets[WIDX_SLOPE_UP_STEEP].tooltip = STR_RIDE_CONSTRUCTION_HELIX_UP_TIP; + + int32_t tmp = widgets[WIDX_SLOPE_DOWN_STEEP].left; + widgets[WIDX_SLOPE_DOWN_STEEP].left = widgets[WIDX_SLOPE_DOWN].left; + widgets[WIDX_SLOPE_DOWN].left = tmp; + + tmp = widgets[WIDX_SLOPE_DOWN_STEEP].right; + widgets[WIDX_SLOPE_DOWN_STEEP].right = widgets[WIDX_SLOPE_DOWN].right; + widgets[WIDX_SLOPE_DOWN].right = tmp; + + tmp = widgets[WIDX_SLOPE_UP_STEEP].left; + widgets[WIDX_SLOPE_UP_STEEP].left = widgets[WIDX_SLOPE_UP].left; + widgets[WIDX_SLOPE_UP].left = tmp; + + tmp = widgets[WIDX_SLOPE_UP_STEEP].right; + widgets[WIDX_SLOPE_UP_STEEP].right = widgets[WIDX_SLOPE_UP].right; + widgets[WIDX_SLOPE_UP].right = tmp; + } + + if ((IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_QUARTER) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_QUARTER) + || IsTrackEnabled(TRACK_HELIX_DOWN_BANKED_HALF) || IsTrackEnabled(TRACK_HELIX_UP_BANKED_HALF)) + && (_currentTrackCurve >= EnumValue(TrackCurve::Left) + && _currentTrackCurve <= EnumValue(TrackCurve::RightSmall)) + && _currentTrackPitchEnd == TrackPitch::None && _currentTrackRollEnd != TrackRoll::None) + { + widgets[WIDX_SLOPE_DOWN_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_HELIX_DOWN); + widgets[WIDX_SLOPE_DOWN_STEEP].tooltip = STR_RIDE_CONSTRUCTION_HELIX_DOWN_TIP; + widgets[WIDX_SLOPE_UP_STEEP].image = ImageId(SPR_RIDE_CONSTRUCTION_HELIX_UP); + widgets[WIDX_SLOPE_UP_STEEP].tooltip = STR_RIDE_CONSTRUCTION_HELIX_UP_TIP; + + int32_t tmp = widgets[WIDX_SLOPE_DOWN_STEEP].left; + widgets[WIDX_SLOPE_DOWN_STEEP].left = widgets[WIDX_SLOPE_DOWN].left; + widgets[WIDX_SLOPE_DOWN].left = tmp; + + tmp = widgets[WIDX_SLOPE_DOWN_STEEP].right; + widgets[WIDX_SLOPE_DOWN_STEEP].right = widgets[WIDX_SLOPE_DOWN].right; + widgets[WIDX_SLOPE_DOWN].right = tmp; + + tmp = widgets[WIDX_SLOPE_UP_STEEP].left; + widgets[WIDX_SLOPE_UP_STEEP].left = widgets[WIDX_SLOPE_UP].left; + widgets[WIDX_SLOPE_UP].left = tmp; + + tmp = widgets[WIDX_SLOPE_UP_STEEP].right; + widgets[WIDX_SLOPE_UP_STEEP].right = widgets[WIDX_SLOPE_UP].right; + widgets[WIDX_SLOPE_UP].right = tmp; + } + + widgets[WIDX_BANKING_GROUPBOX].image = ImageId(STR_RIDE_CONSTRUCTION_ROLL_BANKING); + widgets[WIDX_BANK_LEFT].image = ImageId(SPR_RIDE_CONSTRUCTION_LEFT_BANK); + widgets[WIDX_BANK_LEFT].tooltip = STR_RIDE_CONSTRUCTION_ROLL_FOR_LEFT_CURVE_TIP; + widgets[WIDX_BANK_LEFT].left = 69; + widgets[WIDX_BANK_LEFT].right = 92; + widgets[WIDX_BANK_LEFT].top = 132; + widgets[WIDX_BANK_LEFT].bottom = 155; + widgets[WIDX_BANK_STRAIGHT].image = ImageId(SPR_RIDE_CONSTRUCTION_NO_BANK); + widgets[WIDX_BANK_STRAIGHT].tooltip = STR_RIDE_CONSTRUCTION_NO_ROLL_TIP; + widgets[WIDX_BANK_STRAIGHT].left = 93; + widgets[WIDX_BANK_STRAIGHT].right = 116; + widgets[WIDX_BANK_STRAIGHT].top = 132; + widgets[WIDX_BANK_STRAIGHT].bottom = 155; + widgets[WIDX_BANK_RIGHT].image = ImageId(SPR_RIDE_CONSTRUCTION_RIGHT_BANK); + widgets[WIDX_BANK_RIGHT].tooltip = STR_RIDE_CONSTRUCTION_ROLL_FOR_RIGHT_CURVE_TIP; + widgets[WIDX_BANK_RIGHT].left = 117; + widgets[WIDX_BANK_RIGHT].right = 140; + widgets[WIDX_BANK_RIGHT].top = 132; + widgets[WIDX_BANK_RIGHT].bottom = 155; + widgets[WIDX_BANK_LEFT].type = WindowWidgetType::Empty; + widgets[WIDX_BANK_STRAIGHT].type = WindowWidgetType::Empty; + widgets[WIDX_BANK_RIGHT].type = WindowWidgetType::Empty; + widgets[WIDX_U_TRACK].type = WindowWidgetType::Empty; + widgets[WIDX_O_TRACK].type = WindowWidgetType::Empty; + + bool trackHasSpeedSetting = TrackTypeHasSpeedSetting(_selectedTrackType) + || TrackTypeHasSpeedSetting(_currentTrackCurve & ~RideConstructionSpecialPieceSelected); + bool boosterTrackSelected = TrackTypeIsBooster(_selectedTrackType) + || TrackTypeIsBooster(_currentTrackCurve & ~RideConstructionSpecialPieceSelected); + + // Only necessary because TD6 writes speed and seat rotation to the same bits. Remove for new track design format. + bool trackHasSpeedAndSeatRotation = _selectedTrackType == TrackElemType::BlockBrakes + || _currentTrackCurve == (RideConstructionSpecialPieceSelected | TrackElemType::BlockBrakes) + || _selectedTrackType > TrackElemType::HighestAlias + || _currentTrackCurve > (RideConstructionSpecialPieceSelected | TrackElemType::HighestAlias); + + const auto& rtd = GetRideTypeDescriptor(rideType); + bool rideHasSeatRotation = rtd.HasFlag(RIDE_TYPE_FLAG_HAS_SEAT_ROTATION); + + if (!trackHasSpeedSetting) + { + if (IsTrackEnabled(TRACK_FLAT_ROLL_BANKING)) + { + widgets[WIDX_BANK_LEFT].type = WindowWidgetType::FlatBtn; + widgets[WIDX_BANK_STRAIGHT].type = WindowWidgetType::FlatBtn; + widgets[WIDX_BANK_RIGHT].type = WindowWidgetType::FlatBtn; + } + if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_TRACK_ELEMENTS_HAVE_TWO_VARIETIES)) + { + if (rideType == RIDE_TYPE_WATER_COASTER) + { + widgets[WIDX_U_TRACK].image = ImageId(SPR_RIDE_CONSTRUCTION_RC_TRACK); + widgets[WIDX_O_TRACK].image = ImageId(SPR_RIDE_CONSTRUCTION_WATER_CHANNEL); + widgets[WIDX_U_TRACK].tooltip = STR_RIDE_CONSTRUCTION_STANDARD_RC_TRACK_TIP; + widgets[WIDX_O_TRACK].tooltip = STR_RIDE_CONSTRUCTION_WATER_CHANNEL_TIP; + if ((_currentTrackCurve < EnumValue(TrackCurve::LeftSmall) + || _currentTrackCurve == (RideConstructionSpecialPieceSelected | TrackElemType::SBendLeft) + || _currentTrackCurve == (RideConstructionSpecialPieceSelected | TrackElemType::SBendRight)) + && _currentTrackPitchEnd == TrackPitch::None && _currentTrackRollEnd == TrackRoll::None) + { + widgets[WIDX_BANKING_GROUPBOX].text = STR_RIDE_CONSTRUCTION_TRACK_STYLE; + widgets[WIDX_U_TRACK].type = WindowWidgetType::FlatBtn; + widgets[WIDX_O_TRACK].type = WindowWidgetType::FlatBtn; + } + } + else + { + widgets[WIDX_U_TRACK].image = ImageId(SPR_RIDE_CONSTRUCTION_U_SHAPED_TRACK); + widgets[WIDX_O_TRACK].image = ImageId(SPR_RIDE_CONSTRUCTION_O_SHAPED_TRACK); + widgets[WIDX_U_TRACK].tooltip = STR_RIDE_CONSTRUCTION_U_SHAPED_OPEN_TRACK_TIP; + widgets[WIDX_O_TRACK].tooltip = STR_RIDE_CONSTRUCTION_O_SHAPED_ENCLOSED_TRACK_TIP; widgets[WIDX_BANKING_GROUPBOX].text = STR_RIDE_CONSTRUCTION_TRACK_STYLE; widgets[WIDX_U_TRACK].type = WindowWidgetType::FlatBtn; widgets[WIDX_O_TRACK].type = WindowWidgetType::FlatBtn; } } - else - { - widgets[WIDX_U_TRACK].image = ImageId(SPR_RIDE_CONSTRUCTION_U_SHAPED_TRACK); - widgets[WIDX_O_TRACK].image = ImageId(SPR_RIDE_CONSTRUCTION_O_SHAPED_TRACK); - widgets[WIDX_U_TRACK].tooltip = STR_RIDE_CONSTRUCTION_U_SHAPED_OPEN_TRACK_TIP; - widgets[WIDX_O_TRACK].tooltip = STR_RIDE_CONSTRUCTION_O_SHAPED_ENCLOSED_TRACK_TIP; - widgets[WIDX_BANKING_GROUPBOX].text = STR_RIDE_CONSTRUCTION_TRACK_STYLE; - widgets[WIDX_U_TRACK].type = WindowWidgetType::FlatBtn; - widgets[WIDX_O_TRACK].type = WindowWidgetType::FlatBtn; - } - } - } - else - { - if (!boosterTrackSelected) - { - widgets[WIDX_SPEED_GROUPBOX].text = STR_RIDE_CONSTRUCTION_BRAKE_SPEED; - widgets[WIDX_SPEED_SETTING_SPINNER].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP; - widgets[WIDX_SPEED_SETTING_SPINNER_UP].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP; - widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP; } else { - widgets[WIDX_SPEED_GROUPBOX].text = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED; - widgets[WIDX_SPEED_SETTING_SPINNER].tooltip = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED_LIMIT_TIP; - widgets[WIDX_SPEED_SETTING_SPINNER_UP].tooltip = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED_LIMIT_TIP; - widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].tooltip = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED_LIMIT_TIP; - } - - _currentlyShowingBrakeOrBoosterSpeed = true; - widgets[WIDX_SPEED_SETTING_SPINNER].text = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_VELOCITY; - - widgets[WIDX_SPEED_SETTING_SPINNER].type = WindowWidgetType::Spinner; - widgets[WIDX_SPEED_SETTING_SPINNER_UP].type = WindowWidgetType::Button; - widgets[WIDX_SPEED_SETTING_SPINNER_UP].text = STR_NUMERIC_UP; - widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].type = WindowWidgetType::Button; - widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].text = STR_NUMERIC_DOWN; - - ResizeSpinner(WIDX_SPEED_SETTING_SPINNER, { 12, 138 }, { 85, SPINNER_HEIGHT }); - - hold_down_widgets |= (1uLL << WIDX_SPEED_SETTING_SPINNER_UP) | (1uLL << WIDX_SPEED_SETTING_SPINNER_DOWN); - } - - static constexpr int16_t bankingGroupboxRightNoSeatRotation = GW; - static constexpr int16_t bankingGroupboxRightWithSeatRotation = 114; - - widgets[WIDX_BANKING_GROUPBOX].right = bankingGroupboxRightNoSeatRotation; - widgets[WIDX_SEAT_ROTATION_GROUPBOX].type = WindowWidgetType::Empty; - widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER].type = WindowWidgetType::Empty; - widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP].type = WindowWidgetType::Empty; - widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER_DOWN].type = WindowWidgetType::Empty; - - // Simplify this condition to "rideHasSeatRotation" for new track design format - if ((rideHasSeatRotation && !trackHasSpeedSetting) - || (rideHasSeatRotation && trackHasSpeedSetting && trackHasSpeedAndSeatRotation)) - { - widgets[WIDX_SEAT_ROTATION_GROUPBOX].type = WindowWidgetType::Groupbox; - widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER].type = WindowWidgetType::Spinner; - widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP].type = WindowWidgetType::Button; - widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER_DOWN].type = WindowWidgetType::Button; - widgets[WIDX_BANKING_GROUPBOX].right = bankingGroupboxRightWithSeatRotation; - - // squishes the track speed spinner slightly to make room for the seat rotation widgets - if (trackHasSpeedSetting) - { - widgets[WIDX_SPEED_SETTING_SPINNER].left -= 4; - widgets[WIDX_SPEED_SETTING_SPINNER].right -= 8; - widgets[WIDX_SPEED_SETTING_SPINNER_UP].right -= 8; - widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].right -= 8; - widgets[WIDX_SPEED_SETTING_SPINNER_UP].left -= 8; - widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].left -= 8; - } - // moves banking buttons to the left to make room for the seat rotation widgets - else if (IsTrackEnabled(TRACK_FLAT_ROLL_BANKING)) - { - for (int32_t i = WIDX_BANK_LEFT; i <= WIDX_BANK_RIGHT; i++) + if (!boosterTrackSelected) { - widgets[i].left -= 36; - widgets[i].right -= 36; - } - } - } - - uint64_t pressedWidgets = pressed_widgets - & ((1uLL << WIDX_BACKGROUND) | (1uLL << WIDX_TITLE) | (1uLL << WIDX_CLOSE) | (1uLL << WIDX_DIRECTION_GROUPBOX) - | (1uLL << WIDX_SLOPE_GROUPBOX) | (1uLL << WIDX_BANKING_GROUPBOX) | (1uLL << WIDX_CONSTRUCT) - | (1uLL << WIDX_DEMOLISH) | (1uLL << WIDX_PREVIOUS_SECTION) | (1uLL << WIDX_NEXT_SECTION) - | (1uLL << WIDX_ENTRANCE_EXIT_GROUPBOX) | (1uLL << WIDX_ENTRANCE) | (1uLL << WIDX_EXIT)); - - widgets[WIDX_CONSTRUCT].type = WindowWidgetType::Empty; - widgets[WIDX_DEMOLISH].type = WindowWidgetType::FlatBtn; - widgets[WIDX_ROTATE].type = WindowWidgetType::Empty; - if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_CANNOT_HAVE_GAPS)) - { - widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty; - widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty; - } - else - { - widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::FlatBtn; - widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::FlatBtn; - } - - switch (_rideConstructionState) - { - case RideConstructionState::Front: - widgets[WIDX_CONSTRUCT].type = WindowWidgetType::ImgBtn; - widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty; - break; - case RideConstructionState::Back: - widgets[WIDX_CONSTRUCT].type = WindowWidgetType::ImgBtn; - widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty; - break; - case RideConstructionState::Place: - widgets[WIDX_CONSTRUCT].type = WindowWidgetType::ImgBtn; - widgets[WIDX_DEMOLISH].type = WindowWidgetType::Empty; - widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty; - widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty; - widgets[WIDX_ROTATE].type = WindowWidgetType::FlatBtn; - break; - case RideConstructionState::EntranceExit: - widgets[WIDX_DEMOLISH].type = WindowWidgetType::Empty; - widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty; - widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty; - break; - default: - pressed_widgets = pressedWidgets; - Invalidate(); - return; - } - - WidgetIndex widgetIndex; - switch (_currentTrackCurve) - { - case EnumValue(TrackCurve::None): - widgetIndex = WIDX_STRAIGHT; - break; - case EnumValue(TrackCurve::Left): - widgetIndex = WIDX_LEFT_CURVE; - break; - case EnumValue(TrackCurve::Right): - widgetIndex = WIDX_RIGHT_CURVE; - break; - case EnumValue(TrackCurve::LeftSmall): - widgetIndex = WIDX_LEFT_CURVE_SMALL; - break; - case EnumValue(TrackCurve::RightSmall): - widgetIndex = WIDX_RIGHT_CURVE_SMALL; - break; - case EnumValue(TrackCurve::LeftVerySmall): - widgetIndex = WIDX_LEFT_CURVE_VERY_SMALL; - break; - case EnumValue(TrackCurve::RightVerySmall): - widgetIndex = WIDX_RIGHT_CURVE_VERY_SMALL; - break; - case EnumValue(TrackCurve::LeftLarge): - widgetIndex = WIDX_LEFT_CURVE_LARGE; - break; - case EnumValue(TrackCurve::RightLarge): - widgetIndex = WIDX_RIGHT_CURVE_LARGE; - break; - default: - widgetIndex = WIDX_SPECIAL_TRACK_DROPDOWN; - break; - } - pressedWidgets |= (1uLL << widgetIndex); - - switch (_currentTrackPitchEnd) - { - case TrackPitch::Down60: - case TrackPitch::Up90: - widgetIndex = WIDX_SLOPE_DOWN_STEEP; - break; - case TrackPitch::Down25: - widgetIndex = WIDX_SLOPE_DOWN; - break; - case TrackPitch::Up25: - widgetIndex = WIDX_SLOPE_UP; - break; - case TrackPitch::Up60: - case TrackPitch::Down90: - widgetIndex = WIDX_SLOPE_UP_STEEP; - break; - default: - widgetIndex = WIDX_LEVEL; - break; - } - pressedWidgets |= (1uLL << widgetIndex); - - if (!_currentlyShowingBrakeOrBoosterSpeed) - { - if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_TRACK_ELEMENTS_HAVE_TWO_VARIETIES)) - { - if (_currentTrackAlternative & RIDE_TYPE_ALTERNATIVE_TRACK_PIECES) - { - pressed_widgets |= (1uLL << WIDX_O_TRACK); + widgets[WIDX_SPEED_GROUPBOX].text = STR_RIDE_CONSTRUCTION_BRAKE_SPEED; + widgets[WIDX_SPEED_SETTING_SPINNER].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP; + widgets[WIDX_SPEED_SETTING_SPINNER_UP].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP; + widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP; } else { - pressed_widgets |= (1uLL << WIDX_U_TRACK); + widgets[WIDX_SPEED_GROUPBOX].text = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED; + widgets[WIDX_SPEED_SETTING_SPINNER].tooltip = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED_LIMIT_TIP; + widgets[WIDX_SPEED_SETTING_SPINNER_UP].tooltip = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED_LIMIT_TIP; + widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].tooltip = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED_LIMIT_TIP; + } + + _currentlyShowingBrakeOrBoosterSpeed = true; + widgets[WIDX_SPEED_SETTING_SPINNER].text = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_VELOCITY; + + widgets[WIDX_SPEED_SETTING_SPINNER].type = WindowWidgetType::Spinner; + widgets[WIDX_SPEED_SETTING_SPINNER_UP].type = WindowWidgetType::Button; + widgets[WIDX_SPEED_SETTING_SPINNER_UP].text = STR_NUMERIC_UP; + widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].type = WindowWidgetType::Button; + widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].text = STR_NUMERIC_DOWN; + + ResizeSpinner(WIDX_SPEED_SETTING_SPINNER, { 12, 138 }, { 85, SPINNER_HEIGHT }); + + hold_down_widgets |= (1uLL << WIDX_SPEED_SETTING_SPINNER_UP) | (1uLL << WIDX_SPEED_SETTING_SPINNER_DOWN); + } + + static constexpr int16_t bankingGroupboxRightNoSeatRotation = GW; + static constexpr int16_t bankingGroupboxRightWithSeatRotation = 114; + + widgets[WIDX_BANKING_GROUPBOX].right = bankingGroupboxRightNoSeatRotation; + widgets[WIDX_SEAT_ROTATION_GROUPBOX].type = WindowWidgetType::Empty; + widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER].type = WindowWidgetType::Empty; + widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP].type = WindowWidgetType::Empty; + widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER_DOWN].type = WindowWidgetType::Empty; + + // Simplify this condition to "rideHasSeatRotation" for new track design format + if ((rideHasSeatRotation && !trackHasSpeedSetting) + || (rideHasSeatRotation && trackHasSpeedSetting && trackHasSpeedAndSeatRotation)) + { + widgets[WIDX_SEAT_ROTATION_GROUPBOX].type = WindowWidgetType::Groupbox; + widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER].type = WindowWidgetType::Spinner; + widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP].type = WindowWidgetType::Button; + widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER_DOWN].type = WindowWidgetType::Button; + widgets[WIDX_BANKING_GROUPBOX].right = bankingGroupboxRightWithSeatRotation; + + // squishes the track speed spinner slightly to make room for the seat rotation widgets + if (trackHasSpeedSetting) + { + widgets[WIDX_SPEED_SETTING_SPINNER].left -= 4; + widgets[WIDX_SPEED_SETTING_SPINNER].right -= 8; + widgets[WIDX_SPEED_SETTING_SPINNER_UP].right -= 8; + widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].right -= 8; + widgets[WIDX_SPEED_SETTING_SPINNER_UP].left -= 8; + widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].left -= 8; + } + // moves banking buttons to the left to make room for the seat rotation widgets + else if (IsTrackEnabled(TRACK_FLAT_ROLL_BANKING)) + { + for (int32_t i = WIDX_BANK_LEFT; i <= WIDX_BANK_RIGHT; i++) + { + widgets[i].left -= 36; + widgets[i].right -= 36; + } } } - switch (_currentTrackRollEnd) + + uint64_t pressedWidgets = pressed_widgets + & ((1uLL << WIDX_BACKGROUND) | (1uLL << WIDX_TITLE) | (1uLL << WIDX_CLOSE) | (1uLL << WIDX_DIRECTION_GROUPBOX) + | (1uLL << WIDX_SLOPE_GROUPBOX) | (1uLL << WIDX_BANKING_GROUPBOX) | (1uLL << WIDX_CONSTRUCT) + | (1uLL << WIDX_DEMOLISH) | (1uLL << WIDX_PREVIOUS_SECTION) | (1uLL << WIDX_NEXT_SECTION) + | (1uLL << WIDX_ENTRANCE_EXIT_GROUPBOX) | (1uLL << WIDX_ENTRANCE) | (1uLL << WIDX_EXIT)); + + widgets[WIDX_CONSTRUCT].type = WindowWidgetType::Empty; + widgets[WIDX_DEMOLISH].type = WindowWidgetType::FlatBtn; + widgets[WIDX_ROTATE].type = WindowWidgetType::Empty; + if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_CANNOT_HAVE_GAPS)) { - case TrackRoll::Left: - widgetIndex = WIDX_BANK_LEFT; + widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty; + widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty; + } + else + { + widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::FlatBtn; + widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::FlatBtn; + } + + switch (_rideConstructionState) + { + case RideConstructionState::Front: + widgets[WIDX_CONSTRUCT].type = WindowWidgetType::ImgBtn; + widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty; break; - case TrackRoll::None: - widgetIndex = WIDX_BANK_STRAIGHT; + case RideConstructionState::Back: + widgets[WIDX_CONSTRUCT].type = WindowWidgetType::ImgBtn; + widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty; + break; + case RideConstructionState::Place: + widgets[WIDX_CONSTRUCT].type = WindowWidgetType::ImgBtn; + widgets[WIDX_DEMOLISH].type = WindowWidgetType::Empty; + widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty; + widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty; + widgets[WIDX_ROTATE].type = WindowWidgetType::FlatBtn; + break; + case RideConstructionState::EntranceExit: + widgets[WIDX_DEMOLISH].type = WindowWidgetType::Empty; + widgets[WIDX_NEXT_SECTION].type = WindowWidgetType::Empty; + widgets[WIDX_PREVIOUS_SECTION].type = WindowWidgetType::Empty; break; default: - widgetIndex = WIDX_BANK_RIGHT; + pressed_widgets = pressedWidgets; + Invalidate(); + return; + } + + WidgetIndex widgetIndex; + switch (_currentTrackCurve) + { + case EnumValue(TrackCurve::None): + widgetIndex = WIDX_STRAIGHT; + break; + case EnumValue(TrackCurve::Left): + widgetIndex = WIDX_LEFT_CURVE; + break; + case EnumValue(TrackCurve::Right): + widgetIndex = WIDX_RIGHT_CURVE; + break; + case EnumValue(TrackCurve::LeftSmall): + widgetIndex = WIDX_LEFT_CURVE_SMALL; + break; + case EnumValue(TrackCurve::RightSmall): + widgetIndex = WIDX_RIGHT_CURVE_SMALL; + break; + case EnumValue(TrackCurve::LeftVerySmall): + widgetIndex = WIDX_LEFT_CURVE_VERY_SMALL; + break; + case EnumValue(TrackCurve::RightVerySmall): + widgetIndex = WIDX_RIGHT_CURVE_VERY_SMALL; + break; + case EnumValue(TrackCurve::LeftLarge): + widgetIndex = WIDX_LEFT_CURVE_LARGE; + break; + case EnumValue(TrackCurve::RightLarge): + widgetIndex = WIDX_RIGHT_CURVE_LARGE; + break; + default: + widgetIndex = WIDX_SPECIAL_TRACK_DROPDOWN; break; } pressedWidgets |= (1uLL << widgetIndex); - } - if (_currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED) - pressedWidgets |= (1uLL << WIDX_CHAIN_LIFT); + switch (_currentTrackPitchEnd) + { + case TrackPitch::Down60: + case TrackPitch::Up90: + widgetIndex = WIDX_SLOPE_DOWN_STEEP; + break; + case TrackPitch::Down25: + widgetIndex = WIDX_SLOPE_DOWN; + break; + case TrackPitch::Up25: + widgetIndex = WIDX_SLOPE_UP; + break; + case TrackPitch::Up60: + case TrackPitch::Down90: + widgetIndex = WIDX_SLOPE_UP_STEEP; + break; + default: + widgetIndex = WIDX_LEVEL; + break; + } + pressedWidgets |= (1uLL << widgetIndex); - pressed_widgets = pressedWidgets; - Invalidate(); - } - - void UpdatePossibleRideConfigurations() - { - auto currentRide = GetRide(_currentRideIndex); - if (currentRide == nullptr) - { - return; - } - _specialElementDropdownState = BuildSpecialElementsList( - *currentRide, _currentTrackPieceDirection, _previousTrackPitchEnd, _previousTrackRollEnd, _rideConstructionState); - _currentlyShowingBrakeOrBoosterSpeed = false; - } - - void UpdateMapSelection() - { - int32_t trackType, trackDirection; - CoordsXYZ trackPos{}; - - MapInvalidateMapSelectionTiles(); - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags |= MAP_SELECT_FLAG_GREEN; - - switch (_rideConstructionState) - { - case RideConstructionState::State0: - trackDirection = _currentTrackPieceDirection; - trackType = 0; - trackPos = _currentTrackBegin; - break; - case RideConstructionState::Selected: - trackDirection = _currentTrackPieceDirection; - trackType = _currentTrackPieceType; - trackPos = _currentTrackBegin; - break; - case RideConstructionState::EntranceExit: - gMapSelectionTiles.clear(); - return; - default: - if (WindowRideConstructionUpdateState(&trackType, &trackDirection, nullptr, nullptr, &trackPos, nullptr)) + if (!_currentlyShowingBrakeOrBoosterSpeed) + { + if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_TRACK_ELEMENTS_HAVE_TWO_VARIETIES)) { + if (_currentTrackAlternative & RIDE_TYPE_ALTERNATIVE_TRACK_PIECES) + { + pressed_widgets |= (1uLL << WIDX_O_TRACK); + } + else + { + pressed_widgets |= (1uLL << WIDX_U_TRACK); + } + } + switch (_currentTrackRollEnd) + { + case TrackRoll::Left: + widgetIndex = WIDX_BANK_LEFT; + break; + case TrackRoll::None: + widgetIndex = WIDX_BANK_STRAIGHT; + break; + default: + widgetIndex = WIDX_BANK_RIGHT; + break; + } + pressedWidgets |= (1uLL << widgetIndex); + } + + if (_currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED) + pressedWidgets |= (1uLL << WIDX_CHAIN_LIFT); + + pressed_widgets = pressedWidgets; + Invalidate(); + } + + void UpdatePossibleRideConfigurations() + { + auto currentRide = GetRide(_currentRideIndex); + if (currentRide == nullptr) + { + return; + } + _specialElementDropdownState = BuildSpecialElementsList( + *currentRide, _currentTrackPieceDirection, _previousTrackPitchEnd, _previousTrackRollEnd, + _rideConstructionState); + _currentlyShowingBrakeOrBoosterSpeed = false; + } + + void UpdateMapSelection() + { + int32_t trackType, trackDirection; + CoordsXYZ trackPos{}; + + MapInvalidateMapSelectionTiles(); + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags |= MAP_SELECT_FLAG_GREEN; + + switch (_rideConstructionState) + { + case RideConstructionState::State0: trackDirection = _currentTrackPieceDirection; trackType = 0; trackPos = _currentTrackBegin; - } - break; + break; + case RideConstructionState::Selected: + trackDirection = _currentTrackPieceDirection; + trackType = _currentTrackPieceType; + trackPos = _currentTrackBegin; + break; + case RideConstructionState::EntranceExit: + gMapSelectionTiles.clear(); + return; + default: + if (WindowRideConstructionUpdateState(&trackType, &trackDirection, nullptr, nullptr, &trackPos, nullptr)) + { + trackDirection = _currentTrackPieceDirection; + trackType = 0; + trackPos = _currentTrackBegin; + } + break; + } + + if (GetRide(_currentRideIndex)) + { + SelectMapTiles(trackType, trackDirection, trackPos); + MapInvalidateMapSelectionTiles(); + } } - if (GetRide(_currentRideIndex)) + void SelectMapTiles(int32_t trackType, int32_t trackDirection, const CoordsXY& tileCoords) { - SelectMapTiles(trackType, trackDirection, trackPos); - MapInvalidateMapSelectionTiles(); - } - } + // If the scenery tool is active, we do not display our tiles as it + // will conflict with larger scenery objects selecting tiles + if (SceneryToolIsActive()) + { + return; + } - void SelectMapTiles(int32_t trackType, int32_t trackDirection, const CoordsXY& tileCoords) - { - // If the scenery tool is active, we do not display our tiles as it - // will conflict with larger scenery objects selecting tiles - if (SceneryToolIsActive()) - { - return; + const PreviewTrack* trackBlock; + + const auto& ted = GetTrackElementDescriptor(trackType); + trackBlock = ted.Block; + trackDirection &= 3; + gMapSelectionTiles.clear(); + while (trackBlock->index != 255) + { + CoordsXY offsets = { trackBlock->x, trackBlock->y }; + CoordsXY currentTileCoords = tileCoords + offsets.Rotate(trackDirection); + + gMapSelectionTiles.push_back(currentTileCoords); + trackBlock++; + } } - const PreviewTrack* trackBlock; - - const auto& ted = GetTrackElementDescriptor(trackType); - trackBlock = ted.Block; - trackDirection &= 3; - gMapSelectionTiles.clear(); - while (trackBlock->index != 255) + private: + void Construct() { - CoordsXY offsets = { trackBlock->x, trackBlock->y }; - CoordsXY currentTileCoords = tileCoords + offsets.Rotate(trackDirection); + RideId rideIndex; + int32_t trackType, trackDirection, liftHillAndAlternativeState, properties; + CoordsXYZ trackPos{}; - gMapSelectionTiles.push_back(currentTileCoords); - trackBlock++; - } - } - -private: - void Construct() - { - RideId rideIndex; - int32_t trackType, trackDirection, liftHillAndAlternativeState, properties; - CoordsXYZ trackPos{}; - - _currentTrackPrice = kMoney64Undefined; - _trackPlaceCost = kMoney64Undefined; - _trackPlaceErrorMessage = STR_NONE; - RideConstructionInvalidateCurrentTrack(); - if (WindowRideConstructionUpdateState( - &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &trackPos, &properties)) - { - WindowRideConstructionUpdateActiveElements(); - return; - } - - auto currentRide = GetRide(_currentRideIndex); - if (currentRide == nullptr) - { - return; - } - - auto trackPlaceAction = TrackPlaceAction( - rideIndex, trackType, currentRide->type, { trackPos, static_cast(trackDirection) }, (properties)&0xFF, - (properties >> 8) & 0x0F, (properties >> 12) & 0x0F, liftHillAndAlternativeState, false); - if (_rideConstructionState == RideConstructionState::Back) - { - trackPlaceAction.SetCallback(RideConstructPlacedBackwardGameActionCallback); - } - else if (_rideConstructionState == RideConstructionState::Front) - { - trackPlaceAction.SetCallback(RideConstructPlacedForwardGameActionCallback); - } - auto res = GameActions::Execute(&trackPlaceAction); - // Used by some functions - if (res.Error != GameActions::Status::Ok) - { + _currentTrackPrice = kMoney64Undefined; _trackPlaceCost = kMoney64Undefined; - _trackPlaceErrorMessage = std::get(res.ErrorMessage); - } - else - { - _trackPlaceCost = res.Cost; _trackPlaceErrorMessage = STR_NONE; - } - - if (res.Error != GameActions::Status::Ok) - { - return; - } - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, trackPos); - - if (NetworkGetMode() != NETWORK_MODE_NONE) - { - _currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK_PLACE_ACTION_QUEUED; - } - - const auto resultData = res.GetData(); - if (resultData.GroundFlags & ELEMENT_IS_UNDERGROUND) - { - ViewportSetVisibility(ViewportVisibility::UndergroundViewOn); - } - - const bool helixSelected = (_currentTrackCurve & RideConstructionSpecialPieceSelected) - && TrackTypeIsHelix(_currentTrackCurve & ~RideConstructionSpecialPieceSelected); - if (helixSelected || (_currentTrackPitchEnd != TrackPitch::None)) - { - ViewportSetVisibility(ViewportVisibility::TrackHeights); - } - } - - void MouseUpDemolish() - { - int32_t direction; - TileElement* tileElement; - CoordsXYE inputElement, outputElement; - TrackBeginEnd trackBeginEnd; - - _currentTrackPrice = kMoney64Undefined; - RideConstructionInvalidateCurrentTrack(); - - // Select the track element that is to be deleted - _rideConstructionState2 = RideConstructionState::Selected; - if (_rideConstructionState == RideConstructionState::Front) - { - if (!RideSelectBackwardsFromFront()) + RideConstructionInvalidateCurrentTrack(); + if (WindowRideConstructionUpdateState( + &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &trackPos, &properties)) { WindowRideConstructionUpdateActiveElements(); return; } - _rideConstructionState2 = RideConstructionState::Front; - } - else if (_rideConstructionState == RideConstructionState::Back) - { - if (!RideSelectForwardsFromBack()) + + auto currentRide = GetRide(_currentRideIndex); + if (currentRide == nullptr) { - WindowRideConstructionUpdateActiveElements(); return; } - _rideConstructionState2 = RideConstructionState::Back; + + auto trackPlaceAction = TrackPlaceAction( + rideIndex, trackType, currentRide->type, { trackPos, static_cast(trackDirection) }, properties & 0xFF, + (properties >> 8) & 0x0F, (properties >> 12) & 0x0F, liftHillAndAlternativeState, false); + if (_rideConstructionState == RideConstructionState::Back) + { + trackPlaceAction.SetCallback(RideConstructPlacedBackwardGameActionCallback); + } + else if (_rideConstructionState == RideConstructionState::Front) + { + trackPlaceAction.SetCallback(RideConstructPlacedForwardGameActionCallback); + } + auto res = GameActions::Execute(&trackPlaceAction); + // Used by some functions + if (res.Error != GameActions::Status::Ok) + { + _trackPlaceCost = kMoney64Undefined; + _trackPlaceErrorMessage = std::get(res.ErrorMessage); + } + else + { + _trackPlaceCost = res.Cost; + _trackPlaceErrorMessage = STR_NONE; + } + + if (res.Error != GameActions::Status::Ok) + { + return; + } + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, trackPos); + + if (NetworkGetMode() != NETWORK_MODE_NONE) + { + _currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK_PLACE_ACTION_QUEUED; + } + + const auto resultData = res.GetData(); + if (resultData.GroundFlags & ELEMENT_IS_UNDERGROUND) + { + ViewportSetVisibility(ViewportVisibility::UndergroundViewOn); + } + + const bool helixSelected = (_currentTrackCurve & RideConstructionSpecialPieceSelected) + && TrackTypeIsHelix(_currentTrackCurve & ~RideConstructionSpecialPieceSelected); + if (helixSelected || (_currentTrackPitchEnd != TrackPitch::None)) + { + ViewportSetVisibility(ViewportVisibility::TrackHeights); + } } - // Invalidate the selected track element or make sure it's at origin??? - direction = _currentTrackPieceDirection; - // The direction is reset by ride_initialise_construction_window(), but we need it to remove flat rides properly. - Direction currentDirection = _currentTrackPieceDirection; - track_type_t type = _currentTrackPieceType; - auto newCoords = GetTrackElementOriginAndApplyChanges( - { _currentTrackBegin, static_cast(direction & 3) }, type, 0, &tileElement, 0); - if (!newCoords.has_value()) + void MouseUpDemolish() { - WindowRideConstructionUpdateActiveElements(); - return; - } + int32_t direction; + TileElement* tileElement; + CoordsXYE inputElement, outputElement; + TrackBeginEnd trackBeginEnd; - // Get the previous track element to go to after the selected track element is deleted - inputElement.x = newCoords->x; - inputElement.y = newCoords->y; - inputElement.element = tileElement; - if (TrackBlockGetPrevious({ *newCoords, tileElement }, &trackBeginEnd)) - { - *newCoords = { trackBeginEnd.begin_x, trackBeginEnd.begin_y, trackBeginEnd.begin_z }; - direction = trackBeginEnd.begin_direction; - type = trackBeginEnd.begin_element->AsTrack()->GetTrackType(); - _gotoStartPlacementMode = false; - } - else if (TrackBlockGetNext(&inputElement, &outputElement, &newCoords->z, &direction)) - { - newCoords->x = outputElement.x; - newCoords->y = outputElement.y; - direction = outputElement.element->GetDirection(); - type = outputElement.element->AsTrack()->GetTrackType(); - _gotoStartPlacementMode = false; - } - else - { + _currentTrackPrice = kMoney64Undefined; + RideConstructionInvalidateCurrentTrack(); + + // Select the track element that is to be deleted + _rideConstructionState2 = RideConstructionState::Selected; + if (_rideConstructionState == RideConstructionState::Front) + { + if (!RideSelectBackwardsFromFront()) + { + WindowRideConstructionUpdateActiveElements(); + return; + } + _rideConstructionState2 = RideConstructionState::Front; + } + else if (_rideConstructionState == RideConstructionState::Back) + { + if (!RideSelectForwardsFromBack()) + { + WindowRideConstructionUpdateActiveElements(); + return; + } + _rideConstructionState2 = RideConstructionState::Back; + } + + // Invalidate the selected track element or make sure it's at origin??? direction = _currentTrackPieceDirection; - type = _currentTrackPieceType; - newCoords = GetTrackElementOriginAndApplyChanges( + // The direction is reset by ride_initialise_construction_window(), but we need it to remove flat rides properly. + Direction currentDirection = _currentTrackPieceDirection; + track_type_t type = _currentTrackPieceType; + auto newCoords = GetTrackElementOriginAndApplyChanges( { _currentTrackBegin, static_cast(direction & 3) }, type, 0, &tileElement, 0); - if (!newCoords.has_value()) { WindowRideConstructionUpdateActiveElements(); return; } - const auto& ted = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); - const PreviewTrack* trackBlock = ted.Block; - newCoords->z = (tileElement->GetBaseZ()) - trackBlock->z; - _gotoStartPlacementMode = true; - - // When flat rides are deleted, the window should be reset so the currentRide can be placed again. - auto currentRide = GetRide(_currentRideIndex); - const auto& rtd = currentRide->GetRideTypeDescriptor(); - if (rtd.HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) && !rtd.HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY)) + // Get the previous track element to go to after the selected track element is deleted + inputElement.x = newCoords->x; + inputElement.y = newCoords->y; + inputElement.element = tileElement; + if (TrackBlockGetPrevious({ *newCoords, tileElement }, &trackBeginEnd)) { - RideInitialiseConstructionWindow(*currentRide); + *newCoords = { trackBeginEnd.begin_x, trackBeginEnd.begin_y, trackBeginEnd.begin_z }; + direction = trackBeginEnd.begin_direction; + type = trackBeginEnd.begin_element->AsTrack()->GetTrackType(); + _gotoStartPlacementMode = false; } - } - - auto trackRemoveAction = TrackRemoveAction( - _currentTrackPieceType, 0, { _currentTrackBegin.x, _currentTrackBegin.y, _currentTrackBegin.z, currentDirection }); - - trackRemoveAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) + else if (TrackBlockGetNext(&inputElement, &outputElement, &newCoords->z, &direction)) { - WindowRideConstructionUpdateActiveElements(); + newCoords->x = outputElement.x; + newCoords->y = outputElement.y; + direction = outputElement.element->GetDirection(); + type = outputElement.element->AsTrack()->GetTrackType(); + _gotoStartPlacementMode = false; } else { + direction = _currentTrackPieceDirection; + type = _currentTrackPieceType; + newCoords = GetTrackElementOriginAndApplyChanges( + { _currentTrackBegin, static_cast(direction & 3) }, type, 0, &tileElement, 0); + + if (!newCoords.has_value()) + { + WindowRideConstructionUpdateActiveElements(); + return; + } + + const auto& ted = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); + const PreviewTrack* trackBlock = ted.Block; + newCoords->z = (tileElement->GetBaseZ()) - trackBlock->z; + _gotoStartPlacementMode = true; + + // When flat rides are deleted, the window should be reset so the currentRide can be placed again. auto currentRide = GetRide(_currentRideIndex); - if (currentRide != nullptr) + const auto& rtd = currentRide->GetRideTypeDescriptor(); + if (rtd.HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) && !rtd.HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY)) { - WindowRideConstructionMouseUpDemolishNextPiece({ *newCoords, static_cast(direction) }, type); + RideInitialiseConstructionWindow(*currentRide); } } - }); - GameActions::Execute(&trackRemoveAction); - } + auto trackRemoveAction = TrackRemoveAction( + _currentTrackPieceType, 0, + { _currentTrackBegin.x, _currentTrackBegin.y, _currentTrackBegin.z, currentDirection }); - void Rotate() - { - _autoRotatingShop = false; - _currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3; - RideConstructionInvalidateCurrentTrack(); - _currentTrackPrice = kMoney64Undefined; - WindowRideConstructionUpdateActiveElements(); - } - - void EntranceClick() - { - if (ToolSet(*this, WIDX_ENTRANCE, Tool::Crosshair)) - { - auto currentRide = GetRide(_currentRideIndex); - if (currentRide != nullptr && !RideTryGetOriginElement(*currentRide, nullptr)) - { - RideInitialiseConstructionWindow(*currentRide); - } - } - else - { - gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_ENTRANCE; - gRideEntranceExitPlaceRideIndex = _currentRideIndex; - gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); - InputSetFlag(INPUT_FLAG_6, true); - RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState != RideConstructionState::EntranceExit) - { - gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; - _rideConstructionState = RideConstructionState::EntranceExit; - } - WindowRideConstructionUpdateActiveElements(); - } - } - - void ExitClick() - { - if (ToolSet(*this, WIDX_EXIT, Tool::Crosshair)) - { - auto currentRide = GetRide(_currentRideIndex); - if (!RideTryGetOriginElement(*currentRide, nullptr)) - { - RideInitialiseConstructionWindow(*currentRide); - } - } - else - { - gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_EXIT; - gRideEntranceExitPlaceRideIndex = _currentRideIndex; - gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); - InputSetFlag(INPUT_FLAG_6, true); - RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState != RideConstructionState::EntranceExit) - { - gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; - _rideConstructionState = RideConstructionState::EntranceExit; - } - WindowRideConstructionUpdateActiveElements(); - } - } - - void UpdateLiftHillSelected(TrackPitch slope) - { - _currentTrackPitchEnd = slope; - _currentTrackPrice = kMoney64Undefined; - if (_rideConstructionState == RideConstructionState::Front && !gCheatsEnableChainLiftOnAllTrack) - { - switch (slope) - { - case TrackPitch::None: - case TrackPitch::Up25: - case TrackPitch::Up60: - break; - default: - _currentTrackLiftHill &= ~CONSTRUCTION_LIFT_HILL_SELECTED; - break; - } - } - WindowRideConstructionUpdateActiveElements(); - } - - void SetBrakeSpeed(int32_t brakesSpeed) - { - TileElement* tileElement; - - if (GetTrackElementOriginAndApplyChanges( - { _currentTrackBegin, static_cast(_currentTrackPieceDirection & 3) }, _currentTrackPieceType, 0, - &tileElement, 0) - != std::nullopt) - { - auto trackSetBrakeSpeed = TrackSetBrakeSpeedAction( - _currentTrackBegin, tileElement->AsTrack()->GetTrackType(), brakesSpeed); - trackSetBrakeSpeed.SetCallback( - [](const GameAction* ga, const GameActions::Result* result) { WindowRideConstructionUpdateActiveElements(); }); - GameActions::Execute(&trackSetBrakeSpeed); - return; - } - WindowRideConstructionUpdateActiveElements(); - } - - void ShowSpecialTrackDropdown(Widget* widget) - { - int32_t defaultIndex = -1; - for (size_t i = 0; i < _specialElementDropdownState.Elements.size(); i++) - { - track_type_t trackPiece = _specialElementDropdownState.Elements[i].TrackType; - - const auto& ted = GetTrackElementDescriptor(trackPiece); - StringId trackPieceStringId = ted.Description; - if (trackPieceStringId == STR_RAPIDS) - { - auto currentRide = GetRide(_currentRideIndex); - if (currentRide != nullptr) + trackRemoveAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) { - const auto& rtd = currentRide->GetRideTypeDescriptor(); - if (rtd.Category != RIDE_CATEGORY_WATER) - trackPieceStringId = STR_LOG_BUMPS; - } - } - gDropdownItems[i].Format = trackPieceStringId; - if ((trackPiece | RideConstructionSpecialPieceSelected) == _currentTrackCurve) - { - defaultIndex = static_cast(i); - } - } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 0, - _specialElementDropdownState.Elements.size(), widget->width()); - - for (size_t i = 0; i < _specialElementDropdownState.Elements.size(); i++) - { - Dropdown::SetDisabled(static_cast(i), _specialElementDropdownState.Elements[i].Disabled); - } - gDropdownDefaultIndex = defaultIndex; - } - - void RideSelectedTrackSetSeatRotation(int32_t seatRotation) - { - GetTrackElementOriginAndApplyChanges( - { _currentTrackBegin, static_cast(_currentTrackPieceDirection & 3) }, _currentTrackPieceType, - seatRotation, nullptr, TRACK_ELEMENT_SET_SEAT_ROTATION); - WindowRideConstructionUpdateActiveElements(); - } - - void ToolDownEntranceExit(const ScreenCoordsXY& screenCoords) - { - RideConstructionInvalidateCurrentTrack(); - MapInvalidateSelectionRect(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - - CoordsXYZD entranceOrExitCoords = RideGetEntranceOrExitPositionFromScreenPosition(screenCoords); - if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) - return; - - auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction( - entranceOrExitCoords, DirectionReverse(gRideEntranceExitPlaceDirection), gRideEntranceExitPlaceRideIndex, - gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT); - - rideEntranceExitPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) - return; - - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); - - auto currentRide = GetRide(gRideEntranceExitPlaceRideIndex); - if (currentRide != nullptr && RideAreAllPossibleEntrancesAndExitsBuilt(*currentRide).Successful) - { - ToolCancel(); - if (!currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) - { - WindowCloseByClass(WindowClass::RideConstruction); - } - } - else - { - gRideEntranceExitPlaceType = gRideEntranceExitPlaceType ^ 1; - WindowInvalidateByClass(WindowClass::RideConstruction); - gCurrentToolWidget.widget_index = (gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_ENTRANCE) - ? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE - : WC_RIDE_CONSTRUCTION__WIDX_EXIT; - } - }); - auto res = GameActions::Execute(&rideEntranceExitPlaceAction); - } - - void DrawTrackPiece( - DrawPixelInfo& dpi, RideId rideIndex, int32_t trackType, int32_t trackDirection, int32_t liftHillAndInvertedState, - int32_t widgetWidth, int32_t widgetHeight) - { - auto currentRide = GetRide(rideIndex); - if (currentRide == nullptr) - { - return; - } - - const auto& ted = GetTrackElementDescriptor(trackType); - const auto* trackBlock = ted.Block; - while ((trackBlock + 1)->index != 0xFF) - trackBlock++; - - CoordsXYZ mapCoords{ trackBlock->x, trackBlock->y, trackBlock->z }; - if (trackBlock->flags & RCT_PREVIEW_TRACK_FLAG_1) - { - mapCoords.x = 0; - mapCoords.y = 0; - } - - auto rotatedMapCoords = mapCoords.Rotate(trackDirection); - // this is actually case 0, but the other cases all jump to it - mapCoords.x = 4112 + (rotatedMapCoords.x / 2); - mapCoords.y = 4112 + (rotatedMapCoords.y / 2); - mapCoords.z = 1024 + mapCoords.z; - - auto previewZOffset = ted.Definition.PreviewZOffset; - mapCoords.z -= previewZOffset; - - const ScreenCoordsXY rotatedScreenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), mapCoords); - - dpi.x += rotatedScreenCoords.x - widgetWidth / 2; - dpi.y += rotatedScreenCoords.y - widgetHeight / 2 - 16; - - DrawTrackPieceHelper(dpi, rideIndex, trackType, trackDirection, liftHillAndInvertedState, { 4096, 4096 }, 1024); - } - - void DrawTrackPieceHelper( - DrawPixelInfo& dpi, RideId rideIndex, int32_t trackType, int32_t trackDirection, int32_t liftHillAndInvertedState, - const CoordsXY& originCoords, int32_t originZ) - { - TileElement tempSideTrackTileElement{ 0x80, 0x8F, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - TileElement tempTrackTileElement{}; - TileElement* backupTileElementArrays[5]{}; - PaintSession* session = PaintSessionAlloc(dpi, 0); - trackDirection &= 3; - - auto currentRide = GetRide(rideIndex); - if (currentRide == nullptr) - { - return; - } - - auto& gameState = OpenRCT2::GetGameState(); - auto preserveMapSize = gameState.MapSize; - - gameState.MapSize = { MAXIMUM_MAP_SIZE_TECHNICAL, MAXIMUM_MAP_SIZE_TECHNICAL }; - - // Setup non changing parts of the temporary track tile element - tempTrackTileElement.SetType(TileElementType::Track); - tempTrackTileElement.SetDirection(trackDirection); - tempTrackTileElement.AsTrack()->SetHasChain((liftHillAndInvertedState & CONSTRUCTION_LIFT_HILL_SELECTED) != 0); - tempTrackTileElement.SetLastForTile(true); - tempTrackTileElement.AsTrack()->SetTrackType(trackType); - tempTrackTileElement.AsTrack()->SetRideType(currentRide->type); - tempTrackTileElement.AsTrack()->SetHasCableLift(false); - tempTrackTileElement.AsTrack()->SetInverted((liftHillAndInvertedState & CONSTRUCTION_INVERTED_TRACK_SELECTED) != 0); - tempTrackTileElement.AsTrack()->SetColourScheme(RIDE_COLOUR_SCHEME_MAIN); - // Skipping seat rotation, should not be necessary for a temporary piece. - tempTrackTileElement.AsTrack()->SetRideIndex(rideIndex); - - const auto& ted = GetTrackElementDescriptor(trackType); - const auto* trackBlock = ted.Block; - const auto* rideEntry = currentRide->GetRideEntry(); - auto clearanceHeight = (rideEntry != nullptr) ? rideEntry->Clearance - : currentRide->GetRideTypeDescriptor().Heights.ClearanceHeight; - - while (trackBlock->index != 255) - { - auto quarterTile = trackBlock->var_08.Rotate(trackDirection); - CoordsXY offsets = { trackBlock->x, trackBlock->y }; - CoordsXY coords = originCoords + offsets.Rotate(trackDirection); - - int32_t baseZ = originZ + trackBlock->z; - int32_t clearanceZ = trackBlock->ClearanceZ + clearanceHeight + baseZ + (4 * COORDS_Z_STEP); - - auto centreTileCoords = TileCoordsXY{ coords }; - auto eastTileCoords = centreTileCoords + TileDirectionDelta[TILE_ELEMENT_DIRECTION_EAST]; - auto westTileCoords = centreTileCoords + TileDirectionDelta[TILE_ELEMENT_DIRECTION_WEST]; - auto northTileCoords = centreTileCoords + TileDirectionDelta[TILE_ELEMENT_DIRECTION_NORTH]; - auto southTileCoords = centreTileCoords + TileDirectionDelta[TILE_ELEMENT_DIRECTION_SOUTH]; - - // Replace map elements with temporary ones containing track - backupTileElementArrays[0] = MapGetFirstElementAt(centreTileCoords); - backupTileElementArrays[1] = MapGetFirstElementAt(eastTileCoords); - backupTileElementArrays[2] = MapGetFirstElementAt(westTileCoords); - backupTileElementArrays[3] = MapGetFirstElementAt(northTileCoords); - backupTileElementArrays[4] = MapGetFirstElementAt(southTileCoords); - MapSetTileElement(centreTileCoords, &tempTrackTileElement); - MapSetTileElement(eastTileCoords, &tempSideTrackTileElement); - MapSetTileElement(westTileCoords, &tempSideTrackTileElement); - MapSetTileElement(northTileCoords, &tempSideTrackTileElement); - MapSetTileElement(southTileCoords, &tempSideTrackTileElement); - - // Set the temporary track element - tempTrackTileElement.SetOccupiedQuadrants(quarterTile.GetBaseQuarterOccupied()); - tempTrackTileElement.SetBaseZ(baseZ); - tempTrackTileElement.SetClearanceZ(clearanceZ); - tempTrackTileElement.AsTrack()->SetSequenceIndex(trackBlock->index); - - // Draw this map tile - TileElementPaintSetup(*session, coords, true); - - // Restore map elements - MapSetTileElement(centreTileCoords, backupTileElementArrays[0]); - MapSetTileElement(eastTileCoords, backupTileElementArrays[1]); - MapSetTileElement(westTileCoords, backupTileElementArrays[2]); - MapSetTileElement(northTileCoords, backupTileElementArrays[3]); - MapSetTileElement(southTileCoords, backupTileElementArrays[4]); - - trackBlock++; - } - - gameState.MapSize = preserveMapSize; - - PaintSessionArrange(*session); - PaintDrawStructs(*session); - PaintSessionFree(session); - } -}; - -static void WindowRideConstructionUpdateDisabledPieces(ObjectEntryIndex rideType) -{ - RideTrackGroup disabledPieces{}; - const auto& rtd = GetRideTypeDescriptor(rideType); - if (rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) - { - // Set all pieces as “disabled”. When looping over the ride entries, - // pieces will be re-enabled as soon as a single entry supports it. - disabledPieces.flip(); - - auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); - auto& rideEntries = objManager.GetAllRideEntries(rideType); - // If there are no vehicles for this ride type, enable all the track pieces. - if (rideEntries.size() == 0) - { - disabledPieces.reset(); - } - - for (auto rideEntryIndex : rideEntries) - { - const auto* currentRideEntry = GetRideEntryByIndex(rideEntryIndex); - if (currentRideEntry == nullptr) - continue; - - // Non-default vehicle visuals do not use this system, so we have to assume it supports all the track pieces. - if (currentRideEntry->Cars[0].PaintStyle != VEHICLE_VISUAL_DEFAULT || rideType == RIDE_TYPE_CHAIRLIFT - || (currentRideEntry->Cars[0].flags & CAR_ENTRY_FLAG_SLIDE_SWING)) - { - disabledPieces.reset(); - break; - } - - // Any pieces that this ride entry supports must be taken out of the array. - auto supportedPieces = RideEntryGetSupportedTrackPieces(*currentRideEntry); - disabledPieces &= supportedPieces.flip(); - } - } - - UpdateDisabledRidePieces(disabledPieces); -} - -/** - * - * rct2: 0x006CB481 - */ -WindowBase* WindowRideConstructionOpen() -{ - RideId rideIndex = _currentRideIndex; - CloseRideWindowForConstruction(rideIndex); - - auto currentRide = GetRide(rideIndex); - if (currentRide == nullptr) - { - return nullptr; - } - - WindowRideConstructionUpdateDisabledPieces(currentRide->type); - - const auto& rtd = currentRide->GetRideTypeDescriptor(); - switch (rtd.ConstructionWindowContext) - { - case RideConstructionWindowContext::Maze: - return ContextOpenWindowView(WV_MAZE_CONSTRUCTION); - case RideConstructionWindowContext::Default: - return WindowCreate( - WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE); - } - return WindowCreate(WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE); -} - -static void CloseConstructWindowOnCompletion(const Ride& ride) -{ - if (_rideConstructionState == RideConstructionState::State0) - { - auto w = WindowFindByClass(WindowClass::RideConstruction); - if (w != nullptr) - { - if (RideAreAllPossibleEntrancesAndExitsBuilt(ride).Successful) - { - WindowClose(*w); - } - else - { - WindowEventMouseUpCall(w, WIDX_ENTRANCE); - } - } - } -} - -static void WindowRideConstructionDoEntranceExitCheck() -{ - auto w = WindowFindByClass(WindowClass::RideConstruction); - auto ride = GetRide(_currentRideIndex); - if (w == nullptr || ride == nullptr) - { - return; - } - - if (_rideConstructionState == RideConstructionState::State0) - { - w = WindowFindByClass(WindowClass::RideConstruction); - if (w != nullptr) - { - if (!RideAreAllPossibleEntrancesAndExitsBuilt(*ride).Successful) - { - WindowEventMouseUpCall(w, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); - } - } - } -} - -static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const GameActions::Result* result) -{ - if (result->Error != GameActions::Status::Ok) - { - WindowRideConstructionUpdateActiveElements(); - return; - } - auto ride = GetRide(_currentRideIndex); - if (ride != nullptr) - { - int32_t trackDirection = _currentTrackPieceDirection; - auto trackPos = _currentTrackBegin; - if (!(trackDirection & 4)) - { - trackPos -= CoordsDirectionDelta[trackDirection]; - } - - CoordsXYE next_track; - if (TrackBlockGetNextFromZero(trackPos, *ride, trackDirection, &next_track, &trackPos.z, &trackDirection, false)) - { - _currentTrackBegin.x = next_track.x; - _currentTrackBegin.y = next_track.y; - _currentTrackBegin.z = trackPos.z; - _currentTrackPieceDirection = next_track.element->GetDirection(); - _currentTrackPieceType = next_track.element->AsTrack()->GetTrackType(); - _currentTrackSelectionFlags = 0; - _rideConstructionState = RideConstructionState::Selected; - _rideConstructionNextArrowPulse = 0; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - RideSelectNextSection(); - } - else - { - _rideConstructionState = RideConstructionState::State0; - } - - WindowRideConstructionDoEntranceExitCheck(); - WindowRideConstructionUpdateActiveElements(); - } - - WindowCloseByClass(WindowClass::Error); - if (ride != nullptr) - CloseConstructWindowOnCompletion(*ride); -} - -static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const GameActions::Result* result) -{ - if (result->Error != GameActions::Status::Ok) - { - WindowRideConstructionUpdateActiveElements(); - return; - } - auto ride = GetRide(_currentRideIndex); - if (ride != nullptr) - { - auto trackDirection = DirectionReverse(_currentTrackPieceDirection); - auto trackPos = _currentTrackBegin; - if (!(trackDirection & 4)) - { - trackPos += CoordsDirectionDelta[trackDirection]; - } - - TrackBeginEnd trackBeginEnd; - if (TrackBlockGetPreviousFromZero(trackPos, *ride, trackDirection, &trackBeginEnd)) - { - _currentTrackBegin.x = trackBeginEnd.begin_x; - _currentTrackBegin.y = trackBeginEnd.begin_y; - _currentTrackBegin.z = trackBeginEnd.begin_z; - _currentTrackPieceDirection = trackBeginEnd.begin_direction; - _currentTrackPieceType = trackBeginEnd.begin_element->AsTrack()->GetTrackType(); - _currentTrackSelectionFlags = 0; - _rideConstructionState = RideConstructionState::Selected; - _rideConstructionNextArrowPulse = 0; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - RideSelectPreviousSection(); - } - else - { - _rideConstructionState = RideConstructionState::State0; - } - - WindowRideConstructionUpdateActiveElements(); - } - - WindowCloseByClass(WindowClass::Error); - if (ride != nullptr) - CloseConstructWindowOnCompletion(*ride); -} - -/** - * - * rct2: 0x006CC538 - */ -static std::optional RideGetPlacePositionFromScreenPosition(ScreenCoordsXY screenCoords) -{ - CoordsXY mapCoords; - - if (!_trackPlaceCtrlState) - { - if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_COPY_Z) - { - auto info = GetMapCoordinatesFromPos(screenCoords, 0xFCCA); - if (info.SpriteType != ViewportInteractionItem::None) - { - _trackPlaceCtrlZ = info.Element->GetBaseZ(); - _trackPlaceCtrlState = true; - } - } - } - else - { - if (!(gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_COPY_Z)) - { - _trackPlaceCtrlState = false; - } - } - - if (!_trackPlaceShiftState) - { - if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) - { - _trackPlaceShiftState = true; - _trackPlaceShiftStart = screenCoords; - _trackPlaceShiftZ = 0; - } - } - else - { - if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) - { - uint16_t maxHeight = ZoomLevel::max().ApplyTo(std::numeric_limits::max() - 32); - - _trackPlaceShiftZ = _trackPlaceShiftStart.y - screenCoords.y + 4; - // Scale delta by zoom to match mouse position. - auto* mainWnd = WindowGetMain(); - if (mainWnd != nullptr && mainWnd->viewport != nullptr) - { - _trackPlaceShiftZ = mainWnd->viewport->zoom.ApplyTo(_trackPlaceShiftZ); - } - _trackPlaceShiftZ = Floor2(_trackPlaceShiftZ, 8); - - // Clamp to maximum possible value of BaseHeight can offer. - _trackPlaceShiftZ = std::min(_trackPlaceShiftZ, maxHeight); - - screenCoords = _trackPlaceShiftStart; - } - else - { - _trackPlaceShiftState = false; - } - } - - if (!_trackPlaceCtrlState) - { - mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); - if (mapCoords.IsNull()) - return std::nullopt; - - _trackPlaceZ = 0; - if (_trackPlaceShiftState) - { - auto surfaceElement = MapGetSurfaceElementAt(mapCoords); - if (surfaceElement == nullptr) - return std::nullopt; - auto mapZ = Floor2(surfaceElement->GetBaseZ(), 16); - mapZ += _trackPlaceShiftZ; - mapZ = std::max(mapZ, 16); - _trackPlaceZ = mapZ; - } - } - else - { - auto mapZ = _trackPlaceCtrlZ; - auto mapXYCoords = ScreenGetMapXYWithZ(screenCoords, mapZ); - if (mapXYCoords.has_value()) - { - mapCoords = mapXYCoords.value(); - } - else - { - return std::nullopt; - } - - if (_trackPlaceShiftState != 0) - { - mapZ += _trackPlaceShiftZ; - } - _trackPlaceZ = std::max(mapZ, 16); - } - - if (mapCoords.x == LOCATION_NULL) - return std::nullopt; - - return mapCoords.ToTileStart(); -} - -/** - * - * rct2: 0x006C84CE - */ -void WindowRideConstructionUpdateActiveElementsImpl() -{ - WindowRideConstructionUpdateEnabledTrackPieces(); - if (auto currentRide = GetRide(_currentRideIndex); - !currentRide || currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) - { - return; - } - - auto window = static_cast(WindowFindByClass(WindowClass::RideConstruction)); - if (!window) - { - return; - } - - window->UpdateMapSelection(); - - _selectedTrackType = TrackElemType::None; - if (_rideConstructionState == RideConstructionState::Selected) - { - TileElement* tileElement; - if (GetTrackElementOriginAndApplyChanges( - { _currentTrackBegin, static_cast(_currentTrackPieceDirection & 3) }, _currentTrackPieceType, 0, - &tileElement, 0) - != std::nullopt) - { - _selectedTrackType = tileElement->AsTrack()->GetTrackType(); - if (TrackTypeHasSpeedSetting(tileElement->AsTrack()->GetTrackType())) - _currentBrakeSpeed2 = tileElement->AsTrack()->GetBrakeBoosterSpeed(); - _currentSeatRotationAngle = tileElement->AsTrack()->GetSeatRotation(); - } - } - - window->UpdatePossibleRideConfigurations(); - window->UpdateWidgets(); -} - -/** - * - * rct2: 0x006C6A77 - */ -void WindowRideConstructionUpdateEnabledTrackPieces() -{ - auto ride = GetRide(_currentRideIndex); - if (ride == nullptr) - return; - - auto rideEntry = ride->GetRideEntry(); - if (rideEntry == nullptr) - return; - - int32_t rideType = RideGetAlternativeType(*ride); - UpdateEnabledRidePieces(rideType); -} - -/** - * - * rct2: 0x006C94D8 - */ -void UpdateGhostTrackAndArrow() -{ - RideId rideIndex; - int32_t direction, type, liftHillAndAlternativeState; - CoordsXYZ trackPos{}; - - if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK_PLACE_ACTION_QUEUED) - { - return; - } - - // Recheck if area is fine for new track. - // Set by footpath placement - if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_RECHECK) - { - RideConstructionInvalidateCurrentTrack(); - _currentTrackSelectionFlags &= ~TRACK_SELECTION_FLAG_RECHECK; - } - - switch (_rideConstructionState) - { - case RideConstructionState::Front: - case RideConstructionState::Back: - { - // place ghost piece - if (!(_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK)) - { - if (WindowRideConstructionUpdateState( - &type, &direction, &rideIndex, &liftHillAndAlternativeState, &trackPos, nullptr)) - { - RideConstructionRemoveGhosts(); + WindowRideConstructionUpdateActiveElements(); } else { - _currentTrackPrice = PlaceProvisionalTrackPiece( - rideIndex, type, direction, liftHillAndAlternativeState, trackPos); - WindowRideConstructionUpdateActiveElements(); + auto currentRide = GetRide(_currentRideIndex); + if (currentRide != nullptr) + { + WindowRideConstructionMouseUpDemolishNextPiece({ *newCoords, static_cast(direction) }, type); + } + } + }); + + GameActions::Execute(&trackRemoveAction); + } + + void Rotate() + { + _autoRotatingShop = false; + _currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3; + RideConstructionInvalidateCurrentTrack(); + _currentTrackPrice = kMoney64Undefined; + WindowRideConstructionUpdateActiveElements(); + } + + void EntranceClick() + { + if (ToolSet(*this, WIDX_ENTRANCE, Tool::Crosshair)) + { + auto currentRide = GetRide(_currentRideIndex); + if (currentRide != nullptr && !RideTryGetOriginElement(*currentRide, nullptr)) + { + RideInitialiseConstructionWindow(*currentRide); } } - // update flashing arrow - auto curTime = Platform::GetTicks(); - if (_rideConstructionNextArrowPulse >= curTime) - break; - _rideConstructionNextArrowPulse = curTime + ARROW_PULSE_DURATION; - - _currentTrackSelectionFlags ^= TRACK_SELECTION_FLAG_ARROW; - trackPos = _currentTrackBegin; - direction = _currentTrackPieceDirection; - type = _currentTrackPieceType; - // diagonal pieces trigger this - if (direction >= 4) - direction += 4; - if (_rideConstructionState == RideConstructionState::Back) - direction = DirectionReverse(direction); - gMapSelectArrowPosition = trackPos; - gMapSelectArrowDirection = direction; + else + { + gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_ENTRANCE; + gRideEntranceExitPlaceRideIndex = _currentRideIndex; + gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); + InputSetFlag(INPUT_FLAG_6, true); + RideConstructionInvalidateCurrentTrack(); + if (_rideConstructionState != RideConstructionState::EntranceExit) + { + gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; + _rideConstructionState = RideConstructionState::EntranceExit; + } + WindowRideConstructionUpdateActiveElements(); + } + } + + void ExitClick() + { + if (ToolSet(*this, WIDX_EXIT, Tool::Crosshair)) + { + auto currentRide = GetRide(_currentRideIndex); + if (!RideTryGetOriginElement(*currentRide, nullptr)) + { + RideInitialiseConstructionWindow(*currentRide); + } + } + else + { + gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_EXIT; + gRideEntranceExitPlaceRideIndex = _currentRideIndex; + gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); + InputSetFlag(INPUT_FLAG_6, true); + RideConstructionInvalidateCurrentTrack(); + if (_rideConstructionState != RideConstructionState::EntranceExit) + { + gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; + _rideConstructionState = RideConstructionState::EntranceExit; + } + WindowRideConstructionUpdateActiveElements(); + } + } + + void UpdateLiftHillSelected(TrackPitch slope) + { + _currentTrackPitchEnd = slope; + _currentTrackPrice = kMoney64Undefined; + if (_rideConstructionState == RideConstructionState::Front && !GetGameState().Cheats.EnableChainLiftOnAllTrack) + { + switch (slope) + { + case TrackPitch::None: + case TrackPitch::Up25: + case TrackPitch::Up60: + break; + default: + _currentTrackLiftHill &= ~CONSTRUCTION_LIFT_HILL_SELECTED; + break; + } + } + WindowRideConstructionUpdateActiveElements(); + } + + void SetBrakeSpeed(int32_t brakesSpeed) + { + TileElement* tileElement; + + if (GetTrackElementOriginAndApplyChanges( + { _currentTrackBegin, static_cast(_currentTrackPieceDirection & 3) }, _currentTrackPieceType, 0, + &tileElement, 0) + != std::nullopt) + { + auto trackSetBrakeSpeed = TrackSetBrakeSpeedAction( + _currentTrackBegin, tileElement->AsTrack()->GetTrackType(), brakesSpeed); + trackSetBrakeSpeed.SetCallback([](const GameAction* ga, const GameActions::Result* result) { + WindowRideConstructionUpdateActiveElements(); + }); + GameActions::Execute(&trackSetBrakeSpeed); + return; + } + WindowRideConstructionUpdateActiveElements(); + } + + void ShowSpecialTrackDropdown(Widget* widget) + { + int32_t defaultIndex = -1; + for (size_t i = 0; i < _specialElementDropdownState.Elements.size(); i++) + { + track_type_t trackPiece = _specialElementDropdownState.Elements[i].TrackType; + + const auto& ted = GetTrackElementDescriptor(trackPiece); + StringId trackPieceStringId = ted.Description; + if (trackPieceStringId == STR_RAPIDS) + { + auto currentRide = GetRide(_currentRideIndex); + if (currentRide != nullptr) + { + const auto& rtd = currentRide->GetRideTypeDescriptor(); + if (rtd.Category != RIDE_CATEGORY_WATER) + trackPieceStringId = STR_LOG_BUMPS; + } + } + gDropdownItems[i].Format = trackPieceStringId; + if ((trackPiece | RideConstructionSpecialPieceSelected) == _currentTrackCurve) + { + defaultIndex = static_cast(i); + } + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 0, + _specialElementDropdownState.Elements.size(), widget->width()); + + for (size_t i = 0; i < _specialElementDropdownState.Elements.size(); i++) + { + Dropdown::SetDisabled(static_cast(i), _specialElementDropdownState.Elements[i].Disabled); + } + gDropdownDefaultIndex = defaultIndex; + } + + void RideSelectedTrackSetSeatRotation(int32_t seatRotation) + { + GetTrackElementOriginAndApplyChanges( + { _currentTrackBegin, static_cast(_currentTrackPieceDirection & 3) }, _currentTrackPieceType, + seatRotation, nullptr, TRACK_ELEMENT_SET_SEAT_ROTATION); + WindowRideConstructionUpdateActiveElements(); + } + + void ToolDownEntranceExit(const ScreenCoordsXY& screenCoords) + { + RideConstructionInvalidateCurrentTrack(); + MapInvalidateSelectionRect(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW) - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; - MapInvalidateTileFull(trackPos); - break; - } - case RideConstructionState::Selected: - { - auto curTime = Platform::GetTicks(); - if (_rideConstructionNextArrowPulse >= curTime) - break; - _rideConstructionNextArrowPulse = curTime + ARROW_PULSE_DURATION; - - _currentTrackSelectionFlags ^= TRACK_SELECTION_FLAG_ARROW; - direction = _currentTrackPieceDirection & 3; - type = _currentTrackPieceType; - uint16_t flags = _currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW ? TRACK_ELEMENT_SET_HIGHLIGHT_TRUE - : TRACK_ELEMENT_SET_HIGHLIGHT_FALSE; - auto newCoords = GetTrackElementOriginAndApplyChanges( - { _currentTrackBegin, static_cast(direction) }, type, 0, nullptr, flags); - if (!newCoords.has_value()) + + CoordsXYZD entranceOrExitCoords = RideGetEntranceOrExitPositionFromScreenPosition(screenCoords); + if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) + return; + + auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction( + entranceOrExitCoords, DirectionReverse(gRideEntranceExitPlaceDirection), gRideEntranceExitPlaceRideIndex, + gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT); + + rideEntranceExitPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) + return; + + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); + + auto currentRide = GetRide(gRideEntranceExitPlaceRideIndex); + if (currentRide != nullptr && RideAreAllPossibleEntrancesAndExitsBuilt(*currentRide).Successful) + { + ToolCancel(); + if (!currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) + { + WindowCloseByClass(WindowClass::RideConstruction); + } + } + else + { + gRideEntranceExitPlaceType = gRideEntranceExitPlaceType ^ 1; + WindowInvalidateByClass(WindowClass::RideConstruction); + gCurrentToolWidget.widget_index = (gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_ENTRANCE) + ? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE + : WC_RIDE_CONSTRUCTION__WIDX_EXIT; + } + }); + auto res = GameActions::Execute(&rideEntranceExitPlaceAction); + } + + void DrawTrackPiece( + DrawPixelInfo& dpi, RideId rideIndex, int32_t trackType, int32_t trackDirection, int32_t liftHillAndInvertedState, + int32_t widgetWidth, int32_t widgetHeight) + { + auto currentRide = GetRide(rideIndex); + if (currentRide == nullptr) + { + return; + } + + const auto& ted = GetTrackElementDescriptor(trackType); + const auto* trackBlock = ted.Block; + while ((trackBlock + 1)->index != 0xFF) + trackBlock++; + + CoordsXYZ mapCoords{ trackBlock->x, trackBlock->y, trackBlock->z }; + if (trackBlock->flags & RCT_PREVIEW_TRACK_FLAG_1) + { + mapCoords.x = 0; + mapCoords.y = 0; + } + + auto rotatedMapCoords = mapCoords.Rotate(trackDirection); + // this is actually case 0, but the other cases all jump to it + mapCoords.x = 4112 + (rotatedMapCoords.x / 2); + mapCoords.y = 4112 + (rotatedMapCoords.y / 2); + mapCoords.z = 1024 + mapCoords.z; + + auto previewZOffset = ted.Definition.PreviewZOffset; + mapCoords.z -= previewZOffset; + + const ScreenCoordsXY rotatedScreenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), mapCoords); + + dpi.x += rotatedScreenCoords.x - widgetWidth / 2; + dpi.y += rotatedScreenCoords.y - widgetHeight / 2 - 16; + + DrawTrackPieceHelper(dpi, rideIndex, trackType, trackDirection, liftHillAndInvertedState, { 4096, 4096 }, 1024); + } + + void DrawTrackPieceHelper( + DrawPixelInfo& dpi, RideId rideIndex, int32_t trackType, int32_t trackDirection, int32_t liftHillAndInvertedState, + const CoordsXY& originCoords, int32_t originZ) + { + TileElement tempSideTrackTileElement{ 0x80, 0x8F, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + TileElement tempTrackTileElement{}; + TileElement* backupTileElementArrays[5]{}; + PaintSession* session = PaintSessionAlloc(dpi, 0, GetCurrentRotation()); + trackDirection &= 3; + + auto currentRide = GetRide(rideIndex); + if (currentRide == nullptr) + { + return; + } + + auto& gameState = OpenRCT2::GetGameState(); + auto preserveMapSize = gameState.MapSize; + + gameState.MapSize = { kMaximumMapSizeTechnical, kMaximumMapSizeTechnical }; + + // Setup non changing parts of the temporary track tile element + tempTrackTileElement.SetType(TileElementType::Track); + tempTrackTileElement.SetDirection(trackDirection); + tempTrackTileElement.AsTrack()->SetHasChain((liftHillAndInvertedState & CONSTRUCTION_LIFT_HILL_SELECTED) != 0); + tempTrackTileElement.SetLastForTile(true); + tempTrackTileElement.AsTrack()->SetTrackType(trackType); + tempTrackTileElement.AsTrack()->SetRideType(currentRide->type); + tempTrackTileElement.AsTrack()->SetHasCableLift(false); + tempTrackTileElement.AsTrack()->SetInverted((liftHillAndInvertedState & CONSTRUCTION_INVERTED_TRACK_SELECTED) != 0); + tempTrackTileElement.AsTrack()->SetColourScheme(RIDE_COLOUR_SCHEME_MAIN); + // Skipping seat rotation, should not be necessary for a temporary piece. + tempTrackTileElement.AsTrack()->SetRideIndex(rideIndex); + + const auto& ted = GetTrackElementDescriptor(trackType); + const auto* trackBlock = ted.Block; + const auto* rideEntry = currentRide->GetRideEntry(); + auto clearanceHeight = (rideEntry != nullptr) ? rideEntry->Clearance + : currentRide->GetRideTypeDescriptor().Heights.ClearanceHeight; + + while (trackBlock->index != 255) + { + auto quarterTile = trackBlock->var_08.Rotate(trackDirection); + CoordsXY offsets = { trackBlock->x, trackBlock->y }; + CoordsXY coords = originCoords + offsets.Rotate(trackDirection); + + int32_t baseZ = originZ + trackBlock->z; + int32_t clearanceZ = trackBlock->ClearanceZ + clearanceHeight + baseZ + (4 * COORDS_Z_STEP); + + auto centreTileCoords = TileCoordsXY{ coords }; + auto eastTileCoords = centreTileCoords + TileDirectionDelta[TILE_ELEMENT_DIRECTION_EAST]; + auto westTileCoords = centreTileCoords + TileDirectionDelta[TILE_ELEMENT_DIRECTION_WEST]; + auto northTileCoords = centreTileCoords + TileDirectionDelta[TILE_ELEMENT_DIRECTION_NORTH]; + auto southTileCoords = centreTileCoords + TileDirectionDelta[TILE_ELEMENT_DIRECTION_SOUTH]; + + // Replace map elements with temporary ones containing track + backupTileElementArrays[0] = MapGetFirstElementAt(centreTileCoords); + backupTileElementArrays[1] = MapGetFirstElementAt(eastTileCoords); + backupTileElementArrays[2] = MapGetFirstElementAt(westTileCoords); + backupTileElementArrays[3] = MapGetFirstElementAt(northTileCoords); + backupTileElementArrays[4] = MapGetFirstElementAt(southTileCoords); + MapSetTileElement(centreTileCoords, &tempTrackTileElement); + MapSetTileElement(eastTileCoords, &tempSideTrackTileElement); + MapSetTileElement(westTileCoords, &tempSideTrackTileElement); + MapSetTileElement(northTileCoords, &tempSideTrackTileElement); + MapSetTileElement(southTileCoords, &tempSideTrackTileElement); + + // Set the temporary track element + tempTrackTileElement.SetOccupiedQuadrants(quarterTile.GetBaseQuarterOccupied()); + tempTrackTileElement.SetBaseZ(baseZ); + tempTrackTileElement.SetClearanceZ(clearanceZ); + tempTrackTileElement.AsTrack()->SetSequenceIndex(trackBlock->index); + + // Draw this map tile + TileElementPaintSetup(*session, coords, true); + + // Restore map elements + MapSetTileElement(centreTileCoords, backupTileElementArrays[0]); + MapSetTileElement(eastTileCoords, backupTileElementArrays[1]); + MapSetTileElement(westTileCoords, backupTileElementArrays[2]); + MapSetTileElement(northTileCoords, backupTileElementArrays[3]); + MapSetTileElement(southTileCoords, backupTileElementArrays[4]); + + trackBlock++; + } + + gameState.MapSize = preserveMapSize; + + PaintSessionArrange(*session); + PaintDrawStructs(*session); + PaintSessionFree(session); + } + }; + + static void WindowRideConstructionUpdateDisabledPieces(ObjectEntryIndex rideType) + { + RideTrackGroup disabledPieces{}; + const auto& rtd = GetRideTypeDescriptor(rideType); + if (rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) + { + // Set all pieces as “disabled”. When looping over the ride entries, + // pieces will be re-enabled as soon as a single entry supports it. + disabledPieces.flip(); + + auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + auto& rideEntries = objManager.GetAllRideEntries(rideType); + // If there are no vehicles for this ride type, enable all the track pieces. + if (rideEntries.size() == 0) + { + disabledPieces.reset(); + } + + for (auto rideEntryIndex : rideEntries) + { + const auto* currentRideEntry = GetRideEntryByIndex(rideEntryIndex); + if (currentRideEntry == nullptr) + continue; + + // Non-default vehicle visuals do not use this system, so we have to assume it supports all the track pieces. + if (currentRideEntry->Cars[0].PaintStyle != VEHICLE_VISUAL_DEFAULT || rideType == RIDE_TYPE_CHAIRLIFT + || (currentRideEntry->Cars[0].flags & CAR_ENTRY_FLAG_SLIDE_SWING)) + { + disabledPieces.reset(); + break; + } + + // Any pieces that this ride entry supports must be taken out of the array. + auto supportedPieces = RideEntryGetSupportedTrackPieces(*currentRideEntry); + disabledPieces &= supportedPieces.flip(); + } + } + + UpdateDisabledRidePieces(disabledPieces); + } + + /** + * + * rct2: 0x006CB481 + */ + WindowBase* RideConstructionOpen() + { + RideId rideIndex = _currentRideIndex; + CloseRideWindowForConstruction(rideIndex); + + auto currentRide = GetRide(rideIndex); + if (currentRide == nullptr) + { + return nullptr; + } + + WindowRideConstructionUpdateDisabledPieces(currentRide->type); + + const auto& rtd = currentRide->GetRideTypeDescriptor(); + switch (rtd.ConstructionWindowContext) + { + case RideConstructionWindowContext::Maze: + return ContextOpenWindowView(WV_MAZE_CONSTRUCTION); + case RideConstructionWindowContext::Default: + return WindowCreate( + WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE); + } + return WindowCreate( + WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE); + } + + static void CloseConstructWindowOnCompletion(const Ride& ride) + { + if (_rideConstructionState == RideConstructionState::State0) + { + auto w = WindowFindByClass(WindowClass::RideConstruction); + if (w != nullptr) + { + if (RideAreAllPossibleEntrancesAndExitsBuilt(ride).Successful) + { + WindowClose(*w); + } + else + { + w->OnMouseUp(WIDX_ENTRANCE); + } + } + } + } + + static void WindowRideConstructionDoEntranceExitCheck() + { + auto w = WindowFindByClass(WindowClass::RideConstruction); + auto ride = GetRide(_currentRideIndex); + if (w == nullptr || ride == nullptr) + { + return; + } + + if (_rideConstructionState == RideConstructionState::State0) + { + w = WindowFindByClass(WindowClass::RideConstruction); + if (w != nullptr) + { + if (!RideAreAllPossibleEntrancesAndExitsBuilt(*ride).Successful) + { + w->OnMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); + } + } + } + } + + static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const GameActions::Result* result) + { + if (result->Error != GameActions::Status::Ok) + { + WindowRideConstructionUpdateActiveElements(); + return; + } + auto ride = GetRide(_currentRideIndex); + if (ride != nullptr) + { + int32_t trackDirection = _currentTrackPieceDirection; + auto trackPos = _currentTrackBegin; + if (!(trackDirection & 4)) + { + trackPos -= CoordsDirectionDelta[trackDirection]; + } + + CoordsXYE next_track; + if (TrackBlockGetNextFromZero(trackPos, *ride, trackDirection, &next_track, &trackPos.z, &trackDirection, false)) + { + _currentTrackBegin.x = next_track.x; + _currentTrackBegin.y = next_track.y; + _currentTrackBegin.z = trackPos.z; + _currentTrackPieceDirection = next_track.element->GetDirection(); + _currentTrackPieceType = next_track.element->AsTrack()->GetTrackType(); + _currentTrackSelectionFlags = 0; + _rideConstructionState = RideConstructionState::Selected; + _rideConstructionNextArrowPulse = 0; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + RideSelectNextSection(); + } + else { - RideConstructionRemoveGhosts(); _rideConstructionState = RideConstructionState::State0; } - break; - } - case RideConstructionState::MazeBuild: - case RideConstructionState::MazeMove: - case RideConstructionState::MazeFill: - { - auto curTime = Platform::GetTicks(); - if (_rideConstructionNextArrowPulse >= curTime) - break; - _rideConstructionNextArrowPulse = curTime + ARROW_PULSE_DURATION; - _currentTrackSelectionFlags ^= TRACK_SELECTION_FLAG_ARROW; - trackPos = CoordsXYZ{ _currentTrackBegin.x & 0xFFE0, _currentTrackBegin.y & 0xFFE0, _currentTrackBegin.z + 15 }; - gMapSelectArrowPosition = trackPos; - gMapSelectArrowDirection = 4; - if (((_currentTrackBegin.x & 0x1F) | (_currentTrackBegin.y & 0x1F)) != 0) + WindowRideConstructionDoEntranceExitCheck(); + WindowRideConstructionUpdateActiveElements(); + } + + WindowCloseByClass(WindowClass::Error); + if (ride != nullptr) + CloseConstructWindowOnCompletion(*ride); + } + + static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const GameActions::Result* result) + { + if (result->Error != GameActions::Status::Ok) + { + WindowRideConstructionUpdateActiveElements(); + return; + } + auto ride = GetRide(_currentRideIndex); + if (ride != nullptr) + { + auto trackDirection = DirectionReverse(_currentTrackPieceDirection); + auto trackPos = _currentTrackBegin; + if (!(trackDirection & 4)) { - gMapSelectArrowDirection = 6; - if (((_currentTrackBegin.x & 0x1F) & (_currentTrackBegin.y & 0x1F)) == 0) + trackPos += CoordsDirectionDelta[trackDirection]; + } + + TrackBeginEnd trackBeginEnd; + if (TrackBlockGetPreviousFromZero(trackPos, *ride, trackDirection, &trackBeginEnd)) + { + _currentTrackBegin.x = trackBeginEnd.begin_x; + _currentTrackBegin.y = trackBeginEnd.begin_y; + _currentTrackBegin.z = trackBeginEnd.begin_z; + _currentTrackPieceDirection = trackBeginEnd.begin_direction; + _currentTrackPieceType = trackBeginEnd.begin_element->AsTrack()->GetTrackType(); + _currentTrackSelectionFlags = 0; + _rideConstructionState = RideConstructionState::Selected; + _rideConstructionNextArrowPulse = 0; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + RideSelectPreviousSection(); + } + else + { + _rideConstructionState = RideConstructionState::State0; + } + + WindowRideConstructionUpdateActiveElements(); + } + + WindowCloseByClass(WindowClass::Error); + if (ride != nullptr) + CloseConstructWindowOnCompletion(*ride); + } + + /** + * + * rct2: 0x006CC538 + */ + static std::optional RideGetPlacePositionFromScreenPosition(ScreenCoordsXY screenCoords) + { + CoordsXY mapCoords; + + if (!_trackPlaceCtrlState) + { + if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_COPY_Z) + { + auto info = GetMapCoordinatesFromPos(screenCoords, 0xFCCA); + if (info.SpriteType != ViewportInteractionItem::None) { - gMapSelectArrowDirection = 5; - if ((_currentTrackBegin.y & 0x1F) == 0) - gMapSelectArrowDirection = 7; + _trackPlaceCtrlZ = info.Element->GetBaseZ(); + _trackPlaceCtrlState = true; } } - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW) - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; - MapInvalidateTileFull(trackPos); - break; } - default: - break; - } -} + else + { + if (!(gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_COPY_Z)) + { + _trackPlaceCtrlState = false; + } + } -/** - * - * rct2: 0x006CC6A8 - */ -void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords) -{ - int32_t z; - const PreviewTrack* trackBlock; + if (!_trackPlaceShiftState) + { + if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) + { + _trackPlaceShiftState = true; + _trackPlaceShiftStart = screenCoords; + _trackPlaceShiftZ = 0; + } + } + else + { + if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) + { + uint16_t maxHeight = ZoomLevel::max().ApplyTo( + std::numeric_limits::max() - 32); - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - auto mapCoords = RideGetPlacePositionFromScreenPosition(screenCoords); - if (!mapCoords) - { - RideConstructionInvalidateCurrentTrack(); - MapInvalidateMapSelectionTiles(); - return; + _trackPlaceShiftZ = _trackPlaceShiftStart.y - screenCoords.y + 4; + // Scale delta by zoom to match mouse position. + auto* mainWnd = WindowGetMain(); + if (mainWnd != nullptr && mainWnd->viewport != nullptr) + { + _trackPlaceShiftZ = mainWnd->viewport->zoom.ApplyTo(_trackPlaceShiftZ); + } + _trackPlaceShiftZ = Floor2(_trackPlaceShiftZ, 8); + + // Clamp to maximum possible value of BaseHeight can offer. + _trackPlaceShiftZ = std::min(_trackPlaceShiftZ, maxHeight); + + screenCoords = _trackPlaceShiftStart; + } + else + { + _trackPlaceShiftState = false; + } + } + + if (!_trackPlaceCtrlState) + { + mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); + if (mapCoords.IsNull()) + return std::nullopt; + + _trackPlaceZ = 0; + if (_trackPlaceShiftState) + { + auto surfaceElement = MapGetSurfaceElementAt(mapCoords); + if (surfaceElement == nullptr) + return std::nullopt; + auto mapZ = Floor2(surfaceElement->GetBaseZ(), 16); + mapZ += _trackPlaceShiftZ; + mapZ = std::max(mapZ, 16); + _trackPlaceZ = mapZ; + } + } + else + { + auto mapZ = _trackPlaceCtrlZ; + auto mapXYCoords = ScreenGetMapXYWithZ(screenCoords, mapZ); + if (mapXYCoords.has_value()) + { + mapCoords = mapXYCoords.value(); + } + else + { + return std::nullopt; + } + + if (_trackPlaceShiftState != 0) + { + mapZ += _trackPlaceShiftZ; + } + _trackPlaceZ = std::max(mapZ, 16); + } + + if (mapCoords.x == LOCATION_NULL) + return std::nullopt; + + return mapCoords.ToTileStart(); } - z = _trackPlaceZ; - if (z == 0) - z = MapGetHighestZ(*mapCoords); - - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; - gMapSelectFlags &= ~MAP_SELECT_FLAG_GREEN; - gMapSelectArrowPosition = CoordsXYZ{ *mapCoords, z }; - gMapSelectArrowDirection = _currentTrackPieceDirection; - gMapSelectionTiles.clear(); - gMapSelectionTiles.push_back(*mapCoords); - - RideId rideIndex; - int32_t trackType, trackDirection, liftHillAndAlternativeState; - if (WindowRideConstructionUpdateState( - &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, nullptr, nullptr)) + /** + * + * rct2: 0x006C84CE + */ + void WindowRideConstructionUpdateActiveElementsImpl() { - RideConstructionInvalidateCurrentTrack(); - MapInvalidateMapSelectionTiles(); - return; - } - _currentTrackPieceType = trackType; - auto ride = GetRide(_currentRideIndex); - if (!ride) - { - return; - } + WindowRideConstructionUpdateEnabledTrackPieces(); + if (auto currentRide = GetRide(_currentRideIndex); + !currentRide || currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) + { + return; + } - const auto& rtd = ride->GetRideTypeDescriptor(); - if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) - { auto window = static_cast(WindowFindByClass(WindowClass::RideConstruction)); if (!window) { return; } - // Re-using this other code, very slight difference from original - // - Original code checks for MSB mask instead of 255 on trackPart->var_00 - // - Original code checks this first as its already set origin tile, probably just a micro optimisation - window->SelectMapTiles(trackType, trackDirection, *mapCoords); - } - gMapSelectArrowPosition.z = z; - if (_trackPlaceZ == 0) - { - // Raise z above all slopes and water - if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT) + window->UpdateMapSelection(); + + _selectedTrackType = TrackElemType::None; + if (_rideConstructionState == RideConstructionState::Selected) { - int32_t highestZ = 0; - for (const auto& selectedTile : gMapSelectionTiles) + TileElement* tileElement; + if (GetTrackElementOriginAndApplyChanges( + { _currentTrackBegin, static_cast(_currentTrackPieceDirection & 3) }, _currentTrackPieceType, 0, + &tileElement, 0) + != std::nullopt) { - if (MapIsLocationValid(selectedTile)) - { - z = MapGetHighestZ(selectedTile); - if (z > highestZ) - highestZ = z; - } + _selectedTrackType = tileElement->AsTrack()->GetTrackType(); + if (TrackTypeHasSpeedSetting(tileElement->AsTrack()->GetTrackType())) + _currentBrakeSpeed2 = tileElement->AsTrack()->GetBrakeBoosterSpeed(); + _currentSeatRotationAngle = tileElement->AsTrack()->GetSeatRotation(); } } - // Loc6CC8BF: - // z = MapGetHighestZ(x >> 5, y >> 5); - } - // Loc6CC91B: - const auto& ted = GetTrackElementDescriptor(trackType); - trackBlock = ted.Block; - int32_t bx = 0; - do - { - bx = std::min(bx, trackBlock->z); - trackBlock++; - } while (trackBlock->index != 255); - z -= bx; - gMapSelectArrowPosition.z = z; - _currentTrackBegin.x = mapCoords->x; - _currentTrackBegin.y = mapCoords->y; - _currentTrackBegin.z = z; - if ((_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK) && _currentTrackBegin == _previousTrackPiece) + window->UpdatePossibleRideConfigurations(); + window->UpdateWidgets(); + } + + /** + * + * rct2: 0x006C6A77 + */ + void WindowRideConstructionUpdateEnabledTrackPieces() { + auto ride = GetRide(_currentRideIndex); + if (ride == nullptr) + return; + + auto rideEntry = ride->GetRideEntry(); + if (rideEntry == nullptr) + return; + + int32_t rideType = RideGetAlternativeType(*ride); + UpdateEnabledRidePieces(rideType); + } + + /** + * + * rct2: 0x006C94D8 + */ + void UpdateGhostTrackAndArrow() + { + RideId rideIndex; + int32_t direction, type, liftHillAndAlternativeState; + CoordsXYZ trackPos{}; + + if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK_PLACE_ACTION_QUEUED) + { + return; + } + + // Recheck if area is fine for new track. + // Set by footpath placement + if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_RECHECK) + { + RideConstructionInvalidateCurrentTrack(); + _currentTrackSelectionFlags &= ~TRACK_SELECTION_FLAG_RECHECK; + } + + switch (_rideConstructionState) + { + case RideConstructionState::Front: + case RideConstructionState::Back: + { + // place ghost piece + if (!(_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK)) + { + if (WindowRideConstructionUpdateState( + &type, &direction, &rideIndex, &liftHillAndAlternativeState, &trackPos, nullptr)) + { + RideConstructionRemoveGhosts(); + } + else + { + _currentTrackPrice = PlaceProvisionalTrackPiece( + rideIndex, type, direction, liftHillAndAlternativeState, trackPos); + WindowRideConstructionUpdateActiveElements(); + } + } + // update flashing arrow + auto curTime = Platform::GetTicks(); + if (_rideConstructionNextArrowPulse >= curTime) + break; + _rideConstructionNextArrowPulse = curTime + ARROW_PULSE_DURATION; + + _currentTrackSelectionFlags ^= TRACK_SELECTION_FLAG_ARROW; + trackPos = _currentTrackBegin; + direction = _currentTrackPieceDirection; + type = _currentTrackPieceType; + // diagonal pieces trigger this + if (direction >= 4) + direction += 4; + if (_rideConstructionState == RideConstructionState::Back) + direction = DirectionReverse(direction); + gMapSelectArrowPosition = trackPos; + gMapSelectArrowDirection = direction; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW) + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; + MapInvalidateTileFull(trackPos); + break; + } + case RideConstructionState::Selected: + { + auto curTime = Platform::GetTicks(); + if (_rideConstructionNextArrowPulse >= curTime) + break; + _rideConstructionNextArrowPulse = curTime + ARROW_PULSE_DURATION; + + _currentTrackSelectionFlags ^= TRACK_SELECTION_FLAG_ARROW; + direction = _currentTrackPieceDirection & 3; + type = _currentTrackPieceType; + uint16_t flags = _currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW ? TRACK_ELEMENT_SET_HIGHLIGHT_TRUE + : TRACK_ELEMENT_SET_HIGHLIGHT_FALSE; + auto newCoords = GetTrackElementOriginAndApplyChanges( + { _currentTrackBegin, static_cast(direction) }, type, 0, nullptr, flags); + if (!newCoords.has_value()) + { + RideConstructionRemoveGhosts(); + _rideConstructionState = RideConstructionState::State0; + } + break; + } + case RideConstructionState::MazeBuild: + case RideConstructionState::MazeMove: + case RideConstructionState::MazeFill: + { + auto curTime = Platform::GetTicks(); + if (_rideConstructionNextArrowPulse >= curTime) + break; + _rideConstructionNextArrowPulse = curTime + ARROW_PULSE_DURATION; + + _currentTrackSelectionFlags ^= TRACK_SELECTION_FLAG_ARROW; + trackPos = CoordsXYZ{ _currentTrackBegin.x & 0xFFE0, _currentTrackBegin.y & 0xFFE0, _currentTrackBegin.z + 15 }; + gMapSelectArrowPosition = trackPos; + gMapSelectArrowDirection = 4; + if (((_currentTrackBegin.x & 0x1F) | (_currentTrackBegin.y & 0x1F)) != 0) + { + gMapSelectArrowDirection = 6; + if (((_currentTrackBegin.x & 0x1F) & (_currentTrackBegin.y & 0x1F)) == 0) + { + gMapSelectArrowDirection = 5; + if ((_currentTrackBegin.y & 0x1F) == 0) + gMapSelectArrowDirection = 7; + } + } + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW) + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; + MapInvalidateTileFull(trackPos); + break; + } + default: + break; + } + } + + /** + * + * rct2: 0x006CC6A8 + */ + void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords) + { + int32_t z; + const PreviewTrack* trackBlock; + MapInvalidateMapSelectionTiles(); - return; - } + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + auto mapCoords = RideGetPlacePositionFromScreenPosition(screenCoords); + if (!mapCoords) + { + RideConstructionInvalidateCurrentTrack(); + MapInvalidateMapSelectionTiles(); + return; + } - _previousTrackPiece = _currentTrackBegin; - // search for appropriate z value for ghost, up to max ride height - int numAttempts = (z <= MAX_TRACK_HEIGHT ? ((MAX_TRACK_HEIGHT - z) / COORDS_Z_STEP + 1) : 2); + z = _trackPlaceZ; + if (z == 0) + z = MapGetHighestZ(*mapCoords); + + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; + gMapSelectFlags &= ~MAP_SELECT_FLAG_GREEN; + gMapSelectArrowPosition = CoordsXYZ{ *mapCoords, z }; + gMapSelectArrowDirection = _currentTrackPieceDirection; + gMapSelectionTiles.clear(); + gMapSelectionTiles.push_back(*mapCoords); + + RideId rideIndex; + int32_t trackType, trackDirection, liftHillAndAlternativeState; + if (WindowRideConstructionUpdateState( + &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, nullptr, nullptr)) + { + RideConstructionInvalidateCurrentTrack(); + MapInvalidateMapSelectionTiles(); + return; + } + _currentTrackPieceType = trackType; + auto ride = GetRide(_currentRideIndex); + if (!ride) + { + return; + } + + const auto& rtd = ride->GetRideTypeDescriptor(); + if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) + { + auto window = static_cast(WindowFindByClass(WindowClass::RideConstruction)); + if (!window) + { + return; + } + // Re-using this other code, very slight difference from original + // - Original code checks for MSB mask instead of 255 on trackPart->var_00 + // - Original code checks this first as its already set origin tile, probably just a micro optimisation + window->SelectMapTiles(trackType, trackDirection, *mapCoords); + } + + gMapSelectArrowPosition.z = z; + if (_trackPlaceZ == 0) + { + // Raise z above all slopes and water + if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT) + { + int32_t highestZ = 0; + for (const auto& selectedTile : gMapSelectionTiles) + { + if (MapIsLocationValid(selectedTile)) + { + z = MapGetHighestZ(selectedTile); + if (z > highestZ) + highestZ = z; + } + } + } + // Loc6CC8BF: + // z = MapGetHighestZ(x >> 5, y >> 5); + } + // Loc6CC91B: + const auto& ted = GetTrackElementDescriptor(trackType); + trackBlock = ted.Block; + int32_t bx = 0; + do + { + bx = std::min(bx, trackBlock->z); + trackBlock++; + } while (trackBlock->index != 255); + z -= bx; + + gMapSelectArrowPosition.z = z; + _currentTrackBegin.x = mapCoords->x; + _currentTrackBegin.y = mapCoords->y; + _currentTrackBegin.z = z; + if ((_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK) && _currentTrackBegin == _previousTrackPiece) + { + MapInvalidateMapSelectionTiles(); + return; + } + + _previousTrackPiece = _currentTrackBegin; + // search for appropriate z value for ghost, up to max ride height + int numAttempts = (z <= MAX_TRACK_HEIGHT ? ((MAX_TRACK_HEIGHT - z) / COORDS_Z_STEP + 1) : 2); + + if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) + { + for (int zAttempts = 0; zAttempts < numAttempts; ++zAttempts) + { + CoordsXYZ trackPos{}; + WindowRideConstructionUpdateState( + &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &trackPos, nullptr); + _currentTrackPrice = PlaceProvisionalTrackPiece( + rideIndex, trackType, trackDirection, liftHillAndAlternativeState, trackPos); + if (_currentTrackPrice != kMoney64Undefined) + break; + + _currentTrackBegin.z -= 8; + if (_currentTrackBegin.z < 0) + break; + + _currentTrackBegin.z += 16; + } + + auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); + ContextBroadcastIntent(&intent); + MapInvalidateMapSelectionTiles(); + return; + } - if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) - { for (int zAttempts = 0; zAttempts < numAttempts; ++zAttempts) { CoordsXYZ trackPos{}; @@ -3273,6 +3332,8 @@ void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords) &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &trackPos, nullptr); _currentTrackPrice = PlaceProvisionalTrackPiece( rideIndex, trackType, trackDirection, liftHillAndAlternativeState, trackPos); + mapCoords = trackPos; + z = trackPos.z; if (_currentTrackPrice != kMoney64Undefined) break; @@ -3283,1287 +3344,1274 @@ void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords) _currentTrackBegin.z += 16; } - auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); - ContextBroadcastIntent(&intent); - MapInvalidateMapSelectionTiles(); - return; - } - - for (int zAttempts = 0; zAttempts < numAttempts; ++zAttempts) - { - CoordsXYZ trackPos{}; - WindowRideConstructionUpdateState( - &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &trackPos, nullptr); - _currentTrackPrice = PlaceProvisionalTrackPiece( - rideIndex, trackType, trackDirection, liftHillAndAlternativeState, trackPos); - mapCoords = trackPos; - z = trackPos.z; - if (_currentTrackPrice != kMoney64Undefined) - break; - - _currentTrackBegin.z -= 8; - if (_currentTrackBegin.z < 0) - break; - - _currentTrackBegin.z += 16; - } - - if (_autoRotatingShop && _rideConstructionState == RideConstructionState::Place - && ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY)) - { - PathElement* pathsByDir[NumOrthogonalDirections]; - - bool keepOrientation = false; - for (int8_t i = 0; i < NumOrthogonalDirections; i++) + if (_autoRotatingShop && _rideConstructionState == RideConstructionState::Place + && ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY)) { - const auto testLoc = CoordsXYZ{ *mapCoords + CoordsDirectionDelta[i], z }; - if (!MapIsLocationOwned(testLoc)) + PathElement* pathsByDir[NumOrthogonalDirections]; + + bool keepOrientation = false; + for (int8_t i = 0; i < NumOrthogonalDirections; i++) { - pathsByDir[i] = nullptr; - continue; - } + const auto testLoc = CoordsXYZ{ *mapCoords + CoordsDirectionDelta[i], z }; + if (!MapIsLocationOwned(testLoc)) + { + pathsByDir[i] = nullptr; + continue; + } - pathsByDir[i] = MapGetFootpathElement(testLoc); + pathsByDir[i] = MapGetFootpathElement(testLoc); - if (pathsByDir[i] != nullptr && pathsByDir[i]->IsSloped() && pathsByDir[i]->GetSlopeDirection() != i) - { - pathsByDir[i] = nullptr; - } - - // Sloped path on the level below - if (pathsByDir[i] == nullptr) - { - pathsByDir[i] = MapGetFootpathElement({ *mapCoords + CoordsDirectionDelta[i], z - PATH_HEIGHT_STEP }); - - if (pathsByDir[i] != nullptr - && (!pathsByDir[i]->IsSloped() || pathsByDir[i]->GetSlopeDirection() != DirectionReverse(i))) + if (pathsByDir[i] != nullptr && pathsByDir[i]->IsSloped() && pathsByDir[i]->GetSlopeDirection() != i) { pathsByDir[i] = nullptr; } - } - if (pathsByDir[i] != nullptr && pathsByDir[i]->IsQueue()) - { - pathsByDir[i] = nullptr; - } - - if (pathsByDir[i] != nullptr && i == _currentTrackPieceDirection) - { - keepOrientation = true; - break; - } - } - - if (!keepOrientation) - { - for (int8_t i = 0; i < NumOrthogonalDirections; i++) - { - if (pathsByDir[i] != nullptr) + // Sloped path on the level below + if (pathsByDir[i] == nullptr) { - _currentTrackPieceDirection = i; + pathsByDir[i] = MapGetFootpathElement({ *mapCoords + CoordsDirectionDelta[i], z - PATH_HEIGHT_STEP }); - CoordsXYZ trackPos{}; - WindowRideConstructionUpdateState( - &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &trackPos, nullptr); - PlaceProvisionalTrackPiece(rideIndex, trackType, trackDirection, liftHillAndAlternativeState, trackPos); - gMapSelectArrowDirection = _currentTrackPieceDirection; + if (pathsByDir[i] != nullptr + && (!pathsByDir[i]->IsSloped() || pathsByDir[i]->GetSlopeDirection() != DirectionReverse(i))) + { + pathsByDir[i] = nullptr; + } + } + + if (pathsByDir[i] != nullptr && pathsByDir[i]->IsQueue()) + { + pathsByDir[i] = nullptr; + } + + if (pathsByDir[i] != nullptr && i == _currentTrackPieceDirection) + { + keepOrientation = true; break; } } + + if (!keepOrientation) + { + for (int8_t i = 0; i < NumOrthogonalDirections; i++) + { + if (pathsByDir[i] != nullptr) + { + _currentTrackPieceDirection = i; + + CoordsXYZ trackPos{}; + WindowRideConstructionUpdateState( + &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &trackPos, nullptr); + PlaceProvisionalTrackPiece(rideIndex, trackType, trackDirection, liftHillAndAlternativeState, trackPos); + gMapSelectArrowDirection = _currentTrackPieceDirection; + break; + } + } + } } - } - WindowRideConstructionUpdateActiveElements(); - MapInvalidateMapSelectionTiles(); -} - -/** - * - * rct2: 0x006CD354 - */ -void RideConstructionToolupdateEntranceExit(const ScreenCoordsXY& screenCoords) -{ - MapInvalidateSelectionRect(); - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - CoordsXYZD entranceOrExitCoords = RideGetEntranceOrExitPositionFromScreenPosition(screenCoords); - if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) - { - RideConstructionInvalidateCurrentTrack(); - return; - } - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; - gMapSelectType = MAP_SELECT_TYPE_FULL; - gMapSelectPositionA = entranceOrExitCoords; - gMapSelectPositionB = entranceOrExitCoords; - gMapSelectArrowPosition = entranceOrExitCoords; - gMapSelectArrowDirection = DirectionReverse(entranceOrExitCoords.direction); - MapInvalidateSelectionRect(); - - entranceOrExitCoords.direction = DirectionReverse(gRideEntranceExitPlaceDirection); - StationIndex stationNum = gRideEntranceExitPlaceStationIndex; - if (!(_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT) - || entranceOrExitCoords != gRideEntranceExitGhostPosition || stationNum != gRideEntranceExitGhostStationIndex) - { - auto ride = GetRide(_currentRideIndex); - if (ride != nullptr) - { - _currentTrackPrice = RideEntranceExitPlaceGhost( - *ride, entranceOrExitCoords, entranceOrExitCoords.direction, gRideEntranceExitPlaceType, stationNum); - } WindowRideConstructionUpdateActiveElements(); + MapInvalidateMapSelectionTiles(); } -} -/** - * - * rct2: 0x006CCA73 - */ -void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords) -{ - const CursorState* state = ContextGetCursorState(); - - WindowBase* w; - - MapInvalidateMapSelectionTiles(); - RideConstructionInvalidateCurrentTrack(); - - CoordsXYZ mapCoords{}; - int32_t trackType, z, highestZ; - - if (WindowRideConstructionUpdateState(&trackType, nullptr, nullptr, nullptr, nullptr, nullptr)) - return; - - z = mapCoords.z; - _currentTrackPieceType = trackType; - - // Raise z above all slopes and water - highestZ = 0; - if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT) + /** + * + * rct2: 0x006CD354 + */ + void RideConstructionToolupdateEntranceExit(const ScreenCoordsXY& screenCoords) { - for (const auto& selectedTile : gMapSelectionTiles) + MapInvalidateSelectionRect(); + MapInvalidateMapSelectionTiles(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + CoordsXYZD entranceOrExitCoords = RideGetEntranceOrExitPositionFromScreenPosition(screenCoords); + if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) { - if (!MapIsLocationValid(selectedTile)) - continue; + RideConstructionInvalidateCurrentTrack(); + return; + } + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; + gMapSelectType = MAP_SELECT_TYPE_FULL; + gMapSelectPositionA = entranceOrExitCoords; + gMapSelectPositionB = entranceOrExitCoords; + gMapSelectArrowPosition = entranceOrExitCoords; + gMapSelectArrowDirection = DirectionReverse(entranceOrExitCoords.direction); + MapInvalidateSelectionRect(); - z = MapGetHighestZ(selectedTile); - if (z > highestZ) - highestZ = z; + entranceOrExitCoords.direction = DirectionReverse(gRideEntranceExitPlaceDirection); + StationIndex stationNum = gRideEntranceExitPlaceStationIndex; + if (!(_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT) + || entranceOrExitCoords != gRideEntranceExitGhostPosition || stationNum != gRideEntranceExitGhostStationIndex) + { + auto ride = GetRide(_currentRideIndex); + if (ride != nullptr) + { + _currentTrackPrice = RideEntranceExitPlaceGhost( + *ride, entranceOrExitCoords, entranceOrExitCoords.direction, gRideEntranceExitPlaceType, stationNum); + } + WindowRideConstructionUpdateActiveElements(); } } - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - auto ridePlacePosition = RideGetPlacePositionFromScreenPosition(screenCoords); - if (!ridePlacePosition) - return; - - mapCoords = { *ridePlacePosition, z }; - - z = _trackPlaceZ; - if (z == 0) - z = MapGetHighestZ(mapCoords); - - ToolCancel(); - - auto ride = GetRide(_currentRideIndex); - if (ride == nullptr) - return; - - if (_trackPlaceZ == 0) + /** + * + * rct2: 0x006CCA73 + */ + void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords) { - const auto& ted = GetTrackElementDescriptor(_currentTrackPieceType); - const PreviewTrack* trackBlock = ted.Block; - int32_t bx = 0; - do - { - bx = std::min(bx, trackBlock->z); - trackBlock++; - } while (trackBlock->index != 255); - z -= bx; + const CursorState* state = ContextGetCursorState(); - // FIX not sure exactly why it starts trial and error place from a lower Z, but it causes issues with disable clearance - if (!gCheatsDisableClearanceChecks && z > kMinimumLandZ) + WindowBase* w; + + MapInvalidateMapSelectionTiles(); + RideConstructionInvalidateCurrentTrack(); + + CoordsXYZ mapCoords{}; + int32_t trackType, z, highestZ; + + if (WindowRideConstructionUpdateState(&trackType, nullptr, nullptr, nullptr, nullptr, nullptr)) + return; + + z = mapCoords.z; + _currentTrackPieceType = trackType; + + // Raise z above all slopes and water + highestZ = 0; + if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT) { - z -= LAND_HEIGHT_STEP; + for (const auto& selectedTile : gMapSelectionTiles) + { + if (!MapIsLocationValid(selectedTile)) + continue; + + z = MapGetHighestZ(selectedTile); + if (z > highestZ) + highestZ = z; + } } - } - else - { + + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + auto ridePlacePosition = RideGetPlacePositionFromScreenPosition(screenCoords); + if (!ridePlacePosition) + return; + + mapCoords = { *ridePlacePosition, z }; + z = _trackPlaceZ; - } + if (z == 0) + z = MapGetHighestZ(mapCoords); - // search for z value to build at, up to max ride height - int numAttempts = (z <= MAX_TRACK_HEIGHT ? ((MAX_TRACK_HEIGHT - z) / COORDS_Z_STEP + 1) : 2); + ToolCancel(); + + auto ride = GetRide(_currentRideIndex); + if (ride == nullptr) + return; + + if (_trackPlaceZ == 0) + { + const auto& ted = GetTrackElementDescriptor(_currentTrackPieceType); + const PreviewTrack* trackBlock = ted.Block; + int32_t bx = 0; + do + { + bx = std::min(bx, trackBlock->z); + trackBlock++; + } while (trackBlock->index != 255); + z -= bx; + + // FIX not sure exactly why it starts trial and error place from a lower Z, but it causes issues with disable + // clearance + if (!GetGameState().Cheats.DisableClearanceChecks && z > kMinimumLandZ) + { + z -= LAND_HEIGHT_STEP; + } + } + else + { + z = _trackPlaceZ; + } + + // search for z value to build at, up to max ride height + int numAttempts = (z <= MAX_TRACK_HEIGHT ? ((MAX_TRACK_HEIGHT - z) / COORDS_Z_STEP + 1) : 2); + + const auto& rtd = ride->GetRideTypeDescriptor(); + if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) + { + for (int32_t zAttempts = 0; zAttempts < numAttempts; ++zAttempts) + { + _rideConstructionState = RideConstructionState::MazeBuild; + _currentTrackBegin.x = mapCoords.x; + _currentTrackBegin.y = mapCoords.y; + _currentTrackBegin.z = z; + _currentTrackSelectionFlags = 0; + auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); + ContextBroadcastIntent(&intent); + w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr) + break; + + gDisableErrorWindowSound = true; + + auto gameAction = MazeSetTrackAction( + CoordsXYZD{ _currentTrackBegin, 0 }, true, _currentRideIndex, GC_SET_MAZE_TRACK_BUILD); + auto mazeSetTrackResult = GameActions::Execute(&gameAction); + if (mazeSetTrackResult.Error == GameActions::Status::Ok) + { + _trackPlaceCost = mazeSetTrackResult.Cost; + _trackPlaceErrorMessage = STR_NONE; + } + else + { + _trackPlaceCost = kMoney64Undefined; + _trackPlaceErrorMessage = std::get(mazeSetTrackResult.ErrorMessage); + } + + gDisableErrorWindowSound = false; + + if (mazeSetTrackResult.Error != GameActions::Status::Ok) + { + _rideConstructionState = RideConstructionState::Place; + StringId errorText = std::get(mazeSetTrackResult.ErrorMessage); + z -= 8; + if (errorText == STR_NOT_ENOUGH_CASH_REQUIRES || errorText == STR_CAN_ONLY_BUILD_THIS_UNDERWATER + || errorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER || errorText == STR_RIDE_CANT_BUILD_THIS_UNDERWATER + || errorText == STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND || errorText == STR_TOO_HIGH_FOR_SUPPORTS + || zAttempts == (numAttempts - 1) || z < 0) + { + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Error, 0, state->position.x); + w = WindowFindByClass(WindowClass::RideConstruction); + if (w != nullptr) + { + ToolSet(*w, WIDX_CONSTRUCT, Tool::Crosshair); + InputSetFlag(INPUT_FLAG_6, true); + _trackPlaceCtrlState = false; + _trackPlaceShiftState = false; + } + auto intent2 = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); + ContextBroadcastIntent(&intent2); + break; + } + z += 16; + } + else + { + WindowCloseByClass(WindowClass::Error); + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, _currentTrackBegin); + break; + } + } + return; + } - const auto& rtd = ride->GetRideTypeDescriptor(); - if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) - { for (int32_t zAttempts = 0; zAttempts < numAttempts; ++zAttempts) { - _rideConstructionState = RideConstructionState::MazeBuild; + _rideConstructionState = RideConstructionState::Front; _currentTrackBegin.x = mapCoords.x; _currentTrackBegin.y = mapCoords.y; _currentTrackBegin.z = z; _currentTrackSelectionFlags = 0; - auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); - ContextBroadcastIntent(&intent); + WindowRideConstructionUpdateActiveElements(); w = WindowFindByClass(WindowClass::RideConstruction); if (w == nullptr) break; gDisableErrorWindowSound = true; - - auto gameAction = MazeSetTrackAction( - CoordsXYZD{ _currentTrackBegin, 0 }, true, _currentRideIndex, GC_SET_MAZE_TRACK_BUILD); - auto mazeSetTrackResult = GameActions::Execute(&gameAction); - if (mazeSetTrackResult.Error == GameActions::Status::Ok) - { - _trackPlaceCost = mazeSetTrackResult.Cost; - _trackPlaceErrorMessage = STR_NONE; - } - else - { - _trackPlaceCost = kMoney64Undefined; - _trackPlaceErrorMessage = std::get(mazeSetTrackResult.ErrorMessage); - } - + w->OnMouseUp(WIDX_CONSTRUCT); gDisableErrorWindowSound = false; - if (mazeSetTrackResult.Error != GameActions::Status::Ok) + if (_trackPlaceCost == kMoney64Undefined) { - _rideConstructionState = RideConstructionState::Place; - StringId errorText = std::get(mazeSetTrackResult.ErrorMessage); + StringId errorText = _trackPlaceErrorMessage; z -= 8; if (errorText == STR_NOT_ENOUGH_CASH_REQUIRES || errorText == STR_CAN_ONLY_BUILD_THIS_UNDERWATER - || errorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER || errorText == STR_RIDE_CANT_BUILD_THIS_UNDERWATER - || errorText == STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND || errorText == STR_TOO_HIGH_FOR_SUPPORTS + || errorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER || errorText == STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND + || errorText == STR_TOO_HIGH_FOR_SUPPORTS || errorText == STR_TOO_HIGH + || errorText == STR_LOCAL_AUTHORITY_WONT_ALLOW_CONSTRUCTION_ABOVE_TREE_HEIGHT || zAttempts == (numAttempts - 1) || z < 0) { + int32_t saveTrackDirection = _currentTrackPieceDirection; + auto saveCurrentTrackCurve = _currentTrackCurve; + auto savePreviousTrackPitchEnd = _previousTrackPitchEnd; + auto saveCurrentTrackPitchEnd = _currentTrackPitchEnd; + auto savePreviousTrackRollEnd = _previousTrackRollEnd; + auto saveCurrentTrackRollEnd = _currentTrackRollEnd; + int32_t saveCurrentTrackAlternative = _currentTrackAlternative; + int32_t saveCurrentTrackLiftHill = _currentTrackLiftHill; + + RideInitialiseConstructionWindow(*ride); + + _currentTrackPieceDirection = saveTrackDirection; + _currentTrackCurve = saveCurrentTrackCurve; + _previousTrackPitchEnd = savePreviousTrackPitchEnd; + _currentTrackPitchEnd = saveCurrentTrackPitchEnd; + _previousTrackRollEnd = savePreviousTrackRollEnd; + _currentTrackRollEnd = saveCurrentTrackRollEnd; + _currentTrackAlternative = saveCurrentTrackAlternative; + _currentTrackLiftHill = saveCurrentTrackLiftHill; + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Error, 0, state->position.x); - w = WindowFindByClass(WindowClass::RideConstruction); - if (w != nullptr) - { - ToolSet(*w, WIDX_CONSTRUCT, Tool::Crosshair); - InputSetFlag(INPUT_FLAG_6, true); - _trackPlaceCtrlState = false; - _trackPlaceShiftState = false; - } - auto intent2 = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); - ContextBroadcastIntent(&intent2); break; } + z += 16; } else { - WindowCloseByClass(WindowClass::Error); - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, _currentTrackBegin); break; } } - return; } - for (int32_t zAttempts = 0; zAttempts < numAttempts; ++zAttempts) + void WindowRideConstructionKeyboardShortcutTurnLeft() { - _rideConstructionState = RideConstructionState::Front; - _currentTrackBegin.x = mapCoords.x; - _currentTrackBegin.y = mapCoords.y; - _currentTrackBegin.z = z; - _currentTrackSelectionFlags = 0; - WindowRideConstructionUpdateActiveElements(); - w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr) - break; - - gDisableErrorWindowSound = true; - WindowEventMouseUpCall(w, WIDX_CONSTRUCT); - gDisableErrorWindowSound = false; - - if (_trackPlaceCost == kMoney64Undefined) + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) { - StringId errorText = _trackPlaceErrorMessage; - z -= 8; - if (errorText == STR_NOT_ENOUGH_CASH_REQUIRES || errorText == STR_CAN_ONLY_BUILD_THIS_UNDERWATER - || errorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER || errorText == STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND - || errorText == STR_TOO_HIGH_FOR_SUPPORTS || errorText == STR_TOO_HIGH - || errorText == STR_LOCAL_AUTHORITY_WONT_ALLOW_CONSTRUCTION_ABOVE_TREE_HEIGHT || zAttempts == (numAttempts - 1) - || z < 0) - { - int32_t saveTrackDirection = _currentTrackPieceDirection; - auto saveCurrentTrackCurve = _currentTrackCurve; - auto savePreviousTrackPitchEnd = _previousTrackPitchEnd; - auto saveCurrentTrackPitchEnd = _currentTrackPitchEnd; - auto savePreviousTrackRollEnd = _previousTrackRollEnd; - auto saveCurrentTrackRollEnd = _currentTrackRollEnd; - int32_t saveCurrentTrackAlternative = _currentTrackAlternative; - int32_t saveCurrentTrackLiftHill = _currentTrackLiftHill; + return; + } - RideInitialiseConstructionWindow(*ride); - - _currentTrackPieceDirection = saveTrackDirection; - _currentTrackCurve = saveCurrentTrackCurve; - _previousTrackPitchEnd = savePreviousTrackPitchEnd; - _currentTrackPitchEnd = saveCurrentTrackPitchEnd; - _previousTrackRollEnd = savePreviousTrackRollEnd; - _currentTrackRollEnd = saveCurrentTrackRollEnd; - _currentTrackAlternative = saveCurrentTrackAlternative; - _currentTrackLiftHill = saveCurrentTrackLiftHill; - - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Error, 0, state->position.x); + switch (_currentTrackCurve) + { + case EnumValue(TrackCurve::LeftSmall): + if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) + && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + } break; - } + case EnumValue(TrackCurve::Left): + if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) + && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) + && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::LeftLarge): + if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) + && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) + && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::None): + if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) + && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) + && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) + && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::RightLarge): + if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_STRAIGHT); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) + && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) + && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) + && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::Right): + if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) + && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_STRAIGHT); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) + && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) + && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) + && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::RightSmall): + if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) + && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_STRAIGHT); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) + && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) + && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) + && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::RightVerySmall): + if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) + && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_STRAIGHT); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) + && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) + && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) + && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + default: + return; + } + } - z += 16; + void WindowRideConstructionKeyboardShortcutTurnRight() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) + { + return; + } + + switch (_currentTrackCurve) + { + case EnumValue(TrackCurve::RightSmall): + if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + } + break; + case EnumValue(TrackCurve::Right): + if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::RightLarge): + if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::None): + if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) + && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::LeftLarge): + if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_STRAIGHT); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) + && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::Left): + if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) + && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_STRAIGHT); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) + && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::LeftSmall): + if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) + && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_STRAIGHT); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) + && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + case EnumValue(TrackCurve::LeftVerySmall): + if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) + && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + } + else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) + && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + } + else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_STRAIGHT); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) + && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + } + else if ( + !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) + && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + } + else + { + return; + } + break; + default: + return; + } + } + + void WindowRideConstructionKeyboardShortcutUseTrackDefault() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) + { + return; + } + + if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_STRAIGHT); + } + + if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEVEL); + } + + if (!WidgetIsDisabled(*w, WIDX_CHAIN_LIFT) && w->widgets[WIDX_CHAIN_LIFT].type != WindowWidgetType::Empty + && _currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED) + { + w->OnMouseDown(WIDX_CHAIN_LIFT); + } + + if (!WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_BANK_STRAIGHT); + } + } + + void WindowRideConstructionKeyboardShortcutSlopeDown() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) + { + return; + } + + switch (_currentTrackPitchEnd) + { + case TrackPitch::Down60: + if (IsTrackEnabled(TRACK_SLOPE_VERTICAL) && !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) + && w->widgets[WIDX_SLOPE_UP_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_DROP + && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + } + break; + case TrackPitch::Down25: + if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) + && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + } + break; + case TrackPitch::None: + if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_DOWN); + } + else if ( + IsTrackEnabled(TRACK_SLOPE_VERTICAL) + && w->widgets[WIDX_SLOPE_DOWN_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_RISE) + { + return; + } + else if ( + !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) + && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + } + else + { + return; + } + break; + case TrackPitch::Up25: + if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEVEL); + } + else if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_DOWN); + } + else if ( + !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) + && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + } + else + { + return; + } + break; + case TrackPitch::Up60: + if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_UP); + } + else if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEVEL); + } + else if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_DOWN); + } + else if ( + IsTrackEnabled(TRACK_SLOPE_VERTICAL) + && w->widgets[WIDX_SLOPE_DOWN_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_RISE) + { + return; + } + else if ( + !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) + && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + } + else + { + return; + } + break; + case TrackPitch::Up90: + if (IsTrackEnabled(TRACK_SLOPE_VERTICAL) && !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) + && w->widgets[WIDX_SLOPE_DOWN_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_RISE + && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + } + break; + default: + return; + } + } + + void WindowRideConstructionKeyboardShortcutSlopeUp() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) + { + return; + } + + switch (_currentTrackPitchEnd) + { + case TrackPitch::Up60: + if (IsTrackEnabled(TRACK_SLOPE_VERTICAL) && !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) + && w->widgets[WIDX_SLOPE_DOWN_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_RISE + && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + } + break; + case TrackPitch::Up25: + if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) + && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + } + break; + case TrackPitch::None: + if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_UP); + } + else if ( + IsTrackEnabled(TRACK_SLOPE_VERTICAL) + && w->widgets[WIDX_SLOPE_UP_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_DROP) + { + return; + } + else if ( + !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) + && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + } + else + { + return; + } + break; + case TrackPitch::Down25: + if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEVEL); + } + else if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_UP); + } + else if ( + !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) + && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + } + else + { + return; + } + break; + case TrackPitch::Down60: + if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_DOWN); + } + else if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_LEVEL); + } + else if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_UP); + } + else if ( + IsTrackEnabled(TRACK_SLOPE_VERTICAL) + && w->widgets[WIDX_SLOPE_UP_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_DROP) + { + return; + } + else if ( + !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) + && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + } + else + { + return; + } + break; + case TrackPitch::Down90: + if (IsTrackEnabled(TRACK_SLOPE_VERTICAL) && !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) + && w->widgets[WIDX_SLOPE_UP_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_DROP + && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + } + break; + default: + return; + } + } + + void WindowRideConstructionKeyboardShortcutChainLiftToggle() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_CHAIN_LIFT) + || w->widgets[WIDX_CHAIN_LIFT].type == WindowWidgetType::Empty) + { + return; + } + + w->OnMouseDown(WIDX_CHAIN_LIFT); + } + + void WindowRideConstructionKeyboardShortcutBankLeft() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) + || w->widgets[WIDX_BANK_STRAIGHT].type == WindowWidgetType::Empty) + { + return; + } + + switch (_currentTrackRollEnd) + { + case TrackRoll::None: + if (!WidgetIsDisabled(*w, WIDX_BANK_LEFT) && w->widgets[WIDX_BANK_LEFT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_BANK_LEFT); + } + break; + case TrackRoll::Right: + if (!WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_BANK_STRAIGHT); + } + else if (!WidgetIsDisabled(*w, WIDX_BANK_LEFT) && w->widgets[WIDX_BANK_LEFT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_BANK_LEFT); + } + else + { + return; + } + break; + default: + return; + } + } + + void WindowRideConstructionKeyboardShortcutBankRight() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) + || w->widgets[WIDX_BANK_STRAIGHT].type == WindowWidgetType::Empty) + { + return; + } + + switch (_currentTrackRollEnd) + { + case TrackRoll::None: + if (!WidgetIsDisabled(*w, WIDX_BANK_RIGHT) && w->widgets[WIDX_BANK_RIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_BANK_RIGHT); + } + break; + case TrackRoll::Left: + if (!WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_BANK_STRAIGHT); + } + else if (!WidgetIsDisabled(*w, WIDX_BANK_RIGHT) && w->widgets[WIDX_BANK_RIGHT].type != WindowWidgetType::Empty) + { + w->OnMouseDown(WIDX_BANK_RIGHT); + } + else + { + return; + } + break; + default: + return; + } + } + + void WindowRideConstructionKeyboardShortcutPreviousTrack() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_PREVIOUS_SECTION) + || w->widgets[WIDX_PREVIOUS_SECTION].type == WindowWidgetType::Empty) + { + return; + } + + w->OnMouseUp(WIDX_PREVIOUS_SECTION); + } + + void WindowRideConstructionKeyboardShortcutNextTrack() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_NEXT_SECTION) + || w->widgets[WIDX_NEXT_SECTION].type == WindowWidgetType::Empty) + { + return; + } + + w->OnMouseUp(WIDX_NEXT_SECTION); + } + + void WindowRideConstructionKeyboardShortcutBuildCurrent() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_CONSTRUCT) || w->widgets[WIDX_CONSTRUCT].type == WindowWidgetType::Empty) + { + return; + } + + w->OnMouseUp(WIDX_CONSTRUCT); + } + + void WindowRideConstructionKeyboardShortcutDemolishCurrent() + { + WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); + if (w == nullptr || WidgetIsDisabled(*w, WIDX_DEMOLISH) || w->widgets[WIDX_DEMOLISH].type == WindowWidgetType::Empty) + { + return; + } + + w->OnMouseUp(WIDX_DEMOLISH); + } + + static void WindowRideConstructionMouseUpDemolishNextPiece(const CoordsXYZD& piecePos, int32_t type) + { + if (_gotoStartPlacementMode) + { + _currentTrackBegin.z = Floor2(piecePos.z, COORDS_Z_STEP); + _rideConstructionState = RideConstructionState::Front; + _currentTrackSelectionFlags = 0; + _currentTrackPieceDirection = piecePos.direction & 3; + auto savedCurrentTrackCurve = _currentTrackCurve; + auto savedPreviousTrackPitchEnd = _previousTrackPitchEnd; + auto savedCurrentTrackPitchEnd = _currentTrackPitchEnd; + auto savedPreviousTrackRollEnd = _previousTrackRollEnd; + auto savedCurrentTrackRollEnd = _currentTrackRollEnd; + int32_t savedCurrentTrackAlternative = _currentTrackAlternative; + int32_t savedCurrentTrackLiftHill = _currentTrackLiftHill; + RideConstructionSetDefaultNextPiece(); + WindowRideConstructionUpdateActiveElements(); + auto ride = GetRide(_currentRideIndex); + if (!RideTryGetOriginElement(*ride, nullptr)) + { + RideInitialiseConstructionWindow(*ride); + _currentTrackPieceDirection = piecePos.direction & 3; + if (!(savedCurrentTrackCurve & RideConstructionSpecialPieceSelected)) + { + _currentTrackCurve = savedCurrentTrackCurve; + _previousTrackPitchEnd = savedPreviousTrackPitchEnd; + _currentTrackPitchEnd = savedCurrentTrackPitchEnd; + _previousTrackRollEnd = savedPreviousTrackRollEnd; + _currentTrackRollEnd = savedCurrentTrackRollEnd; + _currentTrackAlternative = savedCurrentTrackAlternative; + _currentTrackLiftHill = savedCurrentTrackLiftHill; + WindowRideConstructionUpdateActiveElements(); + } + } } else { - break; + if (_rideConstructionState2 == RideConstructionState::Selected + || _rideConstructionState2 == RideConstructionState::Front) + { + if (type == TrackElemType::MiddleStation || type == TrackElemType::BeginStation) + { + type = TrackElemType::EndStation; + } + } + if (_rideConstructionState2 == RideConstructionState::Back) + { + if (type == TrackElemType::MiddleStation) + { + type = TrackElemType::BeginStation; + } + } + if (NetworkGetMode() == NETWORK_MODE_CLIENT) + { + // rideConstructionState needs to be set again to the proper value, this only affects the client + _rideConstructionState = RideConstructionState::Selected; + } + _currentTrackBegin = piecePos; + _currentTrackPieceDirection = piecePos.direction; + _currentTrackPieceType = type; + _currentTrackSelectionFlags = 0; + if (_rideConstructionState2 == RideConstructionState::Front) + { + RideSelectNextSection(); + } + else if (_rideConstructionState2 == RideConstructionState::Back) + { + RideSelectPreviousSection(); + } + WindowRideConstructionUpdateActiveElements(); } } -} - -void WindowRideConstructionKeyboardShortcutTurnLeft() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) - { - return; - } - - switch (_currentTrackCurve) - { - case EnumValue(TrackCurve::LeftSmall): - if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) - && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); - } - break; - case EnumValue(TrackCurve::Left): - if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) - && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) - && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::LeftLarge): - if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) - && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) - && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::None): - if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) - && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) - && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) - && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::RightLarge): - if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) - && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) - && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) - && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::Right): - if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) - && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) - && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) - && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) - && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::RightSmall): - if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) - && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) - && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) - && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) - && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::RightVerySmall): - if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); - } - else if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) - && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) - && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) - && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) - && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - default: - return; - } -} - -void WindowRideConstructionKeyboardShortcutTurnRight() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) - { - return; - } - - switch (_currentTrackCurve) - { - case EnumValue(TrackCurve::RightSmall): - if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); - } - break; - case EnumValue(TrackCurve::Right): - if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::RightLarge): - if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::None): - if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) - && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::LeftLarge): - if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) - && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::Left): - if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) - && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) - && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::LeftSmall): - if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) - && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) - && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - case EnumValue(TrackCurve::LeftVerySmall): - if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) - && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); - } - else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) - && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) - && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); - } - else if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); - } - else if ( - !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) - && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); - } - else - { - return; - } - break; - default: - return; - } -} - -void WindowRideConstructionKeyboardShortcutUseTrackDefault() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) - { - return; - } - - if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); - } - - if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEVEL); - } - - if (!WidgetIsDisabled(*w, WIDX_CHAIN_LIFT) && w->widgets[WIDX_CHAIN_LIFT].type != WindowWidgetType::Empty - && _currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED) - { - WindowEventMouseDownCall(w, WIDX_CHAIN_LIFT); - } - - if (!WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_BANK_STRAIGHT); - } -} - -void WindowRideConstructionKeyboardShortcutSlopeDown() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) - { - return; - } - - switch (_currentTrackPitchEnd) - { - case TrackPitch::Down60: - if (IsTrackEnabled(TRACK_SLOPE_VERTICAL) && !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) - && w->widgets[WIDX_SLOPE_UP_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_DROP - && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); - } - break; - case TrackPitch::Down25: - if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) - && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); - } - break; - case TrackPitch::None: - if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN); - } - else if ( - IsTrackEnabled(TRACK_SLOPE_VERTICAL) - && w->widgets[WIDX_SLOPE_DOWN_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_RISE) - { - return; - } - else if ( - !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) - && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); - } - else - { - return; - } - break; - case TrackPitch::Up25: - if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEVEL); - } - else if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN); - } - else if ( - !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) - && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); - } - else - { - return; - } - break; - case TrackPitch::Up60: - if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP); - } - else if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEVEL); - } - else if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN); - } - else if ( - IsTrackEnabled(TRACK_SLOPE_VERTICAL) - && w->widgets[WIDX_SLOPE_DOWN_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_RISE) - { - return; - } - else if ( - !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) - && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); - } - else - { - return; - } - break; - case TrackPitch::Up90: - if (IsTrackEnabled(TRACK_SLOPE_VERTICAL) && !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) - && w->widgets[WIDX_SLOPE_DOWN_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_RISE - && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); - } - break; - default: - return; - } -} - -void WindowRideConstructionKeyboardShortcutSlopeUp() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) - { - return; - } - - switch (_currentTrackPitchEnd) - { - case TrackPitch::Up60: - if (IsTrackEnabled(TRACK_SLOPE_VERTICAL) && !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) - && w->widgets[WIDX_SLOPE_DOWN_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_RISE - && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); - } - break; - case TrackPitch::Up25: - if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); - } - break; - case TrackPitch::None: - if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP); - } - else if ( - IsTrackEnabled(TRACK_SLOPE_VERTICAL) - && w->widgets[WIDX_SLOPE_UP_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_DROP) - { - return; - } - else if ( - !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); - } - else - { - return; - } - break; - case TrackPitch::Down25: - if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEVEL); - } - else if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP); - } - else if ( - !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); - } - else - { - return; - } - break; - case TrackPitch::Down60: - if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN); - } - else if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_LEVEL); - } - else if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP); - } - else if ( - IsTrackEnabled(TRACK_SLOPE_VERTICAL) - && w->widgets[WIDX_SLOPE_UP_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_DROP) - { - return; - } - else if ( - !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); - } - else - { - return; - } - break; - case TrackPitch::Down90: - if (IsTrackEnabled(TRACK_SLOPE_VERTICAL) && !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) - && w->widgets[WIDX_SLOPE_UP_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_DROP - && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); - } - break; - default: - return; - } -} - -void WindowRideConstructionKeyboardShortcutChainLiftToggle() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_CHAIN_LIFT) || w->widgets[WIDX_CHAIN_LIFT].type == WindowWidgetType::Empty) - { - return; - } - - WindowEventMouseDownCall(w, WIDX_CHAIN_LIFT); -} - -void WindowRideConstructionKeyboardShortcutBankLeft() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) - || w->widgets[WIDX_BANK_STRAIGHT].type == WindowWidgetType::Empty) - { - return; - } - - switch (_currentTrackRollEnd) - { - case TrackRoll::None: - if (!WidgetIsDisabled(*w, WIDX_BANK_LEFT) && w->widgets[WIDX_BANK_LEFT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_BANK_LEFT); - } - break; - case TrackRoll::Right: - if (!WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_BANK_STRAIGHT); - } - else if (!WidgetIsDisabled(*w, WIDX_BANK_LEFT) && w->widgets[WIDX_BANK_LEFT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_BANK_LEFT); - } - else - { - return; - } - break; - default: - return; - } -} - -void WindowRideConstructionKeyboardShortcutBankRight() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) - || w->widgets[WIDX_BANK_STRAIGHT].type == WindowWidgetType::Empty) - { - return; - } - - switch (_currentTrackRollEnd) - { - case TrackRoll::None: - if (!WidgetIsDisabled(*w, WIDX_BANK_RIGHT) && w->widgets[WIDX_BANK_RIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_BANK_RIGHT); - } - break; - case TrackRoll::Left: - if (!WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_BANK_STRAIGHT); - } - else if (!WidgetIsDisabled(*w, WIDX_BANK_RIGHT) && w->widgets[WIDX_BANK_RIGHT].type != WindowWidgetType::Empty) - { - WindowEventMouseDownCall(w, WIDX_BANK_RIGHT); - } - else - { - return; - } - break; - default: - return; - } -} - -void WindowRideConstructionKeyboardShortcutPreviousTrack() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_PREVIOUS_SECTION) - || w->widgets[WIDX_PREVIOUS_SECTION].type == WindowWidgetType::Empty) - { - return; - } - - WindowEventMouseUpCall(w, WIDX_PREVIOUS_SECTION); -} - -void WindowRideConstructionKeyboardShortcutNextTrack() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_NEXT_SECTION) - || w->widgets[WIDX_NEXT_SECTION].type == WindowWidgetType::Empty) - { - return; - } - - WindowEventMouseUpCall(w, WIDX_NEXT_SECTION); -} - -void WindowRideConstructionKeyboardShortcutBuildCurrent() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_CONSTRUCT) || w->widgets[WIDX_CONSTRUCT].type == WindowWidgetType::Empty) - { - return; - } - - WindowEventMouseUpCall(w, WIDX_CONSTRUCT); -} - -void WindowRideConstructionKeyboardShortcutDemolishCurrent() -{ - WindowBase* w = WindowFindByClass(WindowClass::RideConstruction); - if (w == nullptr || WidgetIsDisabled(*w, WIDX_DEMOLISH) || w->widgets[WIDX_DEMOLISH].type == WindowWidgetType::Empty) - { - return; - } - - WindowEventMouseUpCall(w, WIDX_DEMOLISH); -} - -static void WindowRideConstructionMouseUpDemolishNextPiece(const CoordsXYZD& piecePos, int32_t type) -{ - if (_gotoStartPlacementMode) - { - _currentTrackBegin.z = Floor2(piecePos.z, COORDS_Z_STEP); - _rideConstructionState = RideConstructionState::Front; - _currentTrackSelectionFlags = 0; - _currentTrackPieceDirection = piecePos.direction & 3; - auto savedCurrentTrackCurve = _currentTrackCurve; - auto savedPreviousTrackPitchEnd = _previousTrackPitchEnd; - auto savedCurrentTrackPitchEnd = _currentTrackPitchEnd; - auto savedPreviousTrackRollEnd = _previousTrackRollEnd; - auto savedCurrentTrackRollEnd = _currentTrackRollEnd; - int32_t savedCurrentTrackAlternative = _currentTrackAlternative; - int32_t savedCurrentTrackLiftHill = _currentTrackLiftHill; - RideConstructionSetDefaultNextPiece(); - WindowRideConstructionUpdateActiveElements(); - auto ride = GetRide(_currentRideIndex); - if (!RideTryGetOriginElement(*ride, nullptr)) - { - RideInitialiseConstructionWindow(*ride); - _currentTrackPieceDirection = piecePos.direction & 3; - if (!(savedCurrentTrackCurve & RideConstructionSpecialPieceSelected)) - { - _currentTrackCurve = savedCurrentTrackCurve; - _previousTrackPitchEnd = savedPreviousTrackPitchEnd; - _currentTrackPitchEnd = savedCurrentTrackPitchEnd; - _previousTrackRollEnd = savedPreviousTrackRollEnd; - _currentTrackRollEnd = savedCurrentTrackRollEnd; - _currentTrackAlternative = savedCurrentTrackAlternative; - _currentTrackLiftHill = savedCurrentTrackLiftHill; - WindowRideConstructionUpdateActiveElements(); - } - } - } - else - { - if (_rideConstructionState2 == RideConstructionState::Selected - || _rideConstructionState2 == RideConstructionState::Front) - { - if (type == TrackElemType::MiddleStation || type == TrackElemType::BeginStation) - { - type = TrackElemType::EndStation; - } - } - if (_rideConstructionState2 == RideConstructionState::Back) - { - if (type == TrackElemType::MiddleStation) - { - type = TrackElemType::BeginStation; - } - } - if (NetworkGetMode() == NETWORK_MODE_CLIENT) - { - // rideConstructionState needs to be set again to the proper value, this only affects the client - _rideConstructionState = RideConstructionState::Selected; - } - _currentTrackBegin = piecePos; - _currentTrackPieceDirection = piecePos.direction; - _currentTrackPieceType = type; - _currentTrackSelectionFlags = 0; - if (_rideConstructionState2 == RideConstructionState::Front) - { - RideSelectNextSection(); - } - else if (_rideConstructionState2 == RideConstructionState::Back) - { - RideSelectPreviousSection(); - } - WindowRideConstructionUpdateActiveElements(); - } -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 3c580f9b9d..23604fcce9 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -29,40 +29,40 @@ #include #include -using namespace OpenRCT2; - -static constexpr StringId WINDOW_TITLE = STR_NONE; -static constexpr int32_t WH = 240; -static constexpr int32_t WW = 340; - -enum +namespace OpenRCT2::Ui::Windows { - PAGE_RIDES, - PAGE_SHOPS_AND_STALLS, - PAGE_KIOSKS_AND_FACILITIES, - PAGE_COUNT -}; + static constexpr StringId WINDOW_TITLE = STR_NONE; + static constexpr int32_t WH = 240; + static constexpr int32_t WW = 340; -enum WindowRideListWidgetIdx -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_PAGE_BACKGROUND, - WIDX_OPEN_CLOSE_ALL, - WIDX_CURRENT_INFORMATION_TYPE, - WIDX_INFORMATION_TYPE_DROPDOWN, - WIDX_SORT, - WIDX_TAB_1, - WIDX_TAB_2, - WIDX_TAB_3, - WIDX_LIST, - WIDX_CLOSE_LIGHT, - WIDX_OPEN_LIGHT, - WIDX_QUICK_DEMOLISH, -}; + enum + { + PAGE_RIDES, + PAGE_SHOPS_AND_STALLS, + PAGE_KIOSKS_AND_FACILITIES, + PAGE_COUNT + }; -// clang-format off + enum WindowRideListWidgetIdx + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_PAGE_BACKGROUND, + WIDX_OPEN_CLOSE_ALL, + WIDX_CURRENT_INFORMATION_TYPE, + WIDX_INFORMATION_TYPE_DROPDOWN, + WIDX_SORT, + WIDX_TAB_1, + WIDX_TAB_2, + WIDX_TAB_3, + WIDX_LIST, + WIDX_CLOSE_LIGHT, + WIDX_OPEN_LIGHT, + WIDX_QUICK_DEMOLISH, + }; + + // clang-format off static Widget _rideListWidgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, {340, 197}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab page background @@ -77,896 +77,903 @@ static Widget _rideListWidgets[] = { MakeWidget({320, 62}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_CLOSE_BUTTON_0) ), MakeWidget({320, 76}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_OPEN_BUTTON_0) ), MakeWidget({315, 90}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_QUICK_DEMOLISH_RIDE ), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -enum -{ - INFORMATION_TYPE_STATUS, - INFORMATION_TYPE_POPULARITY, - INFORMATION_TYPE_SATISFACTION, - INFORMATION_TYPE_PROFIT, - INFORMATION_TYPE_TOTAL_CUSTOMERS, - INFORMATION_TYPE_TOTAL_PROFIT, - INFORMATION_TYPE_CUSTOMERS, - INFORMATION_TYPE_AGE, - INFORMATION_TYPE_INCOME, - INFORMATION_TYPE_RUNNING_COST, - INFORMATION_TYPE_QUEUE_LENGTH, - INFORMATION_TYPE_QUEUE_TIME, - INFORMATION_TYPE_RELIABILITY, - INFORMATION_TYPE_DOWN_TIME, - INFORMATION_TYPE_GUESTS_FAVOURITE, - INFORMATION_TYPE_EXCITEMENT, - INFORMATION_TYPE_INTENSITY, - INFORMATION_TYPE_NAUSEA, - DROPDOWN_LIST_COUNT, -}; - -static constexpr StringId ride_info_type_string_mapping[DROPDOWN_LIST_COUNT] = { - STR_STATUS, - STR_POPULARITY, - STR_SATISFACTION, - STR_PROFIT, - STR_RIDE_LIST_TOTAL_CUSTOMERS, - STR_RIDE_LIST_TOTAL_PROFIT, - STR_RIDE_LIST_CUSTOMERS_PER_HOUR, - STR_RIDE_LIST_AGE, - STR_RIDE_LIST_INCOME, - STR_RIDE_LIST_RUNNING_COST, - STR_QUEUE_LENGTH, - STR_QUEUE_TIME, - STR_RELIABILITY, - STR_DOWN_TIME, - STR_GUESTS_FAVOURITE, - STR_RIDE_LIST_EXCITEMENT, - STR_RIDE_LIST_INTENSITY, - STR_RIDE_LIST_NAUSEA, -}; - -static constexpr StringId ride_list_statusbar_count_strings[PAGE_COUNT] = { - STR_NUMBER_RIDES, - STR_NUMBER_SHOPS_AND_STALLS, - STR_NUMBER_TOILETS_AND_INFORMATION_KIOSKS, -}; - -static constexpr bool ride_info_type_money_mapping[DROPDOWN_LIST_COUNT] = { - false, // Status - false, // Popularity - false, // Satisfaction - true, // Profit - false, // Total customers - true, // Total profit - false, // Customers - false, // Age - true, // Income - true, // Running_cost - false, // Queue length - false, // Queue time - false, // Reliability - false, // Down time - false, // Guests favourite - false, // Excitement - false, // Intensity - false, // Nausea -}; - -static constexpr StringId page_names[] = { - STR_RIDES, - STR_SHOPS_AND_STALLS, - STR_TOILETS_AND_INFORMATION_KIOSKS, -}; - -class RideListWindow final : public Window -{ -private: - bool _quickDemolishMode = false; - int32_t _windowRideListInformationType = INFORMATION_TYPE_STATUS; - - struct RideListEntry + enum { - RideId Id; - u8string Name; + INFORMATION_TYPE_STATUS, + INFORMATION_TYPE_POPULARITY, + INFORMATION_TYPE_SATISFACTION, + INFORMATION_TYPE_PROFIT, + INFORMATION_TYPE_TOTAL_CUSTOMERS, + INFORMATION_TYPE_TOTAL_PROFIT, + INFORMATION_TYPE_CUSTOMERS, + INFORMATION_TYPE_AGE, + INFORMATION_TYPE_INCOME, + INFORMATION_TYPE_RUNNING_COST, + INFORMATION_TYPE_QUEUE_LENGTH, + INFORMATION_TYPE_QUEUE_TIME, + INFORMATION_TYPE_RELIABILITY, + INFORMATION_TYPE_DOWN_TIME, + INFORMATION_TYPE_GUESTS_FAVOURITE, + INFORMATION_TYPE_EXCITEMENT, + INFORMATION_TYPE_INTENSITY, + INFORMATION_TYPE_NAUSEA, + DROPDOWN_LIST_COUNT, }; - std::vector _rideList; -public: - void OnOpen() override + static constexpr StringId ride_info_type_string_mapping[DROPDOWN_LIST_COUNT] = { + STR_STATUS, + STR_POPULARITY, + STR_SATISFACTION, + STR_PROFIT, + STR_RIDE_LIST_TOTAL_CUSTOMERS, + STR_RIDE_LIST_TOTAL_PROFIT, + STR_RIDE_LIST_CUSTOMERS_PER_HOUR, + STR_RIDE_LIST_AGE, + STR_RIDE_LIST_INCOME, + STR_RIDE_LIST_RUNNING_COST, + STR_QUEUE_LENGTH, + STR_QUEUE_TIME, + STR_RELIABILITY, + STR_DOWN_TIME, + STR_GUESTS_FAVOURITE, + STR_RIDE_LIST_EXCITEMENT, + STR_RIDE_LIST_INTENSITY, + STR_RIDE_LIST_NAUSEA, + }; + + static constexpr StringId ride_list_statusbar_count_strings[PAGE_COUNT] = { + STR_NUMBER_RIDES, + STR_NUMBER_SHOPS_AND_STALLS, + STR_NUMBER_TOILETS_AND_INFORMATION_KIOSKS, + }; + + static constexpr bool ride_info_type_money_mapping[DROPDOWN_LIST_COUNT] = { + false, // Status + false, // Popularity + false, // Satisfaction + true, // Profit + false, // Total customers + true, // Total profit + false, // Customers + false, // Age + true, // Income + true, // Running_cost + false, // Queue length + false, // Queue time + false, // Reliability + false, // Down time + false, // Guests favourite + false, // Excitement + false, // Intensity + false, // Nausea + }; + + static constexpr StringId page_names[] = { + STR_RIDES, + STR_SHOPS_AND_STALLS, + STR_TOILETS_AND_INFORMATION_KIOSKS, + }; + + class RideListWindow final : public Window { - widgets = _rideListWidgets; - WindowInitScrollWidgets(*this); - page = PAGE_RIDES; - selected_list_item = -1; - frame_no = 0; - min_width = 340; - min_height = 240; - max_width = 400; - max_height = 700; - RefreshList(); + private: + bool _quickDemolishMode = false; + int32_t _windowRideListInformationType = INFORMATION_TYPE_STATUS; - list_information_type = 0; - - _windowRideListInformationType = INFORMATION_TYPE_STATUS; - _quickDemolishMode = false; - } - - /** - * - * rct2: 0x006B38A7 - */ - void OnResize() override - { - if (width < min_width) + struct RideListEntry { - Invalidate(); - width = min_width; - } - if (height < min_height) + RideId Id; + u8string Name; + }; + std::vector _rideList; + + public: + void OnOpen() override { - Invalidate(); - height = min_height; + widgets = _rideListWidgets; + WindowInitScrollWidgets(*this); + page = PAGE_RIDES; + selected_list_item = -1; + frame_no = 0; + min_width = 340; + min_height = 240; + max_width = 400; + max_height = 700; + RefreshList(); + + list_information_type = 0; + + _windowRideListInformationType = INFORMATION_TYPE_STATUS; + _quickDemolishMode = false; } - widgets[WIDX_SORT].left = width - 60; - widgets[WIDX_SORT].right = width - 60 + 54; + /** + * + * rct2: 0x006B38A7 + */ + void OnResize() override + { + if (width < min_width) + { + Invalidate(); + width = min_width; + } + if (height < min_height) + { + Invalidate(); + height = min_height; + } - ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 150, 46 }, { width - 216, DROPDOWN_HEIGHT }); + widgets[WIDX_SORT].left = width - 60; + widgets[WIDX_SORT].right = width - 60 + 54; - // Refreshing the list can be a very intensive operation - // owing to its use of ride_has_any_track_elements(). - // This makes sure it's only refreshed every 64 ticks. - if (!(gCurrentRealTimeTicks & 0x3f)) + ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 150, 46 }, { width - 216, DROPDOWN_HEIGHT }); + + // Refreshing the list can be a very intensive operation + // owing to its use of ride_has_any_track_elements(). + // This makes sure it's only refreshed every 64 ticks. + if (!(gCurrentRealTimeTicks & 0x3f)) + { + RefreshList(); + } + } + + /** + * + * rct2: 0x006B3511 + */ + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + WindowClose(*this); + break; + case WIDX_SORT: + list_information_type = _windowRideListInformationType; + selected_list_item = -1; + RefreshList(); + break; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + if (page != widgetIndex - WIDX_TAB_1) + { + page = widgetIndex - WIDX_TAB_1; + frame_no = 0; + selected_list_item = -1; + if (page != PAGE_RIDES && _windowRideListInformationType > INFORMATION_TYPE_RUNNING_COST) + { + _windowRideListInformationType = INFORMATION_TYPE_STATUS; + } + RefreshList(); + } + break; + case WIDX_CLOSE_LIGHT: + CloseAllRides(); + break; + case WIDX_OPEN_LIGHT: + OpenAllRides(); + break; + case WIDX_QUICK_DEMOLISH: + if (NetworkGetMode() != NETWORK_MODE_CLIENT) + { + _quickDemolishMode = !_quickDemolishMode; + } + else + { + _quickDemolishMode = false; + } + Invalidate(); + break; + } + } + + /** + * + * rct2: 0x006B3532 + */ + void OnMouseDown(WidgetIndex widgetIndex) override + { + if (widgetIndex == WIDX_OPEN_CLOSE_ALL) + { + const auto& widget = widgets[widgetIndex]; + gDropdownItems[0].Format = STR_CLOSE_ALL; + gDropdownItems[1].Format = STR_OPEN_ALL; + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(), colours[1], 0, 2); + } + else if (widgetIndex == WIDX_INFORMATION_TYPE_DROPDOWN) + { + const auto& widget = widgets[widgetIndex - 1]; + + int32_t lastType; + if (page == PAGE_RIDES) + lastType = INFORMATION_TYPE_NAUSEA; + else + lastType = INFORMATION_TYPE_RUNNING_COST; + + int32_t numItems = 0; + int32_t selectedIndex = -1; + for (int32_t type = INFORMATION_TYPE_STATUS; type <= lastType; type++) + { + if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + if (ride_info_type_money_mapping[type]) + { + continue; + } + } + + if (type == _windowRideListInformationType) + { + selectedIndex = numItems; + } + + gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[numItems].Args = ride_info_type_string_mapping[type]; + numItems++; + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(), colours[1], 0, + Dropdown::Flag::StayOpen, numItems, widget.width() - 3); + if (selectedIndex != -1) + { + Dropdown::SetChecked(selectedIndex, true); + } + } + } + + /** + * + * rct2: 0x006B3547 + */ + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + { + if (widgetIndex == WIDX_OPEN_CLOSE_ALL) + { + if (dropdownIndex == 0) + { + CloseAllRides(); + } + else if (dropdownIndex == 1) + { + OpenAllRides(); + } + + Invalidate(); + } + else if (widgetIndex == WIDX_INFORMATION_TYPE_DROPDOWN) + { + if (dropdownIndex == -1) + return; + + int32_t informationType = INFORMATION_TYPE_STATUS; + uint32_t arg = static_cast(gDropdownItems[dropdownIndex].Args); + for (size_t i = 0; i < std::size(ride_info_type_string_mapping); i++) + { + if (arg == ride_info_type_string_mapping[i]) + { + informationType = static_cast(i); + } + } + + _windowRideListInformationType = informationType; + Invalidate(); + } + } + + /** + * + * rct2: 0x006B386B + */ + void OnUpdate() override + { + frame_no = (frame_no + 1) % 64; + WidgetInvalidate(*this, WIDX_TAB_1 + page); + if (_windowRideListInformationType != INFORMATION_TYPE_STATUS) + Invalidate(); + } + + /** + * + * rct2: 0x006B35A1 + */ + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + const auto newHeight = static_cast(_rideList.size() * SCROLLABLE_ROW_HEIGHT); + if (selected_list_item != -1) + { + selected_list_item = -1; + Invalidate(); + } + + auto top = newHeight - widgets[WIDX_LIST].bottom + widgets[WIDX_LIST].top + 21; + if (top < 0) + top = 0; + if (top < scrolls[0].v_top) + { + scrolls[0].v_top = top; + Invalidate(); + } + + return { 0, newHeight }; + } + + /** + * + * rct2: 0x006B361F + */ + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + const auto index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + if (index < 0 || static_cast(index) >= _rideList.size()) + return; + + // Open ride window + const auto selectedRideId = _rideList[index].Id; + if (_quickDemolishMode && NetworkGetMode() != NETWORK_MODE_CLIENT) + { + auto gameAction = RideDemolishAction(selectedRideId, RIDE_MODIFY_DEMOLISH); + GameActions::Execute(&gameAction); + RefreshList(); + } + else + { + auto intent = Intent(WindowClass::Ride); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, selectedRideId.ToUnderlying()); + ContextOpenIntent(&intent); + } + } + + /** + * + * rct2: 0x006B35EF + */ + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + const auto index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + if (index < 0 || static_cast(index) >= _rideList.size()) + return; + + selected_list_item = index; + Invalidate(); + } + + /** + * + * rct2: 0x006B3182 + */ + void OnPrepareDraw() override + { + widgets[WIDX_CURRENT_INFORMATION_TYPE].text = ride_info_type_string_mapping[_windowRideListInformationType]; + + // Set correct active tab + for (int32_t i = 0; i < 3; i++) + pressed_widgets &= ~(1 << (WIDX_TAB_1 + i)); + pressed_widgets |= 1LL << (WIDX_TAB_1 + page); + + widgets[WIDX_TITLE].text = page_names[page]; + + if (_quickDemolishMode) + pressed_widgets |= (1uLL << WIDX_QUICK_DEMOLISH); + else + pressed_widgets &= ~(1uLL << WIDX_QUICK_DEMOLISH); + + ResizeFrameWithPage(); + + widgets[WIDX_LIST].right = width - 26; + widgets[WIDX_LIST].bottom = height - 15; + widgets[WIDX_OPEN_CLOSE_ALL].right = width - 2; + widgets[WIDX_OPEN_CLOSE_ALL].left = width - 25; + widgets[WIDX_CLOSE_LIGHT].right = width - 7; + widgets[WIDX_CLOSE_LIGHT].left = width - 20; + widgets[WIDX_OPEN_LIGHT].right = width - 7; + widgets[WIDX_OPEN_LIGHT].left = width - 20; + widgets[WIDX_QUICK_DEMOLISH].right = width - 2; + widgets[WIDX_QUICK_DEMOLISH].left = width - 25; + + if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE) + { + widgets[WIDX_OPEN_CLOSE_ALL].type = WindowWidgetType::Empty; + widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::ImgBtn; + widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::ImgBtn; + + const auto& rideManager = GetRideManager(); + auto allClosed = true; + auto allOpen = false; + if (_rideList.size() > 0 && std::size(rideManager) != 0) + { + auto c = static_cast(page); + allClosed = std::none_of(rideManager.begin(), rideManager.end(), [c](const Ride& rideRef) { + return rideRef.GetClassification() == c && rideRef.status == RideStatus::Open; + }); + allOpen = std::none_of(rideManager.begin(), rideManager.end(), [c](const Ride& rideRef) { + return rideRef.GetClassification() == c && rideRef.status != RideStatus::Open; + }); + } + + const auto closeLightImage( + SPR_G2_RCT1_CLOSE_BUTTON_0 + (allClosed ? 1 : 0) * 2 + WidgetIsPressed(*this, WIDX_CLOSE_LIGHT)); + widgets[WIDX_CLOSE_LIGHT].image = ImageId(closeLightImage); + const auto openLightImage = SPR_G2_RCT1_OPEN_BUTTON_0 + (allOpen ? 1 : 0) * 2 + + WidgetIsPressed(*this, WIDX_OPEN_LIGHT); + widgets[WIDX_OPEN_LIGHT].image = ImageId(openLightImage); + widgets[WIDX_QUICK_DEMOLISH].top = widgets[WIDX_OPEN_LIGHT].bottom + 3; + } + else + { + widgets[WIDX_OPEN_CLOSE_ALL].type = WindowWidgetType::FlatBtn; + widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::Empty; + widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::Empty; + widgets[WIDX_QUICK_DEMOLISH].top = widgets[WIDX_OPEN_CLOSE_ALL].bottom + 3; + } + widgets[WIDX_QUICK_DEMOLISH].bottom = widgets[WIDX_QUICK_DEMOLISH].top + 23; + widgets[WIDX_QUICK_DEMOLISH].type = NetworkGetMode() != NETWORK_MODE_CLIENT ? WindowWidgetType::FlatBtn + : WindowWidgetType::Empty; + } + + /** + * + * rct2: 0x006B3235 + */ + void OnDraw(DrawPixelInfo& dpi) override + { + WindowDrawWidgets(*this, dpi); + DrawTabImages(dpi); + + // Draw number of attractions on bottom + auto ft = Formatter(); + ft.Add(static_cast(_rideList.size())); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_LIST].bottom + 2 }, ride_list_statusbar_count_strings[page], + ft); + } + + /** + * + * rct2: 0x006B3240 + */ + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; + GfxFillRect( + dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width, dpi.height } }, ColourMapA[colours[1]].mid_light); + + auto y = 0; + for (size_t i = 0; i < _rideList.size(); i++) + { + StringId format = (_quickDemolishMode ? STR_RED_STRINGID : STR_BLACK_STRING); + if (i == static_cast(selected_list_item)) + { + // Background highlight + GfxFilterRect(dpi, { 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1); + format = (_quickDemolishMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID); + } + + // Get ride + const auto* ridePtr = GetRide(_rideList[i].Id); + if (ridePtr == nullptr) + continue; + + // Ride name + auto ft = Formatter(); + ridePtr->FormatNameTo(ft); + DrawTextEllipsised(dpi, { 0, y - 1 }, 159, format, ft); + + // Ride information + ft = Formatter(); + ft.Increment(2); + auto formatSecondaryEnabled = true; + StringId formatSecondary = 0; + switch (_windowRideListInformationType) + { + case INFORMATION_TYPE_STATUS: + formatSecondaryEnabled = false; + ft.Rewind(); + ridePtr->FormatStatusTo(ft); + + // Make test red and bold if broken down or crashed + if ((ridePtr->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) + || (ridePtr->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)) + { + format = STR_RED_OUTLINED_STRING; + } + break; + case INFORMATION_TYPE_POPULARITY: + formatSecondary = STR_POPULARITY_UNKNOWN_LABEL; + if (ridePtr->popularity != 255) + { + formatSecondary = STR_POPULARITY_LABEL; + ft.Add(ridePtr->popularity * 4); + } + break; + case INFORMATION_TYPE_SATISFACTION: + formatSecondary = STR_SATISFACTION_UNKNOWN_LABEL; + if (ridePtr->satisfaction != 255) + { + formatSecondary = STR_SATISFACTION_LABEL; + ft.Add(ridePtr->satisfaction * 5); + } + break; + case INFORMATION_TYPE_PROFIT: + formatSecondary = 0; + if (ridePtr->profit != kMoney64Undefined) + { + formatSecondary = STR_PROFIT_LABEL; + ft.Add(ridePtr->profit); + } + break; + case INFORMATION_TYPE_TOTAL_CUSTOMERS: + formatSecondary = STR_RIDE_LIST_TOTAL_CUSTOMERS_LABEL; + ft.Add(ridePtr->total_customers); + break; + case INFORMATION_TYPE_TOTAL_PROFIT: + formatSecondary = 0; + if (ridePtr->total_profit != kMoney64Undefined) + { + formatSecondary = STR_RIDE_LIST_TOTAL_PROFIT_LABEL; + ft.Add(ridePtr->total_profit); + } + break; + case INFORMATION_TYPE_CUSTOMERS: + formatSecondary = STR_RIDE_LIST_CUSTOMERS_PER_HOUR_LABEL; + ft.Add(RideCustomersPerHour(*ridePtr)); + break; + case INFORMATION_TYPE_AGE: + { + const auto age = DateGetYear(ridePtr->GetAge()); + switch (age) + { + case 0: + formatSecondary = STR_RIDE_LIST_BUILT_THIS_YEAR_LABEL; + break; + case 1: + formatSecondary = STR_RIDE_LIST_BUILT_LAST_YEAR_LABEL; + break; + default: + formatSecondary = STR_RIDE_LIST_BUILT_X_YEARS_AGO_LABEL; + break; + } + ft.Add(age); + break; + } + case INFORMATION_TYPE_INCOME: + formatSecondary = 0; + if (ridePtr->income_per_hour != kMoney64Undefined) + { + formatSecondary = STR_RIDE_LIST_INCOME_LABEL; + ft.Add(ridePtr->income_per_hour); + } + break; + case INFORMATION_TYPE_RUNNING_COST: + formatSecondary = STR_RIDE_LIST_RUNNING_COST_UNKNOWN; + if (ridePtr->upkeep_cost != kMoney64Undefined) + { + formatSecondary = STR_RIDE_LIST_RUNNING_COST_LABEL; + ft.Add(ridePtr->upkeep_cost * 16); + } + break; + case INFORMATION_TYPE_QUEUE_LENGTH: + { + const auto queueLength = ridePtr->GetTotalQueueLength(); + ft.Add(queueLength); + + if (queueLength == 1) + { + formatSecondary = STR_QUEUE_ONE_PERSON; + } + else if (queueLength > 1) + { + formatSecondary = STR_QUEUE_PEOPLE; + } + else + { + formatSecondary = STR_QUEUE_EMPTY; + } + break; + } + case INFORMATION_TYPE_QUEUE_TIME: + { + const auto maxQueueTime = ridePtr->GetMaxQueueTime(); + ft.Add(maxQueueTime); + + if (maxQueueTime > 1) + { + formatSecondary = STR_QUEUE_TIME_PLURAL_LABEL; + } + else + { + formatSecondary = STR_QUEUE_TIME_LABEL; + } + break; + } + case INFORMATION_TYPE_RELIABILITY: + ft.Add(ridePtr->reliability_percentage); + formatSecondary = STR_RELIABILITY_LABEL; + break; + case INFORMATION_TYPE_DOWN_TIME: + ft.Add(ridePtr->downtime); + formatSecondary = STR_DOWN_TIME_LABEL; + break; + case INFORMATION_TYPE_GUESTS_FAVOURITE: + formatSecondary = 0; + if (ridePtr->IsRide()) + { + ft.Add(ridePtr->guests_favourite); + formatSecondary = ridePtr->guests_favourite == 1 ? STR_GUESTS_FAVOURITE_LABEL + : STR_GUESTS_FAVOURITE_PLURAL_LABEL; + } + break; + case INFORMATION_TYPE_EXCITEMENT: + formatSecondary = STR_RATING_UKNOWN_LABEL; + if (RideHasRatings(*ridePtr)) + { + formatSecondary = STR_EXCITEMENT_LABEL; + ft.Add(ridePtr->excitement); + } + break; + case INFORMATION_TYPE_INTENSITY: + formatSecondary = STR_RATING_UKNOWN_LABEL; + if (RideHasRatings(*ridePtr)) + { + formatSecondary = STR_INTENSITY_LABEL; + ft.Add(ridePtr->intensity); + } + break; + case INFORMATION_TYPE_NAUSEA: + formatSecondary = STR_RATING_UKNOWN_LABEL; + if (RideHasRatings(*ridePtr)) + { + formatSecondary = STR_NAUSEA_LABEL; + ft.Add(ridePtr->nausea); + } + break; + } + + if (formatSecondaryEnabled) + { + ft.Rewind(); + ft.Add(formatSecondary); + } + DrawTextEllipsised(dpi, { 160, y - 1 }, 157, format, ft); + y += SCROLLABLE_ROW_HEIGHT; + } + } + + void RefreshListWrapper() { RefreshList(); } - } - /** - * - * rct2: 0x006B3511 - */ - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + private: + /** + * + * rct2: 0x006B38EA + */ + void DrawTabImages(DrawPixelInfo& dpi) { - case WIDX_CLOSE: - WindowClose(*this); - break; - case WIDX_SORT: - list_information_type = _windowRideListInformationType; - selected_list_item = -1; - RefreshList(); - break; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - if (page != widgetIndex - WIDX_TAB_1) - { - page = widgetIndex - WIDX_TAB_1; - frame_no = 0; - selected_list_item = -1; - if (page != PAGE_RIDES && _windowRideListInformationType > INFORMATION_TYPE_RUNNING_COST) - { - _windowRideListInformationType = INFORMATION_TYPE_STATUS; - } - RefreshList(); - } - break; - case WIDX_CLOSE_LIGHT: - CloseAllRides(); - break; - case WIDX_OPEN_LIGHT: - OpenAllRides(); - break; - case WIDX_QUICK_DEMOLISH: - if (NetworkGetMode() != NETWORK_MODE_CLIENT) - { - _quickDemolishMode = !_quickDemolishMode; - } - else - { - _quickDemolishMode = false; - } - Invalidate(); - break; - } - } + int32_t sprite_idx; - /** - * - * rct2: 0x006B3532 - */ - void OnMouseDown(WidgetIndex widgetIndex) override - { - if (widgetIndex == WIDX_OPEN_CLOSE_ALL) - { - const auto& widget = widgets[widgetIndex]; - gDropdownItems[0].Format = STR_CLOSE_ALL; - gDropdownItems[1].Format = STR_OPEN_ALL; - WindowDropdownShowText({ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(), colours[1], 0, 2); - } - else if (widgetIndex == WIDX_INFORMATION_TYPE_DROPDOWN) - { - const auto& widget = widgets[widgetIndex - 1]; - - int32_t lastType; + // Rides tab + sprite_idx = SPR_TAB_RIDE_0; if (page == PAGE_RIDES) - lastType = INFORMATION_TYPE_NAUSEA; - else - lastType = INFORMATION_TYPE_RUNNING_COST; + sprite_idx += frame_no / 4; + GfxDrawSprite( + dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].left, widgets[WIDX_TAB_1].top }); - int32_t numItems = 0; - int32_t selectedIndex = -1; - for (int32_t type = INFORMATION_TYPE_STATUS; type <= lastType; type++) - { - if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + // Shops and stalls tab + sprite_idx = SPR_TAB_SHOPS_AND_STALLS_0; + if (page == PAGE_SHOPS_AND_STALLS) + sprite_idx += frame_no / 4; + GfxDrawSprite( + dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top }); + + // Information kiosks and facilities tab + sprite_idx = SPR_TAB_KIOSKS_AND_FACILITIES_0; + if (page == PAGE_KIOSKS_AND_FACILITIES) + sprite_idx += (frame_no / 4) % 8; + GfxDrawSprite( + dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_3].left, widgets[WIDX_TAB_3].top }); + } + + /** + * Used in RefreshList() to handle the sorting of the list. + * Uses a lambda function (predicate) as exit criteria for the algorithm. + */ + template void SortListByPredicate(const TSortPred& pred) + { + std::sort(_rideList.begin(), _rideList.end(), [&pred](const auto& lhs, const auto& rhs) { + const Ride* rideLhs = GetRide(lhs.Id); + const Ride* rideRhs = GetRide(rhs.Id); + if (rideLhs == nullptr || rideRhs == nullptr) { - if (ride_info_type_money_mapping[type]) - { - continue; - } + return false; + } + return !pred(*rideLhs, *rideRhs); + }); + } + + void SortListByName() + { + std::sort(_rideList.begin(), _rideList.end(), [](const auto& lhs, const auto& rhs) { + return !(0 <= StrLogicalCmp(lhs.Name.c_str(), rhs.Name.c_str())); + }); + } + + /** + * + * rct2: 0x006B39A8 + */ + void RefreshList() + { + _rideList.clear(); + for (auto& rideRef : GetRideManager()) + { + if (rideRef.GetClassification() != static_cast(page) + || (rideRef.status == RideStatus::Closed && !RideHasAnyTrackElements(rideRef))) + { + continue; } - if (type == _windowRideListInformationType) + if (rideRef.window_invalidate_flags & RIDE_INVALIDATE_RIDE_LIST) { - selectedIndex = numItems; + rideRef.window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_LIST; } - gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[numItems].Args = ride_info_type_string_mapping[type]; - numItems++; + RideListEntry entry{}; + entry.Id = rideRef.id; + entry.Name = rideRef.GetName(); + + _rideList.push_back(std::move(entry)); } - WindowDropdownShowTextCustomWidth( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(), colours[1], 0, - Dropdown::Flag::StayOpen, numItems, widget.width() - 3); - if (selectedIndex != -1) + switch (list_information_type) { - Dropdown::SetChecked(selectedIndex, true); - } - } - } - - /** - * - * rct2: 0x006B3547 - */ - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - if (widgetIndex == WIDX_OPEN_CLOSE_ALL) - { - if (dropdownIndex == 0) - { - CloseAllRides(); - } - else if (dropdownIndex == 1) - { - OpenAllRides(); + case INFORMATION_TYPE_STATUS: + SortListByName(); + break; + case INFORMATION_TYPE_POPULARITY: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.popularity * 4 <= otherRide.popularity * 4; + }); + break; + case INFORMATION_TYPE_SATISFACTION: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.satisfaction * 5 <= otherRide.satisfaction * 5; + }); + break; + case INFORMATION_TYPE_PROFIT: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.profit <= otherRide.profit; + }); + break; + case INFORMATION_TYPE_TOTAL_CUSTOMERS: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.total_customers <= otherRide.total_customers; + }); + break; + case INFORMATION_TYPE_TOTAL_PROFIT: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.total_profit <= otherRide.total_profit; + }); + break; + case INFORMATION_TYPE_CUSTOMERS: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return RideCustomersPerHour(thisRide) <= RideCustomersPerHour(otherRide); + }); + break; + case INFORMATION_TYPE_AGE: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.build_date <= otherRide.build_date; + }); + break; + case INFORMATION_TYPE_INCOME: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.income_per_hour <= otherRide.income_per_hour; + }); + break; + case INFORMATION_TYPE_RUNNING_COST: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.upkeep_cost <= otherRide.upkeep_cost; + }); + break; + case INFORMATION_TYPE_QUEUE_LENGTH: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.GetTotalQueueLength() <= otherRide.GetTotalQueueLength(); + }); + break; + case INFORMATION_TYPE_QUEUE_TIME: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.GetMaxQueueTime() <= otherRide.GetMaxQueueTime(); + }); + break; + case INFORMATION_TYPE_RELIABILITY: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.reliability_percentage <= otherRide.reliability_percentage; + }); + break; + case INFORMATION_TYPE_DOWN_TIME: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.downtime <= otherRide.downtime; + }); + break; + case INFORMATION_TYPE_GUESTS_FAVOURITE: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.guests_favourite <= otherRide.guests_favourite; + }); + break; + case INFORMATION_TYPE_EXCITEMENT: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.excitement <= otherRide.excitement; + }); + break; + case INFORMATION_TYPE_INTENSITY: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.intensity <= otherRide.intensity; + }); + break; + case INFORMATION_TYPE_NAUSEA: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.nausea <= otherRide.nausea; + }); + break; } - Invalidate(); - } - else if (widgetIndex == WIDX_INFORMATION_TYPE_DROPDOWN) - { - if (dropdownIndex == -1) - return; - - int32_t informationType = INFORMATION_TYPE_STATUS; - uint32_t arg = static_cast(gDropdownItems[dropdownIndex].Args); - for (size_t i = 0; i < std::size(ride_info_type_string_mapping); i++) - { - if (arg == ride_info_type_string_mapping[i]) - { - informationType = static_cast(i); - } - } - - _windowRideListInformationType = informationType; - Invalidate(); - } - } - - /** - * - * rct2: 0x006B386B - */ - void OnUpdate() override - { - frame_no = (frame_no + 1) % 64; - WidgetInvalidate(*this, WIDX_TAB_1 + page); - if (_windowRideListInformationType != INFORMATION_TYPE_STATUS) - Invalidate(); - } - - /** - * - * rct2: 0x006B35A1 - */ - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - const auto newHeight = static_cast(_rideList.size() * SCROLLABLE_ROW_HEIGHT); - if (selected_list_item != -1) - { selected_list_item = -1; Invalidate(); } - auto top = newHeight - widgets[WIDX_LIST].bottom + widgets[WIDX_LIST].top + 21; - if (top < 0) - top = 0; - if (top < scrolls[0].v_top) + // window_ride_list_close_all + void CloseAllRides() { - scrolls[0].v_top = top; - Invalidate(); - } - - return { 0, newHeight }; - } - - /** - * - * rct2: 0x006B361F - */ - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - const auto index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - if (index < 0 || static_cast(index) >= _rideList.size()) - return; - - // Open ride window - const auto selectedRideId = _rideList[index].Id; - if (_quickDemolishMode && NetworkGetMode() != NETWORK_MODE_CLIENT) - { - auto gameAction = RideDemolishAction(selectedRideId, RIDE_MODIFY_DEMOLISH); - GameActions::Execute(&gameAction); - RefreshList(); - } - else - { - auto intent = Intent(WindowClass::Ride); - intent.PutExtra(INTENT_EXTRA_RIDE_ID, selectedRideId.ToUnderlying()); - ContextOpenIntent(&intent); - } - } - - /** - * - * rct2: 0x006B35EF - */ - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - const auto index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - if (index < 0 || static_cast(index) >= _rideList.size()) - return; - - selected_list_item = index; - Invalidate(); - } - - /** - * - * rct2: 0x006B3182 - */ - void OnPrepareDraw() override - { - widgets[WIDX_CURRENT_INFORMATION_TYPE].text = ride_info_type_string_mapping[_windowRideListInformationType]; - - // Set correct active tab - for (int32_t i = 0; i < 3; i++) - pressed_widgets &= ~(1 << (WIDX_TAB_1 + i)); - pressed_widgets |= 1LL << (WIDX_TAB_1 + page); - - widgets[WIDX_TITLE].text = page_names[page]; - - if (_quickDemolishMode) - pressed_widgets |= (1uLL << WIDX_QUICK_DEMOLISH); - else - pressed_widgets &= ~(1uLL << WIDX_QUICK_DEMOLISH); - - ResizeFrameWithPage(); - - widgets[WIDX_LIST].right = width - 26; - widgets[WIDX_LIST].bottom = height - 15; - widgets[WIDX_OPEN_CLOSE_ALL].right = width - 2; - widgets[WIDX_OPEN_CLOSE_ALL].left = width - 25; - widgets[WIDX_CLOSE_LIGHT].right = width - 7; - widgets[WIDX_CLOSE_LIGHT].left = width - 20; - widgets[WIDX_OPEN_LIGHT].right = width - 7; - widgets[WIDX_OPEN_LIGHT].left = width - 20; - widgets[WIDX_QUICK_DEMOLISH].right = width - 2; - widgets[WIDX_QUICK_DEMOLISH].left = width - 25; - - if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE) - { - widgets[WIDX_OPEN_CLOSE_ALL].type = WindowWidgetType::Empty; - widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::ImgBtn; - widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::ImgBtn; - - const auto& rideManager = GetRideManager(); - auto allClosed = true; - auto allOpen = false; - if (_rideList.size() > 0 && std::size(rideManager) != 0) + for (auto& rideRef : GetRideManager()) { - auto c = static_cast(page); - allClosed = std::none_of(rideManager.begin(), rideManager.end(), [c](const Ride& rideRef) { - return rideRef.GetClassification() == c && rideRef.status == RideStatus::Open; - }); - allOpen = std::none_of(rideManager.begin(), rideManager.end(), [c](const Ride& rideRef) { - return rideRef.GetClassification() == c && rideRef.status != RideStatus::Open; - }); - } - - const auto closeLightImage( - SPR_G2_RCT1_CLOSE_BUTTON_0 + (allClosed ? 1 : 0) * 2 + WidgetIsPressed(*this, WIDX_CLOSE_LIGHT)); - widgets[WIDX_CLOSE_LIGHT].image = ImageId(closeLightImage); - const auto openLightImage = SPR_G2_RCT1_OPEN_BUTTON_0 + (allOpen ? 1 : 0) * 2 - + WidgetIsPressed(*this, WIDX_OPEN_LIGHT); - widgets[WIDX_OPEN_LIGHT].image = ImageId(openLightImage); - widgets[WIDX_QUICK_DEMOLISH].top = widgets[WIDX_OPEN_LIGHT].bottom + 3; - } - else - { - widgets[WIDX_OPEN_CLOSE_ALL].type = WindowWidgetType::FlatBtn; - widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::Empty; - widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::Empty; - widgets[WIDX_QUICK_DEMOLISH].top = widgets[WIDX_OPEN_CLOSE_ALL].bottom + 3; - } - widgets[WIDX_QUICK_DEMOLISH].bottom = widgets[WIDX_QUICK_DEMOLISH].top + 23; - widgets[WIDX_QUICK_DEMOLISH].type = NetworkGetMode() != NETWORK_MODE_CLIENT ? WindowWidgetType::FlatBtn - : WindowWidgetType::Empty; - } - - /** - * - * rct2: 0x006B3235 - */ - void OnDraw(DrawPixelInfo& dpi) override - { - WindowDrawWidgets(*this, dpi); - DrawTabImages(dpi); - - // Draw number of attractions on bottom - auto ft = Formatter(); - ft.Add(static_cast(_rideList.size())); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_LIST].bottom + 2 }, ride_list_statusbar_count_strings[page], ft); - } - - /** - * - * rct2: 0x006B3240 - */ - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; - GfxFillRect(dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width, dpi.height } }, ColourMapA[colours[1]].mid_light); - - auto y = 0; - for (size_t i = 0; i < _rideList.size(); i++) - { - StringId format = (_quickDemolishMode ? STR_RED_STRINGID : STR_BLACK_STRING); - if (i == static_cast(selected_list_item)) - { - // Background highlight - GfxFilterRect(dpi, { 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1); - format = (_quickDemolishMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID); - } - - // Get ride - const auto* ridePtr = GetRide(_rideList[i].Id); - if (ridePtr == nullptr) - continue; - - // Ride name - auto ft = Formatter(); - ridePtr->FormatNameTo(ft); - DrawTextEllipsised(dpi, { 0, y - 1 }, 159, format, ft); - - // Ride information - ft = Formatter(); - ft.Increment(2); - auto formatSecondaryEnabled = true; - StringId formatSecondary = 0; - switch (_windowRideListInformationType) - { - case INFORMATION_TYPE_STATUS: - formatSecondaryEnabled = false; - ft.Rewind(); - ridePtr->FormatStatusTo(ft); - - // Make test red and bold if broken down or crashed - if ((ridePtr->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) - || (ridePtr->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)) - { - format = STR_RED_OUTLINED_STRING; - } - break; - case INFORMATION_TYPE_POPULARITY: - formatSecondary = STR_POPULARITY_UNKNOWN_LABEL; - if (ridePtr->popularity != 255) - { - formatSecondary = STR_POPULARITY_LABEL; - ft.Add(ridePtr->popularity * 4); - } - break; - case INFORMATION_TYPE_SATISFACTION: - formatSecondary = STR_SATISFACTION_UNKNOWN_LABEL; - if (ridePtr->satisfaction != 255) - { - formatSecondary = STR_SATISFACTION_LABEL; - ft.Add(ridePtr->satisfaction * 5); - } - break; - case INFORMATION_TYPE_PROFIT: - formatSecondary = 0; - if (ridePtr->profit != kMoney64Undefined) - { - formatSecondary = STR_PROFIT_LABEL; - ft.Add(ridePtr->profit); - } - break; - case INFORMATION_TYPE_TOTAL_CUSTOMERS: - formatSecondary = STR_RIDE_LIST_TOTAL_CUSTOMERS_LABEL; - ft.Add(ridePtr->total_customers); - break; - case INFORMATION_TYPE_TOTAL_PROFIT: - formatSecondary = 0; - if (ridePtr->total_profit != kMoney64Undefined) - { - formatSecondary = STR_RIDE_LIST_TOTAL_PROFIT_LABEL; - ft.Add(ridePtr->total_profit); - } - break; - case INFORMATION_TYPE_CUSTOMERS: - formatSecondary = STR_RIDE_LIST_CUSTOMERS_PER_HOUR_LABEL; - ft.Add(RideCustomersPerHour(*ridePtr)); - break; - case INFORMATION_TYPE_AGE: + if (rideRef.status != RideStatus::Closed + && rideRef.GetClassification() == static_cast(page)) { - const auto age = DateGetYear(ridePtr->GetAge()); - switch (age) - { - case 0: - formatSecondary = STR_RIDE_LIST_BUILT_THIS_YEAR_LABEL; - break; - case 1: - formatSecondary = STR_RIDE_LIST_BUILT_LAST_YEAR_LABEL; - break; - default: - formatSecondary = STR_RIDE_LIST_BUILT_X_YEARS_AGO_LABEL; - break; - } - ft.Add(age); - break; + auto gameAction = RideSetStatusAction(rideRef.id, RideStatus::Closed); + GameActions::Execute(&gameAction); } - case INFORMATION_TYPE_INCOME: - formatSecondary = 0; - if (ridePtr->income_per_hour != kMoney64Undefined) - { - formatSecondary = STR_RIDE_LIST_INCOME_LABEL; - ft.Add(ridePtr->income_per_hour); - } - break; - case INFORMATION_TYPE_RUNNING_COST: - formatSecondary = STR_RIDE_LIST_RUNNING_COST_UNKNOWN; - if (ridePtr->upkeep_cost != kMoney64Undefined) - { - formatSecondary = STR_RIDE_LIST_RUNNING_COST_LABEL; - ft.Add(ridePtr->upkeep_cost * 16); - } - break; - case INFORMATION_TYPE_QUEUE_LENGTH: - { - const auto queueLength = ridePtr->GetTotalQueueLength(); - ft.Add(queueLength); - - if (queueLength == 1) - { - formatSecondary = STR_QUEUE_ONE_PERSON; - } - else if (queueLength > 1) - { - formatSecondary = STR_QUEUE_PEOPLE; - } - else - { - formatSecondary = STR_QUEUE_EMPTY; - } - break; - } - case INFORMATION_TYPE_QUEUE_TIME: - { - const auto maxQueueTime = ridePtr->GetMaxQueueTime(); - ft.Add(maxQueueTime); - - if (maxQueueTime > 1) - { - formatSecondary = STR_QUEUE_TIME_PLURAL_LABEL; - } - else - { - formatSecondary = STR_QUEUE_TIME_LABEL; - } - break; - } - case INFORMATION_TYPE_RELIABILITY: - ft.Add(ridePtr->reliability_percentage); - formatSecondary = STR_RELIABILITY_LABEL; - break; - case INFORMATION_TYPE_DOWN_TIME: - ft.Add(ridePtr->downtime); - formatSecondary = STR_DOWN_TIME_LABEL; - break; - case INFORMATION_TYPE_GUESTS_FAVOURITE: - formatSecondary = 0; - if (ridePtr->IsRide()) - { - ft.Add(ridePtr->guests_favourite); - formatSecondary = ridePtr->guests_favourite == 1 ? STR_GUESTS_FAVOURITE_LABEL - : STR_GUESTS_FAVOURITE_PLURAL_LABEL; - } - break; - case INFORMATION_TYPE_EXCITEMENT: - formatSecondary = STR_RATING_UKNOWN_LABEL; - if (RideHasRatings(*ridePtr)) - { - formatSecondary = STR_EXCITEMENT_LABEL; - ft.Add(ridePtr->excitement); - } - break; - case INFORMATION_TYPE_INTENSITY: - formatSecondary = STR_RATING_UKNOWN_LABEL; - if (RideHasRatings(*ridePtr)) - { - formatSecondary = STR_INTENSITY_LABEL; - ft.Add(ridePtr->intensity); - } - break; - case INFORMATION_TYPE_NAUSEA: - formatSecondary = STR_RATING_UKNOWN_LABEL; - if (RideHasRatings(*ridePtr)) - { - formatSecondary = STR_NAUSEA_LABEL; - ft.Add(ridePtr->nausea); - } - break; } - - if (formatSecondaryEnabled) - { - ft.Rewind(); - ft.Add(formatSecondary); - } - DrawTextEllipsised(dpi, { 160, y - 1 }, 157, format, ft); - y += SCROLLABLE_ROW_HEIGHT; } - } - void RefreshListWrapper() - { - RefreshList(); - } - -private: - /** - * - * rct2: 0x006B38EA - */ - void DrawTabImages(DrawPixelInfo& dpi) - { - int32_t sprite_idx; - - // Rides tab - sprite_idx = SPR_TAB_RIDE_0; - if (page == PAGE_RIDES) - sprite_idx += frame_no / 4; - GfxDrawSprite( - dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].left, widgets[WIDX_TAB_1].top }); - - // Shops and stalls tab - sprite_idx = SPR_TAB_SHOPS_AND_STALLS_0; - if (page == PAGE_SHOPS_AND_STALLS) - sprite_idx += frame_no / 4; - GfxDrawSprite( - dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top }); - - // Information kiosks and facilities tab - sprite_idx = SPR_TAB_KIOSKS_AND_FACILITIES_0; - if (page == PAGE_KIOSKS_AND_FACILITIES) - sprite_idx += (frame_no / 4) % 8; - GfxDrawSprite( - dpi, ImageId(sprite_idx), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_3].left, widgets[WIDX_TAB_3].top }); - } - - /** - * Used in RefreshList() to handle the sorting of the list. - * Uses a lambda function (predicate) as exit criteria for the algorithm. - */ - template void SortListByPredicate(const TSortPred& pred) - { - std::sort(_rideList.begin(), _rideList.end(), [&pred](const auto& lhs, const auto& rhs) { - const Ride* rideLhs = GetRide(lhs.Id); - const Ride* rideRhs = GetRide(rhs.Id); - if (rideLhs == nullptr || rideRhs == nullptr) + // window_ride_list_open_all + void OpenAllRides() + { + for (auto& rideRef : GetRideManager()) { - return false; + if (rideRef.status != RideStatus::Open && rideRef.GetClassification() == static_cast(page)) + { + auto gameAction = RideSetStatusAction(rideRef.id, RideStatus::Open); + GameActions::Execute(&gameAction); + } } - return !pred(*rideLhs, *rideRhs); - }); - } - - void SortListByName() - { - std::sort(_rideList.begin(), _rideList.end(), [](const auto& lhs, const auto& rhs) { - return !(0 <= StrLogicalCmp(lhs.Name.c_str(), rhs.Name.c_str())); - }); - } + } + }; /** * - * rct2: 0x006B39A8 + * rct2: 0x006B30BC */ - void RefreshList() + WindowBase* RideListOpen() { - _rideList.clear(); - for (auto& rideRef : GetRideManager()) + // Check if window is already open + auto* window = WindowBringToFrontByClass(WindowClass::RideList); + if (window == nullptr) { - if (rideRef.GetClassification() != static_cast(page) - || (rideRef.status == RideStatus::Closed && !RideHasAnyTrackElements(rideRef))) - { - continue; - } - - if (rideRef.window_invalidate_flags & RIDE_INVALIDATE_RIDE_LIST) - { - rideRef.window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_LIST; - } - - RideListEntry entry{}; - entry.Id = rideRef.id; - entry.Name = rideRef.GetName(); - - _rideList.push_back(std::move(entry)); + window = WindowCreate(WindowClass::RideList, ScreenCoordsXY(32, 32), WW, WH, WF_10 | WF_RESIZABLE); } - - switch (list_information_type) - { - case INFORMATION_TYPE_STATUS: - SortListByName(); - break; - case INFORMATION_TYPE_POPULARITY: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.popularity * 4 <= otherRide.popularity * 4; - }); - break; - case INFORMATION_TYPE_SATISFACTION: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.satisfaction * 5 <= otherRide.satisfaction * 5; - }); - break; - case INFORMATION_TYPE_PROFIT: - SortListByPredicate( - [](const Ride& thisRide, const Ride& otherRide) -> bool { return thisRide.profit <= otherRide.profit; }); - break; - case INFORMATION_TYPE_TOTAL_CUSTOMERS: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.total_customers <= otherRide.total_customers; - }); - break; - case INFORMATION_TYPE_TOTAL_PROFIT: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.total_profit <= otherRide.total_profit; - }); - break; - case INFORMATION_TYPE_CUSTOMERS: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return RideCustomersPerHour(thisRide) <= RideCustomersPerHour(otherRide); - }); - break; - case INFORMATION_TYPE_AGE: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.build_date <= otherRide.build_date; - }); - break; - case INFORMATION_TYPE_INCOME: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.income_per_hour <= otherRide.income_per_hour; - }); - break; - case INFORMATION_TYPE_RUNNING_COST: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.upkeep_cost <= otherRide.upkeep_cost; - }); - break; - case INFORMATION_TYPE_QUEUE_LENGTH: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.GetTotalQueueLength() <= otherRide.GetTotalQueueLength(); - }); - break; - case INFORMATION_TYPE_QUEUE_TIME: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.GetMaxQueueTime() <= otherRide.GetMaxQueueTime(); - }); - break; - case INFORMATION_TYPE_RELIABILITY: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.reliability_percentage <= otherRide.reliability_percentage; - }); - break; - case INFORMATION_TYPE_DOWN_TIME: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.downtime <= otherRide.downtime; - }); - break; - case INFORMATION_TYPE_GUESTS_FAVOURITE: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.guests_favourite <= otherRide.guests_favourite; - }); - break; - case INFORMATION_TYPE_EXCITEMENT: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.excitement <= otherRide.excitement; - }); - break; - case INFORMATION_TYPE_INTENSITY: - SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.intensity <= otherRide.intensity; - }); - break; - case INFORMATION_TYPE_NAUSEA: - SortListByPredicate( - [](const Ride& thisRide, const Ride& otherRide) -> bool { return thisRide.nausea <= otherRide.nausea; }); - break; - } - - selected_list_item = -1; - Invalidate(); + return window; } - // window_ride_list_close_all - void CloseAllRides() + void WindowRideListRefreshList(WindowBase* w) { - for (auto& rideRef : GetRideManager()) - { - if (rideRef.status != RideStatus::Closed && rideRef.GetClassification() == static_cast(page)) - { - auto gameAction = RideSetStatusAction(rideRef.id, RideStatus::Closed); - GameActions::Execute(&gameAction); - } - } + dynamic_cast(w)->RefreshListWrapper(); } - - // window_ride_list_open_all - void OpenAllRides() - { - for (auto& rideRef : GetRideManager()) - { - if (rideRef.status != RideStatus::Open && rideRef.GetClassification() == static_cast(page)) - { - auto gameAction = RideSetStatusAction(rideRef.id, RideStatus::Open); - GameActions::Execute(&gameAction); - } - } - } -}; - -/** - * - * rct2: 0x006B30BC - */ -WindowBase* WindowRideListOpen() -{ - // Check if window is already open - auto* window = WindowBringToFrontByClass(WindowClass::RideList); - if (window == nullptr) - { - window = WindowCreate(WindowClass::RideList, ScreenCoordsXY(32, 32), WW, WH, WF_10 | WF_RESIZABLE); - } - return window; -} - -void WindowRideListRefreshList(WindowBase* w) -{ - dynamic_cast(w)->RefreshListWrapper(); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index 8f0d7d1b58..d4c80757e2 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -21,14 +21,14 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr int32_t WH_SAVE = 54; + static constexpr int32_t WW_SAVE = 260; + static constexpr int32_t WH_QUIT = 38; + static constexpr int32_t WW_QUIT = 177; -static constexpr int32_t WH_SAVE = 54; -static constexpr int32_t WW_SAVE = 260; -static constexpr int32_t WH_QUIT = 38; -static constexpr int32_t WW_QUIT = 177; - -// clang-format off + // clang-format off enum WindowSavePromptWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -45,7 +45,7 @@ static Widget _savePromptWidgets[] = { MakeWidget({ 8, 35}, { 78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_SAVE ), // save MakeWidget({ 91, 35}, { 78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_DONT_SAVE), // don't save MakeWidget({174, 35}, { 78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL ), // cancel - WIDGETS_END, + kWidgetsEnd, }; enum WindowQuitPromptWidgetIdx { @@ -60,7 +60,7 @@ static Widget _quitPromptWidgets[] = { WINDOW_SHIM_WHITE(STR_QUIT_GAME_PROMPT_TITLE, WW_QUIT, WH_QUIT), MakeWidget({ 8, 19}, {78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_OK ), // ok MakeWidget({91, 19}, {78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_CANCEL), // cancel - WIDGETS_END, + kWidgetsEnd, }; static constexpr StringId window_save_prompt_labels[][2] = { @@ -69,184 +69,185 @@ static constexpr StringId window_save_prompt_labels[][2] = { { STR_QUIT_GAME_2_PROMPT_TITLE, STR_SAVE_BEFORE_QUITTING_2 }, { STR_NEW_GAME, STR_SAVE_BEFORE_QUITTING }, }; -// clang-format on + // clang-format on -static void WindowSavePromptCallback(int32_t result, const utf8* path) -{ - if (result == MODAL_RESULT_OK) + static void WindowSavePromptCallback(int32_t result, const utf8* path) { - GameLoadOrQuitNoSavePrompt(); + if (result == MODAL_RESULT_OK) + { + GameLoadOrQuitNoSavePrompt(); + } } -} -class SavePromptWindow final : public Window -{ -private: - PromptMode _promptMode; - -public: - SavePromptWindow(PromptMode promptMode) - : _promptMode(promptMode) - { - } - - void OnOpen() override + class SavePromptWindow final : public Window { - bool canSave = !(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)); - - widgets = canSave ? _savePromptWidgets : _quitPromptWidgets; - - InitScrollWidgets(); + private: + PromptMode _promptMode; - // Pause the game if not network play. - if (NetworkGetMode() == NETWORK_MODE_NONE) + public: + SavePromptWindow(PromptMode promptMode) + : _promptMode(promptMode) { - gGamePaused |= GAME_PAUSED_MODAL; - Audio::StopAll(); } - WindowInvalidateByClass(WindowClass::TopToolbar); - - if (canSave) + void OnOpen() override { - StringId stringId = window_save_prompt_labels[EnumValue(_promptMode)][0]; - if (stringId == STR_LOAD_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + bool canSave = !(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)); + + widgets = canSave ? _savePromptWidgets : _quitPromptWidgets; + + InitScrollWidgets(); + + // Pause the game if not network play. + if (NetworkGetMode() == NETWORK_MODE_NONE) { - stringId = STR_LOAD_LANDSCAPE_PROMPT_TITLE; + gGamePaused |= GAME_PAUSED_MODAL; + Audio::StopAll(); } - else if (stringId == STR_QUIT_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + + WindowInvalidateByClass(WindowClass::TopToolbar); + + if (canSave) { - stringId = STR_QUIT_SCENARIO_EDITOR; + StringId stringId = window_save_prompt_labels[EnumValue(_promptMode)][0]; + if (stringId == STR_LOAD_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + { + stringId = STR_LOAD_LANDSCAPE_PROMPT_TITLE; + } + else if (stringId == STR_QUIT_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + { + stringId = STR_QUIT_SCENARIO_EDITOR; + } + widgets[WIDX_TITLE].text = stringId; + widgets[WIDX_LABEL].text = window_save_prompt_labels[EnumValue(_promptMode)][1]; } - widgets[WIDX_TITLE].text = stringId; - widgets[WIDX_LABEL].text = window_save_prompt_labels[EnumValue(_promptMode)][1]; - } - } - - void OnClose() override - { - // Unpause the game - if (NetworkGetMode() == NETWORK_MODE_NONE) - { - gGamePaused &= ~GAME_PAUSED_MODAL; - Audio::Resume(); } - WindowInvalidateByClass(WindowClass::TopToolbar); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - if (gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + void OnClose() override { + // Unpause the game + if (NetworkGetMode() == NETWORK_MODE_NONE) + { + gGamePaused &= ~GAME_PAUSED_MODAL; + Audio::Resume(); + } + + WindowInvalidateByClass(WindowClass::TopToolbar); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + if (gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + { + switch (widgetIndex) + { + case WQIDX_OK: + GameLoadOrQuitNoSavePrompt(); + break; + case WQIDX_CLOSE: + case WQIDX_CANCEL: + Close(); + break; + } + return; + } + switch (widgetIndex) { - case WQIDX_OK: - GameLoadOrQuitNoSavePrompt(); - break; - case WQIDX_CLOSE: - case WQIDX_CANCEL: + case WIDX_SAVE: + { + std::unique_ptr intent; + + if (gScreenFlags & (SCREEN_FLAGS_EDITOR)) + { + intent = std::make_unique(WindowClass::Loadsave); + intent->PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); + intent->PutExtra(INTENT_EXTRA_PATH, GetGameState().ScenarioName); + } + else + { + intent = CreateSaveGameAsIntent(); + } Close(); + intent->PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowSavePromptCallback)); + ContextOpenIntent(intent.get()); break; + } + case WIDX_DONT_SAVE: + GameLoadOrQuitNoSavePrompt(); + return; + case WIDX_CLOSE: + case WIDX_CANCEL: + Close(); + return; } - return; } - switch (widgetIndex) + void OnDraw(DrawPixelInfo& dpi) override { - case WIDX_SAVE: - { - std::unique_ptr intent; - - if (gScreenFlags & (SCREEN_FLAGS_EDITOR)) - { - intent = std::make_unique(WindowClass::Loadsave); - intent->PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); - intent->PutExtra(INTENT_EXTRA_PATH, GetGameState().ScenarioName); - } - else - { - intent = CreateSaveGameAsIntent(); - } - Close(); - intent->PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowSavePromptCallback)); - ContextOpenIntent(intent.get()); - break; - } - case WIDX_DONT_SAVE: - GameLoadOrQuitNoSavePrompt(); - return; - case WIDX_CLOSE: - case WIDX_CANCEL: - Close(); - return; + DrawWidgets(dpi); } - } - void OnDraw(DrawPixelInfo& dpi) override + void OnResize() override + { + ResizeFrame(); + } + }; + + WindowBase* SavePromptOpen() { - DrawWidgets(dpi); - } + PromptMode prompt_mode = gSavePromptMode; + if (prompt_mode == PromptMode::Quit) + { + prompt_mode = PromptMode::SaveBeforeQuit; + } - void OnResize() override - { - ResizeFrame(); - } -}; - -WindowBase* WindowSavePromptOpen() -{ - PromptMode prompt_mode = gSavePromptMode; - if (prompt_mode == PromptMode::Quit) - { - prompt_mode = PromptMode::SaveBeforeQuit; - } - - // do not show save prompt if we're in the title demo and click on load game - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) - { - GameLoadOrQuitNoSavePrompt(); - return nullptr; - } - - if (!gConfigGeneral.ConfirmationPrompt) - { - /* game_load_or_quit_no_save_prompt() will exec requested task and close this window - * immediately again. - * TODO restructure these functions when we're sure game_load_or_quit_no_save_prompt() - * and game_load_or_quit() are not called by the original binary anymore. - */ - - if (gScreenAge < 3840 && NetworkGetMode() == NETWORK_MODE_NONE) + // do not show save prompt if we're in the title demo and click on load game + if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) { GameLoadOrQuitNoSavePrompt(); return nullptr; } - } - // Check if window is already open - WindowBase* window = WindowBringToFrontByClass(WindowClass::SavePrompt); - if (window != nullptr) - { - WindowClose(*window); - } + if (!gConfigGeneral.ConfirmationPrompt) + { + /* game_load_or_quit_no_save_prompt() will exec requested task and close this window + * immediately again. + * TODO restructure these functions when we're sure game_load_or_quit_no_save_prompt() + * and game_load_or_quit() are not called by the original binary anymore. + */ - if (EnumValue(prompt_mode) >= std::size(window_save_prompt_labels)) - { - LOG_WARNING("Invalid save prompt mode %u", prompt_mode); - return nullptr; - } + if (gScreenAge < 3840 && NetworkGetMode() == NETWORK_MODE_NONE) + { + GameLoadOrQuitNoSavePrompt(); + return nullptr; + } + } - int32_t width = WW_SAVE; - int32_t height = WH_SAVE; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) - { - width = WW_QUIT; - height = WH_QUIT; - } + // Check if window is already open + WindowBase* window = WindowBringToFrontByClass(WindowClass::SavePrompt); + if (window != nullptr) + { + WindowClose(*window); + } - auto savePromptWindow = std::make_unique(prompt_mode); - return WindowCreate( - std::move(savePromptWindow), WindowClass::SavePrompt, {}, width, height, - WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN | WF_AUTO_POSITION); -} + if (EnumValue(prompt_mode) >= std::size(window_save_prompt_labels)) + { + LOG_WARNING("Invalid save prompt mode %u", prompt_mode); + return nullptr; + } + + int32_t width = WW_SAVE; + int32_t height = WH_SAVE; + if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + { + width = WW_QUIT; + height = WH_QUIT; + } + + auto savePromptWindow = std::make_unique(prompt_mode); + return WindowCreate( + std::move(savePromptWindow), WindowClass::SavePrompt, {}, width, height, + WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN | WF_AUTO_POSITION); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index d7d4f10bbb..d40760ae41 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -9,6 +9,7 @@ #include "../interface/Theme.h" +#include #include #include #include @@ -28,68 +29,70 @@ #include #include -static constexpr StringId WINDOW_TITLE = STR_SELECT_SCENARIO; -static constexpr int32_t WW = 734; -static constexpr int32_t WH = 384; -static constexpr int32_t SidebarWidth = 180; -static constexpr int32_t TabWidth = 92; -static constexpr int32_t TabHeight = 34; -static constexpr int32_t TrueFontSize = 24; -static constexpr int32_t WidgetsStart = 17; -static constexpr int32_t TabsStart = WidgetsStart; -static constexpr int32_t InitialNumUnlockedScenarios = 5; -constexpr uint8_t NumTabs = 10; - -enum class ListItemType : uint8_t +namespace OpenRCT2::Ui::Windows { - Heading, - Scenario, -}; + static constexpr StringId WINDOW_TITLE = STR_SELECT_SCENARIO; + static constexpr int32_t WW = 734; + static constexpr int32_t WH = 384; + static constexpr int32_t SidebarWidth = 180; + static constexpr int32_t TabWidth = 92; + static constexpr int32_t TabHeight = 34; + static constexpr int32_t TrueFontSize = 24; + static constexpr int32_t WidgetsStart = 17; + static constexpr int32_t TabsStart = WidgetsStart; + static constexpr int32_t InitialNumUnlockedScenarios = 5; + constexpr uint8_t NumTabs = 10; -struct ScenarioListItem -{ - ListItemType type; - union + enum class ListItemType : uint8_t { - struct - { - StringId string_id; - } heading; - struct - { - const ScenarioIndexEntry* scenario; - bool is_locked; - } scenario; + Heading, + Scenario, }; -}; -enum -{ - WIDX_BACKGROUND, - WIDX_TITLEBAR, - WIDX_CLOSE, - WIDX_TABCONTENT, - WIDX_TAB1, - WIDX_TAB2, - WIDX_TAB3, - WIDX_TAB4, - WIDX_TAB5, - WIDX_TAB6, - WIDX_TAB7, - WIDX_TAB8, - WIDX_TAB9, - WIDX_TAB10, - WIDX_SCENARIOLIST -}; + struct ScenarioListItem + { + ListItemType type; + union + { + struct + { + StringId string_id; + } heading; + struct + { + const ScenarioIndexEntry* scenario; + bool is_locked; + } scenario; + }; + }; -static constexpr StringId kScenarioOriginStringIds[] = { - STR_SCENARIO_CATEGORY_RCT1, STR_SCENARIO_CATEGORY_RCT1_AA, STR_SCENARIO_CATEGORY_RCT1_LL, - STR_SCENARIO_CATEGORY_RCT2, STR_SCENARIO_CATEGORY_RCT2_WW, STR_SCENARIO_CATEGORY_RCT2_TT, - STR_SCENARIO_CATEGORY_UCES, STR_SCENARIO_CATEGORY_REAL_PARKS, STR_SCENARIO_CATEGORY_EXTRAS_PARKS, - STR_SCENARIO_CATEGORY_OTHER_PARKS, -}; + enum + { + WIDX_BACKGROUND, + WIDX_TITLEBAR, + WIDX_CLOSE, + WIDX_TABCONTENT, + WIDX_TAB1, + WIDX_TAB2, + WIDX_TAB3, + WIDX_TAB4, + WIDX_TAB5, + WIDX_TAB6, + WIDX_TAB7, + WIDX_TAB8, + WIDX_TAB9, + WIDX_TAB10, + WIDX_SCENARIOLIST + }; -// clang-format off + static constexpr StringId kScenarioOriginStringIds[] = { + STR_SCENARIO_CATEGORY_RCT1, STR_SCENARIO_CATEGORY_RCT1_AA, STR_SCENARIO_CATEGORY_RCT1_LL, + STR_SCENARIO_CATEGORY_RCT2, STR_SCENARIO_CATEGORY_RCT2_WW, STR_SCENARIO_CATEGORY_RCT2_TT, + STR_SCENARIO_CATEGORY_UCES, STR_SCENARIO_CATEGORY_REAL_PARKS, STR_SCENARIO_CATEGORY_EXTRAS_PARKS, + STR_SCENARIO_CATEGORY_OTHER_PARKS, + }; + + // clang-format off static Widget _scenarioSelectWidgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget({ TabWidth + 1, WidgetsStart }, { WW, 284 }, WindowWidgetType::Resize, WindowColour::Secondary), // tab content panel @@ -104,676 +107,666 @@ static Widget _scenarioSelectWidgets[] = { MakeRemapWidget({ 3, TabsStart + (TabHeight * 8) }, { TabWidth, TabHeight}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_G2_SIDEWAYS_TAB), // tab 09 MakeRemapWidget({ 3, TabsStart + (TabHeight * 8) }, { TabWidth, TabHeight}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_G2_SIDEWAYS_TAB), // tab 10 MakeWidget({ TabWidth + 3, WidgetsStart + 1 }, { WW - SidebarWidth, 362 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), // level list - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class ScenarioSelectWindow final : public Window -{ -private: - bool _showLockedInformation = false; - std::function _callback; - std::vector _listItems; - const ScenarioIndexEntry* _highlightedScenario = nullptr; - -public: - ScenarioSelectWindow(std::function callback) - : _callback(callback) + class ScenarioSelectWindow final : public Window { - } + private: + bool _showLockedInformation = false; + std::function _callback; + std::vector _listItems; + const ScenarioIndexEntry* _highlightedScenario = nullptr; - void OnOpen() override - { - // Load scenario list - ScenarioRepositoryScan(); - - widgets = _scenarioSelectWidgets; - _highlightedScenario = nullptr; - InitTabs(); - InitialiseListItems(); - InitScrollWidgets(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - if (widgetIndex == WIDX_CLOSE) + public: + ScenarioSelectWindow(std::function callback) + : _callback(callback) { - Close(); } - } - void OnMouseDown(WidgetIndex widgetIndex) override - { - if (widgetIndex >= WIDX_TAB1 && widgetIndex <= WIDX_TAB10) + void OnOpen() override { - selected_tab = widgetIndex - 4; + // Load scenario list + ScenarioRepositoryScan(); + + widgets = _scenarioSelectWidgets; _highlightedScenario = nullptr; - gConfigInterface.ScenarioselectLastTab = selected_tab; - ConfigSaveDefault(); + InitTabs(); InitialiseListItems(); - Invalidate(); - OnResize(); - OnPrepareDraw(); InitScrollWidgets(); - Invalidate(); } - } - void OnDraw(DrawPixelInfo& dpi) override - { - int32_t format; - const ScenarioIndexEntry* scenario; - - DrawWidgets(dpi); - - format = ScenarioSelectUseSmallFont() ? STR_SMALL_WINDOW_COLOUR_2_STRINGID : STR_WINDOW_COLOUR_2_STRINGID; - FontStyle fontStyle = ScenarioSelectUseSmallFont() ? FontStyle::Small : FontStyle::Medium; - - // Text for each tab - for (uint32_t i = 0; i < std::size(kScenarioOriginStringIds); i++) + void OnMouseUp(WidgetIndex widgetIndex) override { - const Widget& widget = widgets[WIDX_TAB1 + i]; - if (widget.type == WindowWidgetType::Empty) - continue; - - auto ft = Formatter(); - if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN) + if (widgetIndex == WIDX_CLOSE) { - ft.Add(kScenarioOriginStringIds[i]); - } - else - { // old-style - ft.Add(ScenarioCategoryStringIds[i]); - } - - auto stringCoords = windowPos + ScreenCoordsXY{ widget.midX(), widget.midY() - 3 }; - DrawTextWrapped(dpi, stringCoords, 87, format, ft, { COLOUR_AQUAMARINE, fontStyle, TextAlignment::CENTRE }); - } - - // Return if no scenario highlighted - scenario = _highlightedScenario; - if (scenario == nullptr) - { - if (_showLockedInformation) - { - // Show locked information - auto screenPos = windowPos - + ScreenCoordsXY{ widgets[WIDX_SCENARIOLIST].right + 4, widgets[WIDX_TABCONTENT].top + 5 }; - DrawTextEllipsised( - dpi, screenPos + ScreenCoordsXY{ 85, 0 }, 170, STR_SCENARIO_LOCKED, {}, { TextAlignment::CENTRE }); - - DrawTextWrapped(dpi, screenPos + ScreenCoordsXY{ 0, 15 }, 170, STR_SCENARIO_LOCKED_DESC); - } - else - { - // Show general information about how to start. - auto screenPos = windowPos - + ScreenCoordsXY{ widgets[WIDX_SCENARIOLIST].right + 4, widgets[WIDX_TABCONTENT].top + 5 }; - - DrawTextWrapped(dpi, screenPos + ScreenCoordsXY{ 0, 15 }, 170, STR_SCENARIO_HOVER_HINT); - } - return; - } - - // Scenario path - if (gConfigGeneral.DebuggingTools) - { - const auto shortPath = ShortenPath(scenario->Path, width - 6 - TabWidth, FontStyle::Medium); - - auto ft = Formatter(); - ft.Add(shortPath.c_str()); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ TabWidth + 3, height - 3 - 11 }, STR_STRING, ft, { colours[1] }); - } - - // Scenario name - auto screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_SCENARIOLIST].right + 4, widgets[WIDX_TABCONTENT].top + 5 }; - auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(scenario->Name); - DrawTextEllipsised( - dpi, screenPos + ScreenCoordsXY{ 85, 0 }, 170, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); - screenPos.y += 15; - - // Scenario details - ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(scenario->Details); - screenPos.y += DrawTextWrapped(dpi, screenPos, 170, STR_BLACK_STRING, ft) + 5; - - // Scenario objective - ft = Formatter(); - ft.Add(ObjectiveNames[scenario->ObjectiveType]); - if (scenario->ObjectiveType == OBJECTIVE_BUILD_THE_BEST) - { - StringId rideTypeString = STR_NONE; - auto rideTypeId = scenario->ObjectiveArg3; - if (rideTypeId != RIDE_TYPE_NULL && rideTypeId < RIDE_TYPE_COUNT) - { - rideTypeString = GetRideTypeDescriptor(rideTypeId).Naming.Name; - } - ft.Add(rideTypeString); - } - else - { - ft.Add(scenario->ObjectiveArg3); - ft.Add(DateGetTotalMonths(MONTH_OCTOBER, scenario->ObjectiveArg1)); - if (scenario->ObjectiveType == OBJECTIVE_FINISH_5_ROLLERCOASTERS) - ft.Add(scenario->ObjectiveArg2); - else - ft.Add(scenario->ObjectiveArg2); - } - screenPos.y += DrawTextWrapped(dpi, screenPos, 170, STR_OBJECTIVE, ft) + 5; - - // Scenario score - if (scenario->Highscore != nullptr) - { - // TODO: Should probably be translatable - u8string completedByName = "???"; - if (!scenario->Highscore->name.empty()) - { - completedByName = scenario->Highscore->name; - } - ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(completedByName.c_str()); - ft.Add(scenario->Highscore->company_value); - screenPos.y += DrawTextWrapped(dpi, screenPos, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, ft); - } - } - - void OnPrepareDraw() override - { - pressed_widgets &= ~( - (1uLL << WIDX_CLOSE) | (1uLL << WIDX_TAB1) | (1uLL << WIDX_TAB2) | (1uLL << WIDX_TAB3) | (1uLL << WIDX_TAB4) - | (1uLL << WIDX_TAB5) | (1uLL << WIDX_TAB6) | (1uLL << WIDX_TAB7) | (1uLL << WIDX_TAB8) | (1uLL << WIDX_TAB9) - | (1uLL << WIDX_TAB10)); - - pressed_widgets |= 1LL << (selected_tab + WIDX_TAB1); - - ResizeFrameWithPage(); - const int32_t bottomMargin = gConfigGeneral.DebuggingTools ? 17 : 5; - widgets[WIDX_SCENARIOLIST].right = width - 179; - widgets[WIDX_SCENARIOLIST].bottom = height - bottomMargin; - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - const int32_t scenarioItemHeight = GetScenarioListItemSize(); - - int32_t y = 0; - for (const auto& listItem : _listItems) - { - switch (listItem.type) - { - case ListItemType::Heading: - y += 18; - break; - case ListItemType::Scenario: - y += scenarioItemHeight; - break; + Close(); } } - return { WW, y }; - } - - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - const int32_t scenarioItemHeight = GetScenarioListItemSize(); - - bool originalShowLockedInformation = _showLockedInformation; - _showLockedInformation = false; - const ScenarioIndexEntry* selected = nullptr; - auto mutableScreenCoords = screenCoords; - for (const auto& listItem : _listItems) + void OnMouseDown(WidgetIndex widgetIndex) override { - switch (listItem.type) + if (widgetIndex >= WIDX_TAB1 && widgetIndex <= WIDX_TAB10) { - case ListItemType::Heading: - mutableScreenCoords.y -= 18; - break; - case ListItemType::Scenario: - mutableScreenCoords.y -= scenarioItemHeight; - if (mutableScreenCoords.y < 0) - { - if (listItem.scenario.is_locked) - { - _showLockedInformation = true; - } - else - { - selected = listItem.scenario.scenario; - } - } - break; - } - if (mutableScreenCoords.y < 0) - { - break; + selected_tab = widgetIndex - 4; + _highlightedScenario = nullptr; + gConfigInterface.ScenarioselectLastTab = selected_tab; + ConfigSaveDefault(); + InitialiseListItems(); + Invalidate(); + OnResize(); + OnPrepareDraw(); + InitScrollWidgets(); + Invalidate(); } } - if (_highlightedScenario != selected) + void OnDraw(DrawPixelInfo& dpi) override { - _highlightedScenario = selected; - Invalidate(); - } - else if (_showLockedInformation != originalShowLockedInformation) - { - Invalidate(); - } - } + int32_t format; + const ScenarioIndexEntry* scenario; - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - const int32_t scenarioItemHeight = GetScenarioListItemSize(); + DrawWidgets(dpi); - auto mutableScreenCoords = screenCoords; - for (const auto& listItem : _listItems) - { - switch (listItem.type) + format = ScenarioSelectUseSmallFont() ? STR_SMALL_WINDOW_COLOUR_2_STRINGID : STR_WINDOW_COLOUR_2_STRINGID; + FontStyle fontStyle = ScenarioSelectUseSmallFont() ? FontStyle::Small : FontStyle::Medium; + + // Text for each tab + for (uint32_t i = 0; i < std::size(kScenarioOriginStringIds); i++) { - case ListItemType::Heading: - mutableScreenCoords.y -= 18; - break; - case ListItemType::Scenario: - mutableScreenCoords.y -= scenarioItemHeight; - if (mutableScreenCoords.y < 0 && !listItem.scenario.is_locked) - { - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); - gFirstTimeSaving = true; - // Callback will likely close this window! So should always return after it. - _callback(listItem.scenario.scenario->Path); - return; - } - break; - } - if (mutableScreenCoords.y < 0) - { - break; - } - } - } + const Widget& widget = widgets[WIDX_TAB1 + i]; + if (widget.type == WindowWidgetType::Empty) + continue; - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - uint8_t paletteIndex = ColourMapA[colours[1]].mid_light; - GfxClear(&dpi, paletteIndex); - - StringId highlighted_format = ScenarioSelectUseSmallFont() ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID; - StringId unhighlighted_format = ScenarioSelectUseSmallFont() ? STR_WHITE_STRING : STR_BLACK_STRING; - - const auto& listWidget = widgets[WIDX_SCENARIOLIST]; - int32_t listWidth = listWidget.width() - 12; - - const int32_t scenarioItemHeight = GetScenarioListItemSize(); - - // Scenario title - int32_t scenarioTitleHeight = FontGetLineHeight(FontStyle::Medium); - - int32_t y = 0; - for (const auto& listItem : _listItems) - { - if (y > dpi.y + dpi.height) - { - continue; - } - - switch (listItem.type) - { - case ListItemType::Heading: + auto ft = Formatter(); + if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN) { - const int32_t horizontalRuleMargin = 4; - DrawCategoryHeading( - dpi, horizontalRuleMargin, listWidth - horizontalRuleMargin, y + 2, listItem.heading.string_id); - y += 18; - break; + ft.Add(kScenarioOriginStringIds[i]); } - case ListItemType::Scenario: - { - // Draw hover highlight - const ScenarioIndexEntry* scenario = listItem.scenario.scenario; - bool isHighlighted = _highlightedScenario == scenario; - if (isHighlighted) - { - GfxFilterRect(dpi, { 0, y, width, y + scenarioItemHeight - 1 }, FilterPaletteID::PaletteDarken1); - } - - bool isCompleted = scenario->Highscore != nullptr; - bool isDisabled = listItem.scenario.is_locked; - - // Draw scenario name - char buffer[64]; - SafeStrCpy(buffer, scenario->Name, sizeof(buffer)); - StringId format = isDisabled ? static_cast(STR_STRINGID) - : (isHighlighted ? highlighted_format : unhighlighted_format); - auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(buffer); - colour_t colour = isDisabled ? colours[1] | COLOUR_FLAG_INSET : COLOUR_BLACK; - auto darkness = isDisabled ? TextDarkness::Dark : TextDarkness::Regular; - const auto scrollCentre = widgets[WIDX_SCENARIOLIST].width() / 2; - - DrawTextBasic( - dpi, { scrollCentre, y + 1 }, format, ft, - { colour, FontStyle::Medium, TextAlignment::CENTRE, darkness }); - - // Check if scenario is completed - if (isCompleted) - { - // Draw completion tick - GfxDrawSprite(dpi, ImageId(SPR_MENU_CHECKMARK), { widgets[WIDX_SCENARIOLIST].width() - 45, y + 1 }); - - // Draw completion score - u8string completedByName = "???"; - if (!scenario->Highscore->name.empty()) - { - completedByName = scenario->Highscore->name; - } - ft = Formatter(); - ft.Add(STR_COMPLETED_BY); - ft.Add(STR_STRING); - ft.Add(completedByName.c_str()); - DrawTextBasic( - dpi, { scrollCentre, y + scenarioTitleHeight + 1 }, format, ft, - { FontStyle::Small, TextAlignment::CENTRE }); - } - - y += scenarioItemHeight; - break; + else + { // old-style + ft.Add(ScenarioCategoryStringIds[i]); } - } - } - } -private: - void DrawCategoryHeading(DrawPixelInfo& dpi, int32_t left, int32_t right, int32_t y, StringId stringId) const - { - colour_t baseColour = colours[1]; - colour_t lightColour = ColourMapA[baseColour].lighter; - colour_t darkColour = ColourMapA[baseColour].mid_dark; - - // Draw string - int32_t centreX = (left + right) / 2; - DrawTextBasic(dpi, { centreX, y }, stringId, {}, { baseColour, TextAlignment::CENTRE }); - - // Get string dimensions - utf8 buffer[CommonTextBufferSize]; - auto bufferPtr = buffer; - OpenRCT2::FormatStringLegacy(bufferPtr, sizeof(buffer), stringId, nullptr); - int32_t categoryStringHalfWidth = (GfxGetStringWidth(bufferPtr, FontStyle::Medium) / 2) + 4; - int32_t strLeft = centreX - categoryStringHalfWidth; - int32_t strRight = centreX + categoryStringHalfWidth; - - // Draw light horizontal rule - int32_t lineY = y + 4; - auto lightLineLeftTop1 = ScreenCoordsXY{ left, lineY }; - auto lightLineRightBottom1 = ScreenCoordsXY{ strLeft, lineY }; - GfxDrawLine(dpi, { lightLineLeftTop1, lightLineRightBottom1 }, lightColour); - - auto lightLineLeftTop2 = ScreenCoordsXY{ strRight, lineY }; - auto lightLineRightBottom2 = ScreenCoordsXY{ right, lineY }; - GfxDrawLine(dpi, { lightLineLeftTop2, lightLineRightBottom2 }, lightColour); - - // Draw dark horizontal rule - lineY++; - auto darkLineLeftTop1 = ScreenCoordsXY{ left, lineY }; - auto darkLineRightBottom1 = ScreenCoordsXY{ strLeft, lineY }; - GfxDrawLine(dpi, { darkLineLeftTop1, darkLineRightBottom1 }, darkColour); - - auto darkLineLeftTop2 = ScreenCoordsXY{ strRight, lineY }; - auto darkLineRightBottom2 = ScreenCoordsXY{ right, lineY }; - GfxDrawLine(dpi, { darkLineLeftTop2, darkLineRightBottom2 }, darkColour); - } - - void InitialiseListItems() - { - size_t numScenarios = ScenarioRepositoryGetCount(); - _listItems.clear(); - - // Mega park unlock - const uint32_t rct1RequiredCompletedScenarios = (1 << SC_MEGA_PARK) - 1; - uint32_t rct1CompletedScenarios = 0; - std::optional megaParkListItemIndex = std::nullopt; - - int32_t numUnlocks = InitialNumUnlockedScenarios; - uint8_t currentHeading = UINT8_MAX; - for (size_t i = 0; i < numScenarios; i++) - { - const ScenarioIndexEntry* scenario = ScenarioRepositoryGetByIndex(i); - - if (!IsScenarioVisible(*scenario)) - continue; - - // Category heading - StringId headingStringId = STR_NONE; - if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN) - { - if (selected_tab != static_cast(ScenarioSource::Real) && currentHeading != scenario->Category) - { - currentHeading = scenario->Category; - headingStringId = ScenarioCategoryStringIds[currentHeading]; - } - } - else - { - if (selected_tab <= SCENARIO_CATEGORY_EXPERT) - { - if (currentHeading != static_cast(scenario->SourceGame)) - { - currentHeading = static_cast(scenario->SourceGame); - headingStringId = kScenarioOriginStringIds[currentHeading]; - } - } - else if (selected_tab == SCENARIO_CATEGORY_OTHER) - { - int32_t category = scenario->Category; - if (category <= SCENARIO_CATEGORY_REAL) - { - category = SCENARIO_CATEGORY_OTHER; - } - if (currentHeading != category) - { - currentHeading = category; - headingStringId = ScenarioCategoryStringIds[category]; - } - } + auto stringCoords = windowPos + ScreenCoordsXY{ widget.midX(), widget.midY() - 3 }; + DrawTextWrapped(dpi, stringCoords, 87, format, ft, { COLOUR_AQUAMARINE, fontStyle, TextAlignment::CENTRE }); } - if (headingStringId != STR_NONE) + // Return if no scenario highlighted + scenario = _highlightedScenario; + if (scenario == nullptr) { - ScenarioListItem headerItem; - headerItem.type = ListItemType::Heading; - headerItem.heading.string_id = headingStringId; - _listItems.push_back(std::move(headerItem)); - } - - // Scenario - ScenarioListItem scenarioItem; - scenarioItem.type = ListItemType::Scenario; - scenarioItem.scenario.scenario = scenario; - if (IsLockingEnabled()) - { - scenarioItem.scenario.is_locked = numUnlocks <= 0; - if (scenario->Highscore == nullptr) + if (_showLockedInformation) { - numUnlocks--; + // Show locked information + auto screenPos = windowPos + + ScreenCoordsXY{ widgets[WIDX_SCENARIOLIST].right + 4, widgets[WIDX_TABCONTENT].top + 5 }; + DrawTextEllipsised( + dpi, screenPos + ScreenCoordsXY{ 85, 0 }, 170, STR_SCENARIO_LOCKED, {}, { TextAlignment::CENTRE }); + + DrawTextWrapped(dpi, screenPos + ScreenCoordsXY{ 0, 15 }, 170, STR_SCENARIO_LOCKED_DESC); } else { - // Mark RCT1 scenario as completed - if (scenario->ScenarioId < SC_MEGA_PARK) - { - rct1CompletedScenarios |= 1 << scenario->ScenarioId; - } - } + // Show general information about how to start. + auto screenPos = windowPos + + ScreenCoordsXY{ widgets[WIDX_SCENARIOLIST].right + 4, widgets[WIDX_TABCONTENT].top + 5 }; - // If scenario is Mega Park, keep a reference to it - if (scenario->ScenarioId == SC_MEGA_PARK) - { - megaParkListItemIndex = _listItems.size() - 1; + DrawTextWrapped(dpi, screenPos + ScreenCoordsXY{ 0, 15 }, 170, STR_SCENARIO_HOVER_HINT); } + return; } - else + + // Scenario path + if (gConfigGeneral.DebuggingTools) { - scenarioItem.scenario.is_locked = false; + const auto shortPath = ShortenPath(scenario->Path, width - 6 - TabWidth, FontStyle::Medium); + + auto ft = Formatter(); + ft.Add(shortPath.c_str()); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ TabWidth + 3, height - 3 - 11 }, STR_STRING, ft, { colours[1] }); + } + + // Scenario name + auto screenPos = windowPos + + ScreenCoordsXY{ widgets[WIDX_SCENARIOLIST].right + 4, widgets[WIDX_TABCONTENT].top + 5 }; + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(scenario->Name); + DrawTextEllipsised( + dpi, screenPos + ScreenCoordsXY{ 85, 0 }, 170, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); + screenPos.y += 15; + + // Scenario details + ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(scenario->Details); + screenPos.y += DrawTextWrapped(dpi, screenPos, 170, STR_BLACK_STRING, ft) + 5; + + // Scenario objective + Objective objective = { .Type = scenario->ObjectiveType, + .Year = scenario->ObjectiveArg1, + .NumGuests = static_cast(scenario->ObjectiveArg3), + .Currency = scenario->ObjectiveArg2 }; + + ft = Formatter(); + ft.Add(ObjectiveNames[scenario->ObjectiveType]); + formatObjective(ft, objective); + screenPos.y += DrawTextWrapped(dpi, screenPos, 170, STR_OBJECTIVE, ft) + 5; + + // Scenario score + if (scenario->Highscore != nullptr) + { + // TODO: Should probably be translatable + u8string completedByName = "???"; + if (!scenario->Highscore->name.empty()) + { + completedByName = scenario->Highscore->name; + } + ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(completedByName.c_str()); + ft.Add(scenario->Highscore->company_value); + screenPos.y += DrawTextWrapped(dpi, screenPos, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, ft); } - _listItems.push_back(std::move(scenarioItem)); } - // Mega park handling - if (megaParkListItemIndex.has_value()) + void OnPrepareDraw() override { - bool megaParkLocked = (rct1CompletedScenarios & rct1RequiredCompletedScenarios) != rct1RequiredCompletedScenarios; - _listItems[megaParkListItemIndex.value()].scenario.is_locked = megaParkLocked; - if (megaParkLocked && gConfigGeneral.ScenarioHideMegaPark) - { - // Remove mega park - _listItems.pop_back(); + pressed_widgets &= ~( + (1uLL << WIDX_CLOSE) | (1uLL << WIDX_TAB1) | (1uLL << WIDX_TAB2) | (1uLL << WIDX_TAB3) | (1uLL << WIDX_TAB4) + | (1uLL << WIDX_TAB5) | (1uLL << WIDX_TAB6) | (1uLL << WIDX_TAB7) | (1uLL << WIDX_TAB8) | (1uLL << WIDX_TAB9) + | (1uLL << WIDX_TAB10)); - // Remove empty headings - for (auto it = _listItems.begin(); it != _listItems.end();) + pressed_widgets |= 1LL << (selected_tab + WIDX_TAB1); + + ResizeFrameWithPage(); + const int32_t bottomMargin = gConfigGeneral.DebuggingTools ? 17 : 5; + widgets[WIDX_SCENARIOLIST].right = width - 179; + widgets[WIDX_SCENARIOLIST].bottom = height - bottomMargin; + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + const int32_t scenarioItemHeight = GetScenarioListItemSize(); + + int32_t y = 0; + for (const auto& listItem : _listItems) + { + switch (listItem.type) { - const auto& listItem = *it; - if (listItem.type == ListItemType::Heading) - { - auto nextIt = std::next(it); - if (nextIt == _listItems.end() || nextIt->type == ListItemType::Heading) + case ListItemType::Heading: + y += 18; + break; + case ListItemType::Scenario: + y += scenarioItemHeight; + break; + } + } + + return { WW, y }; + } + + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + const int32_t scenarioItemHeight = GetScenarioListItemSize(); + + bool originalShowLockedInformation = _showLockedInformation; + _showLockedInformation = false; + const ScenarioIndexEntry* selected = nullptr; + auto mutableScreenCoords = screenCoords; + for (const auto& listItem : _listItems) + { + switch (listItem.type) + { + case ListItemType::Heading: + mutableScreenCoords.y -= 18; + break; + case ListItemType::Scenario: + mutableScreenCoords.y -= scenarioItemHeight; + if (mutableScreenCoords.y < 0) { - it = _listItems.erase(it); - continue; + if (listItem.scenario.is_locked) + { + _showLockedInformation = true; + } + else + { + selected = listItem.scenario.scenario; + } + } + break; + } + if (mutableScreenCoords.y < 0) + { + break; + } + } + + if (_highlightedScenario != selected) + { + _highlightedScenario = selected; + Invalidate(); + } + else if (_showLockedInformation != originalShowLockedInformation) + { + Invalidate(); + } + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + const int32_t scenarioItemHeight = GetScenarioListItemSize(); + + auto mutableScreenCoords = screenCoords; + for (const auto& listItem : _listItems) + { + switch (listItem.type) + { + case ListItemType::Heading: + mutableScreenCoords.y -= 18; + break; + case ListItemType::Scenario: + mutableScreenCoords.y -= scenarioItemHeight; + if (mutableScreenCoords.y < 0 && !listItem.scenario.is_locked) + { + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); + gFirstTimeSaving = true; + // Callback will likely close this window! So should always return after it. + _callback(listItem.scenario.scenario->Path); + return; + } + break; + } + if (mutableScreenCoords.y < 0) + { + break; + } + } + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + uint8_t paletteIndex = ColourMapA[colours[1]].mid_light; + GfxClear(dpi, paletteIndex); + + StringId highlighted_format = ScenarioSelectUseSmallFont() ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID; + StringId unhighlighted_format = ScenarioSelectUseSmallFont() ? STR_WHITE_STRING : STR_BLACK_STRING; + + const auto& listWidget = widgets[WIDX_SCENARIOLIST]; + int32_t listWidth = listWidget.width() - 12; + + const int32_t scenarioItemHeight = GetScenarioListItemSize(); + + // Scenario title + int32_t scenarioTitleHeight = FontGetLineHeight(FontStyle::Medium); + + int32_t y = 0; + for (const auto& listItem : _listItems) + { + if (y > dpi.y + dpi.height) + { + continue; + } + + switch (listItem.type) + { + case ListItemType::Heading: + { + const int32_t horizontalRuleMargin = 4; + DrawCategoryHeading( + dpi, horizontalRuleMargin, listWidth - horizontalRuleMargin, y + 2, listItem.heading.string_id); + y += 18; + break; + } + case ListItemType::Scenario: + { + // Draw hover highlight + const ScenarioIndexEntry* scenario = listItem.scenario.scenario; + bool isHighlighted = _highlightedScenario == scenario; + if (isHighlighted) + { + GfxFilterRect(dpi, { 0, y, width, y + scenarioItemHeight - 1 }, FilterPaletteID::PaletteDarken1); + } + + bool isCompleted = scenario->Highscore != nullptr; + bool isDisabled = listItem.scenario.is_locked; + + // Draw scenario name + char buffer[64]; + SafeStrCpy(buffer, scenario->Name, sizeof(buffer)); + StringId format = isDisabled ? static_cast(STR_STRINGID) + : (isHighlighted ? highlighted_format : unhighlighted_format); + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(buffer); + colour_t colour = isDisabled ? colours[1] | COLOUR_FLAG_INSET : COLOUR_BLACK; + auto darkness = isDisabled ? TextDarkness::Dark : TextDarkness::Regular; + const auto scrollCentre = widgets[WIDX_SCENARIOLIST].width() / 2; + + DrawTextBasic( + dpi, { scrollCentre, y + 1 }, format, ft, + { colour, FontStyle::Medium, TextAlignment::CENTRE, darkness }); + + // Check if scenario is completed + if (isCompleted) + { + // Draw completion tick + GfxDrawSprite(dpi, ImageId(SPR_MENU_CHECKMARK), { widgets[WIDX_SCENARIOLIST].width() - 45, y + 1 }); + + // Draw completion score + u8string completedByName = "???"; + if (!scenario->Highscore->name.empty()) + { + completedByName = scenario->Highscore->name; + } + ft = Formatter(); + ft.Add(STR_COMPLETED_BY); + ft.Add(STR_STRING); + ft.Add(completedByName.c_str()); + DrawTextBasic( + dpi, { scrollCentre, y + scenarioTitleHeight + 1 }, format, ft, + { FontStyle::Small, TextAlignment::CENTRE }); + } + + y += scenarioItemHeight; + break; + } + } + } + } + + private: + void DrawCategoryHeading(DrawPixelInfo& dpi, int32_t left, int32_t right, int32_t y, StringId stringId) const + { + colour_t baseColour = colours[1]; + colour_t lightColour = ColourMapA[baseColour].lighter; + colour_t darkColour = ColourMapA[baseColour].mid_dark; + + // Draw string + int32_t centreX = (left + right) / 2; + DrawTextBasic(dpi, { centreX, y }, stringId, {}, { baseColour, TextAlignment::CENTRE }); + + // Get string dimensions + utf8 buffer[CommonTextBufferSize]; + auto bufferPtr = buffer; + OpenRCT2::FormatStringLegacy(bufferPtr, sizeof(buffer), stringId, nullptr); + int32_t categoryStringHalfWidth = (GfxGetStringWidth(bufferPtr, FontStyle::Medium) / 2) + 4; + int32_t strLeft = centreX - categoryStringHalfWidth; + int32_t strRight = centreX + categoryStringHalfWidth; + + // Draw light horizontal rule + int32_t lineY = y + 4; + auto lightLineLeftTop1 = ScreenCoordsXY{ left, lineY }; + auto lightLineRightBottom1 = ScreenCoordsXY{ strLeft, lineY }; + GfxDrawLine(dpi, { lightLineLeftTop1, lightLineRightBottom1 }, lightColour); + + auto lightLineLeftTop2 = ScreenCoordsXY{ strRight, lineY }; + auto lightLineRightBottom2 = ScreenCoordsXY{ right, lineY }; + GfxDrawLine(dpi, { lightLineLeftTop2, lightLineRightBottom2 }, lightColour); + + // Draw dark horizontal rule + lineY++; + auto darkLineLeftTop1 = ScreenCoordsXY{ left, lineY }; + auto darkLineRightBottom1 = ScreenCoordsXY{ strLeft, lineY }; + GfxDrawLine(dpi, { darkLineLeftTop1, darkLineRightBottom1 }, darkColour); + + auto darkLineLeftTop2 = ScreenCoordsXY{ strRight, lineY }; + auto darkLineRightBottom2 = ScreenCoordsXY{ right, lineY }; + GfxDrawLine(dpi, { darkLineLeftTop2, darkLineRightBottom2 }, darkColour); + } + + void InitialiseListItems() + { + size_t numScenarios = ScenarioRepositoryGetCount(); + _listItems.clear(); + + // Mega park unlock + const uint32_t rct1RequiredCompletedScenarios = (1 << SC_MEGA_PARK) - 1; + uint32_t rct1CompletedScenarios = 0; + std::optional megaParkListItemIndex = std::nullopt; + + int32_t numUnlocks = InitialNumUnlockedScenarios; + uint8_t currentHeading = UINT8_MAX; + for (size_t i = 0; i < numScenarios; i++) + { + const ScenarioIndexEntry* scenario = ScenarioRepositoryGetByIndex(i); + + if (!IsScenarioVisible(*scenario)) + continue; + + // Category heading + StringId headingStringId = STR_NONE; + if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN) + { + if (selected_tab != static_cast(ScenarioSource::Real) && currentHeading != scenario->Category) + { + currentHeading = scenario->Category; + headingStringId = ScenarioCategoryStringIds[currentHeading]; + } + } + else + { + if (selected_tab <= SCENARIO_CATEGORY_EXPERT) + { + if (currentHeading != static_cast(scenario->SourceGame)) + { + currentHeading = static_cast(scenario->SourceGame); + headingStringId = kScenarioOriginStringIds[currentHeading]; } } - ++it; + else if (selected_tab == SCENARIO_CATEGORY_OTHER) + { + int32_t category = scenario->Category; + if (category <= SCENARIO_CATEGORY_REAL) + { + category = SCENARIO_CATEGORY_OTHER; + } + if (currentHeading != category) + { + currentHeading = category; + headingStringId = ScenarioCategoryStringIds[category]; + } + } + } + + if (headingStringId != STR_NONE) + { + ScenarioListItem headerItem; + headerItem.type = ListItemType::Heading; + headerItem.heading.string_id = headingStringId; + _listItems.push_back(std::move(headerItem)); + } + + // Scenario + ScenarioListItem scenarioItem; + scenarioItem.type = ListItemType::Scenario; + scenarioItem.scenario.scenario = scenario; + if (IsLockingEnabled()) + { + scenarioItem.scenario.is_locked = numUnlocks <= 0; + if (scenario->Highscore == nullptr) + { + numUnlocks--; + } + else + { + // Mark RCT1 scenario as completed + if (scenario->ScenarioId < SC_MEGA_PARK) + { + rct1CompletedScenarios |= 1 << scenario->ScenarioId; + } + } + + // If scenario is Mega Park, keep a reference to it + if (scenario->ScenarioId == SC_MEGA_PARK) + { + megaParkListItemIndex = _listItems.size() - 1; + } + } + else + { + scenarioItem.scenario.is_locked = false; + } + _listItems.push_back(std::move(scenarioItem)); + } + + // Mega park handling + if (megaParkListItemIndex.has_value()) + { + bool megaParkLocked = (rct1CompletedScenarios & rct1RequiredCompletedScenarios) + != rct1RequiredCompletedScenarios; + _listItems[megaParkListItemIndex.value()].scenario.is_locked = megaParkLocked; + if (megaParkLocked && gConfigGeneral.ScenarioHideMegaPark) + { + // Remove mega park + _listItems.pop_back(); + + // Remove empty headings + for (auto it = _listItems.begin(); it != _listItems.end();) + { + const auto& listItem = *it; + if (listItem.type == ListItemType::Heading) + { + auto nextIt = std::next(it); + if (nextIt == _listItems.end() || nextIt->type == ListItemType::Heading) + { + it = _listItems.erase(it); + continue; + } + } + ++it; + } } } } - } - bool IsScenarioVisible(const ScenarioIndexEntry& scenario) const - { - if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN) + bool IsScenarioVisible(const ScenarioIndexEntry& scenario) const { - if (static_cast(scenario.SourceGame) != selected_tab) - { - return false; - } - } - else - { - int32_t category = scenario.Category; - if (category > SCENARIO_CATEGORY_OTHER) - { - category = SCENARIO_CATEGORY_OTHER; - } - if (category != selected_tab) - { - return false; - } - } - return true; - } - - bool IsLockingEnabled() const - { - if (gConfigGeneral.ScenarioSelectMode != SCENARIO_SELECT_MODE_ORIGIN) - return false; - if (!gConfigGeneral.ScenarioUnlockingEnabled) - return false; - if (selected_tab >= 6) - return false; - - return true; - } - - void InitTabs() - { - int32_t showPages = 0; - size_t numScenarios = ScenarioRepositoryGetCount(); - for (size_t i = 0; i < numScenarios; i++) - { - const ScenarioIndexEntry* scenario = ScenarioRepositoryGetByIndex(i); if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN) { - showPages |= 1 << static_cast(scenario->SourceGame); + if (static_cast(scenario.SourceGame) != selected_tab) + { + return false; + } } else { - int32_t category = scenario->Category; + int32_t category = scenario.Category; if (category > SCENARIO_CATEGORY_OTHER) { category = SCENARIO_CATEGORY_OTHER; } - showPages |= 1 << category; + if (category != selected_tab) + { + return false; + } } + return true; } - if (showPages & (1 << gConfigInterface.ScenarioselectLastTab)) + bool IsLockingEnabled() const { - selected_tab = gConfigInterface.ScenarioselectLastTab; + if (gConfigGeneral.ScenarioSelectMode != SCENARIO_SELECT_MODE_ORIGIN) + return false; + if (!gConfigGeneral.ScenarioUnlockingEnabled) + return false; + if (selected_tab >= 6) + return false; + + return true; } - else + + void InitTabs() { - int32_t firstPage = UtilBitScanForward(showPages); - if (firstPage != -1) + int32_t showPages = 0; + size_t numScenarios = ScenarioRepositoryGetCount(); + for (size_t i = 0; i < numScenarios; i++) { - selected_tab = firstPage; + const ScenarioIndexEntry* scenario = ScenarioRepositoryGetByIndex(i); + if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN) + { + showPages |= 1 << static_cast(scenario->SourceGame); + } + else + { + int32_t category = scenario->Category; + if (category > SCENARIO_CATEGORY_OTHER) + { + category = SCENARIO_CATEGORY_OTHER; + } + showPages |= 1 << category; + } } - } - int32_t y = TabsStart; - for (int32_t i = 0; i < NumTabs; i++) - { - auto& widget = widgets[i + WIDX_TAB1]; - if (!(showPages & (1 << i))) + if (showPages & (1 << gConfigInterface.ScenarioselectLastTab)) { - widget.type = WindowWidgetType::Empty; - continue; + selected_tab = gConfigInterface.ScenarioselectLastTab; + } + else + { + int32_t firstPage = UtilBitScanForward(showPages); + if (firstPage != -1) + { + selected_tab = firstPage; + } } - widget.type = WindowWidgetType::Tab; - widget.top = y; - widget.bottom = y + (TabHeight - 1); - y += TabHeight; + int32_t y = TabsStart; + for (int32_t i = 0; i < NumTabs; i++) + { + auto& widget = widgets[i + WIDX_TAB1]; + if (!(showPages & (1 << i))) + { + widget.type = WindowWidgetType::Empty; + continue; + } + + widget.type = WindowWidgetType::Tab; + widget.top = y; + widget.bottom = y + (TabHeight - 1); + y += TabHeight; + } } + + static bool ScenarioSelectUseSmallFont() + { + return ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT; + } + + static int32_t GetScenarioListItemSize() + { + if (!LocalisationService_UseTrueTypeFont()) + return TrueFontSize; + + // Scenario title + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + + // 'Completed by' line + lineHeight += FontGetLineHeight(FontStyle::Small); + + return lineHeight; + } + }; + + WindowBase* ScenarioselectOpen(scenarioselect_callback callback) + { + return ScenarioselectOpen([callback](std::string_view scenario) { callback(std::string(scenario).c_str()); }); } - static bool ScenarioSelectUseSmallFont() + WindowBase* ScenarioselectOpen(std::function callback) { - return ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT; - } + auto* window = static_cast(WindowBringToFrontByClass(WindowClass::ScenarioSelect)); + if (window != nullptr) + { + return window; + } - static int32_t GetScenarioListItemSize() - { - if (!LocalisationService_UseTrueTypeFont()) - return TrueFontSize; - - // Scenario title - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); - - // 'Completed by' line - lineHeight += FontGetLineHeight(FontStyle::Small); - - return lineHeight; - } -}; - -WindowBase* WindowScenarioselectOpen(scenarioselect_callback callback) -{ - return WindowScenarioselectOpen([callback](std::string_view scenario) { callback(std::string(scenario).c_str()); }); -} - -WindowBase* WindowScenarioselectOpen(std::function callback) -{ - auto* window = static_cast(WindowBringToFrontByClass(WindowClass::ScenarioSelect)); - if (window != nullptr) - { + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + ScreenCoordsXY screenPos = { (screenWidth - WW) / 2, std::max(TOP_TOOLBAR_HEIGHT + 1, (screenHeight - WH) / 2) }; + window = WindowCreate(WindowClass::ScenarioSelect, screenPos, WW, WH, 0, callback); return window; } - - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - ScreenCoordsXY screenPos = { (screenWidth - WW) / 2, std::max(TOP_TOOLBAR_HEIGHT + 1, (screenHeight - WH) / 2) }; - window = WindowCreate(WindowClass::ScenarioSelect, screenPos, WW, WH, 0, callback); - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 82b2ce0c57..755f40e25b 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -38,48 +38,48 @@ #include #include -using namespace OpenRCT2; - -static constexpr StringId WINDOW_TITLE = STR_NONE; -constexpr int32_t WINDOW_SCENERY_MIN_WIDTH = 634; -constexpr int32_t WINDOW_SCENERY_MIN_HEIGHT = 195; -constexpr int32_t SCENERY_BUTTON_WIDTH = 66; -constexpr int32_t SCENERY_BUTTON_HEIGHT = 80; -constexpr int32_t InitTabPosX = 3; -constexpr int32_t InitTabPosY = 17; -constexpr int32_t TabWidth = 31; -constexpr int32_t TabHeight = 28; -constexpr int32_t ReservedTabCount = 2; -constexpr int32_t MaxTabs = 257; // 255 selected tabs + misc + all -constexpr int32_t MaxTabsPerRow = 20; - -constexpr uint8_t SceneryContentScrollIndex = 0; - -enum WindowSceneryListWidgetIdx +namespace OpenRCT2::Ui::Windows { - WIDX_SCENERY_BACKGROUND, - WIDX_SCENERY_TITLE, - WIDX_SCENERY_CLOSE, - WIDX_SCENERY_TAB_CONTENT_PANEL, - WIDX_SCENERY_LIST, - WIDX_SCENERY_ROTATE_OBJECTS_BUTTON, - WIDX_SCENERY_REPAINT_SCENERY_BUTTON, - WIDX_SCENERY_PRIMARY_COLOUR_BUTTON, - WIDX_SCENERY_SECONDARY_COLOUR_BUTTON, - WIDX_SCENERY_TERTIARY_COLOUR_BUTTON, - WIDX_SCENERY_EYEDROPPER_BUTTON, - WIDX_SCENERY_BUILD_CLUSTER_BUTTON, - WIDX_FILTER_TEXT_BOX, - WIDX_FILTER_CLEAR_BUTTON, - WIDX_RESTRICT_SCENERY, - WIDX_SCENERY_TAB_1, -}; + static constexpr StringId WINDOW_TITLE = STR_NONE; + constexpr int32_t WINDOW_SCENERY_MIN_WIDTH = 634; + constexpr int32_t WINDOW_SCENERY_MIN_HEIGHT = 195; + constexpr int32_t SCENERY_BUTTON_WIDTH = 66; + constexpr int32_t SCENERY_BUTTON_HEIGHT = 80; + constexpr int32_t InitTabPosX = 3; + constexpr int32_t InitTabPosY = 17; + constexpr int32_t TabWidth = 31; + constexpr int32_t TabHeight = 28; + constexpr int32_t ReservedTabCount = 2; + constexpr int32_t MaxTabs = 257; // 255 selected tabs + misc + all + constexpr int32_t MaxTabsPerRow = 20; -validate_global_widx(WC_SCENERY, WIDX_SCENERY_TAB_1); -validate_global_widx(WC_SCENERY, WIDX_SCENERY_ROTATE_OBJECTS_BUTTON); -validate_global_widx(WC_SCENERY, WIDX_SCENERY_EYEDROPPER_BUTTON); + constexpr uint8_t SceneryContentScrollIndex = 0; -// clang-format off + enum WindowSceneryListWidgetIdx + { + WIDX_SCENERY_BACKGROUND, + WIDX_SCENERY_TITLE, + WIDX_SCENERY_CLOSE, + WIDX_SCENERY_TAB_CONTENT_PANEL, + WIDX_SCENERY_LIST, + WIDX_SCENERY_ROTATE_OBJECTS_BUTTON, + WIDX_SCENERY_REPAINT_SCENERY_BUTTON, + WIDX_SCENERY_PRIMARY_COLOUR_BUTTON, + WIDX_SCENERY_SECONDARY_COLOUR_BUTTON, + WIDX_SCENERY_TERTIARY_COLOUR_BUTTON, + WIDX_SCENERY_EYEDROPPER_BUTTON, + WIDX_SCENERY_BUILD_CLUSTER_BUTTON, + WIDX_FILTER_TEXT_BOX, + WIDX_FILTER_CLEAR_BUTTON, + WIDX_RESTRICT_SCENERY, + WIDX_SCENERY_TAB_1, + }; + + validate_global_widx(WC_SCENERY, WIDX_SCENERY_TAB_1); + validate_global_widx(WC_SCENERY, WIDX_SCENERY_ROTATE_OBJECTS_BUTTON); + validate_global_widx(WC_SCENERY, WIDX_SCENERY_EYEDROPPER_BUTTON); + + // clang-format off static Widget WindowSceneryBaseWidgets[] = { WINDOW_SHIM(WINDOW_TITLE, WINDOW_SCENERY_MIN_WIDTH, WINDOW_SCENERY_MIN_HEIGHT), MakeWidget ({ 0, 43}, {634, 99}, WindowWidgetType::Resize, WindowColour::Secondary ), // 8 0x009DE2C8 @@ -88,1665 +88,1668 @@ static Widget WindowSceneryBaseWidgets[] = { MakeWidget ({609, 83}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PAINTBRUSH), STR_SCENERY_PAINTBRUSH_TIP ), // 4000000 0x009DE438 MakeWidget ({615, 108}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_COLOUR ), // 8000000 0x009DE448 MakeWidget ({615, 120}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_SECONDARY_COLOUR), // 10000000 0x009DE458 - MakeWidget ({615, 132}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_TERNARY_COLOUR ), // 20000000 0x009DE468 + MakeWidget ({615, 132}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_TERTIARY_COLOUR ), // 20000000 0x009DE468 MakeWidget ({609, 145}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_EYEDROPPER), STR_SCENERY_EYEDROPPER_TIP ), // 40000000 0x009DE478 MakeWidget ({609, 169}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SCENERY_CLUSTER), STR_SCENERY_CLUSTER_TIP ), // 40000000 0x009DE478 MakeWidget ({ 4, 46}, {211, 14}, WindowWidgetType::TextBox, WindowColour::Secondary ), MakeWidget ({218, 46}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_OBJECT_SEARCH_CLEAR ), MakeWidget ({539, 46}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RESTRICT_SCENERY, STR_RESTRICT_SCENERY_TIP ), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -// Persistent between window instances -static size_t _activeTabIndex; -static std::vector _tabSelections; + // Persistent between window instances + static size_t _activeTabIndex; + static std::vector _tabSelections; -uint8_t gWindowSceneryPaintEnabled; -uint8_t gWindowSceneryRotation; -colour_t gWindowSceneryPrimaryColour; -colour_t gWindowScenerySecondaryColour; -colour_t gWindowSceneryTertiaryColour; -bool gWindowSceneryEyedropperEnabled; + uint8_t gWindowSceneryPaintEnabled; + uint8_t gWindowSceneryRotation; + colour_t gWindowSceneryPrimaryColour; + colour_t gWindowScenerySecondaryColour; + colour_t gWindowSceneryTertiaryColour; + bool gWindowSceneryEyedropperEnabled; -class SceneryWindow final : public Window -{ -private: - enum SceneryTabType + class SceneryWindow final : public Window { - SCENERY_TAB_TYPE_GROUP, - SCENERY_TAB_TYPE_MISC, - SCENERY_TAB_TYPE_ALL, - }; - - struct SceneryItem - { - int32_t allRows; - int32_t selected_item; - ScenerySelection scenerySelection; - }; - - struct SceneryTabInfo - { - SceneryTabType Type = SCENERY_TAB_TYPE_GROUP; - ObjectEntryIndex SceneryGroupIndex = OBJECT_ENTRY_INDEX_NULL; - std::deque Entries{}; - u8string Filter = ""; - - bool IsMisc() const + private: + enum SceneryTabType { - return Type == SCENERY_TAB_TYPE_MISC; - } + SCENERY_TAB_TYPE_GROUP, + SCENERY_TAB_TYPE_MISC, + SCENERY_TAB_TYPE_ALL, + }; - bool IsAll() const + struct SceneryItem { - return Type == SCENERY_TAB_TYPE_ALL; - } + int32_t allRows; + int32_t selected_item; + ScenerySelection scenerySelection; + }; - bool IsSceneryGroup() const + struct SceneryTabInfo { - return Type == SCENERY_TAB_TYPE_GROUP; - } + SceneryTabType Type = SCENERY_TAB_TYPE_GROUP; + ObjectEntryIndex SceneryGroupIndex = OBJECT_ENTRY_INDEX_NULL; + std::deque Entries{}; + u8string Filter = ""; - bool Contains(const ScenerySelection& entry) const - { - return std::find(std::begin(Entries), std::end(Entries), entry) != std::end(Entries); - } - - void AddEntryToBack(const ScenerySelection& entry) - { - if (!Contains(entry)) + bool IsMisc() const { - Entries.push_back(entry); + return Type == SCENERY_TAB_TYPE_MISC; + } + + bool IsAll() const + { + return Type == SCENERY_TAB_TYPE_ALL; + } + + bool IsSceneryGroup() const + { + return Type == SCENERY_TAB_TYPE_GROUP; + } + + bool Contains(const ScenerySelection& entry) const + { + return std::find(std::begin(Entries), std::end(Entries), entry) != std::end(Entries); + } + + void AddEntryToBack(const ScenerySelection& entry) + { + if (!Contains(entry)) + { + Entries.push_back(entry); + } + } + + void AddEntryToFront(const ScenerySelection& entry) + { + if (!Contains(entry)) + { + Entries.push_front(entry); + } + } + + const SceneryGroupEntry* GetSceneryGroupEntry() const + { + return OpenRCT2::ObjectManager::GetObjectEntry(SceneryGroupIndex); + } + }; + + std::vector _tabEntries; + std::vector _widgets; + int32_t _requiredWidth; + int32_t _actualMinHeight; + ScenerySelection _selectedScenery; + int16_t _hoverCounter; + SceneryTabInfo _filteredSceneryTab; + + public: + void OnOpen() override + { + Init(); + + InitScrollWidgets(); + ContentUpdateScroll(); + ShowGridlines(); + gWindowSceneryRotation = 3; + gSceneryCtrlPressed = false; + gSceneryShiftPressed = false; + _selectedScenery = {}; + _hoverCounter = 0; + gSceneryGhostType = 0; + gSceneryPlaceCost = kMoney64Undefined; + gSceneryPlaceRotation = 0; + gWindowSceneryPaintEnabled = 0; // repaint coloured scenery tool state + gWindowSceneryEyedropperEnabled = false; + + width = GetRequiredWidth(); + min_width = width; + max_width = width; + height = _actualMinHeight; + min_height = height; + max_height = height; + if (_activeTabIndex > _tabSelections.size()) + { + _activeTabIndex = 0; + } + + WindowMovePosition(*this, { ContextGetWidth() - GetRequiredWidth(), 0x1D }); + WindowPushOthersBelow(*this); + } + + void OnClose() override + { + SceneryRemoveGhostToolPlacement(); + HideGridlines(); + ViewportSetVisibility(ViewportVisibility::Default); + + if (gWindowSceneryScatterEnabled) + WindowCloseByClass(WindowClass::SceneryScatter); + + if (SceneryToolIsActive()) + ToolCancel(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_SCENERY_CLOSE: + Close(); + break; + case WIDX_SCENERY_ROTATE_OBJECTS_BUTTON: + gWindowSceneryRotation++; + gWindowSceneryRotation = gWindowSceneryRotation % 4; + SceneryRemoveGhostToolPlacement(); + Invalidate(); + break; + case WIDX_SCENERY_REPAINT_SCENERY_BUTTON: + gWindowSceneryPaintEnabled ^= 1; + gWindowSceneryEyedropperEnabled = false; + if (gWindowSceneryScatterEnabled) + WindowCloseByClass(WindowClass::SceneryScatter); + Invalidate(); + break; + case WIDX_SCENERY_EYEDROPPER_BUTTON: + gWindowSceneryPaintEnabled = 0; + gWindowSceneryEyedropperEnabled = !gWindowSceneryEyedropperEnabled; + if (gWindowSceneryScatterEnabled) + WindowCloseByClass(WindowClass::SceneryScatter); + SceneryRemoveGhostToolPlacement(); + Invalidate(); + break; + case WIDX_SCENERY_BUILD_CLUSTER_BUTTON: + gWindowSceneryPaintEnabled = 0; + gWindowSceneryEyedropperEnabled = false; + if (gWindowSceneryScatterEnabled) + WindowCloseByClass(WindowClass::SceneryScatter); + else if ( + NetworkGetMode() != NETWORK_MODE_CLIENT + || NetworkCanPerformCommand(NetworkGetCurrentPlayerGroupIndex(), -2)) + { + SceneryScatterOpen(); + } + else + { + ContextShowError(STR_CANT_DO_THIS, STR_PERMISSION_DENIED, {}); + } + Invalidate(); + break; + case WIDX_FILTER_TEXT_BOX: + WindowStartTextbox(*this, widgetIndex, STR_STRING, _filteredSceneryTab.Filter.data(), TEXT_INPUT_SIZE); + break; + case WIDX_FILTER_CLEAR_BUTTON: + _tabEntries[_activeTabIndex].Filter.clear(); + ContentUpdateScroll(); + scrolls->v_top = 0; + Invalidate(); + break; + case WIDX_RESTRICT_SCENERY: + { + const auto tabIndex = _activeTabIndex; + const auto tabSelectedScenery = GetSelectedScenery(tabIndex); + if (!tabSelectedScenery.IsUndefined()) + { + const auto newStatus = !IsSceneryItemRestricted(tabSelectedScenery); + const auto objectType = GetObjectTypeFromSceneryType(tabSelectedScenery.SceneryType); + auto action = ScenerySetRestrictedAction(objectType, tabSelectedScenery.EntryIndex, newStatus); + GameActions::Execute(&action); + } + break; + } } } - void AddEntryToFront(const ScenerySelection& entry) + void OnResize() override { - if (!Contains(entry)) + if (width < min_width) { - Entries.push_front(entry); + Invalidate(); + width = min_width; + Invalidate(); } - } - const SceneryGroupEntry* GetSceneryGroupEntry() const - { - return OpenRCT2::ObjectManager::GetObjectEntry(SceneryGroupIndex); - } - }; - - std::vector _tabEntries; - std::vector _widgets; - int32_t _requiredWidth; - int32_t _actualMinHeight; - ScenerySelection _selectedScenery; - int16_t _hoverCounter; - SceneryTabInfo _filteredSceneryTab; - -public: - void OnOpen() override - { - Init(); - - InitScrollWidgets(); - ContentUpdateScroll(); - ShowGridlines(); - gWindowSceneryRotation = 3; - gSceneryCtrlPressed = false; - gSceneryShiftPressed = false; - _selectedScenery = {}; - _hoverCounter = 0; - gSceneryGhostType = 0; - gSceneryPlaceCost = kMoney64Undefined; - gSceneryPlaceRotation = 0; - gWindowSceneryPaintEnabled = 0; // repaint coloured scenery tool state - gWindowSceneryEyedropperEnabled = false; - - width = GetRequiredWidth(); - min_width = width; - max_width = width; - height = _actualMinHeight; - min_height = height; - max_height = height; - if (_activeTabIndex > _tabSelections.size()) - { - _activeTabIndex = 0; - } - - WindowMovePosition(*this, { ContextGetWidth() - GetRequiredWidth(), 0x1D }); - WindowPushOthersBelow(*this); - } - - void OnClose() override - { - SceneryRemoveGhostToolPlacement(); - HideGridlines(); - ViewportSetVisibility(ViewportVisibility::Default); - - if (gWindowSceneryScatterEnabled) - WindowCloseByClass(WindowClass::SceneryScatter); - - if (SceneryToolIsActive()) - ToolCancel(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_SCENERY_CLOSE: - Close(); - break; - case WIDX_SCENERY_ROTATE_OBJECTS_BUTTON: - gWindowSceneryRotation++; - gWindowSceneryRotation = gWindowSceneryRotation % 4; - SceneryRemoveGhostToolPlacement(); + if (width > max_width) + { Invalidate(); - break; - case WIDX_SCENERY_REPAINT_SCENERY_BUTTON: - gWindowSceneryPaintEnabled ^= 1; - gWindowSceneryEyedropperEnabled = false; - if (gWindowSceneryScatterEnabled) - WindowCloseByClass(WindowClass::SceneryScatter); + width = max_width; Invalidate(); - break; - case WIDX_SCENERY_EYEDROPPER_BUTTON: - gWindowSceneryPaintEnabled = 0; - gWindowSceneryEyedropperEnabled = !gWindowSceneryEyedropperEnabled; - if (gWindowSceneryScatterEnabled) - WindowCloseByClass(WindowClass::SceneryScatter); - SceneryRemoveGhostToolPlacement(); + } + + if (height < min_height) + { Invalidate(); - break; - case WIDX_SCENERY_BUILD_CLUSTER_BUTTON: - gWindowSceneryPaintEnabled = 0; - gWindowSceneryEyedropperEnabled = false; - if (gWindowSceneryScatterEnabled) - WindowCloseByClass(WindowClass::SceneryScatter); - else if ( - NetworkGetMode() != NETWORK_MODE_CLIENT - || NetworkCanPerformCommand(NetworkGetCurrentPlayerGroupIndex(), -2)) - { - WindowSceneryScatterOpen(); - } - else - { - ContextShowError(STR_CANT_DO_THIS, STR_PERMISSION_DENIED, {}); - } + height = min_height; Invalidate(); - break; - case WIDX_FILTER_TEXT_BOX: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _filteredSceneryTab.Filter.data(), TEXT_INPUT_SIZE); - break; - case WIDX_FILTER_CLEAR_BUTTON: - _tabEntries[_activeTabIndex].Filter.clear(); + // HACK: For some reason invalidate has not been called + OnPrepareDraw(); ContentUpdateScroll(); - scrolls->v_top = 0; + } + + if (height > max_height) + { Invalidate(); - break; - case WIDX_RESTRICT_SCENERY: + height = max_height; + Invalidate(); + // HACK: For some reason invalidate has not been called + OnPrepareDraw(); + ContentUpdateScroll(); + } + + ResizeFrameWithPage(); + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_SCENERY_PRIMARY_COLOUR_BUTTON: + WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], gWindowSceneryPrimaryColour); + break; + case WIDX_SCENERY_SECONDARY_COLOUR_BUTTON: + WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], gWindowScenerySecondaryColour); + break; + case WIDX_SCENERY_TERTIARY_COLOUR_BUTTON: + WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], gWindowSceneryTertiaryColour); + break; + } + + if (widgetIndex >= WIDX_SCENERY_TAB_1) + { + _activeTabIndex = widgetIndex - WIDX_SCENERY_TAB_1; + Invalidate(); + gSceneryPlaceCost = kMoney64Undefined; + + ContentUpdateScroll(); + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + { + if (dropdownIndex == -1) + return; + + if (widgetIndex == WIDX_SCENERY_PRIMARY_COLOUR_BUTTON) + { + gWindowSceneryPrimaryColour = ColourDropDownIndexToColour(dropdownIndex); + } + else if (widgetIndex == WIDX_SCENERY_SECONDARY_COLOUR_BUTTON) + { + gWindowScenerySecondaryColour = ColourDropDownIndexToColour(dropdownIndex); + } + else if (widgetIndex == WIDX_SCENERY_TERTIARY_COLOUR_BUTTON) + { + gWindowSceneryTertiaryColour = ColourDropDownIndexToColour(dropdownIndex); + } + + Invalidate(); + } + + void OnPeriodicUpdate() override + { + if (!_selectedScenery.IsUndefined()) + { + // Find out what scenery the cursor is over + const CursorState* state = ContextGetCursorState(); + WidgetIndex widgetIndex = WindowFindWidgetFromPoint(*this, state->position); + if (widgetIndex == WIDX_SCENERY_LIST) + { + ScreenCoordsXY scrollPos = {}; + int32_t scrollArea = 0; + int32_t scrollId = 0; + WidgetScrollGetPart(*this, &widgets[WIDX_SCENERY_LIST], state->position, scrollPos, &scrollArea, &scrollId); + if (scrollArea == SCROLL_PART_VIEW) + { + const ScenerySelection scenery = GetSceneryIdByCursorPos(scrollPos); + if (scenery == _selectedScenery) + { + return; + } + } + } + + // Cursor was not over the currently hover selected scenery so reset hover selection. + // This will happen when the mouse leaves the scroll window and is required so that the cost and description + // switch to the tool scenery selection. + _selectedScenery = {}; + } + } + + void OnUpdate() override + { + const CursorState* state = ContextGetCursorState(); + WindowBase* other = WindowFindFromPoint(state->position); + if (other == this) + { + ScreenCoordsXY window = state->position - ScreenCoordsXY{ windowPos.x - 26, windowPos.y }; + + if (window.y < 44 || window.x <= width) + { + WidgetIndex widgetIndex = WindowFindWidgetFromPoint(*this, state->position); + if (widgetIndex >= WIDX_SCENERY_TAB_CONTENT_PANEL) + { + _hoverCounter++; + if (_hoverCounter < 8) + { + if (InputGetState() != InputState::ScrollLeft) + { + min_height = _actualMinHeight; + max_height = _actualMinHeight; + } + } + else + { + const auto& listWidget = widgets[WIDX_SCENERY_LIST]; + const auto nonListHeight = height - listWidget.height() + 12; + + const auto numRows = static_cast(CountRows()); + const auto maxContentHeight = numRows * SCENERY_BUTTON_HEIGHT; + const auto maxWindowHeight = maxContentHeight + nonListHeight; + const auto windowHeight = std::clamp(maxWindowHeight, _actualMinHeight, 473); + + min_height = windowHeight; + max_height = windowHeight; + } + } + } + } + else + { + _hoverCounter = 0; + if (InputGetState() != InputState::ScrollLeft) + { + min_height = _actualMinHeight; + max_height = _actualMinHeight; + } + } + + if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) + { + WindowUpdateTextboxCaret(); + WidgetInvalidate(*this, WIDX_FILTER_TEXT_BOX); + } + + Invalidate(); + + if (!SceneryToolIsActive()) + { + Close(); + return; + } + + if (gWindowSceneryEyedropperEnabled) + { + gCurrentToolId = Tool::Crosshair; + } + else if (gWindowSceneryPaintEnabled == 1) + { + gCurrentToolId = Tool::PaintDown; + } + else { const auto tabIndex = _activeTabIndex; const auto tabSelectedScenery = GetSelectedScenery(tabIndex); if (!tabSelectedScenery.IsUndefined()) { - const auto newStatus = !IsSceneryItemRestricted(tabSelectedScenery); - const auto objectType = GetObjectTypeFromSceneryType(tabSelectedScenery.SceneryType); - auto action = ScenerySetRestrictedAction(objectType, tabSelectedScenery.EntryIndex, newStatus); - GameActions::Execute(&action); - } - break; - } - } - } - - void OnResize() override - { - if (width < min_width) - { - Invalidate(); - width = min_width; - Invalidate(); - } - - if (width > max_width) - { - Invalidate(); - width = max_width; - Invalidate(); - } - - if (height < min_height) - { - Invalidate(); - height = min_height; - Invalidate(); - // HACK: For some reason invalidate has not been called - WindowEventOnPrepareDrawCall(this); - ContentUpdateScroll(); - } - - if (height > max_height) - { - Invalidate(); - height = max_height; - Invalidate(); - // HACK: For some reason invalidate has not been called - WindowEventOnPrepareDrawCall(this); - ContentUpdateScroll(); - } - - ResizeFrameWithPage(); - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_SCENERY_PRIMARY_COLOUR_BUTTON: - WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], gWindowSceneryPrimaryColour); - break; - case WIDX_SCENERY_SECONDARY_COLOUR_BUTTON: - WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], gWindowScenerySecondaryColour); - break; - case WIDX_SCENERY_TERTIARY_COLOUR_BUTTON: - WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], gWindowSceneryTertiaryColour); - break; - } - - if (widgetIndex >= WIDX_SCENERY_TAB_1) - { - _activeTabIndex = widgetIndex - WIDX_SCENERY_TAB_1; - Invalidate(); - gSceneryPlaceCost = kMoney64Undefined; - - ContentUpdateScroll(); - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - if (dropdownIndex == -1) - return; - - if (widgetIndex == WIDX_SCENERY_PRIMARY_COLOUR_BUTTON) - { - gWindowSceneryPrimaryColour = ColourDropDownIndexToColour(dropdownIndex); - } - else if (widgetIndex == WIDX_SCENERY_SECONDARY_COLOUR_BUTTON) - { - gWindowScenerySecondaryColour = ColourDropDownIndexToColour(dropdownIndex); - } - else if (widgetIndex == WIDX_SCENERY_TERTIARY_COLOUR_BUTTON) - { - gWindowSceneryTertiaryColour = ColourDropDownIndexToColour(dropdownIndex); - } - - Invalidate(); - } - - void OnPeriodicUpdate() override - { - if (!_selectedScenery.IsUndefined()) - { - // Find out what scenery the cursor is over - const CursorState* state = ContextGetCursorState(); - WidgetIndex widgetIndex = WindowFindWidgetFromPoint(*this, state->position); - if (widgetIndex == WIDX_SCENERY_LIST) - { - ScreenCoordsXY scrollPos = {}; - int32_t scrollArea = 0; - int32_t scrollId = 0; - WidgetScrollGetPart(*this, &widgets[WIDX_SCENERY_LIST], state->position, scrollPos, &scrollArea, &scrollId); - if (scrollArea == SCROLL_PART_VIEW) - { - const ScenerySelection scenery = GetSceneryIdByCursorPos(scrollPos); - if (scenery == _selectedScenery) + if (tabSelectedScenery.SceneryType == SCENERY_TYPE_BANNER) { - return; + gCurrentToolId = Tool::EntranceDown; } - } - } - - // Cursor was not over the currently hover selected scenery so reset hover selection. - // This will happen when the mouse leaves the scroll window and is required so that the cost and description switch - // to the tool scenery selection. - _selectedScenery = {}; - } - } - - void OnUpdate() override - { - const CursorState* state = ContextGetCursorState(); - WindowBase* other = WindowFindFromPoint(state->position); - if (other == this) - { - ScreenCoordsXY window = state->position - ScreenCoordsXY{ windowPos.x - 26, windowPos.y }; - - if (window.y < 44 || window.x <= width) - { - WidgetIndex widgetIndex = WindowFindWidgetFromPoint(*this, state->position); - if (widgetIndex >= WIDX_SCENERY_TAB_CONTENT_PANEL) - { - _hoverCounter++; - if (_hoverCounter < 8) + else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_LARGE) { - if (InputGetState() != InputState::ScrollLeft) - { - min_height = _actualMinHeight; - max_height = _actualMinHeight; - } + gCurrentToolId = static_cast( + OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id); + } + else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_WALL) + { + gCurrentToolId = static_cast( + OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id); + } + else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_PATH_ITEM) + { + gCurrentToolId = static_cast( + OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id); } else - { - const auto& listWidget = widgets[WIDX_SCENERY_LIST]; - const auto nonListHeight = height - listWidget.height() + 12; - - const auto numRows = static_cast(CountRows()); - const auto maxContentHeight = numRows * SCENERY_BUTTON_HEIGHT; - const auto maxWindowHeight = maxContentHeight + nonListHeight; - const auto windowHeight = std::clamp(maxWindowHeight, _actualMinHeight, 473); - - min_height = windowHeight; - max_height = windowHeight; + { // small scenery + gCurrentToolId = static_cast( + OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id); } } + else + { + gCurrentToolId = Tool::Arrow; + } } } - else + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override { - _hoverCounter = 0; - if (InputGetState() != InputState::ScrollLeft) + if (widgetIndex != WIDX_FILTER_TEXT_BOX) + return; + + if (text == _tabEntries[_activeTabIndex].Filter) + return; + + _tabEntries[_activeTabIndex].Filter.assign(text); + ContentUpdateScroll(); + + scrolls->v_top = 0; + Invalidate(); + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + if (scrollIndex == SceneryContentScrollIndex) { - min_height = _actualMinHeight; - max_height = _actualMinHeight; + return ContentScrollGetSize(); + } + return {}; + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + if (scrollIndex == SceneryContentScrollIndex) + { + ContentScrollMouseDown(screenCoords); } } - if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { - WindowUpdateTextboxCaret(); - WidgetInvalidate(*this, WIDX_FILTER_TEXT_BOX); + if (scrollIndex == SceneryContentScrollIndex) + { + ContentScrollMouseOver(screenCoords); + } } - Invalidate(); - - if (!SceneryToolIsActive()) + OpenRCT2String OnTooltip(const WidgetIndex widgetIndex, const StringId fallback) override { - Close(); - return; + if (widgetIndex >= WIDX_SCENERY_TAB_1) + { + const auto tabIndex = static_cast(widgetIndex - WIDX_SCENERY_TAB_1); + if (_tabEntries.size() > tabIndex) + { + const auto& tabInfo = _tabEntries[tabIndex]; + if (tabInfo.IsMisc()) + { + auto ft = Formatter(); + ft.Add(STR_MISCELLANEOUS); + return { fallback, ft }; + } + + if (tabInfo.IsAll()) + { + auto ft = Formatter(); + ft.Add(STR_ALL_SCENERY); + return { fallback, ft }; + } + + const auto* sceneryEntry = tabInfo.GetSceneryGroupEntry(); + if (sceneryEntry != nullptr) + { + auto ft = Formatter(); + ft.Add(sceneryEntry->name); + return { fallback, ft }; + } + } + } + return { STR_NONE, Formatter() }; } - if (gWindowSceneryEyedropperEnabled) - { - gCurrentToolId = Tool::Crosshair; - } - else if (gWindowSceneryPaintEnabled == 1) - { - gCurrentToolId = Tool::PaintDown; - } - else + void OnPrepareDraw() override { + // Set the window title + StringId titleStringId = STR_MISCELLANEOUS; const auto tabIndex = _activeTabIndex; + if (tabIndex < _tabEntries.size()) + { + const auto& tabInfo = _tabEntries[tabIndex]; + if (tabInfo.IsAll()) + { + titleStringId = STR_ALL_SCENERY; + } + else + { + const auto* sgEntry = tabInfo.GetSceneryGroupEntry(); + if (sgEntry != nullptr) + { + titleStringId = sgEntry->name; + } + } + } + widgets[WIDX_SCENERY_TITLE].text = titleStringId; + widgets[WIDX_FILTER_TEXT_BOX].string = _filteredSceneryTab.Filter.data(); + + pressed_widgets = 0; + pressed_widgets |= 1uLL << (tabIndex + WIDX_SCENERY_TAB_1); + if (gWindowSceneryPaintEnabled == 1) + pressed_widgets |= (1uLL << WIDX_SCENERY_REPAINT_SCENERY_BUTTON); + if (gWindowSceneryEyedropperEnabled) + pressed_widgets |= (1uLL << WIDX_SCENERY_EYEDROPPER_BUTTON); + if (gWindowSceneryScatterEnabled) + pressed_widgets |= (1uLL << WIDX_SCENERY_BUILD_CLUSTER_BUTTON); + + widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_RESTRICT_SCENERY].type = WindowWidgetType::Empty; + const auto tabSelectedScenery = GetSelectedScenery(tabIndex); if (!tabSelectedScenery.IsUndefined()) { - if (tabSelectedScenery.SceneryType == SCENERY_TYPE_BANNER) - { - gCurrentToolId = Tool::EntranceDown; - } - else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_LARGE) - { - gCurrentToolId = static_cast( - OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id); - } - else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_WALL) - { - gCurrentToolId = static_cast( - OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id); - } - else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_PATH_ITEM) - { - gCurrentToolId = static_cast( - OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id); - } - else - { // small scenery - gCurrentToolId = static_cast( - OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex)->tool_id); - } - } - else - { - gCurrentToolId = Tool::Arrow; - } - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (widgetIndex != WIDX_FILTER_TEXT_BOX) - return; - - if (text == _tabEntries[_activeTabIndex].Filter) - return; - - _tabEntries[_activeTabIndex].Filter.assign(text); - ContentUpdateScroll(); - - scrolls->v_top = 0; - Invalidate(); - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - if (scrollIndex == SceneryContentScrollIndex) - { - return ContentScrollGetSize(); - } - return {}; - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - if (scrollIndex == SceneryContentScrollIndex) - { - ContentScrollMouseDown(screenCoords); - } - } - - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - if (scrollIndex == SceneryContentScrollIndex) - { - ContentScrollMouseOver(screenCoords); - } - } - - OpenRCT2String OnTooltip(const WidgetIndex widgetIndex, const StringId fallback) override - { - if (widgetIndex >= WIDX_SCENERY_TAB_1) - { - const auto tabIndex = static_cast(widgetIndex - WIDX_SCENERY_TAB_1); - if (_tabEntries.size() > tabIndex) - { - const auto& tabInfo = _tabEntries[tabIndex]; - if (tabInfo.IsMisc()) - { - auto ft = Formatter(); - ft.Add(STR_MISCELLANEOUS); - return { fallback, ft }; - } - - if (tabInfo.IsAll()) - { - auto ft = Formatter(); - ft.Add(STR_ALL_SCENERY); - return { fallback, ft }; - } - - const auto* sceneryEntry = tabInfo.GetSceneryGroupEntry(); - if (sceneryEntry != nullptr) - { - auto ft = Formatter(); - ft.Add(sceneryEntry->name); - return { fallback, ft }; - } - } - } - return { STR_NONE, Formatter() }; - } - - void OnPrepareDraw() override - { - // Set the window title - StringId titleStringId = STR_MISCELLANEOUS; - const auto tabIndex = _activeTabIndex; - if (tabIndex < _tabEntries.size()) - { - const auto& tabInfo = _tabEntries[tabIndex]; - if (tabInfo.IsAll()) - { - titleStringId = STR_ALL_SCENERY; - } - else - { - const auto* sgEntry = tabInfo.GetSceneryGroupEntry(); - if (sgEntry != nullptr) - { - titleStringId = sgEntry->name; - } - } - } - widgets[WIDX_SCENERY_TITLE].text = titleStringId; - widgets[WIDX_FILTER_TEXT_BOX].string = _filteredSceneryTab.Filter.data(); - - pressed_widgets = 0; - pressed_widgets |= 1uLL << (tabIndex + WIDX_SCENERY_TAB_1); - if (gWindowSceneryPaintEnabled == 1) - pressed_widgets |= (1uLL << WIDX_SCENERY_REPAINT_SCENERY_BUTTON); - if (gWindowSceneryEyedropperEnabled) - pressed_widgets |= (1uLL << WIDX_SCENERY_EYEDROPPER_BUTTON); - if (gWindowSceneryScatterEnabled) - pressed_widgets |= (1uLL << WIDX_SCENERY_BUILD_CLUSTER_BUTTON); - - widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_RESTRICT_SCENERY].type = WindowWidgetType::Empty; - - if (!(gWindowSceneryPaintEnabled & 1)) - { - widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].type = WindowWidgetType::FlatBtn; - } - - const auto tabSelectedScenery = GetSelectedScenery(tabIndex); - if (!tabSelectedScenery.IsUndefined()) - { - if (tabSelectedScenery.SceneryType == SCENERY_TYPE_SMALL) - { - if (!(gWindowSceneryPaintEnabled & 1)) + if (tabSelectedScenery.SceneryType == SCENERY_TYPE_SMALL) { widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = WindowWidgetType::FlatBtn; - } - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex); - if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE)) + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry( + tabSelectedScenery.EntryIndex); + if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE)) + { + widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WindowWidgetType::FlatBtn; + } + } + else if (tabSelectedScenery.SceneryType >= SCENERY_TYPE_LARGE) { widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WindowWidgetType::FlatBtn; } - } - else if (tabSelectedScenery.SceneryType >= SCENERY_TYPE_LARGE) - { - widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WindowWidgetType::FlatBtn; - } - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) - { - widgets[WIDX_RESTRICT_SCENERY].type = WindowWidgetType::Button; - if (IsSceneryItemRestricted(tabSelectedScenery)) - pressed_widgets |= (1uLL << WIDX_RESTRICT_SCENERY); - else - pressed_widgets &= ~(1uLL << WIDX_RESTRICT_SCENERY); - } - } - - widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].image = GetColourButtonImage(gWindowSceneryPrimaryColour); - widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].image = GetColourButtonImage(gWindowScenerySecondaryColour); - widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].image = GetColourButtonImage(gWindowSceneryTertiaryColour); - - widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WindowWidgetType::Empty; - - if (gWindowSceneryPaintEnabled & 1) - { // repaint coloured scenery tool is on - widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; - widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; - widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; - widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WindowWidgetType::Empty; - } - else if (!tabSelectedScenery.IsUndefined()) - { - if (tabSelectedScenery.SceneryType == SCENERY_TYPE_BANNER) - { - auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex); - if (bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR) + if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.SandboxMode) { - widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + widgets[WIDX_RESTRICT_SCENERY].type = WindowWidgetType::Button; + if (IsSceneryItemRestricted(tabSelectedScenery)) + pressed_widgets |= (1uLL << WIDX_RESTRICT_SCENERY); + else + pressed_widgets &= ~(1uLL << WIDX_RESTRICT_SCENERY); } } - else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_LARGE) - { - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(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 = WindowWidgetType::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 = WindowWidgetType::ColourBtn; - if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_TERTIARY_COLOUR) - widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].image = GetColourButtonImage(gWindowSceneryPrimaryColour); + widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].image = GetColourButtonImage(gWindowScenerySecondaryColour); + widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].image = GetColourButtonImage(gWindowSceneryTertiaryColour); + + widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WindowWidgetType::Empty; + + if (gWindowSceneryPaintEnabled & 1) + { // repaint coloured scenery tool is on + widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; } - else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_WALL) + else if (!tabSelectedScenery.IsUndefined()) { - auto* wallEntry = OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex); - if (wallEntry->flags & (WALL_SCENERY_HAS_PRIMARY_COLOUR | WALL_SCENERY_HAS_GLASS)) + if (tabSelectedScenery.SceneryType == SCENERY_TYPE_BANNER) { - widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; - - if (wallEntry->flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) + auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry( + tabSelectedScenery.EntryIndex); + if (bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR) { - widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + } + } + else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_LARGE) + { + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry( + tabSelectedScenery.EntryIndex); - if (wallEntry->flags2 & WALL_SCENERY_2_NO_SELECT_PRIMARY_COLOUR) - widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::Empty; - if (wallEntry->flags & WALL_SCENERY_HAS_TERTIARY_COLOUR) + 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 = WindowWidgetType::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 = WindowWidgetType::ColourBtn; + if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_TERTIARY_COLOUR) + widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + } + else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_WALL) + { + auto* wallEntry = OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex); + if (wallEntry->flags & (WALL_SCENERY_HAS_PRIMARY_COLOUR | WALL_SCENERY_HAS_GLASS)) + { + widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + + if (wallEntry->flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) + { + widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + + if (wallEntry->flags2 & WALL_SCENERY_2_NO_SELECT_PRIMARY_COLOUR) + widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::Empty; + if (wallEntry->flags & WALL_SCENERY_HAS_TERTIARY_COLOUR) + widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + } + } + } + else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_SMALL) + { + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry( + tabSelectedScenery.EntryIndex); + + if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS)) + { + widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + + if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) + widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_TERTIARY_COLOUR)) widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; } } } - else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_SMALL) + + auto windowWidth = width; + if (_tabEntries.size() > 0) { - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(tabSelectedScenery.EntryIndex); + const auto lastTabIndex = GetMaxTabCountInARow() == MaxTabsPerRow ? MaxTabsPerRow - 1 : _tabEntries.size() - 1; + const auto lastTabWidget = &widgets[WIDX_SCENERY_TAB_1 + lastTabIndex]; + windowWidth = std::max(windowWidth, lastTabWidget->right + 3); - if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS)) + if (GetSceneryTabInfoForMisc() != nullptr) { - widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + auto miscTabWidget = &widgets[WIDX_SCENERY_TAB_1 + _tabEntries.size() - 2]; + miscTabWidget->left = windowWidth - 2 * TabWidth - 6; + miscTabWidget->right = windowWidth - TabWidth - 7; + miscTabWidget->top = InitTabPosY; + miscTabWidget->bottom = InitTabPosY + TabHeight; + } - if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) - widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; - if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_TERTIARY_COLOUR)) - widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn; + if (_tabEntries.back().IsAll()) + { + auto allTabWidget = &widgets[WIDX_SCENERY_TAB_1 + _tabEntries.size() - 1]; + allTabWidget->left = windowWidth - TabWidth - 6; + allTabWidget->right = windowWidth - 7; + allTabWidget->top = InitTabPosY; + allTabWidget->bottom = InitTabPosY + TabHeight; } } + + ResizeFrameWithPage(); + widgets[WIDX_SCENERY_LIST].right = windowWidth - 26; + widgets[WIDX_SCENERY_LIST].bottom = height - 24; + + widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].left = windowWidth - 25; + widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].left = windowWidth - 25; + widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].left = windowWidth - 25; + widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].left = windowWidth - 25; + widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].right = windowWidth - 2; + widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].right = windowWidth - 2; + widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].right = windowWidth - 2; + widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].right = windowWidth - 2; + + widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].left = windowWidth - 19; + widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].left = windowWidth - 19; + widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].left = windowWidth - 19; + widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].right = windowWidth - 8; + widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].right = windowWidth - 8; + widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].right = windowWidth - 8; } - auto windowWidth = width; - if (_tabEntries.size() > 0) + void OnDraw(DrawPixelInfo& dpi) override { - const auto lastTabIndex = GetMaxTabCountInARow() == MaxTabsPerRow ? MaxTabsPerRow - 1 : _tabEntries.size() - 1; - const auto lastTabWidget = &widgets[WIDX_SCENERY_TAB_1 + lastTabIndex]; - windowWidth = std::max(windowWidth, lastTabWidget->right + 3); + DrawWidgets(dpi); + DrawTabs(dpi, windowPos); - if (GetSceneryTabInfoForMisc() != nullptr) - { - auto miscTabWidget = &widgets[WIDX_SCENERY_TAB_1 + _tabEntries.size() - 2]; - miscTabWidget->left = windowWidth - 2 * TabWidth - 6; - miscTabWidget->right = windowWidth - TabWidth - 7; - miscTabWidget->top = InitTabPosY; - miscTabWidget->bottom = InitTabPosY + TabHeight; - } - - if (_tabEntries.back().IsAll()) - { - auto allTabWidget = &widgets[WIDX_SCENERY_TAB_1 + _tabEntries.size() - 1]; - allTabWidget->left = windowWidth - TabWidth - 6; - allTabWidget->right = windowWidth - 7; - allTabWidget->top = InitTabPosY; - allTabWidget->bottom = InitTabPosY + TabHeight; - } - } - - ResizeFrameWithPage(); - widgets[WIDX_SCENERY_LIST].right = windowWidth - 26; - widgets[WIDX_SCENERY_LIST].bottom = height - 24; - - widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].left = windowWidth - 25; - widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].left = windowWidth - 25; - widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].left = windowWidth - 25; - widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].left = windowWidth - 25; - widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].right = windowWidth - 2; - widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].right = windowWidth - 2; - widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].right = windowWidth - 2; - widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].right = windowWidth - 2; - - widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].left = windowWidth - 19; - widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].left = windowWidth - 19; - widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].left = windowWidth - 19; - widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].right = windowWidth - 8; - widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].right = windowWidth - 8; - widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].right = windowWidth - 8; - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabs(dpi, windowPos); - - auto selectedSceneryEntry = _selectedScenery; - if (selectedSceneryEntry.IsUndefined()) - { - if (gWindowSceneryPaintEnabled & 1) // repaint coloured scenery tool is on - return; - if (gWindowSceneryEyedropperEnabled) - return; - - selectedSceneryEntry = GetSelectedScenery(_activeTabIndex); + auto selectedSceneryEntry = _selectedScenery; if (selectedSceneryEntry.IsUndefined()) - return; - } - - auto [name, price] = GetNameAndPrice(selectedSceneryEntry); - if (price != kMoney64Undefined && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) - { - auto ft = Formatter(); - ft.Add(price); - - // -14 - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ width - 0x1A, height - 13 }, STR_COST_LABEL, ft, { TextAlignment::RIGHT }); - } - - auto ft = Formatter(); - ft.Add(name); - DrawTextEllipsised(dpi, { windowPos.x + 3, windowPos.y + height - 23 }, width - 19, STR_BLACK_STRING, ft); - - auto sceneryObjectType = GetObjectTypeFromSceneryType(selectedSceneryEntry.SceneryType); - auto& objManager = GetContext()->GetObjectManager(); - auto sceneryObject = objManager.GetLoadedObject(sceneryObjectType, selectedSceneryEntry.EntryIndex); - if (sceneryObject != nullptr && sceneryObject->GetAuthors().size() > 0) - { - std::string authorsString; - const auto& authors = sceneryObject->GetAuthors(); - for (size_t i = 0; i < authors.size(); ++i) { - if (i > 0) - { - authorsString.append(", "); - } - authorsString.append(authors[i]); + if (gWindowSceneryPaintEnabled & 1) // repaint coloured scenery tool is on + return; + if (gWindowSceneryEyedropperEnabled) + return; + + selectedSceneryEntry = GetSelectedScenery(_activeTabIndex); + if (selectedSceneryEntry.IsUndefined()) + return; } - ft = Formatter(); - ft.Add(authorsString.c_str()); - DrawTextEllipsised( - dpi, windowPos + ScreenCoordsXY{ 3, height - 13 }, width - 19, - (sceneryObject->GetAuthors().size() == 1 ? STR_SCENERY_AUTHOR : STR_SCENERY_AUTHOR_PLURAL), ft); - } - } - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - if (scrollIndex == SceneryContentScrollIndex) + auto [name, price] = GetNameAndPrice(selectedSceneryEntry); + if (price != kMoney64Undefined && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + auto ft = Formatter(); + ft.Add(price); + + // -14 + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ width - 0x1A, height - 13 }, STR_COST_LABEL, ft, { TextAlignment::RIGHT }); + } + + auto ft = Formatter(); + ft.Add(name); + DrawTextEllipsised(dpi, { windowPos.x + 3, windowPos.y + height - 23 }, width - 19, STR_BLACK_STRING, ft); + + auto sceneryObjectType = GetObjectTypeFromSceneryType(selectedSceneryEntry.SceneryType); + auto& objManager = GetContext()->GetObjectManager(); + auto sceneryObject = objManager.GetLoadedObject(sceneryObjectType, selectedSceneryEntry.EntryIndex); + if (sceneryObject != nullptr && sceneryObject->GetAuthors().size() > 0) + { + std::string authorsString; + const auto& authors = sceneryObject->GetAuthors(); + for (size_t i = 0; i < authors.size(); ++i) + { + if (i > 0) + { + authorsString.append(", "); + } + authorsString.append(authors[i]); + } + ft = Formatter(); + ft.Add(authorsString.c_str()); + DrawTextEllipsised( + dpi, windowPos + ScreenCoordsXY{ 3, height - 13 }, width - 19, + (sceneryObject->GetAuthors().size() == 1 ? STR_SCENERY_AUTHOR : STR_SCENERY_AUTHOR_PLURAL), ft); + } + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override { - ContentScrollDraw(dpi); + if (scrollIndex == SceneryContentScrollIndex) + { + ContentScrollDraw(dpi); + } } + + void SetSelectedItem( + const ScenerySelection& scenery, const std::optional primary, const std::optional secondary, + const std::optional tertiary, const std::optional rotation) + { + auto tabIndex = FindTabWithScenery(scenery); + if (!tabIndex.has_value()) + { + return; + } + + _activeTabIndex = tabIndex.value(); + SetSelectedScenery(tabIndex.value(), scenery); + if (primary.has_value()) + { + gWindowSceneryPrimaryColour = primary.value(); + } + if (secondary.has_value()) + { + gWindowScenerySecondaryColour = secondary.value(); + } + if (tertiary.has_value()) + { + gWindowSceneryTertiaryColour = tertiary.value(); + } + if (rotation.has_value()) + { + gWindowSceneryRotation = rotation.value(); + } + gWindowSceneryEyedropperEnabled = false; + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, ContextGetWidth() / 2); + _hoverCounter = -16; + gSceneryPlaceCost = kMoney64Undefined; + Invalidate(); + } + + void SetSelectedTab(const ObjectEntryIndex sceneryGroupIndex) + { + const auto* tabInfo = GetSceneryTabInfoForGroup(sceneryGroupIndex); + if (tabInfo == nullptr) + { + tabInfo = &_tabEntries.back(); + } + const auto tabId = std::distance(&*_tabEntries.cbegin(), tabInfo); + + OnMouseDown(WIDX_SCENERY_TAB_1 + tabId); + } + + const ScenerySelection GetTabSelection() + { + return GetSelectedScenery(_activeTabIndex); + } + + void Init() + { + _tabEntries.clear(); + + for (ObjectEntryIndex scenerySetIndex = 0; scenerySetIndex < MaxTabs - ReservedTabCount; scenerySetIndex++) + { + const auto* sceneryGroupEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySetIndex); + if (sceneryGroupEntry != nullptr && SceneryGroupIsInvented(scenerySetIndex)) + { + SceneryTabInfo tabInfo; + tabInfo.SceneryGroupIndex = scenerySetIndex; + for (const auto& sceneryEntry : sceneryGroupEntry->SceneryEntries) + { + if (IsSceneryAvailableToBuild(sceneryEntry)) + { + tabInfo.AddEntryToBack(sceneryEntry); + } + } + if (tabInfo.Entries.size() > 0) + { + _tabEntries.push_back(std::move(tabInfo)); + } + } + } + + // Sort scenery group tabs before adding other tabs + SortTabs(); + + // Add misc and all tab + _tabEntries.emplace_back(SceneryWindow::SceneryTabInfo{ SCENERY_TAB_TYPE_MISC }); + _tabEntries.emplace_back(SceneryWindow::SceneryTabInfo{ SCENERY_TAB_TYPE_ALL }); + + // small scenery + for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_SMALL_SCENERY_OBJECTS; sceneryId++) + { + const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryId); + if (sceneryEntry != nullptr) + { + InitSceneryEntry({ SCENERY_TYPE_SMALL, sceneryId }, sceneryEntry->scenery_tab_id); + } + } + + // large scenery + for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_LARGE_SCENERY_OBJECTS; sceneryId++) + { + const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryId); + if (sceneryEntry != nullptr) + { + InitSceneryEntry({ SCENERY_TYPE_LARGE, sceneryId }, sceneryEntry->scenery_tab_id); + } + } + + // walls + for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_WALL_SCENERY_OBJECTS; sceneryId++) + { + const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryId); + if (sceneryEntry != nullptr) + { + InitSceneryEntry({ SCENERY_TYPE_WALL, sceneryId }, sceneryEntry->scenery_tab_id); + } + } + + // banners + for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_BANNER_OBJECTS; sceneryId++) + { + const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryId); + if (sceneryEntry != nullptr) + { + InitSceneryEntry({ SCENERY_TYPE_BANNER, sceneryId }, sceneryEntry->scenery_tab_id); + } + } + + for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_PATH_ADDITION_OBJECTS; sceneryId++) + { + const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryId); + if (sceneryEntry != nullptr) + { + InitSceneryEntry({ SCENERY_TYPE_PATH_ITEM, sceneryId }, sceneryEntry->scenery_tab_id); + } + } + + // Remove empty tabs + _tabEntries.erase( + std::remove_if( + _tabEntries.begin(), _tabEntries.end(), + [](const SceneryTabInfo& tabInfo) { return tabInfo.Entries.empty(); }), + _tabEntries.end()); + + // Set required width + _requiredWidth = std::min(static_cast(_tabEntries.size()), MaxTabsPerRow) * TabWidth + 5; + + PrepareWidgets(); + WindowInvalidateByClass(WindowClass::Scenery); + } + + int32_t GetRequiredWidth() const + { + return std::max(_requiredWidth, WINDOW_SCENERY_MIN_WIDTH); + } + + private: + int32_t GetNumColumns() const + { + const auto& listWidget = widgets[WIDX_SCENERY_LIST]; + const auto contentWidth = listWidget.width() - kScrollBarWidth; + return contentWidth / SCENERY_BUTTON_WIDTH; + } + + template T CountRows(T items) const + { + const auto rows = items / GetNumColumns(); + return rows; + } + + size_t CountRows() const + { + const auto tabIndex = _activeTabIndex; + if (tabIndex >= _tabEntries.size()) + { + return 0; + } + + const auto totalItems = _filteredSceneryTab.Entries.size(); + const auto numColumns = GetNumColumns(); + const auto rows = CountRows(totalItems + numColumns - 1); + return rows; + } + + int32_t constexpr ContentRowsHeight(const size_t rows) const + { + return static_cast(rows * SCENERY_BUTTON_HEIGHT); + } + + void ContentUpdateScroll() + { + const auto tabIndex = _activeTabIndex; + if (tabIndex >= _tabEntries.size()) + { + return; + } + + SetFilteredScenery(tabIndex); + + const int32_t listHeight = height - 14 - widgets[WIDX_SCENERY_LIST].top - 1; + + const auto sceneryItem = ContentCountRowsWithSelectedItem(tabIndex); + scrolls[SceneryContentScrollIndex].v_bottom = ContentRowsHeight(sceneryItem.allRows) + 1; + + const int32_t maxTop = std::max(0, scrolls[SceneryContentScrollIndex].v_bottom - listHeight); + auto rowSelected = CountRows(sceneryItem.selected_item); + if (sceneryItem.scenerySelection.IsUndefined()) + { + auto& oldScenery = GetSelectedScenery(tabIndex); + if (!oldScenery.IsUndefined()) + { + // Make sure last selected scenery for tab is always present + _filteredSceneryTab.AddEntryToFront(oldScenery); + } + else + { + // No last selection was made, use blank ScenerySelection + SetSelectedScenery(tabIndex, ScenerySelection()); + rowSelected = 0; + if (!_filteredSceneryTab.Entries.empty()) + { + // Select first item in current filtered tab if available + const auto& scenery = _filteredSceneryTab.Entries.front(); + if (!scenery.IsUndefined()) + { + SetSelectedScenery(tabIndex, scenery); + } + } + } + } + + scrolls[SceneryContentScrollIndex].v_top = ContentRowsHeight(rowSelected); + scrolls[SceneryContentScrollIndex].v_top = std::min(maxTop, scrolls[SceneryContentScrollIndex].v_top); + + WidgetScrollUpdateThumbs(*this, WIDX_SCENERY_LIST); + } + + SceneryItem ContentCountRowsWithSelectedItem(const size_t tabIndex) + { + SceneryItem sceneryItem = { 0, 0, ScenerySelection() }; + const auto scenerySelection = GetSelectedScenery(tabIndex); + for (size_t i = 0; i < _filteredSceneryTab.Entries.size(); i++) + { + const auto& currentEntry = _filteredSceneryTab.Entries[i]; + if (currentEntry == scenerySelection) + { + sceneryItem.selected_item = static_cast(i); + sceneryItem.scenerySelection = scenerySelection; + } + } + sceneryItem.allRows = static_cast(CountRows(_filteredSceneryTab.Entries.size() + 8)); + return sceneryItem; + } + + const ScenerySelection GetSelectedScenery(const size_t tabIndex) + { + if (_tabSelections.size() > tabIndex) + { + return _tabSelections[tabIndex]; + } + return {}; + } + + void SetSelectedScenery(const size_t tabIndex, const ScenerySelection& value) + { + if (_tabSelections.size() <= tabIndex) + { + _tabSelections.resize(tabIndex + 1); + } + _tabSelections[tabIndex] = value; + } + + SceneryTabInfo* GetSceneryTabInfoForMisc() + { + if (_tabEntries.size() >= 2) + { + if (_tabEntries[_tabEntries.size() - 2].IsMisc()) + return &_tabEntries[_tabEntries.size() - 2]; + } + + return nullptr; + } + + SceneryTabInfo* GetSceneryTabInfoForAll() + { + if (!_tabEntries.empty()) + { + if (_tabEntries.back().IsAll()) + return &_tabEntries.back(); + } + + return nullptr; + } + + SceneryTabInfo* GetSceneryTabInfoForGroup(const ObjectEntryIndex sceneryGroupIndex) + { + for (auto& tabEntry : _tabEntries) + { + if (tabEntry.SceneryGroupIndex == sceneryGroupIndex) + return &tabEntry; + } + + return nullptr; + } + + std::optional FindTabWithScenery(const ScenerySelection& scenery) + { + for (size_t i = 0; i < _tabEntries.size(); i++) + { + const auto& tabInfo = _tabEntries[i]; + if (tabInfo.IsAll()) + { + // The scenery will be always added here so exclude this one. + continue; + } + if (tabInfo.Contains(scenery)) + { + return i; + } + } + return std::nullopt; + } + + void InitSceneryEntry(const ScenerySelection& selection, const ObjectEntryIndex sceneryGroupIndex) + { + Guard::ArgumentInRange(selection.EntryIndex, 0, OBJECT_ENTRY_INDEX_NULL); + + if (IsSceneryAvailableToBuild(selection)) + { + // Add scenery to all tab + auto* allTabInfo = GetSceneryTabInfoForAll(); + if (allTabInfo != nullptr) + { + allTabInfo->AddEntryToBack(selection); + } + + // Add scenery to primary group (usually trees or path additions) + if (sceneryGroupIndex != OBJECT_ENTRY_INDEX_NULL) + { + auto* tabInfo = GetSceneryTabInfoForGroup(sceneryGroupIndex); + if (tabInfo != nullptr) + { + tabInfo->AddEntryToBack(selection); + return; + } + } + + // If scenery has no tab, add it to misc + const auto tabIndex = FindTabWithScenery(selection); + if (!tabIndex.has_value()) + { + auto* tabInfo = GetSceneryTabInfoForMisc(); + if (tabInfo != nullptr) + { + tabInfo->AddEntryToBack(selection); + } + } + } + } + + void SetFilteredScenery(const size_t tabIndex) + { + auto currentTab = _tabEntries[tabIndex]; + + _filteredSceneryTab.Entries.clear(); + _filteredSceneryTab.Filter = currentTab.Filter; + + for (auto selection : currentTab.Entries) + { + if (MatchFilter(selection)) + _filteredSceneryTab.AddEntryToBack(selection); + } + } + + bool MatchFilter(const ScenerySelection& selection) + { + if (_filteredSceneryTab.Filter.empty()) + return true; + + auto& objManager = GetContext()->GetObjectManager(); + auto sceneryObjectType = GetObjectTypeFromSceneryType(selection.SceneryType); + auto sceneryObject = objManager.GetLoadedObject(sceneryObjectType, selection.EntryIndex); + + return IsFilterInName(*sceneryObject) || IsFilterInAuthors(*sceneryObject) || IsFilterInIdentifier(*sceneryObject) + || IsFilterInFilename(*sceneryObject); + } + + bool IsFilterInName(const Object& object) + { + return String::Contains(object.GetName(), _filteredSceneryTab.Filter, true); + } + + bool IsFilterInAuthors(const Object& object) + { + for (auto author : object.GetAuthors()) + if (String::Contains(author, _filteredSceneryTab.Filter, true)) + return true; + + return false; + } + + bool IsFilterInIdentifier(const Object& object) + { + return String::Contains(object.GetIdentifier(), _filteredSceneryTab.Filter, true); + } + + bool IsFilterInFilename(const Object& object) + { + auto repoItem = ObjectRepositoryFindObjectByEntry(&(object.GetObjectEntry())); + return String::Contains(repoItem->Path, _filteredSceneryTab.Filter, true); + } + + void SortTabs() + { + std::sort(_tabEntries.begin(), _tabEntries.end(), [](const SceneryTabInfo& a, const SceneryTabInfo& b) { + if (a.SceneryGroupIndex == b.SceneryGroupIndex) + return false; + + if (a.SceneryGroupIndex == OBJECT_ENTRY_INDEX_NULL) + return false; + if (b.SceneryGroupIndex == OBJECT_ENTRY_INDEX_NULL) + return true; + + const auto* entryA = a.GetSceneryGroupEntry(); + const auto* entryB = b.GetSceneryGroupEntry(); + return entryA->priority < entryB->priority; + }); + } + + int32_t GetTabRowCount() + { + return std::max((static_cast(_tabEntries.size()) + MaxTabsPerRow - 1) / MaxTabsPerRow, 0); + } + + int32_t GetMaxTabCountInARow() + { + int32_t tabEntries = static_cast(_tabEntries.size()); + return std::min(tabEntries, MaxTabsPerRow); + } + + void PrepareWidgets() + { + // Add the base widgets + _widgets.clear(); + for (const auto& widget : WindowSceneryBaseWidgets) + { + _widgets.push_back(widget); + } + + // Remove WWT_LAST + auto lastWidget = _widgets.back(); + _widgets.pop_back(); + + // Add tabs + _actualMinHeight = WINDOW_SCENERY_MIN_HEIGHT; + int32_t xInit = InitTabPosX; + int32_t tabsInThisRow = 0; + + auto hasMisc = GetSceneryTabInfoForMisc() != nullptr; + auto maxTabsInThisRow = MaxTabsPerRow - 1 - (hasMisc ? 1 : 0); + + ScreenCoordsXY pos = { xInit, InitTabPosY }; + for (const auto& tabInfo : _tabEntries) + { + auto widget = MakeTab(pos, STR_STRING_DEFINED_TOOLTIP); + pos.x += TabWidth; + + if (tabInfo.IsMisc()) + { + widget.image = ImageId(SPR_TAB_QUESTION, FilterPaletteID::PaletteNull); + } + else if (tabInfo.IsAll()) + { + widget.image = ImageId(SPR_TAB, FilterPaletteID::PaletteNull); + } + else if (tabInfo.IsSceneryGroup()) + { + // Default tab image + widget.image = ImageId(SPR_TAB_QUESTION, FilterPaletteID::PaletteNull); + + // Scenery Group image + auto scgEntry = tabInfo.GetSceneryGroupEntry(); + if (scgEntry != nullptr) + { + widget.image = ImageId(scgEntry->image, colours[1]); + } + } + + _widgets.push_back(widget); + + tabsInThisRow++; + if (tabsInThisRow >= maxTabsInThisRow) + { + pos.x = xInit; + pos.y += TabHeight; + tabsInThisRow = 0; + _actualMinHeight += TabHeight; + maxTabsInThisRow = MaxTabsPerRow; + } + } + + _widgets.push_back(lastWidget); + + // Shift base widgets based on number of tab rows + int32_t shiftAmount = (GetTabRowCount() - 1) * TabHeight; + if (shiftAmount > 0) + { + _widgets[WIDX_SCENERY_LIST].top += shiftAmount; + _widgets[WIDX_SCENERY_LIST].bottom += shiftAmount; + _widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].top += shiftAmount; + _widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].bottom += shiftAmount; + _widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].top += shiftAmount; + _widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].bottom += shiftAmount; + _widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].top += shiftAmount; + _widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].bottom += shiftAmount; + _widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].top += shiftAmount; + _widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].bottom += shiftAmount; + _widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].top += shiftAmount; + _widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].bottom += shiftAmount; + _widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].top += shiftAmount; + _widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].bottom += shiftAmount; + _widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].top += shiftAmount; + _widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].bottom += shiftAmount; + _widgets[WIDX_FILTER_TEXT_BOX].top += shiftAmount; + _widgets[WIDX_FILTER_TEXT_BOX].bottom += shiftAmount; + _widgets[WIDX_FILTER_CLEAR_BUTTON].top += shiftAmount; + _widgets[WIDX_FILTER_CLEAR_BUTTON].bottom += shiftAmount; + } + + widgets = _widgets.data(); + } + + ScenerySelection GetSceneryIdByCursorPos(const ScreenCoordsXY& screenCoords) const + { + ScenerySelection scenery{}; + + const auto numColumns = GetNumColumns(); + const auto colIndex = screenCoords.x / SCENERY_BUTTON_WIDTH; + const auto rowIndex = screenCoords.y / SCENERY_BUTTON_HEIGHT; + if (colIndex >= 0 && colIndex < numColumns && rowIndex >= 0) + { + const auto tabSceneryIndex = static_cast((rowIndex * numColumns) + colIndex); + if (tabSceneryIndex < _filteredSceneryTab.Entries.size()) + { + return _filteredSceneryTab.Entries[tabSceneryIndex]; + } + } + return scenery; + } + + ScreenSize ContentScrollGetSize() const + { + auto rows = CountRows(); + return { 0, ContentRowsHeight(rows) }; + } + + void ContentScrollMouseDown(const ScreenCoordsXY& screenCoords) + { + const auto scenery = GetSceneryIdByCursorPos(screenCoords); + if (scenery.IsUndefined()) + return; + + auto lastScenery = GetSelectedScenery(_activeTabIndex); + if (lastScenery != scenery && !MatchFilter(lastScenery)) + { + _filteredSceneryTab.Entries.pop_front(); + } + SetSelectedScenery(_activeTabIndex, scenery); + + gWindowSceneryPaintEnabled &= 0xFE; + gWindowSceneryEyedropperEnabled = false; + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); + _hoverCounter = -16; + gSceneryPlaceCost = kMoney64Undefined; + Invalidate(); + } + + void ContentScrollMouseOver(const ScreenCoordsXY& screenCoords) + { + ScenerySelection scenery = GetSceneryIdByCursorPos(screenCoords); + if (!scenery.IsUndefined()) + { + _selectedScenery = scenery; + Invalidate(); + } + } + + std::pair GetNameAndPrice(ScenerySelection selectedScenery) + { + StringId name = STR_UNKNOWN_OBJECT_TYPE; + money64 price = kMoney64Undefined; + if (selectedScenery.IsUndefined() && gSceneryPlaceCost != kMoney64Undefined) + { + price = gSceneryPlaceCost; + } + else + { + switch (selectedScenery.SceneryType) + { + case SCENERY_TYPE_SMALL: + { + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry( + selectedScenery.EntryIndex); + if (sceneryEntry != nullptr) + { + price = sceneryEntry->price; + name = sceneryEntry->name; + } + break; + } + case SCENERY_TYPE_PATH_ITEM: + { + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry( + selectedScenery.EntryIndex); + if (sceneryEntry != nullptr) + { + price = sceneryEntry->price; + name = sceneryEntry->name; + } + break; + } + case SCENERY_TYPE_WALL: + { + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry( + selectedScenery.EntryIndex); + if (sceneryEntry != nullptr) + { + price = sceneryEntry->price; + name = sceneryEntry->name; + } + break; + } + case SCENERY_TYPE_LARGE: + { + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry( + selectedScenery.EntryIndex); + if (sceneryEntry != nullptr) + { + price = sceneryEntry->price; + name = sceneryEntry->name; + } + break; + } + case SCENERY_TYPE_BANNER: + { + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry( + selectedScenery.EntryIndex); + if (sceneryEntry != nullptr) + { + price = sceneryEntry->price; + name = sceneryEntry->name; + } + break; + } + } + } + return { name, price }; + } + + void DrawTabs(DrawPixelInfo& dpi, const ScreenCoordsXY& offset) + { + for (size_t tabIndex = 0; tabIndex < _tabEntries.size(); tabIndex++) + { + auto widgetIndex = static_cast(WIDX_SCENERY_TAB_1 + tabIndex); + auto widgetCoordsXY = ScreenCoordsXY(widgets[widgetIndex].left, widgets[widgetIndex].top); + + if (_tabEntries[tabIndex].IsAll()) + { + auto imageId = ImageId(SPR_G2_INFINITY, FilterPaletteID::PaletteNull); + GfxDrawSprite(dpi, imageId, offset + widgetCoordsXY + ScreenCoordsXY(2, 6)); + } + } + } + + void DrawSceneryItem(DrawPixelInfo& dpi, ScenerySelection scenerySelection) + { + if (scenerySelection.SceneryType == SCENERY_TYPE_BANNER) + { + auto bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySelection.EntryIndex); + auto imageId = ImageId(bannerEntry->image + gWindowSceneryRotation * 2, gWindowSceneryPrimaryColour); + GfxDrawSprite(dpi, imageId, { 33, 40 }); + GfxDrawSprite(dpi, imageId.WithIndexOffset(1), { 33, 40 }); + } + else if (scenerySelection.SceneryType == SCENERY_TYPE_LARGE) + { + auto sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySelection.EntryIndex); + auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation); + if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR) + imageId = imageId.WithPrimary(gWindowSceneryPrimaryColour); + if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR) + imageId = imageId.WithSecondary(gWindowScenerySecondaryColour); + if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_TERTIARY_COLOUR) + imageId = imageId.WithTertiary(gWindowSceneryTertiaryColour); + GfxDrawSprite(dpi, imageId, { 33, 0 }); + } + else if (scenerySelection.SceneryType == SCENERY_TYPE_WALL) + { + auto wallEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySelection.EntryIndex); + auto imageId = ImageId(wallEntry->image); + auto spriteTop = (wallEntry->height * 2) + 0x32; + if (wallEntry->flags & WALL_SCENERY_HAS_GLASS) + { + imageId = imageId.WithPrimary(gWindowSceneryPrimaryColour); + if (wallEntry->flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) + { + imageId = imageId.WithSecondary(gWindowScenerySecondaryColour); + } + GfxDrawSprite(dpi, imageId, { 47, spriteTop }); + + auto glassImageId = ImageId(wallEntry->image + 6).WithTransparency(gWindowSceneryPrimaryColour); + GfxDrawSprite(dpi, glassImageId, { 47, spriteTop }); + } + else + { + imageId = imageId.WithPrimary(gWindowSceneryPrimaryColour); + if (wallEntry->flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) + { + imageId = imageId.WithSecondary(gWindowScenerySecondaryColour); + if (wallEntry->flags & WALL_SCENERY_HAS_TERTIARY_COLOUR) + { + imageId = imageId.WithTertiary(gWindowSceneryTertiaryColour); + } + } + GfxDrawSprite(dpi, imageId, { 47, spriteTop }); + + if (wallEntry->flags & WALL_SCENERY_IS_DOOR) + { + GfxDrawSprite(dpi, imageId.WithIndexOffset(1), { 47, spriteTop }); + } + } + } + else if (scenerySelection.SceneryType == SCENERY_TYPE_PATH_ITEM) + { + auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry( + scenerySelection.EntryIndex); + auto imageId = ImageId(pathAdditionEntry->image); + GfxDrawSprite(dpi, imageId, { 11, 16 }); + } + else + { + auto sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySelection.EntryIndex); + auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation); + if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR)) + { + imageId = imageId.WithPrimary(gWindowSceneryPrimaryColour); + if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) + { + imageId = imageId.WithSecondary(gWindowScenerySecondaryColour); + } + } + if (sceneryEntry->flags & SMALL_SCENERY_FLAG_HAS_TERTIARY_COLOUR) + { + imageId = imageId.WithTertiary(gWindowSceneryTertiaryColour); + } + + auto spriteTop = (sceneryEntry->height / 4) + 43; + if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE) + && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) + { + spriteTop -= 12; + } + + GfxDrawSprite(dpi, imageId, { 32, spriteTop }); + + if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_GLASS)) + { + imageId = ImageId(sceneryEntry->image + 4 + gWindowSceneryRotation) + .WithTransparency(gWindowSceneryPrimaryColour); + GfxDrawSprite(dpi, imageId, { 32, spriteTop }); + } + + if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ANIMATED_FG)) + { + imageId = ImageId(sceneryEntry->image + 4 + gWindowSceneryRotation); + GfxDrawSprite(dpi, imageId, { 32, spriteTop }); + } + } + } + + void ContentScrollDraw(DrawPixelInfo& dpi) + { + GfxClear(dpi, ColourMapA[colours[1]].mid_light); + + auto numColumns = GetNumColumns(); + auto tabIndex = _activeTabIndex; + if (tabIndex >= _tabEntries.size()) + { + return; + } + + ScreenCoordsXY topLeft{ 0, 0 }; + + for (size_t sceneryTabItemIndex = 0; sceneryTabItemIndex < _filteredSceneryTab.Entries.size(); + sceneryTabItemIndex++) + { + const auto& currentSceneryGlobal = _filteredSceneryTab.Entries[sceneryTabItemIndex]; + const auto tabSelectedScenery = GetSelectedScenery(tabIndex); + if (gWindowSceneryPaintEnabled == 1 || gWindowSceneryEyedropperEnabled) + { + if (_selectedScenery == currentSceneryGlobal) + { + GfxFillRectInset( + dpi, { topLeft, topLeft + ScreenCoordsXY{ SCENERY_BUTTON_WIDTH - 1, SCENERY_BUTTON_HEIGHT - 1 } }, + colours[1], INSET_RECT_FLAG_FILL_MID_LIGHT); + } + } + else + { + if (tabSelectedScenery == currentSceneryGlobal) + { + GfxFillRectInset( + dpi, { topLeft, topLeft + ScreenCoordsXY{ SCENERY_BUTTON_WIDTH - 1, SCENERY_BUTTON_HEIGHT - 1 } }, + colours[1], (INSET_RECT_FLAG_BORDER_INSET | INSET_RECT_FLAG_FILL_MID_LIGHT)); + } + else if (_selectedScenery == currentSceneryGlobal) + { + GfxFillRectInset( + dpi, { topLeft, topLeft + ScreenCoordsXY{ SCENERY_BUTTON_WIDTH - 1, SCENERY_BUTTON_HEIGHT - 1 } }, + colours[1], INSET_RECT_FLAG_FILL_MID_LIGHT); + } + } + + DrawPixelInfo clipdpi; + if (ClipDrawPixelInfo( + clipdpi, dpi, topLeft + ScreenCoordsXY{ 1, 1 }, SCENERY_BUTTON_WIDTH - 2, SCENERY_BUTTON_HEIGHT - 2)) + { + DrawSceneryItem(clipdpi, currentSceneryGlobal); + } + + topLeft.x += SCENERY_BUTTON_WIDTH; + if (topLeft.x >= numColumns * SCENERY_BUTTON_WIDTH) + { + topLeft.y += SCENERY_BUTTON_HEIGHT; + topLeft.x = 0; + } + } + } + }; + + WindowBase* SceneryOpen() + { + auto* w = static_cast(WindowBringToFrontByClass(WindowClass::Scenery)); + if (w == nullptr) + { + w = WindowCreate(WindowClass::Scenery); + } + return w; } - void SetSelectedItem( + void WindowScenerySetSelectedItem( const ScenerySelection& scenery, const std::optional primary, const std::optional secondary, const std::optional tertiary, const std::optional rotation) { - auto tabIndex = FindTabWithScenery(scenery); - if (!tabIndex.has_value()) + auto* w = static_cast(WindowBringToFrontByClass(WindowClass::Scenery)); + if (w != nullptr) { - return; - } - - _activeTabIndex = tabIndex.value(); - SetSelectedScenery(tabIndex.value(), scenery); - if (primary.has_value()) - { - gWindowSceneryPrimaryColour = primary.value(); - } - if (secondary.has_value()) - { - gWindowScenerySecondaryColour = secondary.value(); - } - if (tertiary.has_value()) - { - gWindowSceneryTertiaryColour = tertiary.value(); - } - if (rotation.has_value()) - { - gWindowSceneryRotation = rotation.value(); - } - gWindowSceneryEyedropperEnabled = false; - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, ContextGetWidth() / 2); - _hoverCounter = -16; - gSceneryPlaceCost = kMoney64Undefined; - Invalidate(); - } - - void SetSelectedTab(const ObjectEntryIndex sceneryGroupIndex) - { - const auto* tabInfo = GetSceneryTabInfoForGroup(sceneryGroupIndex); - if (tabInfo == nullptr) - { - tabInfo = &_tabEntries.back(); - } - const auto tabId = std::distance(&*_tabEntries.cbegin(), tabInfo); - - OnMouseDown(WIDX_SCENERY_TAB_1 + tabId); - } - - const ScenerySelection GetTabSelection() - { - return GetSelectedScenery(_activeTabIndex); - } - - void Init() - { - _tabEntries.clear(); - - for (ObjectEntryIndex scenerySetIndex = 0; scenerySetIndex < MaxTabs - ReservedTabCount; scenerySetIndex++) - { - const auto* sceneryGroupEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySetIndex); - if (sceneryGroupEntry != nullptr && SceneryGroupIsInvented(scenerySetIndex)) - { - SceneryTabInfo tabInfo; - tabInfo.SceneryGroupIndex = scenerySetIndex; - for (const auto& sceneryEntry : sceneryGroupEntry->SceneryEntries) - { - if (IsSceneryAvailableToBuild(sceneryEntry)) - { - tabInfo.AddEntryToBack(sceneryEntry); - } - } - if (tabInfo.Entries.size() > 0) - { - _tabEntries.push_back(std::move(tabInfo)); - } - } - } - - // Sort scenery group tabs before adding other tabs - SortTabs(); - - // Add misc and all tab - _tabEntries.emplace_back(SceneryWindow::SceneryTabInfo{ SCENERY_TAB_TYPE_MISC }); - _tabEntries.emplace_back(SceneryWindow::SceneryTabInfo{ SCENERY_TAB_TYPE_ALL }); - - // small scenery - for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_SMALL_SCENERY_OBJECTS; sceneryId++) - { - const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryId); - if (sceneryEntry != nullptr) - { - InitSceneryEntry({ SCENERY_TYPE_SMALL, sceneryId }, sceneryEntry->scenery_tab_id); - } - } - - // large scenery - for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_LARGE_SCENERY_OBJECTS; sceneryId++) - { - const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryId); - if (sceneryEntry != nullptr) - { - InitSceneryEntry({ SCENERY_TYPE_LARGE, sceneryId }, sceneryEntry->scenery_tab_id); - } - } - - // walls - for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_WALL_SCENERY_OBJECTS; sceneryId++) - { - const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryId); - if (sceneryEntry != nullptr) - { - InitSceneryEntry({ SCENERY_TYPE_WALL, sceneryId }, sceneryEntry->scenery_tab_id); - } - } - - // banners - for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_BANNER_OBJECTS; sceneryId++) - { - const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryId); - if (sceneryEntry != nullptr) - { - InitSceneryEntry({ SCENERY_TYPE_BANNER, sceneryId }, sceneryEntry->scenery_tab_id); - } - } - - for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_PATH_ADDITION_OBJECTS; sceneryId++) - { - const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryId); - if (sceneryEntry != nullptr) - { - InitSceneryEntry({ SCENERY_TYPE_PATH_ITEM, sceneryId }, sceneryEntry->scenery_tab_id); - } - } - - // Remove empty tabs - _tabEntries.erase( - std::remove_if( - _tabEntries.begin(), _tabEntries.end(), [](const SceneryTabInfo& tabInfo) { return tabInfo.Entries.empty(); }), - _tabEntries.end()); - - // Set required width - _requiredWidth = std::min(static_cast(_tabEntries.size()), MaxTabsPerRow) * TabWidth + 5; - - PrepareWidgets(); - WindowInvalidateByClass(WindowClass::Scenery); - } - - int32_t GetRequiredWidth() const - { - return std::max(_requiredWidth, WINDOW_SCENERY_MIN_WIDTH); - } - -private: - int32_t GetNumColumns() const - { - const auto& listWidget = widgets[WIDX_SCENERY_LIST]; - const auto contentWidth = listWidget.width() - SCROLLBAR_WIDTH; - return contentWidth / SCENERY_BUTTON_WIDTH; - } - - template T CountRows(T items) const - { - const auto rows = items / GetNumColumns(); - return rows; - } - - size_t CountRows() const - { - const auto tabIndex = _activeTabIndex; - if (tabIndex >= _tabEntries.size()) - { - return 0; - } - - const auto totalItems = _filteredSceneryTab.Entries.size(); - const auto numColumns = GetNumColumns(); - const auto rows = CountRows(totalItems + numColumns - 1); - return rows; - } - - int32_t constexpr ContentRowsHeight(const size_t rows) const - { - return static_cast(rows * SCENERY_BUTTON_HEIGHT); - } - - void ContentUpdateScroll() - { - const auto tabIndex = _activeTabIndex; - if (tabIndex >= _tabEntries.size()) - { - return; - } - - SetFilteredScenery(tabIndex); - - const int32_t listHeight = height - 14 - widgets[WIDX_SCENERY_LIST].top - 1; - - const auto sceneryItem = ContentCountRowsWithSelectedItem(tabIndex); - scrolls[SceneryContentScrollIndex].v_bottom = ContentRowsHeight(sceneryItem.allRows) + 1; - - const int32_t maxTop = std::max(0, scrolls[SceneryContentScrollIndex].v_bottom - listHeight); - auto rowSelected = CountRows(sceneryItem.selected_item); - if (sceneryItem.scenerySelection.IsUndefined()) - { - auto& oldScenery = GetSelectedScenery(tabIndex); - if (!oldScenery.IsUndefined()) - { - // Make sure last selected scenery for tab is always present - _filteredSceneryTab.AddEntryToFront(oldScenery); - } - else - { - // No last selection was made, use blank ScenerySelection - SetSelectedScenery(tabIndex, ScenerySelection()); - rowSelected = 0; - if (!_filteredSceneryTab.Entries.empty()) - { - // Select first item in current filtered tab if available - const auto& scenery = _filteredSceneryTab.Entries.front(); - if (!scenery.IsUndefined()) - { - SetSelectedScenery(tabIndex, scenery); - } - } - } - } - - scrolls[SceneryContentScrollIndex].v_top = ContentRowsHeight(rowSelected); - scrolls[SceneryContentScrollIndex].v_top = std::min(maxTop, scrolls[SceneryContentScrollIndex].v_top); - - WidgetScrollUpdateThumbs(*this, WIDX_SCENERY_LIST); - } - - SceneryItem ContentCountRowsWithSelectedItem(const size_t tabIndex) - { - SceneryItem sceneryItem = { 0, 0, ScenerySelection() }; - const auto scenerySelection = GetSelectedScenery(tabIndex); - for (size_t i = 0; i < _filteredSceneryTab.Entries.size(); i++) - { - const auto& currentEntry = _filteredSceneryTab.Entries[i]; - if (currentEntry == scenerySelection) - { - sceneryItem.selected_item = static_cast(i); - sceneryItem.scenerySelection = scenerySelection; - } - } - sceneryItem.allRows = static_cast(CountRows(_filteredSceneryTab.Entries.size() + 8)); - return sceneryItem; - } - - const ScenerySelection GetSelectedScenery(const size_t tabIndex) - { - if (_tabSelections.size() > tabIndex) - { - return _tabSelections[tabIndex]; - } - return {}; - } - - void SetSelectedScenery(const size_t tabIndex, const ScenerySelection& value) - { - if (_tabSelections.size() <= tabIndex) - { - _tabSelections.resize(tabIndex + 1); - } - _tabSelections[tabIndex] = value; - } - - SceneryTabInfo* GetSceneryTabInfoForMisc() - { - if (_tabEntries.size() >= 2) - { - if (_tabEntries[_tabEntries.size() - 2].IsMisc()) - return &_tabEntries[_tabEntries.size() - 2]; - } - - return nullptr; - } - - SceneryTabInfo* GetSceneryTabInfoForAll() - { - if (!_tabEntries.empty()) - { - if (_tabEntries.back().IsAll()) - return &_tabEntries.back(); - } - - return nullptr; - } - - SceneryTabInfo* GetSceneryTabInfoForGroup(const ObjectEntryIndex sceneryGroupIndex) - { - for (auto& tabEntry : _tabEntries) - { - if (tabEntry.SceneryGroupIndex == sceneryGroupIndex) - return &tabEntry; - } - - return nullptr; - } - - std::optional FindTabWithScenery(const ScenerySelection& scenery) - { - for (size_t i = 0; i < _tabEntries.size(); i++) - { - const auto& tabInfo = _tabEntries[i]; - if (tabInfo.IsAll()) - { - // The scenery will be always added here so exclude this one. - continue; - } - if (tabInfo.Contains(scenery)) - { - return i; - } - } - return std::nullopt; - } - - void InitSceneryEntry(const ScenerySelection& selection, const ObjectEntryIndex sceneryGroupIndex) - { - Guard::ArgumentInRange(selection.EntryIndex, 0, OBJECT_ENTRY_INDEX_NULL); - - if (IsSceneryAvailableToBuild(selection)) - { - // Add scenery to all tab - auto* allTabInfo = GetSceneryTabInfoForAll(); - if (allTabInfo != nullptr) - { - allTabInfo->AddEntryToBack(selection); - } - - // Add scenery to primary group (usually trees or path additions) - if (sceneryGroupIndex != OBJECT_ENTRY_INDEX_NULL) - { - auto* tabInfo = GetSceneryTabInfoForGroup(sceneryGroupIndex); - if (tabInfo != nullptr) - { - tabInfo->AddEntryToBack(selection); - return; - } - } - - // If scenery has no tab, add it to misc - const auto tabIndex = FindTabWithScenery(selection); - if (!tabIndex.has_value()) - { - auto* tabInfo = GetSceneryTabInfoForMisc(); - if (tabInfo != nullptr) - { - tabInfo->AddEntryToBack(selection); - } - } + w->SetSelectedItem(scenery, primary, secondary, tertiary, rotation); } } - void SetFilteredScenery(const size_t tabIndex) + void WindowScenerySetSelectedTab(const ObjectEntryIndex sceneryGroupIndex) { - auto currentTab = _tabEntries[tabIndex]; - - _filteredSceneryTab.Entries.clear(); - _filteredSceneryTab.Filter = currentTab.Filter; - - for (auto selection : currentTab.Entries) + // Should this bring to front? + auto* w = static_cast(WindowFindByClass(WindowClass::Scenery)); + if (w != nullptr) { - if (MatchFilter(selection)) - _filteredSceneryTab.AddEntryToBack(selection); + return w->SetSelectedTab(sceneryGroupIndex); } } - bool MatchFilter(const ScenerySelection& selection) + // Used after removing objects, in order to avoid crashes. + void WindowSceneryResetSelectedSceneryItems() { - if (_filteredSceneryTab.Filter.empty()) - return true; - - auto& objManager = GetContext()->GetObjectManager(); - auto sceneryObjectType = GetObjectTypeFromSceneryType(selection.SceneryType); - auto sceneryObject = objManager.GetLoadedObject(sceneryObjectType, selection.EntryIndex); - - return IsFilterInName(*sceneryObject) || IsFilterInAuthors(*sceneryObject) || IsFilterInIdentifier(*sceneryObject) - || IsFilterInFilename(*sceneryObject); + _tabSelections.clear(); + _activeTabIndex = 0; } - bool IsFilterInName(const Object& object) + void WindowScenerySetDefaultPlacementConfiguration() { - return String::Contains(object.GetName(), _filteredSceneryTab.Filter, true); + gWindowSceneryRotation = 3; + gWindowSceneryPrimaryColour = COLOUR_BORDEAUX_RED; + gWindowScenerySecondaryColour = COLOUR_YELLOW; + gWindowSceneryTertiaryColour = COLOUR_DARK_BROWN; + + WindowSceneryResetSelectedSceneryItems(); } - bool IsFilterInAuthors(const Object& object) + const ScenerySelection WindowSceneryGetTabSelection() { - for (auto author : object.GetAuthors()) - if (String::Contains(author, _filteredSceneryTab.Filter, true)) - return true; - - return false; - } - - bool IsFilterInIdentifier(const Object& object) - { - return String::Contains(object.GetIdentifier(), _filteredSceneryTab.Filter, true); - } - - bool IsFilterInFilename(const Object& object) - { - auto repoItem = ObjectRepositoryFindObjectByEntry(&(object.GetObjectEntry())); - return String::Contains(repoItem->Path, _filteredSceneryTab.Filter, true); - } - - void SortTabs() - { - std::sort(_tabEntries.begin(), _tabEntries.end(), [](const SceneryTabInfo& a, const SceneryTabInfo& b) { - if (a.SceneryGroupIndex == b.SceneryGroupIndex) - return false; - - if (a.SceneryGroupIndex == OBJECT_ENTRY_INDEX_NULL) - return false; - if (b.SceneryGroupIndex == OBJECT_ENTRY_INDEX_NULL) - return true; - - const auto* entryA = a.GetSceneryGroupEntry(); - const auto* entryB = b.GetSceneryGroupEntry(); - return entryA->priority < entryB->priority; - }); - } - - int32_t GetTabRowCount() - { - return std::max((static_cast(_tabEntries.size()) + MaxTabsPerRow - 1) / MaxTabsPerRow, 0); - } - - int32_t GetMaxTabCountInARow() - { - int32_t tabEntries = static_cast(_tabEntries.size()); - return std::min(tabEntries, MaxTabsPerRow); - } - - void PrepareWidgets() - { - // Add the base widgets - _widgets.clear(); - for (const auto& widget : WindowSceneryBaseWidgets) + auto* w = static_cast(WindowFindByClass(WindowClass::Scenery)); + if (w != nullptr) { - _widgets.push_back(widget); - } - - // Remove WWT_LAST - auto lastWidget = _widgets.back(); - _widgets.pop_back(); - - // Add tabs - _actualMinHeight = WINDOW_SCENERY_MIN_HEIGHT; - int32_t xInit = InitTabPosX; - int32_t tabsInThisRow = 0; - - auto hasMisc = GetSceneryTabInfoForMisc() != nullptr; - auto maxTabsInThisRow = MaxTabsPerRow - 1 - (hasMisc ? 1 : 0); - - ScreenCoordsXY pos = { xInit, InitTabPosY }; - for (const auto& tabInfo : _tabEntries) - { - auto widget = MakeTab(pos, STR_STRING_DEFINED_TOOLTIP); - pos.x += TabWidth; - - if (tabInfo.IsMisc()) - { - widget.image = ImageId(SPR_TAB_QUESTION, FilterPaletteID::PaletteNull); - } - else if (tabInfo.IsAll()) - { - widget.image = ImageId(SPR_TAB, FilterPaletteID::PaletteNull); - } - else if (tabInfo.IsSceneryGroup()) - { - // Default tab image - widget.image = ImageId(SPR_TAB_QUESTION, FilterPaletteID::PaletteNull); - - // Scenery Group image - auto scgEntry = tabInfo.GetSceneryGroupEntry(); - if (scgEntry != nullptr) - { - widget.image = ImageId(scgEntry->image, colours[1]); - } - } - - _widgets.push_back(widget); - - tabsInThisRow++; - if (tabsInThisRow >= maxTabsInThisRow) - { - pos.x = xInit; - pos.y += TabHeight; - tabsInThisRow = 0; - _actualMinHeight += TabHeight; - maxTabsInThisRow = MaxTabsPerRow; - } - } - - _widgets.push_back(lastWidget); - - // Shift base widgets based on number of tab rows - int32_t shiftAmount = (GetTabRowCount() - 1) * TabHeight; - if (shiftAmount > 0) - { - _widgets[WIDX_SCENERY_LIST].top += shiftAmount; - _widgets[WIDX_SCENERY_LIST].bottom += shiftAmount; - _widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].top += shiftAmount; - _widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].bottom += shiftAmount; - _widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].top += shiftAmount; - _widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].bottom += shiftAmount; - _widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].top += shiftAmount; - _widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].bottom += shiftAmount; - _widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].top += shiftAmount; - _widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].bottom += shiftAmount; - _widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].top += shiftAmount; - _widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].bottom += shiftAmount; - _widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].top += shiftAmount; - _widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].bottom += shiftAmount; - _widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].top += shiftAmount; - _widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].bottom += shiftAmount; - _widgets[WIDX_FILTER_TEXT_BOX].top += shiftAmount; - _widgets[WIDX_FILTER_TEXT_BOX].bottom += shiftAmount; - _widgets[WIDX_FILTER_CLEAR_BUTTON].top += shiftAmount; - _widgets[WIDX_FILTER_CLEAR_BUTTON].bottom += shiftAmount; - } - - widgets = _widgets.data(); - } - - ScenerySelection GetSceneryIdByCursorPos(const ScreenCoordsXY& screenCoords) const - { - ScenerySelection scenery{}; - - const auto numColumns = GetNumColumns(); - const auto colIndex = screenCoords.x / SCENERY_BUTTON_WIDTH; - const auto rowIndex = screenCoords.y / SCENERY_BUTTON_HEIGHT; - if (colIndex >= 0 && colIndex < numColumns && rowIndex >= 0) - { - const auto tabSceneryIndex = static_cast((rowIndex * numColumns) + colIndex); - if (tabSceneryIndex < _filteredSceneryTab.Entries.size()) - { - return _filteredSceneryTab.Entries[tabSceneryIndex]; - } - } - return scenery; - } - - ScreenSize ContentScrollGetSize() const - { - auto rows = CountRows(); - return { 0, ContentRowsHeight(rows) }; - } - - void ContentScrollMouseDown(const ScreenCoordsXY& screenCoords) - { - const auto scenery = GetSceneryIdByCursorPos(screenCoords); - if (scenery.IsUndefined()) - return; - - auto lastScenery = GetSelectedScenery(_activeTabIndex); - if (lastScenery != scenery && !MatchFilter(lastScenery)) - { - _filteredSceneryTab.Entries.pop_front(); - } - SetSelectedScenery(_activeTabIndex, scenery); - - gWindowSceneryPaintEnabled &= 0xFE; - gWindowSceneryEyedropperEnabled = false; - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); - _hoverCounter = -16; - gSceneryPlaceCost = kMoney64Undefined; - Invalidate(); - } - - void ContentScrollMouseOver(const ScreenCoordsXY& screenCoords) - { - ScenerySelection scenery = GetSceneryIdByCursorPos(screenCoords); - if (!scenery.IsUndefined()) - { - _selectedScenery = scenery; - Invalidate(); - } - } - - std::pair GetNameAndPrice(ScenerySelection selectedScenery) - { - StringId name = STR_UNKNOWN_OBJECT_TYPE; - money64 price = kMoney64Undefined; - if (selectedScenery.IsUndefined() && gSceneryPlaceCost != kMoney64Undefined) - { - price = gSceneryPlaceCost; + return w->GetTabSelection(); } else { - switch (selectedScenery.SceneryType) - { - case SCENERY_TYPE_SMALL: - { - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(selectedScenery.EntryIndex); - if (sceneryEntry != nullptr) - { - price = sceneryEntry->price; - name = sceneryEntry->name; - } - break; - } - case SCENERY_TYPE_PATH_ITEM: - { - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(selectedScenery.EntryIndex); - if (sceneryEntry != nullptr) - { - price = sceneryEntry->price; - name = sceneryEntry->name; - } - break; - } - case SCENERY_TYPE_WALL: - { - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(selectedScenery.EntryIndex); - if (sceneryEntry != nullptr) - { - price = sceneryEntry->price; - name = sceneryEntry->name; - } - break; - } - case SCENERY_TYPE_LARGE: - { - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(selectedScenery.EntryIndex); - if (sceneryEntry != nullptr) - { - price = sceneryEntry->price; - name = sceneryEntry->name; - } - break; - } - case SCENERY_TYPE_BANNER: - { - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry( - selectedScenery.EntryIndex); - if (sceneryEntry != nullptr) - { - price = sceneryEntry->price; - name = sceneryEntry->name; - } - break; - } - } + return {}; } - return { name, price }; } - void DrawTabs(DrawPixelInfo& dpi, const ScreenCoordsXY& offset) + void WindowSceneryInit() { - for (size_t tabIndex = 0; tabIndex < _tabEntries.size(); tabIndex++) + auto* w = static_cast(WindowFindByClass(WindowClass::Scenery)); + if (w != nullptr) { - auto widgetIndex = static_cast(WIDX_SCENERY_TAB_1 + tabIndex); - auto widgetCoordsXY = ScreenCoordsXY(widgets[widgetIndex].left, widgets[widgetIndex].top); - - if (_tabEntries[tabIndex].IsAll()) - { - auto imageId = ImageId(SPR_G2_INFINITY, FilterPaletteID::PaletteNull); - GfxDrawSprite(dpi, imageId, offset + widgetCoordsXY + ScreenCoordsXY(2, 6)); - } + w->Init(); } } - - void DrawSceneryItem(DrawPixelInfo& dpi, ScenerySelection scenerySelection) - { - if (scenerySelection.SceneryType == SCENERY_TYPE_BANNER) - { - auto bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySelection.EntryIndex); - auto imageId = ImageId(bannerEntry->image + gWindowSceneryRotation * 2, gWindowSceneryPrimaryColour); - GfxDrawSprite(dpi, imageId, { 33, 40 }); - GfxDrawSprite(dpi, imageId.WithIndexOffset(1), { 33, 40 }); - } - else if (scenerySelection.SceneryType == SCENERY_TYPE_LARGE) - { - auto sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySelection.EntryIndex); - auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation); - if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR) - imageId = imageId.WithPrimary(gWindowSceneryPrimaryColour); - if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR) - imageId = imageId.WithSecondary(gWindowScenerySecondaryColour); - if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_TERTIARY_COLOUR) - imageId = imageId.WithTertiary(gWindowSceneryTertiaryColour); - GfxDrawSprite(dpi, imageId, { 33, 0 }); - } - else if (scenerySelection.SceneryType == SCENERY_TYPE_WALL) - { - auto wallEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySelection.EntryIndex); - auto imageId = ImageId(wallEntry->image); - auto spriteTop = (wallEntry->height * 2) + 0x32; - if (wallEntry->flags & WALL_SCENERY_HAS_GLASS) - { - imageId = imageId.WithPrimary(gWindowSceneryPrimaryColour); - if (wallEntry->flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) - { - imageId = imageId.WithSecondary(gWindowScenerySecondaryColour); - } - GfxDrawSprite(dpi, imageId, { 47, spriteTop }); - - auto glassImageId = ImageId(wallEntry->image + 6).WithTransparency(gWindowSceneryPrimaryColour); - GfxDrawSprite(dpi, glassImageId, { 47, spriteTop }); - } - else - { - imageId = imageId.WithPrimary(gWindowSceneryPrimaryColour); - if (wallEntry->flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) - { - imageId = imageId.WithSecondary(gWindowScenerySecondaryColour); - if (wallEntry->flags & WALL_SCENERY_HAS_TERTIARY_COLOUR) - { - imageId = imageId.WithTertiary(gWindowSceneryTertiaryColour); - } - } - GfxDrawSprite(dpi, imageId, { 47, spriteTop }); - - if (wallEntry->flags & WALL_SCENERY_IS_DOOR) - { - GfxDrawSprite(dpi, imageId.WithIndexOffset(1), { 47, spriteTop }); - } - } - } - else if (scenerySelection.SceneryType == SCENERY_TYPE_PATH_ITEM) - { - auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySelection.EntryIndex); - auto imageId = ImageId(pathAdditionEntry->image); - GfxDrawSprite(dpi, imageId, { 11, 16 }); - } - else - { - auto sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(scenerySelection.EntryIndex); - auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation); - if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR)) - { - imageId = imageId.WithPrimary(gWindowSceneryPrimaryColour); - if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) - { - imageId = imageId.WithSecondary(gWindowScenerySecondaryColour); - } - } - if (sceneryEntry->flags & SMALL_SCENERY_FLAG_HAS_TERTIARY_COLOUR) - { - imageId = imageId.WithTertiary(gWindowSceneryTertiaryColour); - } - - auto spriteTop = (sceneryEntry->height / 4) + 43; - if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE) && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) - { - spriteTop -= 12; - } - - GfxDrawSprite(dpi, imageId, { 32, spriteTop }); - - if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_GLASS)) - { - imageId = ImageId(sceneryEntry->image + 4 + gWindowSceneryRotation) - .WithTransparency(gWindowSceneryPrimaryColour); - GfxDrawSprite(dpi, imageId, { 32, spriteTop }); - } - - if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ANIMATED_FG)) - { - imageId = ImageId(sceneryEntry->image + 4 + gWindowSceneryRotation); - GfxDrawSprite(dpi, imageId, { 32, spriteTop }); - } - } - } - - void ContentScrollDraw(DrawPixelInfo& dpi) - { - GfxClear(&dpi, ColourMapA[colours[1]].mid_light); - - auto numColumns = GetNumColumns(); - auto tabIndex = _activeTabIndex; - if (tabIndex >= _tabEntries.size()) - { - return; - } - - ScreenCoordsXY topLeft{ 0, 0 }; - - for (size_t sceneryTabItemIndex = 0; sceneryTabItemIndex < _filteredSceneryTab.Entries.size(); sceneryTabItemIndex++) - { - const auto& currentSceneryGlobal = _filteredSceneryTab.Entries[sceneryTabItemIndex]; - const auto tabSelectedScenery = GetSelectedScenery(tabIndex); - if (gWindowSceneryPaintEnabled == 1 || gWindowSceneryEyedropperEnabled) - { - if (_selectedScenery == currentSceneryGlobal) - { - GfxFillRectInset( - dpi, { topLeft, topLeft + ScreenCoordsXY{ SCENERY_BUTTON_WIDTH - 1, SCENERY_BUTTON_HEIGHT - 1 } }, - colours[1], INSET_RECT_FLAG_FILL_MID_LIGHT); - } - } - else - { - if (tabSelectedScenery == currentSceneryGlobal) - { - GfxFillRectInset( - dpi, { topLeft, topLeft + ScreenCoordsXY{ SCENERY_BUTTON_WIDTH - 1, SCENERY_BUTTON_HEIGHT - 1 } }, - colours[1], (INSET_RECT_FLAG_BORDER_INSET | INSET_RECT_FLAG_FILL_MID_LIGHT)); - } - else if (_selectedScenery == currentSceneryGlobal) - { - GfxFillRectInset( - dpi, { topLeft, topLeft + ScreenCoordsXY{ SCENERY_BUTTON_WIDTH - 1, SCENERY_BUTTON_HEIGHT - 1 } }, - colours[1], INSET_RECT_FLAG_FILL_MID_LIGHT); - } - } - - DrawPixelInfo clipdpi; - if (ClipDrawPixelInfo( - clipdpi, dpi, topLeft + ScreenCoordsXY{ 1, 1 }, SCENERY_BUTTON_WIDTH - 2, SCENERY_BUTTON_HEIGHT - 2)) - { - DrawSceneryItem(clipdpi, currentSceneryGlobal); - } - - topLeft.x += SCENERY_BUTTON_WIDTH; - if (topLeft.x >= numColumns * SCENERY_BUTTON_WIDTH) - { - topLeft.y += SCENERY_BUTTON_HEIGHT; - topLeft.x = 0; - } - } - } -}; - -WindowBase* WindowSceneryOpen() -{ - auto* w = static_cast(WindowBringToFrontByClass(WindowClass::Scenery)); - if (w == nullptr) - { - w = WindowCreate(WindowClass::Scenery); - } - return w; -} - -void WindowScenerySetSelectedItem( - const ScenerySelection& scenery, const std::optional primary, const std::optional secondary, - const std::optional tertiary, const std::optional rotation) -{ - auto* w = static_cast(WindowBringToFrontByClass(WindowClass::Scenery)); - if (w != nullptr) - { - w->SetSelectedItem(scenery, primary, secondary, tertiary, rotation); - } -} - -void WindowScenerySetSelectedTab(const ObjectEntryIndex sceneryGroupIndex) -{ - // Should this bring to front? - auto* w = static_cast(WindowFindByClass(WindowClass::Scenery)); - if (w != nullptr) - { - return w->SetSelectedTab(sceneryGroupIndex); - } -} - -// Used after removing objects, in order to avoid crashes. -void WindowSceneryResetSelectedSceneryItems() -{ - _tabSelections.clear(); - _activeTabIndex = 0; -} - -void WindowScenerySetDefaultPlacementConfiguration() -{ - gWindowSceneryRotation = 3; - gWindowSceneryPrimaryColour = COLOUR_BORDEAUX_RED; - gWindowScenerySecondaryColour = COLOUR_YELLOW; - gWindowSceneryTertiaryColour = COLOUR_DARK_BROWN; - - WindowSceneryResetSelectedSceneryItems(); -} - -const ScenerySelection WindowSceneryGetTabSelection() -{ - auto* w = static_cast(WindowFindByClass(WindowClass::Scenery)); - if (w != nullptr) - { - return w->GetTabSelection(); - } - else - { - return {}; - } -} - -void WindowSceneryInit() -{ - auto* w = static_cast(WindowFindByClass(WindowClass::Scenery)); - if (w != nullptr) - { - w->Init(); - } -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp index ad8107368a..6da6ae4f27 100644 --- a/src/openrct2-ui/windows/SceneryScatter.cpp +++ b/src/openrct2-ui/windows/SceneryScatter.cpp @@ -15,26 +15,27 @@ #include #include #include - -enum WindowSceneryScatterWidgetIdx +namespace OpenRCT2::Ui::Windows { - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_PREVIEW, - WIDX_DECREMENT, - WIDX_INCREMENT, - WIDX_DENSITY, - WIDX_DENSITY_LOW, - WIDX_DENSITY_MEDIUM, - WIDX_DENSITY_HIGH -}; + enum WindowSceneryScatterWidgetIdx + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_PREVIEW, + WIDX_DECREMENT, + WIDX_INCREMENT, + WIDX_DENSITY, + WIDX_DENSITY_LOW, + WIDX_DENSITY_MEDIUM, + WIDX_DENSITY_HIGH + }; -bool gWindowSceneryScatterEnabled = false; -uint16_t gWindowSceneryScatterSize; -ScatterToolDensity gWindowSceneryScatterDensity; + bool gWindowSceneryScatterEnabled = false; + uint16_t gWindowSceneryScatterSize; + ScatterToolDensity gWindowSceneryScatterDensity; -// clang-format off + // clang-format off static Widget _sceneryScatterWidgets[] = { MakeWidget ({ 0, 0}, {86, 100}, WindowWidgetType::Frame, WindowColour::Secondary ), // panel / background MakeWidget ({ 1, 1}, {84, 14}, WindowWidgetType::Caption, WindowColour::Primary , STR_SCENERY_SCATTER, STR_WINDOW_TITLE_TIP ), // title bar @@ -48,163 +49,167 @@ static Widget _sceneryScatterWidgets[] = { MakeRemapWidget({ 7, 68}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_SCENERY_SCATTER_LOW, STR_SCATTER_TOOL_DENSITY_LOW ), // low amount MakeRemapWidget({31, 68}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_SCENERY_SCATTER_MEDIUM, STR_SCATTER_TOOL_DENSITY_MEDIUM), // medium amount MakeRemapWidget({55, 68}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_SCENERY_SCATTER_HIGH, STR_SCATTER_TOOL_DENSITY_HIGH ), // high amount - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class SceneryScatterWindow final : public WindowBase -{ -public: - void OnOpen() override + class SceneryScatterWindow final : public Window { - widgets = _sceneryScatterWidgets; - hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); - WindowInitScrollWidgets(*this); - WindowPushOthersBelow(*this); - - gWindowSceneryScatterEnabled = true; - gWindowSceneryScatterSize = 16; - gWindowSceneryScatterDensity = ScatterToolDensity::MediumDensity; - } - - void OnClose() override - { - gWindowSceneryScatterEnabled = false; - } - - void InputSize(const WidgetIndex widgetIndex) - { - uint8_t maxLength = 0; - Formatter ft; - - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_PREVIEW: - ft.Add(kLandToolMinimumSize); - ft.Add(kLandToolMaximumSize); - maxLength = 3; - break; + widgets = _sceneryScatterWidgets; + hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); + WindowInitScrollWidgets(*this); + WindowPushOthersBelow(*this); + + gWindowSceneryScatterEnabled = true; + gWindowSceneryScatterSize = 16; + gWindowSceneryScatterDensity = ScatterToolDensity::MediumDensity; } - WindowTextInputOpen(this, widgetIndex, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, maxLength); - } - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + void OnClose() override { - case WIDX_CLOSE: - WindowClose(*this); - break; - - case WIDX_PREVIEW: - InputSize(widgetIndex); - break; - - case WIDX_DENSITY_LOW: - gWindowSceneryScatterDensity = ScatterToolDensity::LowDensity; - break; - - case WIDX_DENSITY_MEDIUM: - gWindowSceneryScatterDensity = ScatterToolDensity::MediumDensity; - break; - - case WIDX_DENSITY_HIGH: - gWindowSceneryScatterDensity = ScatterToolDensity::HighDensity; - break; + gWindowSceneryScatterEnabled = false; } - } - void OnMouseDown(const WidgetIndex widgetIndex) override - { - switch (widgetIndex) + void InputSize(const WidgetIndex widgetIndex) { - case WIDX_DECREMENT: - // Decrement land tool size, if it stays within the limit - gWindowSceneryScatterSize = std::max(kLandToolMinimumSize, gWindowSceneryScatterSize - 1); - Invalidate(); - break; + uint8_t maxLength = 0; + Formatter ft; - case WIDX_INCREMENT: - // Increment land tool size, if it stays within the limit - gWindowSceneryScatterSize = std::min(kLandToolMaximumSize, gWindowSceneryScatterSize + 1); - Invalidate(); - break; - } - } - - void OnTextInput(const WidgetIndex widgetIndex, const std::string_view text) override - { - if (widgetIndex != WIDX_PREVIEW || text.empty()) - return; - - const auto res = String::Parse(text); - - if (res.has_value()) - { switch (widgetIndex) { case WIDX_PREVIEW: - gWindowSceneryScatterSize = std::clamp(res.value(), kLandToolMinimumSize, kLandToolMaximumSize); + ft.Add(kLandToolMinimumSize); + ft.Add(kLandToolMaximumSize); + maxLength = 3; break; } - Invalidate(); + WindowTextInputOpen( + this, widgetIndex, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, maxLength); } - } - void OnPrepareDraw() override - { - // Set the preview image button to be pressed down - pressed_widgets = (1uLL << WIDX_PREVIEW); - - // Set density buttons' pressed state. - switch (gWindowSceneryScatterDensity) + void OnMouseUp(WidgetIndex widgetIndex) override { - case ScatterToolDensity::LowDensity: - pressed_widgets |= (1uLL << WIDX_DENSITY_LOW); - break; + switch (widgetIndex) + { + case WIDX_CLOSE: + WindowClose(*this); + break; - case ScatterToolDensity::MediumDensity: - pressed_widgets |= (1uLL << WIDX_DENSITY_MEDIUM); - break; + case WIDX_PREVIEW: + InputSize(widgetIndex); + break; - case ScatterToolDensity::HighDensity: - pressed_widgets |= (1uLL << WIDX_DENSITY_HIGH); - break; + case WIDX_DENSITY_LOW: + gWindowSceneryScatterDensity = ScatterToolDensity::LowDensity; + break; + + case WIDX_DENSITY_MEDIUM: + gWindowSceneryScatterDensity = ScatterToolDensity::MediumDensity; + break; + + case WIDX_DENSITY_HIGH: + gWindowSceneryScatterDensity = ScatterToolDensity::HighDensity; + break; + } } - // Update the preview image (for tool sizes up to 7) - widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gWindowSceneryScatterSize)); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - WindowDrawWidgets(*this, dpi); - - // Draw area as a number for tool sizes bigger than 7 - if (gWindowSceneryScatterSize > kLandToolMaximumSizeWithSprite) + void OnMouseDown(const WidgetIndex widgetIndex) override { - const auto& preview = widgets[WIDX_PREVIEW]; - const auto screenCoords = ScreenCoordsXY{ windowPos.x + preview.midX(), windowPos.y + preview.midY() }; - auto ft = Formatter(); - ft.Add(gWindowSceneryScatterSize); - DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + switch (widgetIndex) + { + case WIDX_DECREMENT: + // Decrement land tool size, if it stays within the limit + gWindowSceneryScatterSize = std::max(kLandToolMinimumSize, gWindowSceneryScatterSize - 1); + Invalidate(); + break; + + case WIDX_INCREMENT: + // Increment land tool size, if it stays within the limit + gWindowSceneryScatterSize = std::min(kLandToolMaximumSize, gWindowSceneryScatterSize + 1); + Invalidate(); + break; + } } - } - void OnResize() override + void OnTextInput(const WidgetIndex widgetIndex, const std::string_view text) override + { + if (widgetIndex != WIDX_PREVIEW || text.empty()) + return; + + const auto res = String::Parse(text); + + if (res.has_value()) + { + switch (widgetIndex) + { + case WIDX_PREVIEW: + gWindowSceneryScatterSize = std::clamp( + res.value(), kLandToolMinimumSize, kLandToolMaximumSize); + break; + } + Invalidate(); + } + } + + void OnPrepareDraw() override + { + // Set the preview image button to be pressed down + pressed_widgets = (1uLL << WIDX_PREVIEW); + + // Set density buttons' pressed state. + switch (gWindowSceneryScatterDensity) + { + case ScatterToolDensity::LowDensity: + pressed_widgets |= (1uLL << WIDX_DENSITY_LOW); + break; + + case ScatterToolDensity::MediumDensity: + pressed_widgets |= (1uLL << WIDX_DENSITY_MEDIUM); + break; + + case ScatterToolDensity::HighDensity: + pressed_widgets |= (1uLL << WIDX_DENSITY_HIGH); + break; + } + + // Update the preview image (for tool sizes up to 7) + widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gWindowSceneryScatterSize)); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + WindowDrawWidgets(*this, dpi); + + // Draw area as a number for tool sizes bigger than 7 + if (gWindowSceneryScatterSize > kLandToolMaximumSizeWithSprite) + { + const auto& preview = widgets[WIDX_PREVIEW]; + const auto screenCoords = ScreenCoordsXY{ windowPos.x + preview.midX(), windowPos.y + preview.midY() }; + auto ft = Formatter(); + ft.Add(gWindowSceneryScatterSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + } + } + + void OnResize() override + { + ResizeFrame(); + } + }; + + WindowBase* SceneryScatterOpen() { - ResizeFrame(); - } -}; + // Check if window is already open + auto* window = WindowFindByClass(WindowClass::SceneryScatter); + if (window == nullptr) + { + window = WindowCreate(WindowClass::SceneryScatter, 86, 100, 0); + } -WindowBase* WindowSceneryScatterOpen() -{ - // Check if window is already open - auto* window = WindowFindByClass(WindowClass::SceneryScatter); - if (window == nullptr) - { - window = WindowCreate(WindowClass::SceneryScatter, 86, 100, 0); + return window; } - - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index febf8bc89a..29bb122642 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -27,39 +27,41 @@ # include # include +namespace OpenRCT2::Ui::Windows +{ # define WWIDTH_MIN 500 # define WHEIGHT_MIN 300 # define WWIDTH_MAX 1200 # define WHEIGHT_MAX 800 # define ITEM_HEIGHT (3 + 9 + 3) -constexpr size_t MaxPlayerNameLength = 32; + constexpr size_t MaxPlayerNameLength = 32; -enum -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_PLAYER_NAME_INPUT, - WIDX_LIST, - WIDX_FETCH_SERVERS, - WIDX_ADD_SERVER, - WIDX_START_SERVER -}; + enum + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_PLAYER_NAME_INPUT, + WIDX_LIST, + WIDX_FETCH_SERVERS, + WIDX_ADD_SERVER, + WIDX_START_SERVER + }; -enum -{ - WIDX_LIST_REMOVE, - WIDX_LIST_SPECTATE -}; + enum + { + WIDX_LIST_REMOVE, + WIDX_LIST_SPECTATE + }; -enum -{ - DDIDX_JOIN, - DDIDX_FAVOURITE -}; + enum + { + DDIDX_JOIN, + DDIDX_FAVOURITE + }; -// clang-format off + // clang-format off static Widget _serverListWidgets[] = { MakeWidget({ 0, 0}, {341, 91}, WindowWidgetType::Frame, WindowColour::Primary ), // panel / background MakeWidget({ 1, 1}, {338, 14}, WindowWidgetType::Caption, WindowColour::Primary, STR_SERVER_LIST, STR_WINDOW_TITLE_TIP), // title bar @@ -69,515 +71,518 @@ static Widget _serverListWidgets[] = { MakeWidget({ 6, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_FETCH_SERVERS ), // fetch servers button MakeWidget({112, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_ADD_SERVER ), // add server button MakeWidget({218, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_START_SERVER ), // start server button - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -void JoinServer(std::string address); + void JoinServer(std::string address); -class ServerListWindow final : public Window -{ -private: - u8string _playerName; - ServerList _serverList; - std::future, StringId>> _fetchFuture; - uint32_t _numPlayersOnline = 0; - StringId _statusText = STR_SERVER_LIST_CONNECTING; + class ServerListWindow final : public Window + { + private: + u8string _playerName; + ServerList _serverList; + std::future, StringId>> _fetchFuture; + uint32_t _numPlayersOnline = 0; + StringId _statusText = STR_SERVER_LIST_CONNECTING; - bool _showNetworkVersionTooltip = false; - std::string _version; + bool _showNetworkVersionTooltip = false; + std::string _version; -public: + public: # pragma region Window Override Events - void OnOpen() override - { - _playerName = gConfigNetwork.PlayerName; - widgets = _serverListWidgets; - _serverListWidgets[WIDX_PLAYER_NAME_INPUT].string = const_cast(_playerName.c_str()); - InitScrollWidgets(); - no_list_items = 0; - selected_list_item = -1; - frame_no = 0; - min_width = 320; - min_height = 90; - max_width = min_width; - max_height = min_height; - - page = 0; - list_information_type = 0; - - WindowSetResize(*this, WWIDTH_MIN, WHEIGHT_MIN, WWIDTH_MAX, WHEIGHT_MAX); - - no_list_items = static_cast(_serverList.GetCount()); - - ServerListFetchServersBegin(); - } - - void OnClose() override - { - _serverList = {}; - _fetchFuture = {}; - ConfigSaveDefault(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + void OnOpen() override { - case WIDX_CLOSE: - Close(); - break; - case WIDX_PLAYER_NAME_INPUT: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _playerName.c_str(), MaxPlayerNameLength); - break; - case WIDX_LIST: + _playerName = gConfigNetwork.PlayerName; + widgets = _serverListWidgets; + _serverListWidgets[WIDX_PLAYER_NAME_INPUT].string = const_cast(_playerName.c_str()); + InitScrollWidgets(); + no_list_items = 0; + selected_list_item = -1; + frame_no = 0; + min_width = 320; + min_height = 90; + max_width = min_width; + max_height = min_height; + + page = 0; + list_information_type = 0; + + WindowSetResize(*this, WWIDTH_MIN, WHEIGHT_MIN, WWIDTH_MAX, WHEIGHT_MAX); + + no_list_items = static_cast(_serverList.GetCount()); + + ServerListFetchServersBegin(); + } + + void OnClose() override + { + _serverList = {}; + _fetchFuture = {}; + ConfigSaveDefault(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) { - int32_t serverIndex = selected_list_item; - if (serverIndex >= 0 && serverIndex < static_cast(_serverList.GetCount())) + case WIDX_CLOSE: + Close(); + break; + case WIDX_PLAYER_NAME_INPUT: + WindowStartTextbox(*this, widgetIndex, STR_STRING, _playerName.c_str(), MaxPlayerNameLength); + break; + case WIDX_LIST: { - const auto& server = _serverList.GetServer(serverIndex); - if (server.IsVersionValid()) + int32_t serverIndex = selected_list_item; + if (serverIndex >= 0 && serverIndex < static_cast(_serverList.GetCount())) { - JoinServer(server.Address); - } - else - { - Formatter ft; - ft.Add(server.Version.c_str()); - ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft); - } - } - break; - } - case WIDX_FETCH_SERVERS: - ServerListFetchServersBegin(); - break; - case WIDX_ADD_SERVER: - TextInputOpen(widgetIndex, STR_ADD_SERVER, STR_ENTER_HOSTNAME_OR_IP_ADDRESS, {}, STR_NONE, 0, 128); - break; - case WIDX_START_SERVER: - ContextOpenWindow(WindowClass::ServerStart); - break; - } - } - - void OnResize() override - { - WindowSetResize(*this, WWIDTH_MIN, WHEIGHT_MIN, WWIDTH_MAX, WHEIGHT_MAX); - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - if (selectedIndex == -1) - { - return; - } - auto serverIndex = selected_list_item; - if (serverIndex >= 0 && serverIndex < static_cast(_serverList.GetCount())) - { - auto& server = _serverList.GetServer(serverIndex); - switch (selectedIndex) - { - case DDIDX_JOIN: - if (server.IsVersionValid()) - { - JoinServer(server.Address); - } - else - { - Formatter ft; - ft.Add(server.Version.c_str()); - ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft); + const auto& server = _serverList.GetServer(serverIndex); + if (server.IsVersionValid()) + { + JoinServer(server.Address); + } + else + { + Formatter ft; + ft.Add(server.Version.c_str()); + ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft); + } } break; - case DDIDX_FAVOURITE: - { - server.Favourite = !server.Favourite; - _serverList.WriteFavourites(); } - break; + case WIDX_FETCH_SERVERS: + ServerListFetchServersBegin(); + break; + case WIDX_ADD_SERVER: + TextInputOpen(widgetIndex, STR_ADD_SERVER, STR_ENTER_HOSTNAME_OR_IP_ADDRESS, {}, STR_NONE, 0, 128); + break; + case WIDX_START_SERVER: + ContextOpenWindow(WindowClass::ServerStart); + break; } } - } - void OnUpdate() override - { - if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) + void OnResize() override { - WindowUpdateTextboxCaret(); - InvalidateWidget(WIDX_PLAYER_NAME_INPUT); + WindowSetResize(*this, WWIDTH_MIN, WHEIGHT_MIN, WWIDTH_MAX, WHEIGHT_MAX); } - ServerListFetchServersCheck(); - } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - return { 0, no_list_items * ITEM_HEIGHT }; - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - int32_t serverIndex = selected_list_item; - if (serverIndex >= 0 && serverIndex < static_cast(_serverList.GetCount())) + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { - const auto& server = _serverList.GetServer(serverIndex); - - const auto& listWidget = widgets[WIDX_LIST]; - - gDropdownItems[0].Format = STR_JOIN_GAME; - if (server.Favourite) + if (selectedIndex == -1) { - gDropdownItems[1].Format = STR_REMOVE_FROM_FAVOURITES; + return; } - else + auto serverIndex = selected_list_item; + if (serverIndex >= 0 && serverIndex < static_cast(_serverList.GetCount())) { - gDropdownItems[1].Format = STR_ADD_TO_FAVOURITES; + auto& server = _serverList.GetServer(serverIndex); + switch (selectedIndex) + { + case DDIDX_JOIN: + if (server.IsVersionValid()) + { + JoinServer(server.Address); + } + else + { + Formatter ft; + ft.Add(server.Version.c_str()); + ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft); + } + break; + case DDIDX_FAVOURITE: + { + server.Favourite = !server.Favourite; + _serverList.WriteFavourites(); + } + break; + } } - auto dropdownPos = ScreenCoordsXY{ windowPos.x + listWidget.left + screenCoords.x + 2 - scrolls[0].h_left, - windowPos.y + listWidget.top + screenCoords.y + 2 - scrolls[0].v_top }; - WindowDropdownShowText(dropdownPos, 0, COLOUR_GREY, 0, 2); - } - } - - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - auto& listWidget = widgets[WIDX_LIST]; - - int32_t itemIndex = screenCoords.y / ITEM_HEIGHT; - bool showNetworkVersionTooltip = false; - if (itemIndex < 0 || itemIndex >= no_list_items) - { - itemIndex = -1; - } - else - { - const int32_t iconX = listWidget.width() - SCROLLBAR_WIDTH - 7 - 10; - showNetworkVersionTooltip = screenCoords.x > iconX; } - if (selected_list_item != itemIndex || _showNetworkVersionTooltip != showNetworkVersionTooltip) + void OnUpdate() override { - selected_list_item = itemIndex; - _showNetworkVersionTooltip = showNetworkVersionTooltip; - - listWidget.tooltip = showNetworkVersionTooltip ? static_cast(STR_NETWORK_VERSION_TIP) : STR_NONE; - WindowTooltipClose(); - - Invalidate(); - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (text.empty()) - return; - - auto temp = u8string{ text }; - - switch (widgetIndex) - { - case WIDX_PLAYER_NAME_INPUT: - if (_playerName == text) - return; - - _playerName = temp; - gConfigNetwork.PlayerName = _playerName; - widgets[WIDX_PLAYER_NAME_INPUT].string = const_cast(_playerName.c_str()); - + if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) + { + WindowUpdateTextboxCaret(); InvalidateWidget(WIDX_PLAYER_NAME_INPUT); - break; + } + ServerListFetchServersCheck(); + } - case WIDX_ADD_SERVER: + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + return { 0, no_list_items * ITEM_HEIGHT }; + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + int32_t serverIndex = selected_list_item; + if (serverIndex >= 0 && serverIndex < static_cast(_serverList.GetCount())) { - ServerListEntry entry; - entry.Address = text; - entry.Name = text; - entry.Favourite = true; - _serverList.Add(entry); - _serverList.WriteFavourites(); - Invalidate(); - break; + const auto& server = _serverList.GetServer(serverIndex); + + const auto& listWidget = widgets[WIDX_LIST]; + + gDropdownItems[0].Format = STR_JOIN_GAME; + if (server.Favourite) + { + gDropdownItems[1].Format = STR_REMOVE_FROM_FAVOURITES; + } + else + { + gDropdownItems[1].Format = STR_ADD_TO_FAVOURITES; + } + auto dropdownPos = ScreenCoordsXY{ windowPos.x + listWidget.left + screenCoords.x + 2 - scrolls[0].h_left, + windowPos.y + listWidget.top + screenCoords.y + 2 - scrolls[0].v_top }; + WindowDropdownShowText(dropdownPos, 0, COLOUR_GREY, 0, 2); } } - } - OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override - { - auto ft = Formatter(); - ft.Add(_version.c_str()); - return { fallback, ft }; - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PLAYER_NAME_INPUT].top }, STR_PLAYER_NAME, {}, { COLOUR_WHITE }); - - // Draw version number - std::string version = NetworkGetVersion(); - auto ft = Formatter(); - ft.Add(version.c_str()); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 324, widgets[WIDX_START_SERVER].top + 1 }, STR_NETWORK_VERSION, ft, - { COLOUR_WHITE }); - - ft = Formatter(); - ft.Add(_numPlayersOnline); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, height - 15 }, _statusText, ft, { COLOUR_WHITE }); - } - - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - uint8_t paletteIndex = ColourMapA[colours[1]].mid_light; - GfxClear(&dpi, paletteIndex); - - auto& listWidget = widgets[WIDX_LIST]; - int32_t listWidgetWidth = listWidget.width(); - - ScreenCoordsXY screenCoords; - screenCoords.y = 0; - for (int32_t i = 0; i < no_list_items; i++) + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { - if (screenCoords.y >= dpi.y + dpi.height) - continue; + auto& listWidget = widgets[WIDX_LIST]; - const auto& serverDetails = _serverList.GetServer(i); - bool highlighted = i == selected_list_item; - - // Draw hover highlight - if (highlighted) + int32_t itemIndex = screenCoords.y / ITEM_HEIGHT; + bool showNetworkVersionTooltip = false; + if (itemIndex < 0 || itemIndex >= no_list_items) { - GfxFilterRect( - dpi, { 0, screenCoords.y, listWidgetWidth, screenCoords.y + ITEM_HEIGHT }, FilterPaletteID::PaletteDarken1); - _version = serverDetails.Version; - } - - colour_t colour = colours[1]; - if (serverDetails.Favourite) - { - colour = COLOUR_YELLOW; - } - else if (serverDetails.Local) - { - colour = COLOUR_MOSS_GREEN; - } - - screenCoords.x = 3; - - // Before we draw the server info, we need to know how much room we'll need for player info. - char players[32] = { 0 }; - if (serverDetails.MaxPlayers > 0) - { - snprintf(players, sizeof(players), "%d/%d", serverDetails.Players, serverDetails.MaxPlayers); - } - const int16_t numPlayersStringWidth = GfxGetStringWidth(players, FontStyle::Medium); - - // How much space we have for the server info depends on the size of everything rendered after. - const int16_t spaceAvailableForInfo = listWidgetWidth - numPlayersStringWidth - SCROLLBAR_WIDTH - 35; - - // Are we showing the server's name or description? - const char* serverInfoToShow = serverDetails.Name.c_str(); - if (highlighted && !serverDetails.Description.empty()) - { - serverInfoToShow = serverDetails.Description.c_str(); - } - - // Finally, draw the server information. - auto ft = Formatter(); - ft.Add(serverInfoToShow); - DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, spaceAvailableForInfo, STR_STRING, ft, { colour }); - - int32_t right = listWidgetWidth - 7 - SCROLLBAR_WIDTH; - - // Draw compatibility icon - right -= 10; - int32_t compatibilitySpriteId; - if (serverDetails.Version.empty()) - { - // Server not online... - compatibilitySpriteId = SPR_G2_RCT1_CLOSE_BUTTON_0; + itemIndex = -1; } else { - // Server online... check version - bool correctVersion = serverDetails.Version == NetworkGetVersion(); - compatibilitySpriteId = correctVersion ? SPR_G2_RCT1_OPEN_BUTTON_2 : SPR_G2_RCT1_CLOSE_BUTTON_2; + const int32_t iconX = listWidget.width() - kScrollBarWidth - 7 - 10; + showNetworkVersionTooltip = screenCoords.x > iconX; } - GfxDrawSprite(dpi, ImageId(compatibilitySpriteId), { right, screenCoords.y + 1 }); - right -= 4; - // Draw lock icon - right -= 8; - if (serverDetails.RequiresPassword) + if (selected_list_item != itemIndex || _showNetworkVersionTooltip != showNetworkVersionTooltip) { - GfxDrawSprite(dpi, ImageId(SPR_G2_LOCKED), { right, screenCoords.y + 4 }); + selected_list_item = itemIndex; + _showNetworkVersionTooltip = showNetworkVersionTooltip; + + listWidget.tooltip = showNetworkVersionTooltip ? static_cast(STR_NETWORK_VERSION_TIP) : STR_NONE; + WindowTooltipClose(); + + Invalidate(); + } + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (text.empty()) + return; + + auto temp = u8string{ text }; + + switch (widgetIndex) + { + case WIDX_PLAYER_NAME_INPUT: + if (_playerName == text) + return; + + _playerName = temp; + gConfigNetwork.PlayerName = _playerName; + widgets[WIDX_PLAYER_NAME_INPUT].string = const_cast(_playerName.c_str()); + + InvalidateWidget(WIDX_PLAYER_NAME_INPUT); + break; + + case WIDX_ADD_SERVER: + { + ServerListEntry entry; + entry.Address = text; + entry.Name = text; + entry.Favourite = true; + _serverList.Add(entry); + _serverList.WriteFavourites(); + Invalidate(); + break; + } + } + } + + OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override + { + auto ft = Formatter(); + ft.Add(_version.c_str()); + return { fallback, ft }; + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PLAYER_NAME_INPUT].top }, STR_PLAYER_NAME, {}, + { COLOUR_WHITE }); + + // Draw version number + std::string version = NetworkGetVersion(); + auto ft = Formatter(); + ft.Add(version.c_str()); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 324, widgets[WIDX_START_SERVER].top + 1 }, STR_NETWORK_VERSION, ft, + { COLOUR_WHITE }); + + ft = Formatter(); + ft.Add(_numPlayersOnline); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, height - 15 }, _statusText, ft, { COLOUR_WHITE }); + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + uint8_t paletteIndex = ColourMapA[colours[1]].mid_light; + GfxClear(dpi, paletteIndex); + + auto& listWidget = widgets[WIDX_LIST]; + int32_t listWidgetWidth = listWidget.width(); + + ScreenCoordsXY screenCoords; + screenCoords.y = 0; + for (int32_t i = 0; i < no_list_items; i++) + { + if (screenCoords.y >= dpi.y + dpi.height) + continue; + + const auto& serverDetails = _serverList.GetServer(i); + bool highlighted = i == selected_list_item; + + // Draw hover highlight + if (highlighted) + { + GfxFilterRect( + dpi, { 0, screenCoords.y, listWidgetWidth, screenCoords.y + ITEM_HEIGHT }, + FilterPaletteID::PaletteDarken1); + _version = serverDetails.Version; + } + + colour_t colour = colours[1]; + if (serverDetails.Favourite) + { + colour = COLOUR_YELLOW; + } + else if (serverDetails.Local) + { + colour = COLOUR_MOSS_GREEN; + } + + screenCoords.x = 3; + + // Before we draw the server info, we need to know how much room we'll need for player info. + char players[32] = { 0 }; + if (serverDetails.MaxPlayers > 0) + { + snprintf(players, sizeof(players), "%d/%d", serverDetails.Players, serverDetails.MaxPlayers); + } + const int16_t numPlayersStringWidth = GfxGetStringWidth(players, FontStyle::Medium); + + // How much space we have for the server info depends on the size of everything rendered after. + const int16_t spaceAvailableForInfo = listWidgetWidth - numPlayersStringWidth - kScrollBarWidth - 35; + + // Are we showing the server's name or description? + const char* serverInfoToShow = serverDetails.Name.c_str(); + if (highlighted && !serverDetails.Description.empty()) + { + serverInfoToShow = serverDetails.Description.c_str(); + } + + // Finally, draw the server information. + auto ft = Formatter(); + ft.Add(serverInfoToShow); + DrawTextEllipsised( + dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, spaceAvailableForInfo, STR_STRING, ft, { colour }); + + int32_t right = listWidgetWidth - 7 - kScrollBarWidth; + + // Draw compatibility icon + right -= 10; + int32_t compatibilitySpriteId; + if (serverDetails.Version.empty()) + { + // Server not online... + compatibilitySpriteId = SPR_G2_RCT1_CLOSE_BUTTON_0; + } + else + { + // Server online... check version + bool correctVersion = serverDetails.Version == NetworkGetVersion(); + compatibilitySpriteId = correctVersion ? SPR_G2_RCT1_OPEN_BUTTON_2 : SPR_G2_RCT1_CLOSE_BUTTON_2; + } + GfxDrawSprite(dpi, ImageId(compatibilitySpriteId), { right, screenCoords.y + 1 }); + right -= 4; + + // Draw lock icon + right -= 8; + if (serverDetails.RequiresPassword) + { + GfxDrawSprite(dpi, ImageId(SPR_G2_LOCKED), { right, screenCoords.y + 4 }); + } + right -= 6; + + // Draw number of players + screenCoords.x = right - numPlayersStringWidth; + GfxDrawString(dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, players, { colours[1] }); + + screenCoords.y += ITEM_HEIGHT; } - right -= 6; - - // Draw number of players - screenCoords.x = right - numPlayersStringWidth; - GfxDrawString(dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, players, { colours[1] }); - - screenCoords.y += ITEM_HEIGHT; } - } # pragma endregion -private: - void ServerListFetchServersBegin() - { - if (_fetchFuture.valid()) + private: + void ServerListFetchServersBegin() { - // A fetch is already in progress - return; - } - - _serverList.Clear(); - _serverList.ReadAndAddFavourites(); - _statusText = STR_SERVER_LIST_CONNECTING; - - _fetchFuture = std::async(std::launch::async, [this] { - // Spin off background fetches - auto lanF = _serverList.FetchLocalServerListAsync(); - auto wanF = _serverList.FetchOnlineServerListAsync(); - - // Merge or deal with errors - std::vector allEntries; - try - { - auto entries = lanF.get(); - allEntries.reserve(entries.size()); - allEntries.insert(allEntries.end(), entries.begin(), entries.end()); - } - // TODO: Stop catching all exceptions - catch (...) + if (_fetchFuture.valid()) { + // A fetch is already in progress + return; } - auto status = STR_NONE; - try - { - auto entries = wanF.get(); - allEntries.reserve(allEntries.capacity() + entries.size()); - allEntries.insert(allEntries.end(), entries.begin(), entries.end()); - } - catch (const MasterServerException& e) - { - status = e.StatusText; - } - // TODO: Stop catching all exceptions - catch (...) - { - status = STR_SERVER_LIST_NO_CONNECTION; - } - return std::make_tuple(allEntries, status); - }); - } + _serverList.Clear(); + _serverList.ReadAndAddFavourites(); + _statusText = STR_SERVER_LIST_CONNECTING; - void ServerListFetchServersCheck() - { - if (_fetchFuture.valid()) - { - auto status = _fetchFuture.wait_for(std::chrono::seconds::zero()); - if (status == std::future_status::ready) - { + _fetchFuture = std::async(std::launch::async, [this] { + // Spin off background fetches + auto lanF = _serverList.FetchLocalServerListAsync(); + auto wanF = _serverList.FetchOnlineServerListAsync(); + + // Merge or deal with errors + std::vector allEntries; try { - auto [entries, statusText] = _fetchFuture.get(); - _serverList.AddOrUpdateRange(entries); - _serverList.WriteFavourites(); // Update favourites in case favourited server info changes - _numPlayersOnline = _serverList.GetTotalPlayerCount(); - _statusText = STR_X_PLAYERS_ONLINE; - if (statusText != STR_NONE) - { - _statusText = statusText; - } + auto entries = lanF.get(); + allEntries.reserve(entries.size()); + allEntries.insert(allEntries.end(), entries.begin(), entries.end()); + } + // TODO: Stop catching all exceptions + catch (...) + { + } + + auto status = STR_NONE; + try + { + auto entries = wanF.get(); + allEntries.reserve(allEntries.capacity() + entries.size()); + allEntries.insert(allEntries.end(), entries.begin(), entries.end()); } catch (const MasterServerException& e) { - _statusText = e.StatusText; + status = e.StatusText; } - catch (const std::exception& e) + // TODO: Stop catching all exceptions + catch (...) { - _statusText = STR_SERVER_LIST_NO_CONNECTION; - LOG_WARNING("Unable to connect to master server: %s", e.what()); + status = STR_SERVER_LIST_NO_CONNECTION; } - _fetchFuture = {}; - Invalidate(); - } + return std::make_tuple(allEntries, status); + }); } - } - void OnPrepareDraw() override - { - ResizeFrame(); - - int32_t margin = 6; - int32_t buttonHeight = 13; - int32_t buttonTop = height - margin - buttonHeight - 13; - int32_t buttonBottom = buttonTop + buttonHeight; - int32_t listBottom = buttonTop - margin; - - widgets[WIDX_PLAYER_NAME_INPUT].right = width - 6; - widgets[WIDX_LIST].left = 6; - widgets[WIDX_LIST].right = width - 6; - widgets[WIDX_LIST].bottom = listBottom; - widgets[WIDX_FETCH_SERVERS].top = buttonTop; - widgets[WIDX_FETCH_SERVERS].bottom = buttonBottom; - widgets[WIDX_ADD_SERVER].top = buttonTop; - widgets[WIDX_ADD_SERVER].bottom = buttonBottom; - widgets[WIDX_START_SERVER].top = buttonTop; - widgets[WIDX_START_SERVER].bottom = buttonBottom; - - no_list_items = static_cast(_serverList.GetCount()); - } -}; - -WindowBase* WindowServerListOpen() -{ - // Check if window is already open - auto* window = WindowBringToFrontByClass(WindowClass::ServerList); - if (window != nullptr) - return window; - - window = WindowCreate( - WindowClass::ServerList, WWIDTH_MIN, WHEIGHT_MIN, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN); - - return window; -} - -void JoinServer(std::string address) -{ - int32_t port = NETWORK_DEFAULT_PORT; - auto endBracketIndex = address.find(']'); - auto colonIndex = address.find_last_of(':'); - if (colonIndex != std::string::npos) - { - if (auto dotIndex = address.find('.'); endBracketIndex != std::string::npos || dotIndex != std::string::npos) + void ServerListFetchServersCheck() { - auto ret = std::sscanf(&address[colonIndex + 1], "%d", &port); - assert(ret); - if (ret > 0) + if (_fetchFuture.valid()) { - address = address.substr(0, colonIndex); + auto status = _fetchFuture.wait_for(std::chrono::seconds::zero()); + if (status == std::future_status::ready) + { + try + { + auto [entries, statusText] = _fetchFuture.get(); + _serverList.AddOrUpdateRange(entries); + _serverList.WriteFavourites(); // Update favourites in case favourited server info changes + _numPlayersOnline = _serverList.GetTotalPlayerCount(); + _statusText = STR_X_PLAYERS_ONLINE; + if (statusText != STR_NONE) + { + _statusText = statusText; + } + } + catch (const MasterServerException& e) + { + _statusText = e.StatusText; + } + catch (const std::exception& e) + { + _statusText = STR_SERVER_LIST_NO_CONNECTION; + LOG_WARNING("Unable to connect to master server: %s", e.what()); + } + _fetchFuture = {}; + Invalidate(); + } } } - } - if (auto beginBracketIndex = address.find('['); - beginBracketIndex != std::string::npos && endBracketIndex != std::string::npos) + void OnPrepareDraw() override + { + ResizeFrame(); + + int32_t margin = 6; + int32_t buttonHeight = 13; + int32_t buttonTop = height - margin - buttonHeight - 13; + int32_t buttonBottom = buttonTop + buttonHeight; + int32_t listBottom = buttonTop - margin; + + widgets[WIDX_PLAYER_NAME_INPUT].right = width - 6; + widgets[WIDX_LIST].left = 6; + widgets[WIDX_LIST].right = width - 6; + widgets[WIDX_LIST].bottom = listBottom; + widgets[WIDX_FETCH_SERVERS].top = buttonTop; + widgets[WIDX_FETCH_SERVERS].bottom = buttonBottom; + widgets[WIDX_ADD_SERVER].top = buttonTop; + widgets[WIDX_ADD_SERVER].bottom = buttonBottom; + widgets[WIDX_START_SERVER].top = buttonTop; + widgets[WIDX_START_SERVER].bottom = buttonBottom; + + no_list_items = static_cast(_serverList.GetCount()); + } + }; + + WindowBase* ServerListOpen() { - address = address.substr(beginBracketIndex + 1, endBracketIndex - beginBracketIndex - 1); + // Check if window is already open + auto* window = WindowBringToFrontByClass(WindowClass::ServerList); + if (window != nullptr) + return window; + + window = WindowCreate( + WindowClass::ServerList, WWIDTH_MIN, WHEIGHT_MIN, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN); + + return window; } - if (!NetworkBeginClient(address, port)) + void JoinServer(std::string address) { - ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE, {}); - } -} + int32_t port = NETWORK_DEFAULT_PORT; + auto endBracketIndex = address.find(']'); + auto colonIndex = address.find_last_of(':'); + if (colonIndex != std::string::npos) + { + if (auto dotIndex = address.find('.'); endBracketIndex != std::string::npos || dotIndex != std::string::npos) + { + auto ret = std::sscanf(&address[colonIndex + 1], "%d", &port); + assert(ret); + if (ret > 0) + { + address = address.substr(0, colonIndex); + } + } + } + if (auto beginBracketIndex = address.find('['); + beginBracketIndex != std::string::npos && endBracketIndex != std::string::npos) + { + address = address.substr(beginBracketIndex + 1, endBracketIndex - beginBracketIndex - 1); + } + + if (!NetworkBeginClient(address, port)) + { + ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE, {}); + } + } +} // namespace OpenRCT2::Ui::Windows #endif diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index a5e5bb6a62..24dbb0081c 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -22,9 +22,9 @@ # include # include -using namespace OpenRCT2; - -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum { WIDX_BACKGROUND, WIDX_TITLE, @@ -58,228 +58,233 @@ static Widget _windowServerStartWidgets[] = { MakeWidget({ 6, 117 }, { 287, 14 }, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ADVERTISE,STR_ADVERTISE_SERVER_TIP), // advertise checkbox MakeWidget({ 6, WH - 6 - 13 }, { 101, 14 }, WindowWidgetType::Button, WindowColour::Secondary,STR_NEW_GAME), // start server button MakeWidget({ 112, WH - 6 - 13 }, { 101, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_LOAD_GAME), // None - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on -class ServerStartWindow final : public Window -{ -public: - void OnOpen() override + // clang-format on + class ServerStartWindow final : public Window { - widgets = _windowServerStartWidgets; - widgets[WIDX_PORT_INPUT].string = _port; - widgets[WIDX_NAME_INPUT].string = _name; - widgets[WIDX_DESCRIPTION_INPUT].string = _description; - widgets[WIDX_GREETING_INPUT].string = _greeting; - widgets[WIDX_PASSWORD_INPUT].string = _password; - InitScrollWidgets(); - frame_no = 0; - min_width = width; - min_height = height; - max_width = min_width; - max_height = min_height; - - page = 0; - list_information_type = 0; - - snprintf(_port, 7, "%u", gConfigNetwork.DefaultPort); - SafeStrCpy(_name, gConfigNetwork.ServerName.c_str(), sizeof(_name)); - SafeStrCpy(_description, gConfigNetwork.ServerDescription.c_str(), sizeof(_description)); - SafeStrCpy(_greeting, gConfigNetwork.ServerGreeting.c_str(), sizeof(_greeting)); - } - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_CLOSE: - Close(); - break; - case WIDX_PORT_INPUT: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _port, 6); - break; - case WIDX_NAME_INPUT: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _name, 64); - break; - case WIDX_DESCRIPTION_INPUT: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _description, MAX_SERVER_DESCRIPTION_LENGTH); - break; - case WIDX_GREETING_INPUT: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _greeting, CHAT_INPUT_SIZE); - break; - case WIDX_PASSWORD_INPUT: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _password, 32); - break; - case WIDX_MAXPLAYERS_INCREASE: - if (gConfigNetwork.Maxplayers < 255) - { - gConfigNetwork.Maxplayers++; - } - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_MAXPLAYERS_DECREASE: - if (gConfigNetwork.Maxplayers > 1) - { - gConfigNetwork.Maxplayers--; - } - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_ADVERTISE_CHECKBOX: - gConfigNetwork.Advertise = !gConfigNetwork.Advertise; - ConfigSaveDefault(); - Invalidate(); - break; - case WIDX_START_SERVER: - NetworkSetPassword(_password); - WindowScenarioselectOpen(ScenarioSelectCallback); - break; - case WIDX_LOAD_SERVER: - NetworkSetPassword(_password); - auto intent = Intent(WindowClass::Loadsave); - intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); - intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(LoadSaveCallback)); - ContextOpenIntent(&intent); - break; + widgets = _windowServerStartWidgets; + widgets[WIDX_PORT_INPUT].string = _port; + widgets[WIDX_NAME_INPUT].string = _name; + widgets[WIDX_DESCRIPTION_INPUT].string = _description; + widgets[WIDX_GREETING_INPUT].string = _greeting; + widgets[WIDX_PASSWORD_INPUT].string = _password; + InitScrollWidgets(); + frame_no = 0; + min_width = width; + min_height = height; + max_width = min_width; + max_height = min_height; + + page = 0; + list_information_type = 0; + + snprintf(_port, 7, "%u", gConfigNetwork.DefaultPort); + SafeStrCpy(_name, gConfigNetwork.ServerName.c_str(), sizeof(_name)); + SafeStrCpy(_description, gConfigNetwork.ServerDescription.c_str(), sizeof(_description)); + SafeStrCpy(_greeting, gConfigNetwork.ServerGreeting.c_str(), sizeof(_greeting)); } - } - void OnPrepareDraw() override - { - ColourSchemeUpdateByClass(this, WindowClass::ServerList); - - WidgetSetCheckboxValue(*this, WIDX_ADVERTISE_CHECKBOX, gConfigNetwork.Advertise); - auto ft = Formatter::Common(); - ft.Increment(18); - ft.Add(gConfigNetwork.Maxplayers); - } - void OnUpdate() override - { - if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) + void OnMouseUp(WidgetIndex widgetIndex) override { - WindowUpdateTextboxCaret(); - WidgetInvalidate(*this, WIDX_NAME_INPUT); - WidgetInvalidate(*this, WIDX_DESCRIPTION_INPUT); - WidgetInvalidate(*this, WIDX_GREETING_INPUT); - WidgetInvalidate(*this, WIDX_PASSWORD_INPUT); + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_PORT_INPUT: + WindowStartTextbox(*this, widgetIndex, STR_STRING, _port, 6); + break; + case WIDX_NAME_INPUT: + WindowStartTextbox(*this, widgetIndex, STR_STRING, _name, 64); + break; + case WIDX_DESCRIPTION_INPUT: + WindowStartTextbox(*this, widgetIndex, STR_STRING, _description, MAX_SERVER_DESCRIPTION_LENGTH); + break; + case WIDX_GREETING_INPUT: + WindowStartTextbox(*this, widgetIndex, STR_STRING, _greeting, CHAT_INPUT_SIZE); + break; + case WIDX_PASSWORD_INPUT: + WindowStartTextbox(*this, widgetIndex, STR_STRING, _password, 32); + break; + case WIDX_MAXPLAYERS_INCREASE: + if (gConfigNetwork.Maxplayers < 255) + { + gConfigNetwork.Maxplayers++; + } + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_MAXPLAYERS_DECREASE: + if (gConfigNetwork.Maxplayers > 1) + { + gConfigNetwork.Maxplayers--; + } + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_ADVERTISE_CHECKBOX: + gConfigNetwork.Advertise = !gConfigNetwork.Advertise; + ConfigSaveDefault(); + Invalidate(); + break; + case WIDX_START_SERVER: + NetworkSetPassword(_password); + ScenarioselectOpen(ScenarioSelectCallback); + break; + case WIDX_LOAD_SERVER: + NetworkSetPassword(_password); + auto intent = Intent(WindowClass::Loadsave); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); + intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(LoadSaveCallback)); + ContextOpenIntent(&intent); + break; + } } - } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - std::string temp = static_cast(text); - int tempPort = 0; - - switch (widgetIndex) + void OnPrepareDraw() override { - case WIDX_PORT_INPUT: - if (strcmp(_port, temp.c_str()) == 0) - return; - - SafeStrCpy(_port, temp.c_str(), sizeof(_port)); - - // Don't allow negative/zero for port number - tempPort = atoi(_port); - if (tempPort > 0) - { - gConfigNetwork.DefaultPort = tempPort; - ConfigSaveDefault(); - } - - WidgetInvalidate(*this, WIDX_PORT_INPUT); - break; - case WIDX_NAME_INPUT: - if (strcmp(_name, temp.c_str()) == 0) - return; - - SafeStrCpy(_name, temp.c_str(), sizeof(_name)); - - // Don't allow empty server names - if (_name[0] != '\0') - { - gConfigNetwork.ServerName = _name; - ConfigSaveDefault(); - } + ColourSchemeUpdateByClass(this, WindowClass::ServerList); + WidgetSetCheckboxValue(*this, WIDX_ADVERTISE_CHECKBOX, gConfigNetwork.Advertise); + auto ft = Formatter::Common(); + ft.Increment(18); + ft.Add(gConfigNetwork.Maxplayers); + } + void OnUpdate() override + { + if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) + { + WindowUpdateTextboxCaret(); WidgetInvalidate(*this, WIDX_NAME_INPUT); - break; - case WIDX_DESCRIPTION_INPUT: - if (strcmp(_description, temp.c_str()) == 0) - return; - - SafeStrCpy(_description, temp.c_str(), sizeof(_description)); - gConfigNetwork.ServerDescription = _description; - ConfigSaveDefault(); - WidgetInvalidate(*this, WIDX_DESCRIPTION_INPUT); - break; - case WIDX_GREETING_INPUT: - if (strcmp(_greeting, temp.c_str()) == 0) - return; - - SafeStrCpy(_greeting, temp.c_str(), sizeof(_greeting)); - gConfigNetwork.ServerGreeting = _greeting; - ConfigSaveDefault(); - WidgetInvalidate(*this, WIDX_GREETING_INPUT); - break; - case WIDX_PASSWORD_INPUT: - if (strcmp(_password, temp.c_str()) == 0) - return; - - SafeStrCpy(_password, temp.c_str(), sizeof(_password)); - WidgetInvalidate(*this, WIDX_PASSWORD_INPUT); - break; + } } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PORT_INPUT].top }, STR_PORT, {}, { colours[1] }); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_NAME_INPUT].top }, STR_SERVER_NAME, {}, { colours[1] }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_DESCRIPTION_INPUT].top }, STR_SERVER_DESCRIPTION, {}, - { colours[1] }); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_GREETING_INPUT].top }, STR_SERVER_GREETING, {}, { colours[1] }); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PASSWORD_INPUT].top }, STR_PASSWORD, {}, { colours[1] }); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_MAXPLAYERS].top }, STR_MAX_PLAYERS, {}, { colours[1] }); - } - - void OnResize() override - { - ResizeFrame(); - } - -private: - char _port[7]; - char _name[65]; - char _description[MAX_SERVER_DESCRIPTION_LENGTH]; - char _greeting[CHAT_INPUT_SIZE]; - char _password[33]; - static void ScenarioSelectCallback(const utf8* path) - { - GameNotifyMapChange(); - if (GetContext()->LoadParkFromFile(path, false, true)) + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override { - NetworkBeginServer(gConfigNetwork.DefaultPort, gConfigNetwork.ListenAddress); - } - } + std::string temp = static_cast(text); + int tempPort = 0; - static void LoadSaveCallback(int32_t result, const utf8* path) - { - if (result == MODAL_RESULT_OK) + switch (widgetIndex) + { + case WIDX_PORT_INPUT: + if (strcmp(_port, temp.c_str()) == 0) + return; + + SafeStrCpy(_port, temp.c_str(), sizeof(_port)); + + // Don't allow negative/zero for port number + tempPort = atoi(_port); + if (tempPort > 0) + { + gConfigNetwork.DefaultPort = tempPort; + ConfigSaveDefault(); + } + + WidgetInvalidate(*this, WIDX_PORT_INPUT); + break; + case WIDX_NAME_INPUT: + if (strcmp(_name, temp.c_str()) == 0) + return; + + SafeStrCpy(_name, temp.c_str(), sizeof(_name)); + + // Don't allow empty server names + if (_name[0] != '\0') + { + gConfigNetwork.ServerName = _name; + ConfigSaveDefault(); + } + + WidgetInvalidate(*this, WIDX_NAME_INPUT); + break; + case WIDX_DESCRIPTION_INPUT: + if (strcmp(_description, temp.c_str()) == 0) + return; + + SafeStrCpy(_description, temp.c_str(), sizeof(_description)); + gConfigNetwork.ServerDescription = _description; + ConfigSaveDefault(); + + WidgetInvalidate(*this, WIDX_DESCRIPTION_INPUT); + break; + case WIDX_GREETING_INPUT: + if (strcmp(_greeting, temp.c_str()) == 0) + return; + + SafeStrCpy(_greeting, temp.c_str(), sizeof(_greeting)); + gConfigNetwork.ServerGreeting = _greeting; + ConfigSaveDefault(); + + WidgetInvalidate(*this, WIDX_GREETING_INPUT); + break; + case WIDX_PASSWORD_INPUT: + if (strcmp(_password, temp.c_str()) == 0) + return; + + SafeStrCpy(_password, temp.c_str(), sizeof(_password)); + + WidgetInvalidate(*this, WIDX_PASSWORD_INPUT); + break; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PORT_INPUT].top }, STR_PORT, {}, { colours[1] }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_NAME_INPUT].top }, STR_SERVER_NAME, {}, { colours[1] }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_DESCRIPTION_INPUT].top }, STR_SERVER_DESCRIPTION, {}, + { colours[1] }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_GREETING_INPUT].top }, STR_SERVER_GREETING, {}, + { colours[1] }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PASSWORD_INPUT].top }, STR_PASSWORD, {}, { colours[1] }); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_MAXPLAYERS].top }, STR_MAX_PLAYERS, {}, { colours[1] }); + } + + void OnResize() override + { + ResizeFrame(); + } + + private: + char _port[7]; + char _name[65]; + char _description[MAX_SERVER_DESCRIPTION_LENGTH]; + char _greeting[CHAT_INPUT_SIZE]; + char _password[33]; + static void ScenarioSelectCallback(const utf8* path) { GameNotifyMapChange(); - GetContext()->LoadParkFromFile(path); - NetworkBeginServer(gConfigNetwork.DefaultPort, gConfigNetwork.ListenAddress); + if (GetContext()->LoadParkFromFile(path, false, true)) + { + NetworkBeginServer(gConfigNetwork.DefaultPort, gConfigNetwork.ListenAddress); + } } - } -}; -WindowBase* WindowServerStartOpen() -{ - return WindowFocusOrCreate(WindowClass::ServerStart, WW, WH, WF_CENTRE_SCREEN); -} + static void LoadSaveCallback(int32_t result, const utf8* path) + { + if (result == MODAL_RESULT_OK) + { + GameNotifyMapChange(); + GetContext()->LoadParkFromFile(path); + NetworkBeginServer(gConfigNetwork.DefaultPort, gConfigNetwork.ListenAddress); + } + } + }; + + WindowBase* ServerStartOpen() + { + return WindowFocusOrCreate(WindowClass::ServerStart, WW, WH, WF_CENTRE_SCREEN); + } +} // namespace OpenRCT2::Ui::Windows #endif diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index fcc7ad0f46..cc9f3d7339 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -16,609 +16,611 @@ #include #include -using namespace OpenRCT2; -using namespace OpenRCT2::Ui; - -WindowBase* ResetShortcutKeysPromptOpen(); - -static constexpr StringId WINDOW_TITLE = STR_SHORTCUTS_TITLE; -static constexpr int32_t WW = 420; -static constexpr int32_t WH = 280; - -static constexpr int32_t WW_SC_MAX = 1200; -static constexpr int32_t WH_SC_MAX = 800; - -enum WindowShortcutWidgetIdx +namespace OpenRCT2::Ui::Windows { - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_TAB_CONTENT_PANEL, - WIDX_SCROLL, - WIDX_RESET, - WIDX_TAB_0, -}; + WindowBase* ResetShortcutKeysPromptOpen(); -// clang-format off + static constexpr StringId WINDOW_TITLE = STR_SHORTCUTS_TITLE; + static constexpr int32_t WW = 420; + static constexpr int32_t WH = 280; + + static constexpr int32_t WW_SC_MAX = 1200; + static constexpr int32_t WH_SC_MAX = 800; + + enum WindowShortcutWidgetIdx + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_TAB_CONTENT_PANEL, + WIDX_SCROLL, + WIDX_RESET, + WIDX_TAB_0, + }; + + // clang-format off static Widget _shortcutWidgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget({0, 43}, {350, 287}, WindowWidgetType::Resize, WindowColour::Secondary), MakeWidget({4, 47}, {412, 215}, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL, STR_SHORTCUT_LIST_TIP ), MakeWidget({4, WH-15}, {150, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_SHORTCUT_ACTION_RESET, STR_SHORTCUT_ACTION_RESET_TIP), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -static constexpr StringId CHANGE_WINDOW_TITLE = STR_SHORTCUT_CHANGE_TITLE; -static constexpr int32_t CHANGE_WW = 250; -static constexpr int32_t CHANGE_WH = 80; + static constexpr StringId CHANGE_WINDOW_TITLE = STR_SHORTCUT_CHANGE_TITLE; + static constexpr int32_t CHANGE_WW = 250; + static constexpr int32_t CHANGE_WH = 80; -enum -{ - WIDX_REMOVE = 3 -}; + enum + { + WIDX_REMOVE = 3 + }; -// clang-format off + // clang-format off static Widget window_shortcut_change_widgets[] = { WINDOW_SHIM(CHANGE_WINDOW_TITLE, CHANGE_WW, CHANGE_WH), MakeWidget({ 75, 56 }, { 100, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_SHORTCUT_REMOVE, STR_SHORTCUT_REMOVE_TIP), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class ChangeShortcutWindow final : public Window -{ -private: - std::string _shortcutId; - StringId _shortcutLocalisedName{}; - std::string _shortcutCustomName; - -public: - static ChangeShortcutWindow* Open(std::string_view shortcutId) + class ChangeShortcutWindow final : public Window { - auto& shortcutManager = GetShortcutManager(); - auto registeredShortcut = shortcutManager.GetShortcut(shortcutId); - if (registeredShortcut != nullptr) + private: + std::string _shortcutId; + StringId _shortcutLocalisedName{}; + std::string _shortcutCustomName; + + public: + static ChangeShortcutWindow* Open(std::string_view shortcutId) { - WindowCloseByClass(WindowClass::ChangeKeyboardShortcut); - auto w = WindowCreate( - WindowClass::ChangeKeyboardShortcut, CHANGE_WW, CHANGE_WH, WF_CENTRE_SCREEN); - if (w != nullptr) + auto& shortcutManager = GetShortcutManager(); + auto registeredShortcut = shortcutManager.GetShortcut(shortcutId); + if (registeredShortcut != nullptr) { - w->_shortcutId = shortcutId; - w->_shortcutLocalisedName = registeredShortcut->LocalisedName; - w->_shortcutCustomName = registeredShortcut->CustomName; - shortcutManager.SetPendingShortcutChange(registeredShortcut->Id); - return w; - } - } - return nullptr; - } - - void OnOpen() override - { - widgets = window_shortcut_change_widgets; - WindowInitScrollWidgets(*this); - } - - void OnClose() override - { - auto& shortcutManager = GetShortcutManager(); - shortcutManager.SetPendingShortcutChange({}); - NotifyShortcutKeysWindow(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_REMOVE: - Remove(); - break; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - ScreenCoordsXY stringCoords(windowPos.x + 125, windowPos.y + 30); - - auto ft = Formatter(); - if (_shortcutCustomName.empty()) - { - ft.Add(_shortcutLocalisedName); - } - else - { - ft.Add(STR_STRING); - ft.Add(_shortcutCustomName.c_str()); - } - DrawTextWrapped(dpi, stringCoords, 242, STR_SHORTCUT_CHANGE_PROMPT, ft, { TextAlignment::CENTRE }); - } - -private: - void NotifyShortcutKeysWindow(); - - void Remove() - { - auto& shortcutManager = GetShortcutManager(); - auto* shortcut = shortcutManager.GetShortcut(_shortcutId); - if (shortcut != nullptr) - { - shortcut->Current.clear(); - shortcutManager.SaveUserBindings(); - } - Close(); - } -}; - -class ShortcutKeysWindow final : public Window -{ -private: - struct ShortcutStringPair - { - std::string ShortcutId; - ::StringId StringId = STR_NONE; - std::string CustomString; - std::string Binding; - }; - - struct ShortcutTabDesc - { - std::string_view IdGroup; - uint32_t ImageId; - uint32_t ImageDivisor; - uint32_t ImageNumFrames; - }; - - std::vector _tabs; - std::vector _widgets; - std::vector _list; - int_fast16_t _highlightedItem; - size_t _currentTabIndex{}; - uint32_t _tabAnimationIndex{}; - -public: - void OnOpen() override - { - InitialiseTabs(); - InitialiseWidgets(); - InitialiseList(); - - min_width = WW; - min_height = WH; - max_width = WW_SC_MAX; - max_height = WH_SC_MAX; - } - - void OnClose() override - { - WindowCloseByClass(WindowClass::ResetShortcutKeysPrompt); - } - - void OnResize() override - { - WindowSetResize(*this, min_width, min_height, max_width, max_height); - } - - void OnUpdate() override - { - // Remove highlight when the mouse is not hovering over the list - if (_highlightedItem != -1 && !WidgetIsHighlighted(*this, WIDX_SCROLL)) - { - _highlightedItem = -1; - InvalidateWidget(WIDX_SCROLL); - } - - _tabAnimationIndex++; - InvalidateWidget(static_cast(WIDX_TAB_0 + _currentTabIndex)); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_RESET: - ResetShortcutKeysPromptOpen(); - break; - default: - { - auto tabIndex = static_cast(widgetIndex - WIDX_TAB_0); - if (tabIndex < _tabs.size()) + WindowCloseByClass(WindowClass::ChangeKeyboardShortcut); + auto w = WindowCreate( + WindowClass::ChangeKeyboardShortcut, CHANGE_WW, CHANGE_WH, WF_CENTRE_SCREEN); + if (w != nullptr) { - SetTab(tabIndex); + w->_shortcutId = shortcutId; + w->_shortcutLocalisedName = registeredShortcut->LocalisedName; + w->_shortcutCustomName = registeredShortcut->CustomName; + shortcutManager.SetPendingShortcutChange(registeredShortcut->Id); + return w; } } + return nullptr; } - } - void OnPrepareDraw() override - { - ResizeFrameWithPage(); - widgets[WIDX_SCROLL].right = width - 5; - widgets[WIDX_SCROLL].bottom = height - 19; - widgets[WIDX_RESET].top = height - 16; - widgets[WIDX_RESET].bottom = height - 5; - WindowAlignTabs(this, WIDX_TAB_0, static_cast(WIDX_TAB_0 + _tabs.size())); - - // Set selected tab - for (size_t i = 0; i < _tabs.size(); i++) + void OnOpen() override { - SetWidgetPressed(static_cast(WIDX_TAB_0 + i), false); + widgets = window_shortcut_change_widgets; + WindowInitScrollWidgets(*this); } - SetWidgetPressed(static_cast(WIDX_TAB_0 + _currentTabIndex), true); - } - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabImages(dpi); - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - auto h = static_cast(_list.size() * SCROLLABLE_ROW_HEIGHT); - auto bottom = std::max(0, h - widgets[WIDX_SCROLL].bottom + widgets[WIDX_SCROLL].top + 21); - if (bottom < scrolls[0].v_top) + void OnClose() override { - scrolls[0].v_top = bottom; - Invalidate(); + auto& shortcutManager = GetShortcutManager(); + shortcutManager.SetPendingShortcutChange({}); + NotifyShortcutKeysWindow(); } - return { 0, h }; - } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - auto index = static_cast((screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT); - if (static_cast(index) < _list.size()) + void OnMouseUp(WidgetIndex widgetIndex) override { - _highlightedItem = index; - Invalidate(); - } - else - { - _highlightedItem = -1; - } - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - auto selectedItem = static_cast((screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT); - if (selectedItem < _list.size()) - { - // Is this a separator? - if (!_list[selectedItem].ShortcutId.empty()) + switch (widgetIndex) { - auto& shortcut = _list[selectedItem]; - ChangeShortcutWindow::Open(shortcut.ShortcutId); + case WIDX_CLOSE: + Close(); + break; + case WIDX_REMOVE: + Remove(); + break; } } - } - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; - GfxFillRect( - dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width - 1, dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); - - // TODO: the line below is a workaround for what is presumably a bug with dpi->width - // see https://github.com/OpenRCT2/OpenRCT2/issues/11238 for details - const auto scrollWidth = width - SCROLLBAR_WIDTH - 10; - - for (size_t i = 0; i < _list.size(); ++i) + void OnDraw(DrawPixelInfo& dpi) override { - auto y = static_cast(1 + i * SCROLLABLE_ROW_HEIGHT); - if (y > dpi.y + dpi.height) - { - break; - } + DrawWidgets(dpi); - if (y + SCROLLABLE_ROW_HEIGHT < dpi.y) - { - continue; - } + ScreenCoordsXY stringCoords(windowPos.x + 125, windowPos.y + 30); - // Is this a separator? - if (_list[i].ShortcutId.empty()) + auto ft = Formatter(); + if (_shortcutCustomName.empty()) { - DrawSeparator(dpi, y, scrollWidth); + ft.Add(_shortcutLocalisedName); } else { - auto isHighlighted = _highlightedItem == static_cast(i); - DrawItem(dpi, y, scrollWidth, _list[i], isHighlighted); + ft.Add(STR_STRING); + ft.Add(_shortcutCustomName.c_str()); } + DrawTextWrapped(dpi, stringCoords, 242, STR_SHORTCUT_CHANGE_PROMPT, ft, { TextAlignment::CENTRE }); } - } - void RefreshBindings() - { - InitialiseList(); - } + private: + void NotifyShortcutKeysWindow(); - void ResetAllOnActiveTab() - { - auto& shortcutManager = GetShortcutManager(); - for (const auto& item : _list) + void Remove() { - auto shortcut = shortcutManager.GetShortcut(item.ShortcutId); + auto& shortcutManager = GetShortcutManager(); + auto* shortcut = shortcutManager.GetShortcut(_shortcutId); if (shortcut != nullptr) { - shortcut->Current = shortcut->Default; + shortcut->Current.clear(); + shortcutManager.SaveUserBindings(); } + Close(); } - shortcutManager.SaveUserBindings(); - RefreshBindings(); - } + }; -private: - bool IsInCurrentTab(const RegisteredShortcut& shortcut) + class ShortcutKeysWindow final : public Window { - auto groupFilter = _tabs[_currentTabIndex].IdGroup; - auto group = shortcut.GetTopLevelGroup(); - if (groupFilter.empty()) + private: + struct ShortcutStringPair { - // Check it doesn't belong in any other tab - for (const auto& tab : _tabs) + std::string ShortcutId; + ::StringId StringId = STR_NONE; + std::string CustomString; + std::string Binding; + }; + + struct ShortcutTabDesc + { + std::string_view IdGroup; + uint32_t ImageId; + uint32_t ImageDivisor; + uint32_t ImageNumFrames; + }; + + std::vector _tabs; + std::vector _widgets; + std::vector _list; + int_fast16_t _highlightedItem; + size_t _currentTabIndex{}; + uint32_t _tabAnimationIndex{}; + + public: + void OnOpen() override + { + InitialiseTabs(); + InitialiseWidgets(); + InitialiseList(); + + min_width = WW; + min_height = WH; + max_width = WW_SC_MAX; + max_height = WH_SC_MAX; + } + + void OnClose() override + { + WindowCloseByClass(WindowClass::ResetShortcutKeysPrompt); + } + + void OnResize() override + { + WindowSetResize(*this, min_width, min_height, max_width, max_height); + } + + void OnUpdate() override + { + // Remove highlight when the mouse is not hovering over the list + if (_highlightedItem != -1 && !WidgetIsHighlighted(*this, WIDX_SCROLL)) { - if (!tab.IdGroup.empty()) + _highlightedItem = -1; + InvalidateWidget(WIDX_SCROLL); + } + + _tabAnimationIndex++; + InvalidateWidget(static_cast(WIDX_TAB_0 + _currentTabIndex)); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_RESET: + ResetShortcutKeysPromptOpen(); + break; + default: { - if (tab.IdGroup == group) + auto tabIndex = static_cast(widgetIndex - WIDX_TAB_0); + if (tabIndex < _tabs.size()) { - return false; + SetTab(tabIndex); } } } - return true; } - return group == groupFilter; - } - - void InitialiseList() - { - // Get shortcuts and sort by group - auto shortcuts = GetShortcutsForCurrentTab(); - std::stable_sort(shortcuts.begin(), shortcuts.end(), [](const RegisteredShortcut* a, const RegisteredShortcut* b) { - return a->OrderIndex < b->OrderIndex; - }); - - // Create list items with a separator between each group - _list.clear(); - std::string group; - for (const auto* shortcut : shortcuts) + void OnPrepareDraw() override { - if (group.empty()) + ResizeFrameWithPage(); + widgets[WIDX_SCROLL].right = width - 5; + widgets[WIDX_SCROLL].bottom = height - 19; + widgets[WIDX_RESET].top = height - 16; + widgets[WIDX_RESET].bottom = height - 5; + WindowAlignTabs(this, WIDX_TAB_0, static_cast(WIDX_TAB_0 + _tabs.size())); + + // Set selected tab + for (size_t i = 0; i < _tabs.size(); i++) { - group = shortcut->GetGroup(); + SetWidgetPressed(static_cast(WIDX_TAB_0 + i), false); + } + SetWidgetPressed(static_cast(WIDX_TAB_0 + _currentTabIndex), true); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + DrawTabImages(dpi); + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + auto h = static_cast(_list.size() * SCROLLABLE_ROW_HEIGHT); + auto bottom = std::max(0, h - widgets[WIDX_SCROLL].bottom + widgets[WIDX_SCROLL].top + 21); + if (bottom < scrolls[0].v_top) + { + scrolls[0].v_top = bottom; + Invalidate(); + } + return { 0, h }; + } + + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + auto index = static_cast((screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT); + if (static_cast(index) < _list.size()) + { + _highlightedItem = index; + Invalidate(); } else { - auto groupName = shortcut->GetGroup(); - if (group != groupName) + _highlightedItem = -1; + } + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + auto selectedItem = static_cast((screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT); + if (selectedItem < _list.size()) + { + // Is this a separator? + if (!_list[selectedItem].ShortcutId.empty()) { - // Add separator - group = groupName; - _list.emplace_back(); + auto& shortcut = _list[selectedItem]; + ChangeShortcutWindow::Open(shortcut.ShortcutId); } } - - ShortcutStringPair ssp; - ssp.ShortcutId = shortcut->Id; - ssp.StringId = shortcut->LocalisedName; - ssp.CustomString = shortcut->CustomName; - ssp.Binding = shortcut->GetDisplayString(); - _list.push_back(std::move(ssp)); } - Invalidate(); - } - - std::vector GetShortcutsForCurrentTab() - { - std::vector result; - auto& shortcutManager = GetShortcutManager(); - for (const auto& shortcut : shortcutManager.Shortcuts) + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override { - if (IsInCurrentTab(shortcut.second)) + auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; + GfxFillRect( + dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width - 1, dpi.height - 1 } }, + ColourMapA[colours[1]].mid_light); + + // TODO: the line below is a workaround for what is presumably a bug with dpi->width + // see https://github.com/OpenRCT2/OpenRCT2/issues/11238 for details + const auto scrollWidth = width - kScrollBarWidth - 10; + + for (size_t i = 0; i < _list.size(); ++i) { - result.push_back(&shortcut.second); + auto y = static_cast(1 + i * SCROLLABLE_ROW_HEIGHT); + if (y > dpi.y + dpi.height) + { + break; + } + + if (y + SCROLLABLE_ROW_HEIGHT < dpi.y) + { + continue; + } + + // Is this a separator? + if (_list[i].ShortcutId.empty()) + { + DrawSeparator(dpi, y, scrollWidth); + } + else + { + auto isHighlighted = _highlightedItem == static_cast(i); + DrawItem(dpi, y, scrollWidth, _list[i], isHighlighted); + } } } - return result; - } - void InitialiseTabs() - { - _tabs.clear(); - _tabs.push_back({ "interface", SPR_TAB_GEARS_0, 2, 4 }); - _tabs.push_back({ "view", SPR_G2_VIEW, 0, 0 }); - _tabs.push_back({ "window", SPR_TAB_PARK_ENTRANCE, 0, 0 }); - _tabs.push_back({ {}, SPR_TAB_WRENCH_0, 2, 16 }); - } - - void InitialiseWidgets() - { - _widgets.clear(); - _widgets.insert(_widgets.begin(), std::begin(_shortcutWidgets), std::end(_shortcutWidgets) - 1); - - int32_t x = 3; - for (size_t i = 0; i < _tabs.size(); i++) + void RefreshBindings() { - auto tab = MakeTab({ x, 17 }, STR_NONE); - _widgets.push_back(tab); - x += 31; - } - - _widgets.push_back(WIDGETS_END); - widgets = _widgets.data(); - - WindowInitScrollWidgets(*this); - } - - void SetTab(size_t index) - { - if (_currentTabIndex != index) - { - _currentTabIndex = index; - _tabAnimationIndex = 0; InitialiseList(); } - } - void DrawTabImages(DrawPixelInfo& dpi) const - { - for (size_t i = 0; i < _tabs.size(); i++) + void ResetAllOnActiveTab() { - DrawTabImage(dpi, i); - } - } - - void DrawTabImage(DrawPixelInfo& dpi, size_t tabIndex) const - { - const auto& tabDesc = _tabs[tabIndex]; - auto widgetIndex = static_cast(WIDX_TAB_0 + tabIndex); - if (!IsWidgetDisabled(widgetIndex)) - { - auto imageId = tabDesc.ImageId; - if (imageId != 0) + auto& shortcutManager = GetShortcutManager(); + for (const auto& item : _list) { - if (tabIndex == _currentTabIndex && tabDesc.ImageDivisor != 0 && tabDesc.ImageNumFrames != 0) + auto shortcut = shortcutManager.GetShortcut(item.ShortcutId); + if (shortcut != nullptr) { - auto frame = _tabAnimationIndex / tabDesc.ImageDivisor; - imageId += frame % tabDesc.ImageNumFrames; + shortcut->Current = shortcut->Default; + } + } + shortcutManager.SaveUserBindings(); + RefreshBindings(); + } + + private: + bool IsInCurrentTab(const RegisteredShortcut& shortcut) + { + auto groupFilter = _tabs[_currentTabIndex].IdGroup; + auto group = shortcut.GetTopLevelGroup(); + if (groupFilter.empty()) + { + // Check it doesn't belong in any other tab + for (const auto& tab : _tabs) + { + if (!tab.IdGroup.empty()) + { + if (tab.IdGroup == group) + { + return false; + } + } + } + return true; + } + + return group == groupFilter; + } + + void InitialiseList() + { + // Get shortcuts and sort by group + auto shortcuts = GetShortcutsForCurrentTab(); + std::stable_sort(shortcuts.begin(), shortcuts.end(), [](const RegisteredShortcut* a, const RegisteredShortcut* b) { + return a->OrderIndex < b->OrderIndex; + }); + + // Create list items with a separator between each group + _list.clear(); + std::string group; + for (const auto* shortcut : shortcuts) + { + if (group.empty()) + { + group = shortcut->GetGroup(); + } + else + { + auto groupName = shortcut->GetGroup(); + if (group != groupName) + { + // Add separator + group = groupName; + _list.emplace_back(); + } } - const auto& widget = widgets[widgetIndex]; - GfxDrawSprite(dpi, ImageId(imageId), windowPos + ScreenCoordsXY{ widget.left, widget.top }); + ShortcutStringPair ssp; + ssp.ShortcutId = shortcut->Id; + ssp.StringId = shortcut->LocalisedName; + ssp.CustomString = shortcut->CustomName; + ssp.Binding = shortcut->GetDisplayString(); + _list.push_back(std::move(ssp)); + } + + Invalidate(); + } + + std::vector GetShortcutsForCurrentTab() + { + std::vector result; + auto& shortcutManager = GetShortcutManager(); + for (const auto& shortcut : shortcutManager.Shortcuts) + { + if (IsInCurrentTab(shortcut.second)) + { + result.push_back(&shortcut.second); + } + } + return result; + } + + void InitialiseTabs() + { + _tabs.clear(); + _tabs.push_back({ "interface", SPR_TAB_GEARS_0, 2, 4 }); + _tabs.push_back({ "view", SPR_G2_VIEW, 0, 0 }); + _tabs.push_back({ "window", SPR_TAB_PARK_ENTRANCE, 0, 0 }); + _tabs.push_back({ {}, SPR_TAB_WRENCH_0, 2, 16 }); + } + + void InitialiseWidgets() + { + _widgets.clear(); + _widgets.insert(_widgets.begin(), std::begin(_shortcutWidgets), std::end(_shortcutWidgets) - 1); + + int32_t x = 3; + for (size_t i = 0; i < _tabs.size(); i++) + { + auto tab = MakeTab({ x, 17 }, STR_NONE); + _widgets.push_back(tab); + x += 31; + } + + _widgets.push_back(kWidgetsEnd); + widgets = _widgets.data(); + + WindowInitScrollWidgets(*this); + } + + void SetTab(size_t index) + { + if (_currentTabIndex != index) + { + _currentTabIndex = index; + _tabAnimationIndex = 0; + InitialiseList(); } } - } - void DrawSeparator(DrawPixelInfo& dpi, int32_t y, int32_t scrollWidth) - { - const int32_t top = y + (SCROLLABLE_ROW_HEIGHT / 2) - 1; - GfxFillRect(dpi, { { 0, top }, { scrollWidth, top } }, ColourMapA[colours[0]].mid_dark); - GfxFillRect(dpi, { { 0, top + 1 }, { scrollWidth, top + 1 } }, ColourMapA[colours[0]].lightest); - } - - void DrawItem(DrawPixelInfo& dpi, int32_t y, int32_t scrollWidth, const ShortcutStringPair& shortcut, bool isHighlighted) - { - auto format = STR_BLACK_STRING; - if (isHighlighted) + void DrawTabImages(DrawPixelInfo& dpi) const { - format = STR_WINDOW_COLOUR_2_STRINGID; - GfxFilterRect(dpi, { 0, y - 1, scrollWidth, y + (SCROLLABLE_ROW_HEIGHT - 2) }, FilterPaletteID::PaletteDarken1); + for (size_t i = 0; i < _tabs.size(); i++) + { + DrawTabImage(dpi, i); + } } - auto bindingOffset = (scrollWidth * 2) / 3; - auto ft = Formatter(); - ft.Add(STR_SHORTCUT_ENTRY_FORMAT); - if (shortcut.CustomString.empty()) + void DrawTabImage(DrawPixelInfo& dpi, size_t tabIndex) const { - ft.Add(shortcut.StringId); - } - else - { - ft.Add(STR_STRING); - ft.Add(shortcut.CustomString.c_str()); - } - DrawTextEllipsised(dpi, { 0, y - 1 }, bindingOffset, format, ft); + const auto& tabDesc = _tabs[tabIndex]; + auto widgetIndex = static_cast(WIDX_TAB_0 + tabIndex); + if (!IsWidgetDisabled(widgetIndex)) + { + auto imageId = tabDesc.ImageId; + if (imageId != 0) + { + if (tabIndex == _currentTabIndex && tabDesc.ImageDivisor != 0 && tabDesc.ImageNumFrames != 0) + { + auto frame = _tabAnimationIndex / tabDesc.ImageDivisor; + imageId += frame % tabDesc.ImageNumFrames; + } - if (!shortcut.Binding.empty()) - { - ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(shortcut.Binding.c_str()); - DrawTextEllipsised(dpi, { bindingOffset, y - 1 }, 150, format, ft); + const auto& widget = widgets[widgetIndex]; + GfxDrawSprite(dpi, ImageId(imageId), windowPos + ScreenCoordsXY{ widget.left, widget.top }); + } + } } - } -}; -void ChangeShortcutWindow::NotifyShortcutKeysWindow() -{ - auto w = WindowFindByClass(WindowClass::KeyboardShortcutList); - if (w != nullptr) + void DrawSeparator(DrawPixelInfo& dpi, int32_t y, int32_t scrollWidth) + { + const int32_t top = y + (SCROLLABLE_ROW_HEIGHT / 2) - 1; + GfxFillRect(dpi, { { 0, top }, { scrollWidth, top } }, ColourMapA[colours[0]].mid_dark); + GfxFillRect(dpi, { { 0, top + 1 }, { scrollWidth, top + 1 } }, ColourMapA[colours[0]].lightest); + } + + void DrawItem( + DrawPixelInfo& dpi, int32_t y, int32_t scrollWidth, const ShortcutStringPair& shortcut, bool isHighlighted) + { + auto format = STR_BLACK_STRING; + if (isHighlighted) + { + format = STR_WINDOW_COLOUR_2_STRINGID; + GfxFilterRect(dpi, { 0, y - 1, scrollWidth, y + (SCROLLABLE_ROW_HEIGHT - 2) }, FilterPaletteID::PaletteDarken1); + } + + auto bindingOffset = (scrollWidth * 2) / 3; + auto ft = Formatter(); + ft.Add(STR_SHORTCUT_ENTRY_FORMAT); + if (shortcut.CustomString.empty()) + { + ft.Add(shortcut.StringId); + } + else + { + ft.Add(STR_STRING); + ft.Add(shortcut.CustomString.c_str()); + } + DrawTextEllipsised(dpi, { 0, y - 1 }, bindingOffset, format, ft); + + if (!shortcut.Binding.empty()) + { + ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(shortcut.Binding.c_str()); + DrawTextEllipsised(dpi, { bindingOffset, y - 1 }, 150, format, ft); + } + } + }; + + void ChangeShortcutWindow::NotifyShortcutKeysWindow() { - static_cast(w)->RefreshBindings(); + auto w = WindowFindByClass(WindowClass::KeyboardShortcutList); + if (w != nullptr) + { + static_cast(w)->RefreshBindings(); + } } -} -WindowBase* WindowShortcutKeysOpen() -{ - auto w = WindowBringToFrontByClass(WindowClass::KeyboardShortcutList); - if (w == nullptr) + WindowBase* ShortcutKeysOpen() { - w = WindowCreate(WindowClass::KeyboardShortcutList, WW, WH, WF_RESIZABLE); + auto w = WindowBringToFrontByClass(WindowClass::KeyboardShortcutList); + if (w == nullptr) + { + w = WindowCreate(WindowClass::KeyboardShortcutList, WW, WH, WF_RESIZABLE); + } + return w; } - return w; -} #pragma region Reset prompt -static constexpr int32_t RESET_PROMPT_WW = 200; -static constexpr int32_t RESET_PROMPT_WH = 80; + static constexpr int32_t RESET_PROMPT_WW = 200; + static constexpr int32_t RESET_PROMPT_WH = 80; -enum -{ - WIDX_RESET_PROMPT_BACKGROUND, - WIDX_RESET_PROMPT_TITLE, - WIDX_RESET_PROMPT_CLOSE, - WIDX_RESET_PROMPT_LABEL, - WIDX_RESET_PROMPT_RESET, - WIDX_RESET_PROMPT_CANCEL -}; - -static Widget WindowResetShortcutKeysPromptWidgets[] = { - WINDOW_SHIM_WHITE(STR_SHORTCUT_ACTION_RESET, RESET_PROMPT_WW, RESET_PROMPT_WH), - MakeWidget( - { 2, 30 }, { RESET_PROMPT_WW - 4, 12 }, WindowWidgetType::LabelCentred, WindowColour::Primary, - STR_RESET_SHORTCUT_KEYS_PROMPT), - MakeWidget({ 8, RESET_PROMPT_WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_RESET), - MakeWidget( - { RESET_PROMPT_WW - 95, RESET_PROMPT_WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, - STR_SAVE_PROMPT_CANCEL), - WIDGETS_END, -}; - -class ResetShortcutKeysPrompt final : public Window -{ - void OnOpen() override + enum { - widgets = WindowResetShortcutKeysPromptWidgets; - } + WIDX_RESET_PROMPT_BACKGROUND, + WIDX_RESET_PROMPT_TITLE, + WIDX_RESET_PROMPT_CLOSE, + WIDX_RESET_PROMPT_LABEL, + WIDX_RESET_PROMPT_RESET, + WIDX_RESET_PROMPT_CANCEL + }; - void OnMouseUp(WidgetIndex widgetIndex) override + static Widget WindowResetShortcutKeysPromptWidgets[] = { + WINDOW_SHIM_WHITE(STR_SHORTCUT_ACTION_RESET, RESET_PROMPT_WW, RESET_PROMPT_WH), + MakeWidget( + { 2, 30 }, { RESET_PROMPT_WW - 4, 12 }, WindowWidgetType::LabelCentred, WindowColour::Primary, + STR_RESET_SHORTCUT_KEYS_PROMPT), + MakeWidget({ 8, RESET_PROMPT_WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_RESET), + MakeWidget( + { RESET_PROMPT_WW - 95, RESET_PROMPT_WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, + STR_SAVE_PROMPT_CANCEL), + kWidgetsEnd, + }; + + class ResetShortcutKeysPrompt final : public Window { - switch (widgetIndex) + void OnOpen() override { - case WIDX_RESET_PROMPT_RESET: - { - auto w = WindowFindByClass(WindowClass::KeyboardShortcutList); - if (w != nullptr) - { - static_cast(w)->ResetAllOnActiveTab(); - } - Close(); - break; - } - case WIDX_RESET_PROMPT_CANCEL: - case WIDX_RESET_PROMPT_CLOSE: - Close(); - break; + widgets = WindowResetShortcutKeysPromptWidgets; } - } -}; -WindowBase* ResetShortcutKeysPromptOpen() -{ - return WindowFocusOrCreate( - WindowClass::ResetShortcutKeysPrompt, RESET_PROMPT_WW, RESET_PROMPT_WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); -} + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_RESET_PROMPT_RESET: + { + auto w = WindowFindByClass(WindowClass::KeyboardShortcutList); + if (w != nullptr) + { + static_cast(w)->ResetAllOnActiveTab(); + } + Close(); + break; + } + case WIDX_RESET_PROMPT_CANCEL: + case WIDX_RESET_PROMPT_CLOSE: + Close(); + break; + } + } + }; + + WindowBase* ResetShortcutKeysPromptOpen() + { + return WindowFocusOrCreate( + WindowClass::ResetShortcutKeysPrompt, RESET_PROMPT_WW, RESET_PROMPT_WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); + } #pragma endregion +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index 0d16eeeaca..5e21545df7 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -26,12 +26,13 @@ #include #include #include +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_SIGN; + static constexpr int32_t WW = 113; + static constexpr int32_t WH = 96; -static constexpr StringId WINDOW_TITLE = STR_SIGN; -static constexpr int32_t WW = 113; -static constexpr int32_t WH = 96; - -// clang-format off + // clang-format off enum WindowSignWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -51,322 +52,324 @@ static Widget _signWidgets[] = { MakeWidget({WW - 25, 67}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_DEMOLISH_SIGN_TIP ), // demolish button MakeWidget({ 5, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_MAIN_SIGN_COLOUR_TIP), // Main colour MakeWidget({ 17, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_TEXT_COLOUR_TIP ), // Text colour - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class SignWindow final : public Window -{ -private: - bool _isSmall = false; - ObjectEntryIndex _sceneryEntry = OBJECT_ENTRY_INDEX_NULL; - colour_t _mainColour = {}; - colour_t _textColour = {}; - - BannerIndex GetBannerIndex() const + class SignWindow final : public Window { - return BannerIndex::FromUnderlying(number); - } + private: + bool _isSmall = false; + ObjectEntryIndex _sceneryEntry = OBJECT_ENTRY_INDEX_NULL; + colour_t _mainColour = {}; + colour_t _textColour = {}; - void ShowTextInput() - { - auto* banner = GetBanner(GetBannerIndex()); - if (banner != nullptr) + BannerIndex GetBannerIndex() const { - auto bannerText = banner->GetText(); - WindowTextInputRawOpen(this, WIDX_SIGN_TEXT, STR_SIGN_TEXT_TITLE, STR_SIGN_TEXT_PROMPT, {}, bannerText.c_str(), 32); - } - } - -public: - void OnOpen() override - { - widgets = _signWidgets; - WindowInitScrollWidgets(*this); - } - - /* - * Initializes the window and sets it's number and if it's small - * @return true if successfull - */ - bool Initialize(rct_windownumber windowNumber, const bool isSmall) - { - number = windowNumber; - _isSmall = isSmall; - auto* banner = GetBanner(GetBannerIndex()); - if (banner == nullptr) - { - return false; + return BannerIndex::FromUnderlying(number); } - auto signViewPosition = banner->position.ToCoordsXY().ToTileCentre(); - auto* tileElement = BannerGetTileElement(GetBannerIndex()); - if (tileElement == nullptr) - return false; - - int32_t viewZ = tileElement->GetBaseZ(); - frame_no = viewZ; - - if (_isSmall) + void ShowTextInput() { - auto* wallElement = tileElement->AsWall(); - if (wallElement == nullptr) + auto* banner = GetBanner(GetBannerIndex()); + if (banner != nullptr) + { + auto bannerText = banner->GetText(); + WindowTextInputRawOpen( + this, WIDX_SIGN_TEXT, STR_SIGN_TEXT_TITLE, STR_SIGN_TEXT_PROMPT, {}, bannerText.c_str(), 32); + } + } + + public: + void OnOpen() override + { + widgets = _signWidgets; + WindowInitScrollWidgets(*this); + } + + /* + * Initializes the window and sets it's number and if it's small + * @return true if successfull + */ + bool Initialize(rct_windownumber windowNumber, const bool isSmall) + { + number = windowNumber; + _isSmall = isSmall; + auto* banner = GetBanner(GetBannerIndex()); + if (banner == nullptr) { return false; } - _mainColour = wallElement->GetPrimaryColour(); - _textColour = wallElement->GetSecondaryColour(); - _sceneryEntry = wallElement->GetEntryIndex(); - } - else - { - auto* sceneryElement = tileElement->AsLargeScenery(); - if (sceneryElement == nullptr) - { + + auto signViewPosition = banner->position.ToCoordsXY().ToTileCentre(); + auto* tileElement = BannerGetTileElement(GetBannerIndex()); + if (tileElement == nullptr) return false; + + int32_t viewZ = tileElement->GetBaseZ(); + frame_no = viewZ; + + if (_isSmall) + { + auto* wallElement = tileElement->AsWall(); + if (wallElement == nullptr) + { + return false; + } + _mainColour = wallElement->GetPrimaryColour(); + _textColour = wallElement->GetSecondaryColour(); + _sceneryEntry = wallElement->GetEntryIndex(); } - _mainColour = sceneryElement->GetPrimaryColour(); - _textColour = sceneryElement->GetSecondaryColour(); - _sceneryEntry = sceneryElement->GetEntryIndex(); + else + { + auto* sceneryElement = tileElement->AsLargeScenery(); + if (sceneryElement == nullptr) + { + return false; + } + _mainColour = sceneryElement->GetPrimaryColour(); + _textColour = sceneryElement->GetSecondaryColour(); + _sceneryEntry = sceneryElement->GetEntryIndex(); + } + + // Create viewport + Widget& viewportWidget = widgets[WIDX_VIEWPORT]; + ViewportCreate( + this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 }, viewportWidget.width() - 1, + viewportWidget.height() - 1, Focus(CoordsXYZ{ signViewPosition, viewZ })); + + viewport->flags = gConfigGeneral.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE; + Invalidate(); + + return true; } - // Create viewport - Widget& viewportWidget = widgets[WIDX_VIEWPORT]; - ViewportCreate( - this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 }, viewportWidget.width() - 1, - viewportWidget.height() - 1, Focus(CoordsXYZ{ signViewPosition, viewZ })); - - viewport->flags = gConfigGeneral.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : 0; - Invalidate(); - - return true; - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - auto* banner = GetBanner(GetBannerIndex()); - if (banner == nullptr) + void OnMouseUp(WidgetIndex widgetIndex) override { - Close(); - return; - } - switch (widgetIndex) - { - case WIDX_CLOSE: + auto* banner = GetBanner(GetBannerIndex()); + if (banner == nullptr) + { Close(); - break; - case WIDX_SIGN_DEMOLISH: + return; + } + switch (widgetIndex) { - auto* tileElement = BannerGetTileElement(GetBannerIndex()); - if (tileElement == nullptr) - { + case WIDX_CLOSE: Close(); - return; - } - auto bannerCoords = banner->position.ToCoordsXY(); - - if (_isSmall) + break; + case WIDX_SIGN_DEMOLISH: { - CoordsXYZD wallLocation = { bannerCoords, tileElement->GetBaseZ(), tileElement->GetDirection() }; - auto wallRemoveAction = WallRemoveAction(wallLocation); - GameActions::Execute(&wallRemoveAction); + auto* tileElement = BannerGetTileElement(GetBannerIndex()); + if (tileElement == nullptr) + { + Close(); + return; + } + auto bannerCoords = banner->position.ToCoordsXY(); + + if (_isSmall) + { + CoordsXYZD wallLocation = { bannerCoords, tileElement->GetBaseZ(), tileElement->GetDirection() }; + auto wallRemoveAction = WallRemoveAction(wallLocation); + GameActions::Execute(&wallRemoveAction); + } + else + { + auto sceneryRemoveAction = LargeSceneryRemoveAction( + { bannerCoords, tileElement->GetBaseZ(), tileElement->GetDirection() }, + tileElement->AsLargeScenery()->GetSequenceIndex()); + GameActions::Execute(&sceneryRemoveAction); + } + break; } - else + case WIDX_SIGN_TEXT: + ShowTextInput(); + break; + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + Widget* widget = &widgets[widgetIndex]; + switch (widgetIndex) + { + case WIDX_MAIN_COLOUR: + WindowDropdownShowColour(this, widget, TRANSLUCENT(colours[1]), static_cast(_mainColour)); + break; + case WIDX_TEXT_COLOUR: + WindowDropdownShowColour(this, widget, TRANSLUCENT(colours[1]), static_cast(_textColour)); + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + { + switch (widgetIndex) + { + case WIDX_MAIN_COLOUR: { - auto sceneryRemoveAction = LargeSceneryRemoveAction( - { bannerCoords, tileElement->GetBaseZ(), tileElement->GetDirection() }, - tileElement->AsLargeScenery()->GetSequenceIndex()); - GameActions::Execute(&sceneryRemoveAction); + if (dropdownIndex == -1) + return; + _mainColour = ColourDropDownIndexToColour(dropdownIndex); + auto signSetStyleAction = SignSetStyleAction(GetBannerIndex(), _mainColour, _textColour, !_isSmall); + GameActions::Execute(&signSetStyleAction); + break; } - break; - } - case WIDX_SIGN_TEXT: - ShowTextInput(); - break; - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - Widget* widget = &widgets[widgetIndex]; - switch (widgetIndex) - { - case WIDX_MAIN_COLOUR: - WindowDropdownShowColour(this, widget, TRANSLUCENT(colours[1]), static_cast(_mainColour)); - break; - case WIDX_TEXT_COLOUR: - WindowDropdownShowColour(this, widget, TRANSLUCENT(colours[1]), static_cast(_textColour)); - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - switch (widgetIndex) - { - case WIDX_MAIN_COLOUR: - { - if (dropdownIndex == -1) + case WIDX_TEXT_COLOUR: + { + if (dropdownIndex == -1) + return; + _textColour = ColourDropDownIndexToColour(dropdownIndex); + auto signSetStyleAction = SignSetStyleAction(GetBannerIndex(), _mainColour, _textColour, !_isSmall); + GameActions::Execute(&signSetStyleAction); + break; + } + default: return; - _mainColour = ColourDropDownIndexToColour(dropdownIndex); - auto signSetStyleAction = SignSetStyleAction(GetBannerIndex(), _mainColour, _textColour, !_isSmall); - GameActions::Execute(&signSetStyleAction); - break; } - case WIDX_TEXT_COLOUR: + + Invalidate(); + } + + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (widgetIndex == WIDX_SIGN_TEXT && !text.empty()) { - if (dropdownIndex == -1) + auto signSetNameAction = SignSetNameAction(GetBannerIndex(), std::string(text)); + GameActions::Execute(&signSetNameAction); + } + } + + void OnPrepareDraw() override + { + Widget* main_colour_btn = &widgets[WIDX_MAIN_COLOUR]; + Widget* text_colour_btn = &widgets[WIDX_TEXT_COLOUR]; + + if (_isSmall) + { + auto* wallEntry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryEntry); + + main_colour_btn->type = WindowWidgetType::Empty; + text_colour_btn->type = WindowWidgetType::Empty; + if (wallEntry == nullptr) + { return; - _textColour = ColourDropDownIndexToColour(dropdownIndex); - auto signSetStyleAction = SignSetStyleAction(GetBannerIndex(), _mainColour, _textColour, !_isSmall); - GameActions::Execute(&signSetStyleAction); - break; + } + if (wallEntry->flags & WALL_SCENERY_HAS_PRIMARY_COLOUR) + { + main_colour_btn->type = WindowWidgetType::ColourBtn; + } + if (wallEntry->flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) + { + text_colour_btn->type = WindowWidgetType::ColourBtn; + } } - default: - return; + else + { + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryEntry); + + main_colour_btn->type = WindowWidgetType::Empty; + text_colour_btn->type = WindowWidgetType::Empty; + if (sceneryEntry == nullptr) + { + return; + } + if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR) + { + main_colour_btn->type = WindowWidgetType::ColourBtn; + } + if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR) + { + text_colour_btn->type = WindowWidgetType::ColourBtn; + } + } + + main_colour_btn->image = GetColourButtonImage(_mainColour); + text_colour_btn->image = GetColourButtonImage(_textColour); } - Invalidate(); - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (widgetIndex == WIDX_SIGN_TEXT && !text.empty()) + void OnDraw(DrawPixelInfo& dpi) override { - auto signSetNameAction = SignSetNameAction(GetBannerIndex(), std::string(text)); - GameActions::Execute(&signSetNameAction); + DrawWidgets(dpi); + + if (viewport != nullptr) + { + WindowDrawViewport(dpi, *this); + } } - } - void OnPrepareDraw() override - { - Widget* main_colour_btn = &widgets[WIDX_MAIN_COLOUR]; - Widget* text_colour_btn = &widgets[WIDX_TEXT_COLOUR]; - - if (_isSmall) + void OnViewportRotate() override { - auto* wallEntry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryEntry); + RemoveViewport(); - main_colour_btn->type = WindowWidgetType::Empty; - text_colour_btn->type = WindowWidgetType::Empty; - if (wallEntry == nullptr) + auto banner = GetBanner(GetBannerIndex()); + if (banner == nullptr) { return; } - if (wallEntry->flags & WALL_SCENERY_HAS_PRIMARY_COLOUR) - { - main_colour_btn->type = WindowWidgetType::ColourBtn; - } - if (wallEntry->flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) - { - text_colour_btn->type = WindowWidgetType::ColourBtn; - } + + auto signViewPos = CoordsXYZ{ banner->position.ToCoordsXY().ToTileCentre(), frame_no }; + + // Create viewport + Widget* viewportWidget = &widgets[WIDX_VIEWPORT]; + ViewportCreate( + this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, + viewportWidget->width() - 1, viewportWidget->height() - 1, Focus(CoordsXYZ{ signViewPos })); + if (viewport != nullptr) + viewport->flags = gConfigGeneral.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE; + Invalidate(); } - else + + void OnResize() override { - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryEntry); - - main_colour_btn->type = WindowWidgetType::Empty; - text_colour_btn->type = WindowWidgetType::Empty; - if (sceneryEntry == nullptr) - { - return; - } - if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR) - { - main_colour_btn->type = WindowWidgetType::ColourBtn; - } - if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR) - { - text_colour_btn->type = WindowWidgetType::ColourBtn; - } + ResizeFrame(); } + }; - main_colour_btn->image = GetColourButtonImage(_mainColour); - text_colour_btn->image = GetColourButtonImage(_textColour); - } - - void OnDraw(DrawPixelInfo& dpi) override + /** + * + * rct2: 0x006BA305 + */ + WindowBase* SignOpen(rct_windownumber number) { - DrawWidgets(dpi); + auto* w = static_cast(WindowBringToFrontByNumber(WindowClass::Banner, number)); - if (viewport != nullptr) - { - WindowDrawViewport(dpi, *this); - } - } + if (w != nullptr) + return w; - void OnViewportRotate() override - { - RemoveViewport(); + w = WindowCreate(WindowClass::Banner, WW, WH, 0); - auto banner = GetBanner(GetBannerIndex()); - if (banner == nullptr) - { - return; - } + if (w == nullptr) + return nullptr; - auto signViewPos = CoordsXYZ{ banner->position.ToCoordsXY().ToTileCentre(), frame_no }; + bool result = w->Initialize(number, false); + if (result != true) + return nullptr; - // Create viewport - Widget* viewportWidget = &widgets[WIDX_VIEWPORT]; - ViewportCreate( - this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, viewportWidget->width() - 1, - viewportWidget->height() - 1, Focus(CoordsXYZ{ signViewPos })); - if (viewport != nullptr) - viewport->flags = gConfigGeneral.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : 0; - Invalidate(); - } - - void OnResize() override - { - ResizeFrame(); - } -}; - -/** - * - * rct2: 0x006BA305 - */ -WindowBase* WindowSignOpen(rct_windownumber number) -{ - auto* w = static_cast(WindowBringToFrontByNumber(WindowClass::Banner, number)); - - if (w != nullptr) return w; + } - w = WindowCreate(WindowClass::Banner, WW, WH, 0); + /** + * + * rct2: 0x6E5F52 + */ + WindowBase* SignSmallOpen(rct_windownumber number) + { + auto* w = static_cast(WindowBringToFrontByNumber(WindowClass::Banner, number)); - if (w == nullptr) - return nullptr; + if (w != nullptr) + return w; - bool result = w->Initialize(number, false); - if (result != true) - return nullptr; + w = WindowCreate(WindowClass::Banner, WW, WH, 0); - return w; -} + if (w == nullptr) + return nullptr; -/** - * - * rct2: 0x6E5F52 - */ -WindowBase* WindowSignSmallOpen(rct_windownumber number) -{ - auto* w = static_cast(WindowBringToFrontByNumber(WindowClass::Banner, number)); + bool result = w->Initialize(number, true); + if (result != true) + return nullptr; - if (w != nullptr) return w; - - w = WindowCreate(WindowClass::Banner, WW, WH, 0); - - if (w == nullptr) - return nullptr; - - bool result = w->Initialize(number, true); - if (result != true) - return nullptr; - - return w; -} + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index b720629f3f..b743ae7090 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -35,51 +35,51 @@ #include #include -using namespace OpenRCT2; - -static constexpr StringId WINDOW_TITLE = STR_STRINGID; - -static constexpr int32_t WW = 190; -static constexpr int32_t WH = 180; - -enum WindowStaffPage +namespace OpenRCT2::Ui::Windows { - WINDOW_STAFF_OVERVIEW, - WINDOW_STAFF_OPTIONS, - WINDOW_STAFF_STATISTICS, - WINDOW_STAFF_PAGE_COUNT, -}; + static constexpr StringId WINDOW_TITLE = STR_STRINGID; -enum WindowStaffWidgetIdx -{ - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_RESIZE, - WIDX_TAB_1, - WIDX_TAB_2, - WIDX_TAB_3, + static constexpr int32_t WW = 190; + static constexpr int32_t WH = 180; - WIDX_VIEWPORT = 7, - WIDX_BTM_LABEL, - WIDX_PICKUP, - WIDX_PATROL, - WIDX_RENAME, - WIDX_LOCATE, - WIDX_FIRE, + enum WindowStaffPage + { + WINDOW_STAFF_OVERVIEW, + WINDOW_STAFF_OPTIONS, + WINDOW_STAFF_STATISTICS, + WINDOW_STAFF_PAGE_COUNT, + }; - WIDX_CHECKBOX_1 = 7, - WIDX_CHECKBOX_2, - WIDX_CHECKBOX_3, - WIDX_CHECKBOX_4, - WIDX_COSTUME_BOX, - WIDX_COSTUME_BTN, -}; + enum WindowStaffWidgetIdx + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_RESIZE, + WIDX_TAB_1, + WIDX_TAB_2, + WIDX_TAB_3, -validate_global_widx(WC_PEEP, WIDX_PATROL); -validate_global_widx(WC_STAFF, WIDX_PICKUP); + WIDX_VIEWPORT = 7, + WIDX_BTM_LABEL, + WIDX_PICKUP, + WIDX_PATROL, + WIDX_RENAME, + WIDX_LOCATE, + WIDX_FIRE, -// clang-format off + WIDX_CHECKBOX_1 = 7, + WIDX_CHECKBOX_2, + WIDX_CHECKBOX_3, + WIDX_CHECKBOX_4, + WIDX_COSTUME_BOX, + WIDX_COSTUME_BTN, + }; + + validate_global_widx(WC_PEEP, WIDX_PATROL); + validate_global_widx(WC_STAFF, WIDX_PICKUP); + + // clang-format off #define MAIN_STAFF_WIDGETS \ WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ MakeWidget({ 0, 43}, {190, 137}, WindowWidgetType::Resize, WindowColour::Secondary), /* Resize */ \ @@ -96,7 +96,7 @@ static Widget _staffOverviewWidgets[] = { MakeWidget ({WW - 25, 93}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_NAME_STAFF_TIP ), // Rename Button MakeWidget ({WW - 25, 117}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP), // Locate Button MakeWidget ({WW - 25, 141}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_FIRE_STAFF_TIP ), // Fire Button - WIDGETS_END, + kWidgetsEnd, }; //0x9AF910 @@ -108,1152 +108,1154 @@ static Widget _staffOptionsWidgets[] = { MakeWidget ({ 5, 101}, {180, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary ), // Checkbox 4 MakeWidget ({ 5, 50}, {180, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Costume Dropdown MakeWidget ({WW - 17, 51}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_COSTUME_TIP), // Costume Dropdown Button - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -// 0x9AF9F4 -static Widget _staffStatsWidgets[] = { - MAIN_STAFF_WIDGETS, - WIDGETS_END, -}; + // 0x9AF9F4 + static Widget _staffStatsWidgets[] = { + MAIN_STAFF_WIDGETS, + kWidgetsEnd, + }; -static Widget* window_staff_page_widgets[] = { - _staffOverviewWidgets, - _staffOptionsWidgets, - _staffStatsWidgets, -}; + static Widget* window_staff_page_widgets[] = { + _staffOverviewWidgets, + _staffOptionsWidgets, + _staffStatsWidgets, + }; -class StaffWindow final : public Window -{ -private: - EntertainerCostume _availableCostumes[static_cast(EntertainerCostume::Count)]{}; - uint16_t _tabAnimationOffset = 0; - int32_t _pickedPeepOldX = LOCATION_NULL; - -public: - void Initialise(EntityId entityId) + class StaffWindow final : public Window { - number = entityId.ToUnderlying(); - } + private: + EntertainerCostume _availableCostumes[EnumValue(EntertainerCostume::Count)]{}; + uint16_t _tabAnimationOffset = 0; + int32_t _pickedPeepOldX = LOCATION_NULL; - void OnOpen() override - { - SetPage(WINDOW_STAFF_OVERVIEW); - } + public: + void Initialise(EntityId entityId) + { + number = entityId.ToUnderlying(); + } - void OnClose() override - { - CancelTools(); - } + void OnOpen() override + { + SetPage(WINDOW_STAFF_OVERVIEW); + } - void OnMouseUp(WidgetIndex widgetIndex) override - { - if (widgetIndex <= WIDX_TAB_3) - CommonMouseUp(widgetIndex); - else + void OnClose() override + { + CancelTools(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + if (widgetIndex <= WIDX_TAB_3) + CommonMouseUp(widgetIndex); + else + { + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewMouseUp(widgetIndex); + break; + case WINDOW_STAFF_OPTIONS: + OptionsMouseUp(widgetIndex); + } + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override { switch (page) { case WINDOW_STAFF_OVERVIEW: - OverviewMouseUp(widgetIndex); + OverviewOnMouseDown(widgetIndex); break; case WINDOW_STAFF_OPTIONS: - OptionsMouseUp(widgetIndex); + OptionsOnMouseDown(widgetIndex); + break; } } - } - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (page) + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { - case WINDOW_STAFF_OVERVIEW: - OverviewOnMouseDown(widgetIndex); - break; - case WINDOW_STAFF_OPTIONS: - OptionsOnMouseDown(widgetIndex); - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - switch (page) - { - case WINDOW_STAFF_OVERVIEW: - OverviewOnDropdown(widgetIndex, dropdownIndex); - break; - case WINDOW_STAFF_OPTIONS: - OptionsOnDropdown(widgetIndex, dropdownIndex); - break; - } - } - - void OnPrepareDraw() override - { - CommonPrepareDrawBefore(); - - switch (page) - { - case WINDOW_STAFF_OVERVIEW: - OverviewPrepareDraw(); - break; - case WINDOW_STAFF_OPTIONS: - OptionsPrepareDraw(); - break; + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewOnDropdown(widgetIndex, dropdownIndex); + break; + case WINDOW_STAFF_OPTIONS: + OptionsOnDropdown(widgetIndex, dropdownIndex); + break; + } } - CommonPrepareDrawAfter(); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - switch (page) + void OnPrepareDraw() override { - case WINDOW_STAFF_OVERVIEW: - OverviewDraw(dpi); - break; - case WINDOW_STAFF_STATISTICS: - StatsDraw(dpi); - break; - } - } + CommonPrepareDrawBefore(); - void OnResize() override - { - switch (page) + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewPrepareDraw(); + break; + case WINDOW_STAFF_OPTIONS: + OptionsPrepareDraw(); + break; + } + + CommonPrepareDrawAfter(); + } + + void OnDraw(DrawPixelInfo& dpi) override { - case WINDOW_STAFF_OVERVIEW: - OverviewResize(); - break; - case WINDOW_STAFF_OPTIONS: - OptionsResize(); - break; - case WINDOW_STAFF_STATISTICS: - StatsResize(); - break; - } - } + DrawWidgets(dpi); + DrawTabImages(dpi); - void OnUpdate() override - { - switch (page) + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewDraw(dpi); + break; + case WINDOW_STAFF_STATISTICS: + StatsDraw(dpi); + break; + } + } + + void OnResize() override { - case WINDOW_STAFF_OVERVIEW: - OverviewUpdate(); - break; - case WINDOW_STAFF_OPTIONS: - OptionsUpdate(); - break; - case WINDOW_STAFF_STATISTICS: - StatsUpdate(); - break; + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewResize(); + break; + case WINDOW_STAFF_OPTIONS: + OptionsResize(); + break; + case WINDOW_STAFF_STATISTICS: + StatsResize(); + break; + } } - } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (page) + void OnUpdate() override { - case WINDOW_STAFF_OVERVIEW: - OverviewToolUpdate(widgetIndex, screenCoords); - break; + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewUpdate(); + break; + case WINDOW_STAFF_OPTIONS: + OptionsUpdate(); + break; + case WINDOW_STAFF_STATISTICS: + StatsUpdate(); + break; + } } - } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (page) + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - case WINDOW_STAFF_OVERVIEW: - OverviewToolDown(widgetIndex, screenCoords); - break; + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewToolUpdate(widgetIndex, screenCoords); + break; + } } - } - void OnToolAbort(WidgetIndex widgetIndex) override - { - switch (page) + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - case WINDOW_STAFF_OVERVIEW: - OverviewToolAbort(widgetIndex); - break; + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewToolDown(widgetIndex, screenCoords); + break; + } } - } - void OnViewportRotate() override - { - switch (page) + void OnToolAbort(WidgetIndex widgetIndex) override { - case WINDOW_STAFF_OVERVIEW: - OverviewViewportRotate(); - break; + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewToolAbort(widgetIndex); + break; + } } - } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - switch (page) + void OnViewportRotate() override { - case WINDOW_STAFF_OVERVIEW: - OverviewTextInput(widgetIndex, text); - break; + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewViewportRotate(); + break; + } } - } -private: + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + switch (page) + { + case WINDOW_STAFF_OVERVIEW: + OverviewTextInput(widgetIndex, text); + break; + } + } + + private: #pragma region Common events - void CommonMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void CommonMouseUp(WidgetIndex widgetIndex) { - case WIDX_CLOSE: - Close(); - break; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - SetPage(widgetIndex - WIDX_TAB_1); - break; - } - } - - void CommonPrepareDrawBefore() - { - ColourSchemeUpdateByClass(this, static_cast(WindowClass::Staff)); - - if (window_staff_page_widgets[page] != widgets) - { - widgets = window_staff_page_widgets[page]; - InitScrollWidgets(); - } - SetPressedTab(); - DisableWidgets(); - - auto staff = GetStaff(); - if (staff == nullptr) - { - return; + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + SetPage(widgetIndex - WIDX_TAB_1); + break; + } } - auto ft = Formatter::Common(); - staff->FormatNameTo(ft); + void CommonPrepareDrawBefore() + { + ColourSchemeUpdateByClass(this, static_cast(WindowClass::Staff)); - ResizeFrameWithPage(); - } + if (window_staff_page_widgets[page] != widgets) + { + widgets = window_staff_page_widgets[page]; + InitScrollWidgets(); + } + SetPressedTab(); + DisableWidgets(); - void CommonPrepareDrawAfter() - { - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_3); - } + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } + + auto ft = Formatter::Common(); + staff->FormatNameTo(ft); + + ResizeFrameWithPage(); + } + + void CommonPrepareDrawAfter() + { + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_3); + } #pragma endregion #pragma region Overview tab events - void OverviewMouseUp(WidgetIndex widgetIndex) - { - auto staff = GetStaff(); - if (staff == nullptr) + void OverviewMouseUp(WidgetIndex widgetIndex) { - return; - } - - switch (widgetIndex) - { - case WIDX_PICKUP: + auto staff = GetStaff(); + if (staff == nullptr) { - _pickedPeepOldX = staff->x; - CoordsXYZ nullLoc{}; - nullLoc.SetNull(); - PeepPickupAction pickupAction{ PeepPickupType::Pickup, EntityId::FromUnderlying(number), nullLoc, - NetworkGetCurrentPlayerId() }; - pickupAction.SetCallback([peepnum = number](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) - return; - WindowBase* wind = WindowFindByNumber(WindowClass::Peep, peepnum); - if (wind != nullptr) - { - ToolSet(*wind, WC_STAFF__WIDX_PICKUP, Tool::Picker); - } - }); - GameActions::Execute(&pickupAction); + return; } - break; - case WIDX_FIRE: + + switch (widgetIndex) { - auto intent = Intent(WindowClass::FirePrompt); - intent.PutExtra(INTENT_EXTRA_PEEP, staff); - ContextOpenIntent(&intent); - break; - } - case WIDX_RENAME: - { - auto peepName = staff->GetName(); - WindowTextInputRawOpen( - this, widgetIndex, STR_STAFF_TITLE_STAFF_MEMBER_NAME, STR_STAFF_PROMPT_ENTER_NAME, {}, peepName.c_str(), - 32); - break; - } - } - } - - void OverviewOnMouseDown(WidgetIndex widgetIndex) - { - Widget* widget = &widgets[widgetIndex]; - - switch (widgetIndex) - { - case WIDX_LOCATE: - ShowLocateDropdown(widget); - break; - case WIDX_PATROL: - { - // Dropdown names - gDropdownItems[0].Format = STR_SET_PATROL_AREA; - gDropdownItems[1].Format = STR_CLEAR_PATROL_AREA; - - auto ddPos = ScreenCoordsXY{ widget->left + windowPos.x, widget->top + windowPos.y }; - int32_t extraHeight = widget->height() + 1; - WindowDropdownShowText(ddPos, extraHeight, colours[1], 0, 2); - gDropdownDefaultIndex = 0; - - auto staff = GetStaff(); - if (staff == nullptr) + case WIDX_PICKUP: { - return; + _pickedPeepOldX = staff->x; + CoordsXYZ nullLoc{}; + nullLoc.SetNull(); + PeepPickupAction pickupAction{ PeepPickupType::Pickup, EntityId::FromUnderlying(number), nullLoc, + NetworkGetCurrentPlayerId() }; + pickupAction.SetCallback([peepnum = number](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) + return; + WindowBase* wind = WindowFindByNumber(WindowClass::Peep, peepnum); + if (wind != nullptr) + { + ToolSet(*wind, WC_STAFF__WIDX_PICKUP, Tool::Picker); + } + }); + GameActions::Execute(&pickupAction); } - - // Disable clear patrol area if no area is set. - if (!staff->HasPatrolArea()) + break; + case WIDX_FIRE: { - Dropdown::SetDisabled(1, true); + auto intent = Intent(WindowClass::FirePrompt); + intent.PutExtra(INTENT_EXTRA_PEEP, staff); + ContextOpenIntent(&intent); + break; + } + case WIDX_RENAME: + { + auto peepName = staff->GetName(); + WindowTextInputRawOpen( + this, widgetIndex, STR_STAFF_TITLE_STAFF_MEMBER_NAME, STR_STAFF_PROMPT_ENTER_NAME, {}, peepName.c_str(), + 32); + break; } } } - } - void OverviewOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - switch (widgetIndex) + void OverviewOnMouseDown(WidgetIndex widgetIndex) { - case WIDX_LOCATE: + Widget* widget = &widgets[widgetIndex]; + + switch (widgetIndex) { - if (dropdownIndex == 0) - { - ScrollToViewport(); - } - else if (dropdownIndex == 1) - { - FollowPeep(); - } - break; - } - case WIDX_PATROL: - { - // Clear patrol - if (dropdownIndex == 1) + case WIDX_LOCATE: + ShowLocateDropdown(widget); + break; + case WIDX_PATROL: { + // Dropdown names + gDropdownItems[0].Format = STR_SET_PATROL_AREA; + gDropdownItems[1].Format = STR_CLEAR_PATROL_AREA; + + auto ddPos = ScreenCoordsXY{ widget->left + windowPos.x, widget->top + windowPos.y }; + int32_t extraHeight = widget->height() + 1; + WindowDropdownShowText(ddPos, extraHeight, colours[1], 0, 2); + gDropdownDefaultIndex = 0; + auto staff = GetStaff(); if (staff == nullptr) { return; } - WindowCloseByClass(WindowClass::PatrolArea); - - auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(staff->Id, {}, StaffSetPatrolAreaMode::ClearAll); - GameActions::Execute(&staffSetPatrolAreaAction); - } - else - { - auto staffId = EntityId::FromUnderlying(number); - if (WindowPatrolAreaGetCurrentStaffId() == staffId) + // Disable clear patrol area if no area is set. + if (!staff->HasPatrolArea()) { + Dropdown::SetDisabled(1, true); + } + } + } + } + + void OverviewOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) + { + switch (widgetIndex) + { + case WIDX_LOCATE: + { + if (dropdownIndex == 0) + { + ScrollToViewport(); + } + else if (dropdownIndex == 1) + { + FollowPeep(); + } + break; + } + case WIDX_PATROL: + { + // Clear patrol + if (dropdownIndex == 1) + { + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } + WindowCloseByClass(WindowClass::PatrolArea); + + auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction( + staff->Id, {}, StaffSetPatrolAreaMode::ClearAll); + GameActions::Execute(&staffSetPatrolAreaAction); } else { - WindowPatrolAreaOpen(staffId); + auto staffId = EntityId::FromUnderlying(number); + if (WindowPatrolAreaGetCurrentStaffId() == staffId) + { + WindowCloseByClass(WindowClass::PatrolArea); + } + else + { + PatrolAreaOpen(staffId); + } } + break; } - break; } } - } - void OverviewPrepareDraw() - { - auto staff = GetStaff(); - if (staff == nullptr) + void OverviewPrepareDraw() { - return; - } - - widgets[WIDX_VIEWPORT].right = width - 26; - widgets[WIDX_VIEWPORT].bottom = height - 14; - - widgets[WIDX_BTM_LABEL].right = width - 26; - widgets[WIDX_BTM_LABEL].top = height - 13; - widgets[WIDX_BTM_LABEL].bottom = height - 3; - - widgets[WIDX_PICKUP].left = width - 25; - widgets[WIDX_PICKUP].right = width - 2; - - SetWidgetPressed(WIDX_PATROL, WindowPatrolAreaGetCurrentStaffId() == staff->Id); - - widgets[WIDX_PATROL].left = width - 25; - widgets[WIDX_PATROL].right = width - 2; - - widgets[WIDX_RENAME].left = width - 25; - widgets[WIDX_RENAME].right = width - 2; - - widgets[WIDX_LOCATE].left = width - 25; - widgets[WIDX_LOCATE].right = width - 2; - - widgets[WIDX_FIRE].left = width - 25; - widgets[WIDX_FIRE].right = width - 2; - } - - void OverviewDraw(DrawPixelInfo& dpi) - { - // Draw the viewport no sound sprite - if (viewport != nullptr) - { - WindowDrawViewport(dpi, *this); - - if (viewport->flags & VIEWPORT_FLAG_SOUND_ON) + auto staff = GetStaff(); + if (staff == nullptr) { - GfxDrawSprite(dpi, ImageId(SPR_HEARING_VIEWPORT), WindowGetViewportSoundIconPos(*this)); - } - } - - // Draw the centred label - auto staff = GetStaff(); - if (staff == nullptr) - { - return; - } - auto ft = Formatter(); - staff->FormatActionTo(ft); - const auto& widget = widgets[WIDX_BTM_LABEL]; - auto screenPos = windowPos + ScreenCoordsXY{ widget.midX(), widget.top }; - int32_t widgetWidth = widget.width(); - DrawTextEllipsised(dpi, screenPos, widgetWidth, STR_BLACK_STRING, ft, { TextAlignment::CENTRE }); - } - - void DrawOverviewTabImage(DrawPixelInfo& dpi) - { - if (IsWidgetDisabled(WIDX_TAB_1)) - return; - - const auto& widget = widgets[WIDX_TAB_1]; - int32_t widgetWidth = widget.width() - 1; - int32_t widgetHeight = widget.height() - 1; - auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; - if (page == WINDOW_STAFF_OVERVIEW) - widgetHeight++; - - DrawPixelInfo clip_dpi; - if (!ClipDrawPixelInfo(clip_dpi, dpi, screenCoords, widgetWidth, widgetHeight)) - { - return; - } - - screenCoords = ScreenCoordsXY{ 14, 20 }; - - auto staff = GetStaff(); - if (staff == nullptr) - { - return; - } - - if (staff->Is() && staff->AssignedStaffType == StaffType::Entertainer) - screenCoords.y++; - - int32_t imageIndex = GetPeepAnimation(staff->SpriteType).base_image + 1; - - int32_t offset = 0; - - if (page == WINDOW_STAFF_OVERVIEW) - { - offset = _tabAnimationOffset; - offset = Floor2(offset, 4); - } - imageIndex += offset; - - GfxDrawSprite(clip_dpi, ImageId(imageIndex, staff->TshirtColour, staff->TrousersColour), screenCoords); - } - - void OverviewResize() - { - min_width = WW; - max_width = 500; - min_height = WH; - max_height = 450; - - if (width < min_width) - { - width = min_width; - Invalidate(); - } - if (width > max_width) - { - Invalidate(); - width = max_width; - } - if (height < min_height) - { - height = min_height; - Invalidate(); - } - if (height > max_height) - { - Invalidate(); - height = max_height; - } - - if (viewport != nullptr) - { - int32_t newWidth = width - 30; - int32_t newHeight = height - 62; - - // Update the viewport size - if (viewport->width != newWidth || viewport->height != newHeight) - { - viewport->width = newWidth; - viewport->height = newHeight; - viewport->view_width = viewport->zoom.ApplyTo(newWidth); - viewport->view_height = viewport->zoom.ApplyTo(newHeight); - } - } - - ViewportInit(); - } - - void OverviewUpdate() - { - _tabAnimationOffset++; - _tabAnimationOffset %= 24; - - // Update pickup animation, can only happen in this tab. - picked_peep_frame++; - picked_peep_frame %= 48; - - InvalidateWidget(WIDX_TAB_1); - } - - void OverviewToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) - { - if (widgetIndex != WIDX_PICKUP) - return; - - MapInvalidateSelectionRect(); - - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - - auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr); - if (!mapCoords.IsNull()) - { - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectType = MAP_SELECT_TYPE_FULL; - gMapSelectPositionA = mapCoords; - gMapSelectPositionB = mapCoords; - MapInvalidateSelectionRect(); - } - - gPickupPeepImage = ImageId(); - - auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll); - if (info.SpriteType == ViewportInteractionItem::None) - return; - - gPickupPeepX = screenCoords.x - 1; - gPickupPeepY = screenCoords.y + 16; - - auto staff = GetStaff(); - if (staff == nullptr) - { - return; - } - - auto baseImageId = GetPeepAnimation(staff->SpriteType, PeepActionSpriteType::Ui).base_image; - baseImageId += picked_peep_frame >> 2; - gPickupPeepImage = ImageId(baseImageId, staff->TshirtColour, staff->TrousersColour); - } - - void OverviewToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) - { - if (widgetIndex != WIDX_PICKUP) - return; - - const auto staffEntityId = EntityId::FromUnderlying(number); - TileElement* tileElement; - auto destCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, &tileElement); - - if (destCoords.IsNull()) - return; - - PeepPickupAction pickupAction{ - PeepPickupType::Place, staffEntityId, { destCoords, tileElement->GetBaseZ() }, NetworkGetCurrentPlayerId() - }; - pickupAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) return; - ToolCancel(); + } + + widgets[WIDX_VIEWPORT].right = width - 26; + widgets[WIDX_VIEWPORT].bottom = height - 14; + + widgets[WIDX_BTM_LABEL].right = width - 26; + widgets[WIDX_BTM_LABEL].top = height - 13; + widgets[WIDX_BTM_LABEL].bottom = height - 3; + + widgets[WIDX_PICKUP].left = width - 25; + widgets[WIDX_PICKUP].right = width - 2; + + SetWidgetPressed(WIDX_PATROL, WindowPatrolAreaGetCurrentStaffId() == staff->Id); + + widgets[WIDX_PATROL].left = width - 25; + widgets[WIDX_PATROL].right = width - 2; + + widgets[WIDX_RENAME].left = width - 25; + widgets[WIDX_RENAME].right = width - 2; + + widgets[WIDX_LOCATE].left = width - 25; + widgets[WIDX_LOCATE].right = width - 2; + + widgets[WIDX_FIRE].left = width - 25; + widgets[WIDX_FIRE].right = width - 2; + } + + void OverviewDraw(DrawPixelInfo& dpi) + { + // Draw the viewport no sound sprite + if (viewport != nullptr) + { + WindowDrawViewport(dpi, *this); + + if (viewport->flags & VIEWPORT_FLAG_SOUND_ON) + { + GfxDrawSprite(dpi, ImageId(SPR_HEARING_VIEWPORT), WindowGetViewportSoundIconPos(*this)); + } + } + + // Draw the centred label + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } + auto ft = Formatter(); + staff->FormatActionTo(ft); + const auto& widget = widgets[WIDX_BTM_LABEL]; + auto screenPos = windowPos + ScreenCoordsXY{ widget.midX(), widget.top }; + int32_t widgetWidth = widget.width(); + DrawTextEllipsised(dpi, screenPos, widgetWidth, STR_BLACK_STRING, ft, { TextAlignment::CENTRE }); + } + + void DrawOverviewTabImage(DrawPixelInfo& dpi) + { + if (IsWidgetDisabled(WIDX_TAB_1)) + return; + + const auto& widget = widgets[WIDX_TAB_1]; + int32_t widgetWidth = widget.width() - 1; + int32_t widgetHeight = widget.height() - 1; + auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; + if (page == WINDOW_STAFF_OVERVIEW) + widgetHeight++; + + DrawPixelInfo clip_dpi; + if (!ClipDrawPixelInfo(clip_dpi, dpi, screenCoords, widgetWidth, widgetHeight)) + { + return; + } + + screenCoords = ScreenCoordsXY{ 14, 20 }; + + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } + + if (staff->Is() && staff->AssignedStaffType == StaffType::Entertainer) + screenCoords.y++; + + int32_t imageIndex = GetPeepAnimation(staff->SpriteType).base_image + 1; + + int32_t offset = 0; + + if (page == WINDOW_STAFF_OVERVIEW) + { + offset = _tabAnimationOffset; + offset = Floor2(offset, 4); + } + imageIndex += offset; + + GfxDrawSprite(clip_dpi, ImageId(imageIndex, staff->TshirtColour, staff->TrousersColour), screenCoords); + } + + void OverviewResize() + { + min_width = WW; + max_width = 500; + min_height = WH; + max_height = 450; + + if (width < min_width) + { + width = min_width; + Invalidate(); + } + if (width > max_width) + { + Invalidate(); + width = max_width; + } + if (height < min_height) + { + height = min_height; + Invalidate(); + } + if (height > max_height) + { + Invalidate(); + height = max_height; + } + + if (viewport != nullptr) + { + int32_t newWidth = width - 30; + int32_t newHeight = height - 62; + + // Update the viewport size + if (viewport->width != newWidth || viewport->height != newHeight) + { + viewport->width = newWidth; + viewport->height = newHeight; + viewport->view_width = viewport->zoom.ApplyTo(newWidth); + viewport->view_height = viewport->zoom.ApplyTo(newHeight); + } + } + + ViewportInit(); + } + + void OverviewUpdate() + { + _tabAnimationOffset++; + _tabAnimationOffset %= 24; + + // Update pickup animation, can only happen in this tab. + picked_peep_frame++; + picked_peep_frame %= 48; + + InvalidateWidget(WIDX_TAB_1); + } + + void OverviewToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + { + if (widgetIndex != WIDX_PICKUP) + return; + + MapInvalidateSelectionRect(); + + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + + auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr); + if (!mapCoords.IsNull()) + { + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectType = MAP_SELECT_TYPE_FULL; + gMapSelectPositionA = mapCoords; + gMapSelectPositionB = mapCoords; + MapInvalidateSelectionRect(); + } + gPickupPeepImage = ImageId(); - }); - GameActions::Execute(&pickupAction); - } - void OverviewToolAbort(WidgetIndex widgetIndex) - { - if (widgetIndex != WIDX_PICKUP) - return; + auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll); + if (info.SpriteType == ViewportInteractionItem::None) + return; - PeepPickupAction pickupAction{ - PeepPickupType::Cancel, EntityId::FromUnderlying(number), { _pickedPeepOldX, 0, 0 }, NetworkGetCurrentPlayerId() - }; - GameActions::Execute(&pickupAction); - } + gPickupPeepX = screenCoords.x - 1; + gPickupPeepY = screenCoords.y + 16; - void OverviewViewportRotate() - { - ViewportInit(); - } + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } - void OverviewTextInput(WidgetIndex widgetIndex, std::string_view text) - { - if (widgetIndex != WIDX_RENAME) - return; + auto baseImageId = GetPeepAnimation(staff->SpriteType, PeepActionSpriteType::Ui).base_image; + baseImageId += picked_peep_frame >> 2; + gPickupPeepImage = ImageId(baseImageId, staff->TshirtColour, staff->TrousersColour); + } - if (text.empty()) - return; + void OverviewToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + { + if (widgetIndex != WIDX_PICKUP) + return; - auto gameAction = StaffSetNameAction(EntityId::FromUnderlying(number), std::string{ text }); - GameActions::Execute(&gameAction); - } + const auto staffEntityId = EntityId::FromUnderlying(number); + TileElement* tileElement; + auto destCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, &tileElement); + + if (destCoords.IsNull()) + return; + + PeepPickupAction pickupAction{ + PeepPickupType::Place, staffEntityId, { destCoords, tileElement->GetBaseZ() }, NetworkGetCurrentPlayerId() + }; + pickupAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) + return; + ToolCancel(); + gPickupPeepImage = ImageId(); + }); + GameActions::Execute(&pickupAction); + } + + void OverviewToolAbort(WidgetIndex widgetIndex) + { + if (widgetIndex != WIDX_PICKUP) + return; + + PeepPickupAction pickupAction{ + PeepPickupType::Cancel, EntityId::FromUnderlying(number), { _pickedPeepOldX, 0, 0 }, NetworkGetCurrentPlayerId() + }; + GameActions::Execute(&pickupAction); + } + + void OverviewViewportRotate() + { + ViewportInit(); + } + + void OverviewTextInput(WidgetIndex widgetIndex, std::string_view text) + { + if (widgetIndex != WIDX_RENAME) + return; + + if (text.empty()) + return; + + auto gameAction = StaffSetNameAction(EntityId::FromUnderlying(number), std::string{ text }); + GameActions::Execute(&gameAction); + } #pragma endregion #pragma region Options tab events - void OptionsMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) + void OptionsMouseUp(WidgetIndex widgetIndex) { - case WIDX_CHECKBOX_1: - case WIDX_CHECKBOX_2: - case WIDX_CHECKBOX_3: - case WIDX_CHECKBOX_4: - SetOrder(widgetIndex - WIDX_CHECKBOX_1); - break; - } - } - - void OptionsOnMouseDown(WidgetIndex widgetIndex) - { - if (widgetIndex != WIDX_COSTUME_BTN) - { - return; - } - - auto* ddWidget = &widgets[WIDX_COSTUME_BOX]; - - auto staff = GetStaff(); - if (staff == nullptr) - { - return; - } - - int32_t checkedIndex = -1; - // This will be moved below where Items Checked is when all - // of dropdown related functions are finished. This prevents - // the dropdown from not working on first click. - int32_t numCostumes = StaffGetAvailableEntertainerCostumeList(_availableCostumes); - for (int32_t i = 0; i < numCostumes; i++) - { - EntertainerCostume costume = _availableCostumes[i]; - if (staff->SpriteType == EntertainerCostumeToSprite(costume)) + switch (widgetIndex) { - checkedIndex = i; + case WIDX_CHECKBOX_1: + case WIDX_CHECKBOX_2: + case WIDX_CHECKBOX_3: + case WIDX_CHECKBOX_4: + SetOrder(widgetIndex - WIDX_CHECKBOX_1); + break; } - gDropdownItems[i].Args = StaffCostumeNames[static_cast(costume)]; - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; } - auto ddPos = ScreenCoordsXY{ ddWidget->left + windowPos.x, ddWidget->top + windowPos.y }; - int32_t ddHeight = ddWidget->height() + 1; - int32_t ddWidth = ddWidget->width() - 3; - WindowDropdownShowTextCustomWidth(ddPos, ddHeight, colours[1], 0, Dropdown::Flag::StayOpen, numCostumes, ddWidth); - - // See above note. - if (checkedIndex != -1) + void OptionsOnMouseDown(WidgetIndex widgetIndex) { - Dropdown::SetChecked(checkedIndex, true); - } - } + if (widgetIndex != WIDX_COSTUME_BTN) + { + return; + } - void OptionsOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) - { - if (widgetIndex != WIDX_COSTUME_BTN) + auto* ddWidget = &widgets[WIDX_COSTUME_BOX]; + + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } + + int32_t checkedIndex = -1; + // This will be moved below where Items Checked is when all + // of dropdown related functions are finished. This prevents + // the dropdown from not working on first click. + int32_t numCostumes = StaffGetAvailableEntertainerCostumeList(_availableCostumes); + for (int32_t i = 0; i < numCostumes; i++) + { + EntertainerCostume costume = _availableCostumes[i]; + if (staff->SpriteType == EntertainerCostumeToSprite(costume)) + { + checkedIndex = i; + } + gDropdownItems[i].Args = StaffCostumeNames[EnumValue(costume)]; + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + } + + auto ddPos = ScreenCoordsXY{ ddWidget->left + windowPos.x, ddWidget->top + windowPos.y }; + int32_t ddHeight = ddWidget->height() + 1; + int32_t ddWidth = ddWidget->width() - 3; + WindowDropdownShowTextCustomWidth(ddPos, ddHeight, colours[1], 0, Dropdown::Flag::StayOpen, numCostumes, ddWidth); + + // See above note. + if (checkedIndex != -1) + { + Dropdown::SetChecked(checkedIndex, true); + } + } + + void OptionsOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) { - return; + if (widgetIndex != WIDX_COSTUME_BTN) + { + return; + } + + if (dropdownIndex == -1) + return; + + EntertainerCostume costume = _availableCostumes[dropdownIndex]; + auto staffSetCostumeAction = StaffSetCostumeAction(EntityId::FromUnderlying(number), costume); + GameActions::Execute(&staffSetCostumeAction); } - if (dropdownIndex == -1) - return; - - EntertainerCostume costume = _availableCostumes[dropdownIndex]; - auto staffSetCostumeAction = StaffSetCostumeAction(EntityId::FromUnderlying(number), costume); - GameActions::Execute(&staffSetCostumeAction); - } - - void OptionsPrepareDraw() - { - auto staff = GetStaff(); - if (staff == nullptr) + void OptionsPrepareDraw() { - return; + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } + + switch (staff->AssignedStaffType) + { + case StaffType::Entertainer: + widgets[WIDX_CHECKBOX_1].type = WindowWidgetType::Empty; + widgets[WIDX_CHECKBOX_2].type = WindowWidgetType::Empty; + widgets[WIDX_CHECKBOX_3].type = WindowWidgetType::Empty; + widgets[WIDX_CHECKBOX_4].type = WindowWidgetType::Empty; + widgets[WIDX_COSTUME_BOX].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Button; + widgets[WIDX_COSTUME_BOX].text = StaffCostumeNames[EnumValue(staff->SpriteType) - 4]; + break; + case StaffType::Handyman: + widgets[WIDX_CHECKBOX_1].type = WindowWidgetType::Checkbox; + widgets[WIDX_CHECKBOX_1].text = STR_STAFF_OPTION_SWEEP_FOOTPATHS; + widgets[WIDX_CHECKBOX_2].type = WindowWidgetType::Checkbox; + widgets[WIDX_CHECKBOX_2].text = STR_STAFF_OPTION_WATER_GARDENS; + widgets[WIDX_CHECKBOX_3].type = WindowWidgetType::Checkbox; + widgets[WIDX_CHECKBOX_3].text = STR_STAFF_OPTION_EMPTY_LITTER; + widgets[WIDX_CHECKBOX_4].type = WindowWidgetType::Checkbox; + widgets[WIDX_CHECKBOX_4].text = STR_STAFF_OPTION_MOW_GRASS; + widgets[WIDX_COSTUME_BOX].type = WindowWidgetType::Empty; + widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Empty; + OptionsSetCheckboxValues(); + break; + case StaffType::Mechanic: + widgets[WIDX_CHECKBOX_1].type = WindowWidgetType::Checkbox; + widgets[WIDX_CHECKBOX_1].text = STR_INSPECT_RIDES; + widgets[WIDX_CHECKBOX_2].type = WindowWidgetType::Checkbox; + widgets[WIDX_CHECKBOX_2].text = STR_FIX_RIDES; + widgets[WIDX_CHECKBOX_3].type = WindowWidgetType::Empty; + widgets[WIDX_CHECKBOX_4].type = WindowWidgetType::Empty; + widgets[WIDX_COSTUME_BOX].type = WindowWidgetType::Empty; + widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Empty; + widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Empty; + OptionsSetCheckboxValues(); + break; + case StaffType::Security: + // Security guards don't have an options screen. + break; + case StaffType::Count: + break; + } } - switch (staff->AssignedStaffType) + void OptionsSetCheckboxValues() { - case StaffType::Entertainer: - widgets[WIDX_CHECKBOX_1].type = WindowWidgetType::Empty; - widgets[WIDX_CHECKBOX_2].type = WindowWidgetType::Empty; - widgets[WIDX_CHECKBOX_3].type = WindowWidgetType::Empty; - widgets[WIDX_CHECKBOX_4].type = WindowWidgetType::Empty; - widgets[WIDX_COSTUME_BOX].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Button; - widgets[WIDX_COSTUME_BOX].text = StaffCostumeNames[EnumValue(staff->SpriteType) - 4]; - break; - case StaffType::Handyman: - widgets[WIDX_CHECKBOX_1].type = WindowWidgetType::Checkbox; - widgets[WIDX_CHECKBOX_1].text = STR_STAFF_OPTION_SWEEP_FOOTPATHS; - widgets[WIDX_CHECKBOX_2].type = WindowWidgetType::Checkbox; - widgets[WIDX_CHECKBOX_2].text = STR_STAFF_OPTION_WATER_GARDENS; - widgets[WIDX_CHECKBOX_3].type = WindowWidgetType::Checkbox; - widgets[WIDX_CHECKBOX_3].text = STR_STAFF_OPTION_EMPTY_LITTER; - widgets[WIDX_CHECKBOX_4].type = WindowWidgetType::Checkbox; - widgets[WIDX_CHECKBOX_4].text = STR_STAFF_OPTION_MOW_GRASS; - widgets[WIDX_COSTUME_BOX].type = WindowWidgetType::Empty; - widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Empty; - OptionsSetCheckboxValues(); - break; - case StaffType::Mechanic: - widgets[WIDX_CHECKBOX_1].type = WindowWidgetType::Checkbox; - widgets[WIDX_CHECKBOX_1].text = STR_INSPECT_RIDES; - widgets[WIDX_CHECKBOX_2].type = WindowWidgetType::Checkbox; - widgets[WIDX_CHECKBOX_2].text = STR_FIX_RIDES; - widgets[WIDX_CHECKBOX_3].type = WindowWidgetType::Empty; - widgets[WIDX_CHECKBOX_4].type = WindowWidgetType::Empty; - widgets[WIDX_COSTUME_BOX].type = WindowWidgetType::Empty; - widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Empty; - widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Empty; - OptionsSetCheckboxValues(); - break; - case StaffType::Security: - // Security guards don't have an options screen. - break; - case StaffType::Count: - break; + SetCheckboxValue(WIDX_CHECKBOX_1, false); + SetCheckboxValue(WIDX_CHECKBOX_2, false); + SetCheckboxValue(WIDX_CHECKBOX_3, false); + SetCheckboxValue(WIDX_CHECKBOX_4, false); + + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } + + auto staffOrders = staff->StaffOrders; + + for (auto index = UtilBitScanForward(staffOrders); index != -1; index = UtilBitScanForward(staffOrders)) + { + staffOrders &= ~(1 << index); + SetCheckboxValue(WIDX_CHECKBOX_1 + index, true); + } } - } - void OptionsSetCheckboxValues() - { - SetCheckboxValue(WIDX_CHECKBOX_1, false); - SetCheckboxValue(WIDX_CHECKBOX_2, false); - SetCheckboxValue(WIDX_CHECKBOX_3, false); - SetCheckboxValue(WIDX_CHECKBOX_4, false); - - auto staff = GetStaff(); - if (staff == nullptr) + void OptionsResize() { - return; + min_width = 190; + max_width = 190; + min_height = 126; + max_height = 126; + + if (width < min_width) + { + width = min_width; + Invalidate(); + } + if (width > max_width) + { + Invalidate(); + width = max_width; + } + if (height < min_height) + { + height = min_height; + Invalidate(); + } + if (height > max_height) + { + Invalidate(); + height = max_height; + } } - auto staffOrders = staff->StaffOrders; - - for (auto index = UtilBitScanForward(staffOrders); index != -1; index = UtilBitScanForward(staffOrders)) + void OptionsUpdate() { - staffOrders &= ~(1 << index); - SetCheckboxValue(WIDX_CHECKBOX_1 + index, true); + frame_no++; + InvalidateWidget(WIDX_TAB_2); } - } - - void OptionsResize() - { - min_width = 190; - max_width = 190; - min_height = 126; - max_height = 126; - - if (width < min_width) - { - width = min_width; - Invalidate(); - } - if (width > max_width) - { - Invalidate(); - width = max_width; - } - if (height < min_height) - { - height = min_height; - Invalidate(); - } - if (height > max_height) - { - Invalidate(); - height = max_height; - } - } - - void OptionsUpdate() - { - frame_no++; - InvalidateWidget(WIDX_TAB_2); - } #pragma endregion #pragma region Statistics tab events - void StatsDraw(DrawPixelInfo& dpi) - { - auto staff = GetStaff(); - if (staff == nullptr) + void StatsDraw(DrawPixelInfo& dpi) { - return; - } - - auto screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_RESIZE].left + 4, widgets[WIDX_RESIZE].top + 4 }; - - if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) - { - auto ft = Formatter(); - ft.Add(GetStaffWage(staff->AssignedStaffType)); - DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_WAGES, ft); - screenCoords.y += LIST_ROW_HEIGHT; - } - - auto ft = Formatter(); - ft.Add(staff->GetHireDate()); - DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_EMPLOYED_FOR, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - switch (staff->AssignedStaffType) - { - case StaffType::Handyman: - ft = Formatter(); - ft.Add(staff->StaffLawnsMown); - DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_LAWNS_MOWN, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - ft = Formatter(); - ft.Add(staff->StaffGardensWatered); - DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_GARDENS_WATERED, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - ft = Formatter(); - ft.Add(staff->StaffLitterSwept); - DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_LITTER_SWEPT, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - ft = Formatter(); - ft.Add(staff->StaffBinsEmptied); - DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_BINS_EMPTIED, ft); - break; - case StaffType::Mechanic: - ft = Formatter(); - ft.Add(staff->StaffRidesInspected); - DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_RIDES_INSPECTED, ft); - screenCoords.y += LIST_ROW_HEIGHT; - - ft = Formatter(); - ft.Add(staff->StaffRidesFixed); - DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_RIDES_FIXED, ft); - break; - case StaffType::Security: - ft = Formatter(); - ft.Add(staff->StaffVandalsStopped); - DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_VANDALS_STOPPED, ft); - break; - case StaffType::Entertainer: - case StaffType::Count: - break; - } - } - - void StatsResize() - { - min_width = 190; - max_width = 190; - min_height = 126; - max_height = 126; - - if (width < min_width) - { - width = min_width; - Invalidate(); - } - if (width > max_width) - { - Invalidate(); - width = max_width; - } - if (height < min_height) - { - height = min_height; - Invalidate(); - } - if (height > max_height) - { - Invalidate(); - height = max_height; - } - } - - void StatsUpdate() - { - frame_no++; - InvalidateWidget(WIDX_TAB_3); - - auto staff = GetStaff(); - if (staff == nullptr) - { - return; - } - - if (staff->WindowInvalidateFlags & PEEP_INVALIDATE_STAFF_STATS) - { - staff->WindowInvalidateFlags &= ~PEEP_INVALIDATE_STAFF_STATS; - Invalidate(); - } - } -#pragma endregion - void DisableWidgets() - { - const auto staff = GetStaff(); - if (staff == nullptr) - { - return; - } - - for (WidgetIndex widgetIndex = WIDX_TAB_1; widgets[widgetIndex].type != WIDGETS_END.type; widgetIndex++) - { - SetWidgetDisabled(widgetIndex, false); - } - - if (staff->AssignedStaffType == StaffType::Security) - { - SetWidgetDisabled(WIDX_TAB_2, true); - } - - if (page == WINDOW_STAFF_OVERVIEW) - { - if (staff->CanBePickedUp()) + auto staff = GetStaff(); + if (staff == nullptr) { - SetWidgetDisabled(WIDX_PICKUP, false); - } - else - { - SetWidgetDisabled(WIDX_PICKUP, true); - } - - SetWidgetDisabled(WIDX_FIRE, staff->State == PeepState::Fixing || staff->State == PeepState::Inspecting); - } - } - - void CancelTools() - { - if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) - { - if (number == gCurrentToolWidget.window_number && classification == gCurrentToolWidget.window_classification) - ToolCancel(); - } - } - - void SetPage(int32_t pageNum) - { - CancelTools(); - - int32_t listen = 0; - if (page == WINDOW_STAFF_OVERVIEW && viewport != nullptr) - { - if (!(viewport->flags & VIEWPORT_FLAG_SOUND_ON)) - listen = 1; - } - - page = pageNum; - frame_no = 0; - pressed_widgets = 0; - hold_down_widgets = 0; - widgets = window_staff_page_widgets[page]; - - RemoveViewport(); - - Invalidate(); - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); - InitScrollWidgets(); - ViewportInit(); - Invalidate(); - - if (listen && viewport != nullptr) - viewport->flags |= VIEWPORT_FLAG_SOUND_ON; - } - - void SetPressedTab() - { - for (int32_t i = 0; i < WINDOW_STAFF_PAGE_COUNT; i++) - SetWidgetPressed((WIDX_TAB_1 + i), false); - SetWidgetPressed(WIDX_TAB_1 + page, true); - } - - void SetOrder(int32_t orderId) - { - auto staff = GetStaff(); - if (staff == nullptr) - { - return; - } - - uint8_t newOrders = staff->StaffOrders ^ (1 << orderId); - auto staffSetOrdersAction = StaffSetOrdersAction(EntityId::FromUnderlying(number), newOrders); - GameActions::Execute(&staffSetOrdersAction); - } - - void ViewportInit() - { - if (page != WINDOW_STAFF_OVERVIEW) - return; - - auto staff = GetStaff(); - if (staff == nullptr) - { - return; - } - - std::optional tempFocus; - if (staff->State != PeepState::Picked) - { - tempFocus = Focus(staff->Id); - } - - uint16_t viewport_flags; - - if (viewport != nullptr) - { - if (tempFocus == focus) return; + } - viewport_flags = viewport->flags; - RemoveViewport(); - } - else - { - viewport_flags = 0; - if (gConfigGeneral.AlwaysShowGridlines) - viewport_flags |= VIEWPORT_FLAG_GRIDLINES; - } + auto screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_RESIZE].left + 4, widgets[WIDX_RESIZE].top + 4 }; - WindowEventOnPrepareDrawCall(this); - - focus = tempFocus; - - if (staff->State != PeepState::Picked) - { - if (viewport == nullptr) + if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) { - const auto& viewWidget = widgets[WIDX_VIEWPORT]; + auto ft = Formatter(); + ft.Add(GetStaffWage(staff->AssignedStaffType)); + DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_WAGES, ft); + screenCoords.y += LIST_ROW_HEIGHT; + } - auto screenPos = ScreenCoordsXY{ viewWidget.left + 1 + windowPos.x, viewWidget.top + 1 + windowPos.y }; - int32_t viewportWidth = viewWidget.width() - 1; - int32_t viewportHeight = viewWidget.height() - 1; + auto ft = Formatter(); + ft.Add(staff->GetHireDate()); + DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_EMPLOYED_FOR, ft); + screenCoords.y += LIST_ROW_HEIGHT; - ViewportCreate(this, screenPos, viewportWidth, viewportHeight, focus.value()); - flags |= WF_NO_SCROLLING; + switch (staff->AssignedStaffType) + { + case StaffType::Handyman: + ft = Formatter(); + ft.Add(staff->StaffLawnsMown); + DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_LAWNS_MOWN, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + ft = Formatter(); + ft.Add(staff->StaffGardensWatered); + DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_GARDENS_WATERED, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + ft = Formatter(); + ft.Add(staff->StaffLitterSwept); + DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_LITTER_SWEPT, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + ft = Formatter(); + ft.Add(staff->StaffBinsEmptied); + DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_BINS_EMPTIED, ft); + break; + case StaffType::Mechanic: + ft = Formatter(); + ft.Add(staff->StaffRidesInspected); + DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_RIDES_INSPECTED, ft); + screenCoords.y += LIST_ROW_HEIGHT; + + ft = Formatter(); + ft.Add(staff->StaffRidesFixed); + DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_RIDES_FIXED, ft); + break; + case StaffType::Security: + ft = Formatter(); + ft.Add(staff->StaffVandalsStopped); + DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_VANDALS_STOPPED, ft); + break; + case StaffType::Entertainer: + case StaffType::Count: + break; + } + } + + void StatsResize() + { + min_width = 190; + max_width = 190; + min_height = 126; + max_height = 126; + + if (width < min_width) + { + width = min_width; + Invalidate(); + } + if (width > max_width) + { + Invalidate(); + width = max_width; + } + if (height < min_height) + { + height = min_height; + Invalidate(); + } + if (height > max_height) + { + Invalidate(); + height = max_height; + } + } + + void StatsUpdate() + { + frame_no++; + InvalidateWidget(WIDX_TAB_3); + + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } + + if (staff->WindowInvalidateFlags & PEEP_INVALIDATE_STAFF_STATS) + { + staff->WindowInvalidateFlags &= ~PEEP_INVALIDATE_STAFF_STATS; Invalidate(); } } - - if (viewport != nullptr) - viewport->flags = viewport_flags; - Invalidate(); - } - - void ShowLocateDropdown(Widget* widget) - { - gDropdownItems[0].Format = STR_LOCATE_SUBJECT_TIP; - gDropdownItems[1].Format = STR_FOLLOW_SUBJECT_TIP; - - WindowDropdownShowText( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 2); - gDropdownDefaultIndex = 0; - } - - void FollowPeep() - { - WindowBase* main = WindowGetMain(); - WindowFollowSprite(*main, EntityId::FromUnderlying(number)); - } - - void DrawTabImages(DrawPixelInfo& dpi) - { - DrawOverviewTabImage(dpi); - DrawTabImage(dpi, WINDOW_STAFF_OPTIONS, SPR_TAB_STAFF_OPTIONS_0); - DrawTabImage(dpi, WINDOW_STAFF_STATISTICS, SPR_TAB_STATS_0); - } - - void DrawTabImage(DrawPixelInfo& dpi, int32_t p, int32_t baseImageId) - { - WidgetIndex widgetIndex = WIDX_TAB_1 + p; - Widget* widget = &widgets[widgetIndex]; - - auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; - - if (!IsWidgetDisabled(widgetIndex)) +#pragma endregion + void DisableWidgets() { - if (page == p) + const auto staff = GetStaff(); + if (staff == nullptr) { - int32_t frame = frame_no / TabAnimationDivisor[page - 1]; - baseImageId += (frame % TabAnimationFrames); + return; } - // Draw normal, enabled sprite. - GfxDrawSprite(dpi, ImageId(baseImageId), screenCoords); + for (WidgetIndex widgetIndex = WIDX_TAB_1; widgets[widgetIndex].type != kWidgetsEnd.type; widgetIndex++) + { + SetWidgetDisabled(widgetIndex, false); + } + + if (staff->AssignedStaffType == StaffType::Security) + { + SetWidgetDisabled(WIDX_TAB_2, true); + } + + if (page == WINDOW_STAFF_OVERVIEW) + { + if (staff->CanBePickedUp()) + { + SetWidgetDisabled(WIDX_PICKUP, false); + } + else + { + SetWidgetDisabled(WIDX_PICKUP, true); + } + + SetWidgetDisabled(WIDX_FIRE, staff->State == PeepState::Fixing || staff->State == PeepState::Inspecting); + } } - } - Staff* GetStaff() - { - return GetEntity(EntityId::FromUnderlying(number)); - } + void CancelTools() + { + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) + { + if (number == gCurrentToolWidget.window_number && classification == gCurrentToolWidget.window_classification) + ToolCancel(); + } + } - static constexpr int32_t TabAnimationDivisor[] = { - 2, // WINDOW_STAFF_OPTIONS, - 4, // WINDOW_STAFF_STATISTICS, + void SetPage(int32_t pageNum) + { + CancelTools(); + + int32_t listen = 0; + if (page == WINDOW_STAFF_OVERVIEW && viewport != nullptr) + { + if (!(viewport->flags & VIEWPORT_FLAG_SOUND_ON)) + listen = 1; + } + + page = pageNum; + frame_no = 0; + pressed_widgets = 0; + hold_down_widgets = 0; + widgets = window_staff_page_widgets[page]; + + RemoveViewport(); + + Invalidate(); + OnResize(); + OnPrepareDraw(); + InitScrollWidgets(); + ViewportInit(); + Invalidate(); + + if (listen && viewport != nullptr) + viewport->flags |= VIEWPORT_FLAG_SOUND_ON; + } + + void SetPressedTab() + { + for (int32_t i = 0; i < WINDOW_STAFF_PAGE_COUNT; i++) + SetWidgetPressed((WIDX_TAB_1 + i), false); + SetWidgetPressed(WIDX_TAB_1 + page, true); + } + + void SetOrder(int32_t orderId) + { + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } + + uint8_t newOrders = staff->StaffOrders ^ (1 << orderId); + auto staffSetOrdersAction = StaffSetOrdersAction(EntityId::FromUnderlying(number), newOrders); + GameActions::Execute(&staffSetOrdersAction); + } + + void ViewportInit() + { + if (page != WINDOW_STAFF_OVERVIEW) + return; + + auto staff = GetStaff(); + if (staff == nullptr) + { + return; + } + + std::optional tempFocus; + if (staff->State != PeepState::Picked) + { + tempFocus = Focus(staff->Id); + } + + uint16_t viewport_flags; + + if (viewport != nullptr) + { + if (tempFocus == focus) + return; + + viewport_flags = viewport->flags; + RemoveViewport(); + } + else + { + viewport_flags = 0; + if (gConfigGeneral.AlwaysShowGridlines) + viewport_flags |= VIEWPORT_FLAG_GRIDLINES; + } + + OnPrepareDraw(); + + focus = tempFocus; + + if (staff->State != PeepState::Picked) + { + if (viewport == nullptr) + { + const auto& viewWidget = widgets[WIDX_VIEWPORT]; + + auto screenPos = ScreenCoordsXY{ viewWidget.left + 1 + windowPos.x, viewWidget.top + 1 + windowPos.y }; + int32_t viewportWidth = viewWidget.width() - 1; + int32_t viewportHeight = viewWidget.height() - 1; + + ViewportCreate(this, screenPos, viewportWidth, viewportHeight, focus.value()); + flags |= WF_NO_SCROLLING; + Invalidate(); + } + } + + if (viewport != nullptr) + viewport->flags = viewport_flags; + Invalidate(); + } + + void ShowLocateDropdown(Widget* widget) + { + gDropdownItems[0].Format = STR_LOCATE_SUBJECT_TIP; + gDropdownItems[1].Format = STR_FOLLOW_SUBJECT_TIP; + + WindowDropdownShowText( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 2); + gDropdownDefaultIndex = 0; + } + + void FollowPeep() + { + WindowBase* main = WindowGetMain(); + WindowFollowSprite(*main, EntityId::FromUnderlying(number)); + } + + void DrawTabImages(DrawPixelInfo& dpi) + { + DrawOverviewTabImage(dpi); + DrawTabImage(dpi, WINDOW_STAFF_OPTIONS, SPR_TAB_STAFF_OPTIONS_0); + DrawTabImage(dpi, WINDOW_STAFF_STATISTICS, SPR_TAB_STATS_0); + } + + void DrawTabImage(DrawPixelInfo& dpi, int32_t p, int32_t baseImageId) + { + WidgetIndex widgetIndex = WIDX_TAB_1 + p; + Widget* widget = &widgets[widgetIndex]; + + auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; + + if (!IsWidgetDisabled(widgetIndex)) + { + if (page == p) + { + int32_t frame = frame_no / TabAnimationDivisor[page - 1]; + baseImageId += (frame % TabAnimationFrames); + } + + // Draw normal, enabled sprite. + GfxDrawSprite(dpi, ImageId(baseImageId), screenCoords); + } + } + + Staff* GetStaff() + { + return GetEntity(EntityId::FromUnderlying(number)); + } + + static constexpr int32_t TabAnimationDivisor[] = { + 2, // WINDOW_STAFF_OPTIONS, + 4, // WINDOW_STAFF_STATISTICS, + }; + + static constexpr int32_t TabAnimationFrames = 7; }; - static constexpr int32_t TabAnimationFrames = 7; -}; + WindowBase* StaffOpen(Peep* peep) + { + auto w = static_cast(WindowBringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying())); -WindowBase* WindowStaffOpen(Peep* peep) -{ - auto w = static_cast(WindowBringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying())); + if (w != nullptr) + return w; + + w = WindowCreate(WindowClass::Peep, WW, WH, WF_10 | WF_RESIZABLE); + + if (w == nullptr) + return nullptr; + + if (w != nullptr) + w->Initialise(peep->Id); - if (w != nullptr) return w; - - w = WindowCreate(WindowClass::Peep, WW, WH, WF_10 | WF_RESIZABLE); - - if (w == nullptr) - return nullptr; - - if (w != nullptr) - w->Initialise(peep->Id); - - return w; -} + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index d27e527d47..0839cbb8a4 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -18,11 +18,13 @@ #include #include -static constexpr StringId WINDOW_TITLE = STR_SACK_STAFF; -static constexpr int32_t WW = 200; -static constexpr int32_t WH = 100; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_SACK_STAFF; + static constexpr int32_t WW = 200; + static constexpr int32_t WH = 100; -// clang-format off + // clang-format off enum WindowStaffFireWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -36,65 +38,66 @@ static Widget _staffFireWidgets[] = { WINDOW_SHIM_WHITE(WINDOW_TITLE, WW, WH), MakeWidget({ 10, WH - 20}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_YES ), MakeWidget({WW - 95, WH - 20}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class StaffFirePromptWindow final : public Window -{ -public: - void SetWindowNumber(rct_windownumber windownumber) + class StaffFirePromptWindow final : public Window { - number = windownumber; - } - - void OnOpen() override - { - widgets = _staffFireWidgets; - WindowInitScrollWidgets(*this); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void SetWindowNumber(rct_windownumber windownumber) { - case WIDX_YES: - { - auto staffFireAction = StaffFireAction(EntityId::FromUnderlying(number)); - GameActions::Execute(&staffFireAction); - break; - } - case WIDX_CLOSE: - case WIDX_CANCEL: - Close(); - break; + number = windownumber; } - } - void OnDraw(DrawPixelInfo& dpi) override + void OnOpen() override + { + widgets = _staffFireWidgets; + WindowInitScrollWidgets(*this); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_YES: + { + auto staffFireAction = StaffFireAction(EntityId::FromUnderlying(number)); + GameActions::Execute(&staffFireAction); + break; + } + case WIDX_CLOSE: + case WIDX_CANCEL: + Close(); + break; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + Peep* peep = GetEntity(EntityId::FromUnderlying(number)); + auto ft = Formatter(); + peep->FormatNameTo(ft); + + ScreenCoordsXY textCoords(windowPos + ScreenCoordsXY{ WW / 2, (WH / 2) - 3 }); + DrawTextWrapped(dpi, textCoords, WW - 4, STR_FIRE_STAFF_ID, ft, { TextAlignment::CENTRE }); + } + + void OnResize() override + { + ResizeFrame(); + } + }; + + WindowBase* StaffFirePromptOpen(Peep* peep) { - DrawWidgets(dpi); - - Peep* peep = GetEntity(EntityId::FromUnderlying(number)); - auto ft = Formatter(); - peep->FormatNameTo(ft); - - ScreenCoordsXY textCoords(windowPos + ScreenCoordsXY{ WW / 2, (WH / 2) - 3 }); - DrawTextWrapped(dpi, textCoords, WW - 4, STR_FIRE_STAFF_ID, ft, { TextAlignment::CENTRE }); + // Check if the confirm window already exists + auto* window = WindowFocusOrCreate( + WindowClass::FirePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); + window->SetWindowNumber(peep->Id.ToUnderlying()); + return window; } - - void OnResize() override - { - ResizeFrame(); - } -}; - -WindowBase* WindowStaffFirePromptOpen(Peep* peep) -{ - // Check if the confirm window already exists - auto* window = WindowFocusOrCreate( - WindowClass::FirePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); - window->SetWindowNumber(peep->Id.ToUnderlying()); - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 2aa55093bd..6493660c19 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -36,41 +36,41 @@ #include #include -using namespace OpenRCT2; - -enum +namespace OpenRCT2::Ui::Windows { - WINDOW_STAFF_LIST_TAB_HANDYMEN, - WINDOW_STAFF_LIST_TAB_MECHANICS, - WINDOW_STAFF_LIST_TAB_SECURITY, - WINDOW_STAFF_LIST_TAB_ENTERTAINERS -}; + enum + { + WINDOW_STAFF_LIST_TAB_HANDYMEN, + WINDOW_STAFF_LIST_TAB_MECHANICS, + WINDOW_STAFF_LIST_TAB_SECURITY, + WINDOW_STAFF_LIST_TAB_ENTERTAINERS + }; -enum WindowStaffListWidgetIdx -{ - WIDX_STAFF_LIST_BACKGROUND, - WIDX_STAFF_LIST_TITLE, - WIDX_STAFF_LIST_CLOSE, - WIDX_STAFF_LIST_TAB_CONTENT_PANEL, - WIDX_STAFF_LIST_HANDYMEN_TAB, - WIDX_STAFF_LIST_MECHANICS_TAB, - WIDX_STAFF_LIST_SECURITY_TAB, - WIDX_STAFF_LIST_ENTERTAINERS_TAB, - WIDX_STAFF_LIST_LIST, - WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER, - WIDX_STAFF_LIST_HIRE_BUTTON, - WIDX_STAFF_LIST_QUICK_FIRE, - WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON, - WIDX_STAFF_LIST_MAP, -}; + enum WindowStaffListWidgetIdx + { + WIDX_STAFF_LIST_BACKGROUND, + WIDX_STAFF_LIST_TITLE, + WIDX_STAFF_LIST_CLOSE, + WIDX_STAFF_LIST_TAB_CONTENT_PANEL, + WIDX_STAFF_LIST_HANDYMEN_TAB, + WIDX_STAFF_LIST_MECHANICS_TAB, + WIDX_STAFF_LIST_SECURITY_TAB, + WIDX_STAFF_LIST_ENTERTAINERS_TAB, + WIDX_STAFF_LIST_LIST, + WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER, + WIDX_STAFF_LIST_HIRE_BUTTON, + WIDX_STAFF_LIST_QUICK_FIRE, + WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON, + WIDX_STAFF_LIST_MAP, + }; -static constexpr StringId WINDOW_TITLE = STR_STAFF; -static constexpr int32_t WW = 320; -static constexpr int32_t WH = 270; -constexpr int32_t MAX_WW = 500; -constexpr int32_t MAX_WH = 450; + static constexpr StringId WINDOW_TITLE = STR_STAFF; + static constexpr int32_t WW = 320; + static constexpr int32_t WH = 270; + constexpr int32_t MAX_WW = 500; + constexpr int32_t MAX_WH = 450; -// clang-format off + // clang-format off static Widget _staffListWidgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, { WW, WH - 43}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab content panel @@ -84,679 +84,683 @@ static Widget _staffListWidgets[] = { MakeWidget({243, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_QUICK_FIRE_STAFF ), // quick fire staff MakeWidget({267, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PATROL_BTN), STR_SHOW_PATROL_AREA_TIP ), // show staff patrol area tool MakeWidget({291, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_MAP), STR_SHOW_STAFF_ON_MAP_TIP ), // show staff on map button - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class StaffListWindow final : public Window -{ -private: - struct StaffNamingConvention + class StaffListWindow final : public Window { - StringId Plural; - StringId Singular; - StringId ActionHire; - }; - - struct StaffEntry - { - EntityId Id; - u8string Name; - }; - - std::vector _staffList; - bool _quickFireMode{}; - std::optional _highlightedIndex{}; - int32_t _selectedTab{}; - uint32_t _tabAnimationIndex{}; - -public: - void OnOpen() override - { - widgets = _staffListWidgets; - WindowInitScrollWidgets(*this); - - widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].type = WindowWidgetType::Empty; - min_width = WW; - min_height = WH; - max_width = MAX_WW; - max_height = MAX_WH; - - RefreshList(); - } - - void OnClose() override - { - CancelTools(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + private: + struct StaffNamingConvention { - case WIDX_STAFF_LIST_CLOSE: - Close(); - break; - case WIDX_STAFF_LIST_HIRE_BUTTON: + StringId Plural; + StringId Singular; + StringId ActionHire; + }; + + struct StaffEntry + { + EntityId Id; + u8string Name; + }; + + std::vector _staffList; + bool _quickFireMode{}; + std::optional _highlightedIndex{}; + int32_t _selectedTab{}; + uint32_t _tabAnimationIndex{}; + + public: + void OnOpen() override + { + widgets = _staffListWidgets; + WindowInitScrollWidgets(*this); + + widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].type = WindowWidgetType::Empty; + min_width = WW; + min_height = WH; + max_width = MAX_WW; + max_height = MAX_WH; + + RefreshList(); + } + + void OnClose() override + { + CancelTools(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) { - auto staffType = GetSelectedStaffType(); - auto costume = EntertainerCostume::Count; - if (staffType == StaffType::Entertainer) + case WIDX_STAFF_LIST_CLOSE: + Close(); + break; + case WIDX_STAFF_LIST_HIRE_BUTTON: { - costume = GetRandomEntertainerCostume(); - } - HireNewMember(staffType, costume); - break; - } - case WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON: - if (!ToolSet(*this, WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON, Tool::Crosshair)) - { - ShowGridlines(); - SetPatrolAreaToRender(GetSelectedStaffType()); - GfxInvalidateScreen(); - } - break; - case WIDX_STAFF_LIST_MAP: - ContextOpenWindow(WindowClass::Map); - break; - case WIDX_STAFF_LIST_QUICK_FIRE: - _quickFireMode = !_quickFireMode; - Invalidate(); - break; - } - } - - void OnResize() override - { - min_width = WW; - min_height = WH; - if (width < min_width) - { - width = min_width; - Invalidate(); - } - if (height < min_height) - { - height = min_height; - Invalidate(); - } - ResizeFrameWithPage(); - } - - void OnUpdate() override - { - _tabAnimationIndex++; - if (_tabAnimationIndex >= 24) - { - _tabAnimationIndex = 0; - } - else - { - InvalidateWidget(WIDX_STAFF_LIST_HANDYMEN_TAB + _selectedTab); - - // Enable highlighting of these staff members in map window - if (WindowFindByClass(WindowClass::Map) != nullptr) - { - gWindowMapFlashingFlags |= MapFlashingFlags::StaffListOpen; - for (auto peep : EntityList()) - { - EntitySetFlashing(peep, false); - if (peep->AssignedStaffType == GetSelectedStaffType()) + auto staffType = GetSelectedStaffType(); + auto costume = EntertainerCostume::Count; + if (staffType == StaffType::Entertainer) { - EntitySetFlashing(peep, true); + costume = GetRandomEntertainerCostume(); } + HireNewMember(staffType, costume); + break; } - } - } - - // Note this may be slow if number of staff increases a large amount. - // See GuestList for fix (more intents) if required. - RefreshList(); - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_STAFF_LIST_HANDYMEN_TAB: - case WIDX_STAFF_LIST_MECHANICS_TAB: - case WIDX_STAFF_LIST_SECURITY_TAB: - case WIDX_STAFF_LIST_ENTERTAINERS_TAB: - { - auto newSelectedTab = widgetIndex - WIDX_STAFF_LIST_HANDYMEN_TAB; - if (_selectedTab != newSelectedTab) - { - _selectedTab = static_cast(newSelectedTab); + case WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON: + if (!ToolSet(*this, WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON, Tool::Crosshair)) + { + ShowGridlines(); + SetPatrolAreaToRender(GetSelectedStaffType()); + GfxInvalidateScreen(); + } + break; + case WIDX_STAFF_LIST_MAP: + ContextOpenWindow(WindowClass::Map); + break; + case WIDX_STAFF_LIST_QUICK_FIRE: + _quickFireMode = !_quickFireMode; Invalidate(); - scrolls[0].v_top = 0; - CancelTools(); - } - break; + break; } - case WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER: - WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], StaffGetColour(GetSelectedStaffType())); - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - if (dropdownIndex == -1) - { - return; - } - if (widgetIndex == WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER) - { - auto action = StaffSetColourAction(GetSelectedStaffType(), ColourDropDownIndexToColour(dropdownIndex)); - GameActions::Execute(&action); - } - } - - void OnPrepareDraw() override - { - // Set selected tab - SetWidgetPressed(WIDX_STAFF_LIST_HANDYMEN_TAB, false); - SetWidgetPressed(WIDX_STAFF_LIST_MECHANICS_TAB, false); - SetWidgetPressed(WIDX_STAFF_LIST_SECURITY_TAB, false); - SetWidgetPressed(WIDX_STAFF_LIST_ENTERTAINERS_TAB, false); - SetWidgetPressed(_selectedTab + WIDX_STAFF_LIST_HANDYMEN_TAB, true); - - widgets[WIDX_STAFF_LIST_HIRE_BUTTON].text = GetStaffNamingConvention(GetSelectedStaffType()).ActionHire; - widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].type = WindowWidgetType::Empty; - - if (GetSelectedStaffType() != StaffType::Entertainer) - { - widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].type = WindowWidgetType::ColourBtn; - widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].image = GetColourButtonImage(StaffGetColour(GetSelectedStaffType())); - } - SetWidgetPressed(WIDX_STAFF_LIST_QUICK_FIRE, _quickFireMode); - - ResizeFrameWithPage(); - widgets[WIDX_STAFF_LIST_LIST].right = width - 4; - widgets[WIDX_STAFF_LIST_LIST].bottom = height - 15; - widgets[WIDX_STAFF_LIST_QUICK_FIRE].left = width - 77; - widgets[WIDX_STAFF_LIST_QUICK_FIRE].right = width - 54; - widgets[WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON].left = width - 53; - widgets[WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON].right = width - 30; - widgets[WIDX_STAFF_LIST_MAP].left = width - 29; - widgets[WIDX_STAFF_LIST_MAP].right = width - 6; - widgets[WIDX_STAFF_LIST_HIRE_BUTTON].left = width - 155; - widgets[WIDX_STAFF_LIST_HIRE_BUTTON].right = width - 11; - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - DrawTabImages(dpi); - - if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) - { - auto ft = Formatter(); - ft.Add(GetStaffWage(GetSelectedStaffType())); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ width - 155, 32 }, STR_COST_PER_MONTH, ft); } - if (GetSelectedStaffType() != StaffType::Entertainer) + void OnResize() override { - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].top + 1 }, - STR_UNIFORM_COLOUR); - } - - auto namingConvention = GetStaffNamingConvention(GetSelectedStaffType()); - auto staffTypeStringId = _staffList.size() == 1 ? namingConvention.Singular : namingConvention.Plural; - - auto ft = Formatter(); - ft.Add(_staffList.size()); - ft.Add(staffTypeStringId); - - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_STAFF_LIST_LIST].bottom + 2 }, STR_STAFF_LIST_COUNTER, ft); - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - if (_highlightedIndex) - { - _highlightedIndex = {}; - Invalidate(); - } - - auto scrollHeight = static_cast(_staffList.size()) * SCROLLABLE_ROW_HEIGHT; - auto i = scrollHeight - widgets[WIDX_STAFF_LIST_LIST].bottom + widgets[WIDX_STAFF_LIST_LIST].top + 21; - if (i < 0) - i = 0; - if (i < scrolls[0].v_top) - { - scrolls[0].v_top = i; - Invalidate(); - } - - auto scrollWidth = widgets[WIDX_STAFF_LIST_LIST].width() - 15; - return { scrollWidth, scrollHeight }; - } - - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - auto i = static_cast(screenCoords.y / SCROLLABLE_ROW_HEIGHT); - if (i != _highlightedIndex) - { - _highlightedIndex = static_cast(i); - Invalidate(); - } - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - int32_t i = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - for (const auto& entry : _staffList) - { - if (i == 0) + min_width = WW; + min_height = WH; + if (width < min_width) { - if (_quickFireMode) + width = min_width; + Invalidate(); + } + if (height < min_height) + { + height = min_height; + Invalidate(); + } + ResizeFrameWithPage(); + } + + void OnUpdate() override + { + _tabAnimationIndex++; + if (_tabAnimationIndex >= 24) + { + _tabAnimationIndex = 0; + } + else + { + InvalidateWidget(WIDX_STAFF_LIST_HANDYMEN_TAB + _selectedTab); + + // Enable highlighting of these staff members in map window + if (WindowFindByClass(WindowClass::Map) != nullptr) { - auto staffFireAction = StaffFireAction(entry.Id); - GameActions::Execute(&staffFireAction); - } - else - { - auto peep = GetEntity(entry.Id); - if (peep != nullptr) + gWindowMapFlashingFlags |= MapFlashingFlags::StaffListOpen; + for (auto peep : EntityList()) { - auto intent = Intent(WindowClass::Peep); - intent.PutExtra(INTENT_EXTRA_PEEP, peep); - ContextOpenIntent(&intent); - } - } - break; - } - - i--; - } - } - - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; - GfxFillRect( - dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width - 1, dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); - - // How much space do we have for the name and action columns? (Discount scroll area and icons.) - const int32_t nonIconSpace = widgets[WIDX_STAFF_LIST_LIST].width() - 15 - 68; - const int32_t nameColumnSize = nonIconSpace * 0.42; - const int32_t actionColumnSize = nonIconSpace * 0.58; - const int32_t actionOffset = widgets[WIDX_STAFF_LIST_LIST].right - actionColumnSize - 15; - - auto y = 0; - size_t i = 0; - for (const auto& entry : _staffList) - { - if (y > dpi.y + dpi.height) - { - break; - } - - if (y + 11 >= dpi.y) - { - const auto* peep = GetEntity(entry.Id); - if (peep == nullptr) - { - continue; - } - int32_t format = (_quickFireMode ? STR_RED_STRINGID : STR_BLACK_STRING); - - if (i == _highlightedIndex) - { - GfxFilterRect(dpi, { 0, y, 800, y + (SCROLLABLE_ROW_HEIGHT - 1) }, FilterPaletteID::PaletteDarken1); - format = (_quickFireMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID); - } - - auto ft = Formatter(); - peep->FormatNameTo(ft); - DrawTextEllipsised(dpi, { 0, y }, nameColumnSize, format, ft); - - ft = Formatter(); - peep->FormatActionTo(ft); - DrawTextEllipsised(dpi, { actionOffset, y }, actionColumnSize, format, ft); - - // True if a patrol path is set for the worker - if (peep->HasPatrolArea()) - { - GfxDrawSprite(dpi, ImageId(SPR_STAFF_PATROL_PATH), { nameColumnSize + 5, y }); - } - - auto staffOrderIcon_x = nameColumnSize + 20; - if (peep->AssignedStaffType != StaffType::Entertainer) - { - auto staffOrders = peep->StaffOrders; - auto staffOrderSprite = GetStaffOrderBaseSprite(GetSelectedStaffType()); - - while (staffOrders != 0) - { - if (staffOrders & 1) + EntitySetFlashing(peep, false); + if (peep->AssignedStaffType == GetSelectedStaffType()) { - GfxDrawSprite(dpi, ImageId(staffOrderSprite), { staffOrderIcon_x, y }); + EntitySetFlashing(peep, true); } - staffOrders = staffOrders >> 1; - staffOrderIcon_x += 9; - // TODO: Remove sprite ID addition - staffOrderSprite++; } } + } + + // Note this may be slow if number of staff increases a large amount. + // See GuestList for fix (more intents) if required. + RefreshList(); + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_STAFF_LIST_HANDYMEN_TAB: + case WIDX_STAFF_LIST_MECHANICS_TAB: + case WIDX_STAFF_LIST_SECURITY_TAB: + case WIDX_STAFF_LIST_ENTERTAINERS_TAB: + { + auto newSelectedTab = widgetIndex - WIDX_STAFF_LIST_HANDYMEN_TAB; + if (_selectedTab != newSelectedTab) + { + _selectedTab = static_cast(newSelectedTab); + Invalidate(); + scrolls[0].v_top = 0; + CancelTools(); + } + break; + } + case WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER: + WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], StaffGetColour(GetSelectedStaffType())); + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + { + if (dropdownIndex == -1) + { + return; + } + if (widgetIndex == WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER) + { + auto action = StaffSetColourAction(GetSelectedStaffType(), ColourDropDownIndexToColour(dropdownIndex)); + GameActions::Execute(&action); + } + } + + void OnPrepareDraw() override + { + // Set selected tab + SetWidgetPressed(WIDX_STAFF_LIST_HANDYMEN_TAB, false); + SetWidgetPressed(WIDX_STAFF_LIST_MECHANICS_TAB, false); + SetWidgetPressed(WIDX_STAFF_LIST_SECURITY_TAB, false); + SetWidgetPressed(WIDX_STAFF_LIST_ENTERTAINERS_TAB, false); + SetWidgetPressed(_selectedTab + WIDX_STAFF_LIST_HANDYMEN_TAB, true); + + widgets[WIDX_STAFF_LIST_HIRE_BUTTON].text = GetStaffNamingConvention(GetSelectedStaffType()).ActionHire; + widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].type = WindowWidgetType::Empty; + + if (GetSelectedStaffType() != StaffType::Entertainer) + { + widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].type = WindowWidgetType::ColourBtn; + widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].image = GetColourButtonImage( + StaffGetColour(GetSelectedStaffType())); + } + SetWidgetPressed(WIDX_STAFF_LIST_QUICK_FIRE, _quickFireMode); + + ResizeFrameWithPage(); + widgets[WIDX_STAFF_LIST_LIST].right = width - 4; + widgets[WIDX_STAFF_LIST_LIST].bottom = height - 15; + widgets[WIDX_STAFF_LIST_QUICK_FIRE].left = width - 77; + widgets[WIDX_STAFF_LIST_QUICK_FIRE].right = width - 54; + widgets[WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON].left = width - 53; + widgets[WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON].right = width - 30; + widgets[WIDX_STAFF_LIST_MAP].left = width - 29; + widgets[WIDX_STAFF_LIST_MAP].right = width - 6; + widgets[WIDX_STAFF_LIST_HIRE_BUTTON].left = width - 155; + widgets[WIDX_STAFF_LIST_HIRE_BUTTON].right = width - 11; + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + DrawTabImages(dpi); + + if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + auto ft = Formatter(); + ft.Add(GetStaffWage(GetSelectedStaffType())); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ width - 155, 32 }, STR_COST_PER_MONTH, ft); + } + + if (GetSelectedStaffType() != StaffType::Entertainer) + { + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].top + 1 }, + STR_UNIFORM_COLOUR); + } + + auto namingConvention = GetStaffNamingConvention(GetSelectedStaffType()); + auto staffTypeStringId = _staffList.size() == 1 ? namingConvention.Singular : namingConvention.Plural; + + auto ft = Formatter(); + ft.Add(_staffList.size()); + ft.Add(staffTypeStringId); + + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_STAFF_LIST_LIST].bottom + 2 }, STR_STAFF_LIST_COUNTER, ft); + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + if (_highlightedIndex) + { + _highlightedIndex = {}; + Invalidate(); + } + + auto scrollHeight = static_cast(_staffList.size()) * SCROLLABLE_ROW_HEIGHT; + auto i = scrollHeight - widgets[WIDX_STAFF_LIST_LIST].bottom + widgets[WIDX_STAFF_LIST_LIST].top + 21; + if (i < 0) + i = 0; + if (i < scrolls[0].v_top) + { + scrolls[0].v_top = i; + Invalidate(); + } + + auto scrollWidth = widgets[WIDX_STAFF_LIST_LIST].width() - 15; + return { scrollWidth, scrollHeight }; + } + + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + auto i = static_cast(screenCoords.y / SCROLLABLE_ROW_HEIGHT); + if (i != _highlightedIndex) + { + _highlightedIndex = static_cast(i); + Invalidate(); + } + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + int32_t i = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + for (const auto& entry : _staffList) + { + if (i == 0) + { + if (_quickFireMode) + { + auto staffFireAction = StaffFireAction(entry.Id); + GameActions::Execute(&staffFireAction); + } + else + { + auto peep = GetEntity(entry.Id); + if (peep != nullptr) + { + auto intent = Intent(WindowClass::Peep); + intent.PutExtra(INTENT_EXTRA_PEEP, peep); + ContextOpenIntent(&intent); + } + } + break; + } + + i--; + } + } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + auto dpiCoords = ScreenCoordsXY{ dpi.x, dpi.y }; + GfxFillRect( + dpi, { dpiCoords, dpiCoords + ScreenCoordsXY{ dpi.width - 1, dpi.height - 1 } }, + ColourMapA[colours[1]].mid_light); + + // How much space do we have for the name and action columns? (Discount scroll area and icons.) + const int32_t nonIconSpace = widgets[WIDX_STAFF_LIST_LIST].width() - 15 - 68; + const int32_t nameColumnSize = nonIconSpace * 0.42; + const int32_t actionColumnSize = nonIconSpace * 0.58; + const int32_t actionOffset = widgets[WIDX_STAFF_LIST_LIST].right - actionColumnSize - 15; + + auto y = 0; + size_t i = 0; + for (const auto& entry : _staffList) + { + if (y > dpi.y + dpi.height) + { + break; + } + + if (y + 11 >= dpi.y) + { + const auto* peep = GetEntity(entry.Id); + if (peep == nullptr) + { + continue; + } + int32_t format = (_quickFireMode ? STR_RED_STRINGID : STR_BLACK_STRING); + + if (i == _highlightedIndex) + { + GfxFilterRect(dpi, { 0, y, 800, y + (SCROLLABLE_ROW_HEIGHT - 1) }, FilterPaletteID::PaletteDarken1); + format = (_quickFireMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID); + } + + auto ft = Formatter(); + peep->FormatNameTo(ft); + DrawTextEllipsised(dpi, { 0, y }, nameColumnSize, format, ft); + + ft = Formatter(); + peep->FormatActionTo(ft); + DrawTextEllipsised(dpi, { actionOffset, y }, actionColumnSize, format, ft); + + // True if a patrol path is set for the worker + if (peep->HasPatrolArea()) + { + GfxDrawSprite(dpi, ImageId(SPR_STAFF_PATROL_PATH), { nameColumnSize + 5, y }); + } + + auto staffOrderIcon_x = nameColumnSize + 20; + if (peep->AssignedStaffType != StaffType::Entertainer) + { + auto staffOrders = peep->StaffOrders; + auto staffOrderSprite = GetStaffOrderBaseSprite(GetSelectedStaffType()); + + while (staffOrders != 0) + { + if (staffOrders & 1) + { + GfxDrawSprite(dpi, ImageId(staffOrderSprite), { staffOrderIcon_x, y }); + } + staffOrders = staffOrders >> 1; + staffOrderIcon_x += 9; + // TODO: Remove sprite ID addition + staffOrderSprite++; + } + } + else + { + GfxDrawSprite(dpi, ImageId(GetEntertainerCostumeSprite(peep->SpriteType)), { staffOrderIcon_x, y }); + } + } + + y += SCROLLABLE_ROW_HEIGHT; + i++; + } + } + + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON) + { + auto closestStaffMember = GetClosestStaffMemberTo(screenCoords); + if (closestStaffMember != nullptr) + { + ToolCancel(); + auto* staffWindow = StaffOpen(closestStaffMember); + staffWindow->OnDropdown(WC_PEEP__WIDX_PATROL, 0); + } else { - GfxDrawSprite(dpi, ImageId(GetEntertainerCostumeSprite(peep->SpriteType)), { staffOrderIcon_x, y }); + auto ft = Formatter(); + ft.Add(GetStaffNamingConvention(GetSelectedStaffType()).Plural); + ContextShowError(STR_NO_THING_IN_PARK_YET, STR_NONE, ft); + } + } + } + + void OnToolAbort(WidgetIndex widgetIndex) override + { + if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON) + { + HideGridlines(); + ToolCancel(); + ClearPatrolAreaToRender(); + GfxInvalidateScreen(); + } + } + + void RefreshList() + { + _staffList.clear(); + + for (auto* peep : EntityList()) + { + EntitySetFlashing(peep, false); + if (peep->AssignedStaffType == GetSelectedStaffType()) + { + EntitySetFlashing(peep, true); + + StaffEntry entry; + entry.Id = peep->Id; + entry.Name = peep->GetName(); + + _staffList.push_back(std::move(entry)); } } - y += SCROLLABLE_ROW_HEIGHT; - i++; + std::sort(_staffList.begin(), _staffList.end(), [](const auto& a, const auto& b) { + return StrLogicalCmp(a.Name.c_str(), b.Name.c_str()) < 0; + }); } - } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON) + private: + /** + * Hires a new staff member of the given type. + */ + void HireNewMember(StaffType staffType, EntertainerCostume entertainerType) { - auto closestStaffMember = GetClosestStaffMemberTo(screenCoords); - if (closestStaffMember != nullptr) + bool autoPosition = gConfigGeneral.AutoStaffPlacement; + if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) { - ToolCancel(); - auto* staffWindow = WindowStaffOpen(closestStaffMember); - WindowEventDropdownCall(staffWindow, WC_PEEP__WIDX_PATROL, 0); + autoPosition = autoPosition ^ 1; } - else + + uint32_t staffOrders = 0; + + if (staffType == StaffType::Handyman) { - auto ft = Formatter(); - ft.Add(GetStaffNamingConvention(GetSelectedStaffType()).Plural); - ContextShowError(STR_NO_THING_IN_PARK_YET, STR_NONE, ft); + staffOrders = STAFF_ORDERS_SWEEPING | STAFF_ORDERS_WATER_FLOWERS | STAFF_ORDERS_EMPTY_BINS; + if (gConfigGeneral.HandymenMowByDefault) + { + staffOrders |= STAFF_ORDERS_MOWING; + } } - } - } - - void OnToolAbort(WidgetIndex widgetIndex) override - { - if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON) - { - HideGridlines(); - ToolCancel(); - ClearPatrolAreaToRender(); - GfxInvalidateScreen(); - } - } - - void RefreshList() - { - _staffList.clear(); - - for (auto* peep : EntityList()) - { - EntitySetFlashing(peep, false); - if (peep->AssignedStaffType == GetSelectedStaffType()) + else if (staffType == StaffType::Mechanic) { - EntitySetFlashing(peep, true); - - StaffEntry entry; - entry.Id = peep->Id; - entry.Name = peep->GetName(); - - _staffList.push_back(std::move(entry)); + staffOrders = STAFF_ORDERS_INSPECT_RIDES | STAFF_ORDERS_FIX_RIDES; } - } - std::sort(_staffList.begin(), _staffList.end(), [](const auto& a, const auto& b) { - return StrLogicalCmp(a.Name.c_str(), b.Name.c_str()) < 0; - }); - } + auto hireStaffAction = StaffHireNewAction(autoPosition, staffType, entertainerType, staffOrders); + hireStaffAction.SetCallback([=](const GameAction*, const GameActions::Result* res) -> void { + if (res->Error != GameActions::Status::Ok) + return; -private: - /** - * Hires a new staff member of the given type. - */ - void HireNewMember(StaffType staffType, EntertainerCostume entertainerType) - { - bool autoPosition = gConfigGeneral.AutoStaffPlacement; - if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) - { - autoPosition = autoPosition ^ 1; - } + auto actionResult = res->GetData(); + auto* staff = GetEntity(actionResult.StaffEntityId); + if (staff == nullptr) + return; - uint32_t staffOrders = 0; + // If autoposition of staff is disabled, pickup peep and then open the staff window + if (staff->State == PeepState::Picked) + { + CoordsXYZ nullLoc{}; + nullLoc.SetNull(); - if (staffType == StaffType::Handyman) - { - staffOrders = STAFF_ORDERS_SWEEPING | STAFF_ORDERS_WATER_FLOWERS | STAFF_ORDERS_EMPTY_BINS; - if (gConfigGeneral.HandymenMowByDefault) - { - staffOrders |= STAFF_ORDERS_MOWING; - } - } - else if (staffType == StaffType::Mechanic) - { - staffOrders = STAFF_ORDERS_INSPECT_RIDES | STAFF_ORDERS_FIX_RIDES; - } + PeepPickupAction pickupAction{ PeepPickupType::Pickup, staff->Id, nullLoc, NetworkGetCurrentPlayerId() }; + pickupAction.SetCallback([staffId = staff->Id](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) + return; - auto hireStaffAction = StaffHireNewAction(autoPosition, staffType, entertainerType, staffOrders); - hireStaffAction.SetCallback([=](const GameAction*, const GameActions::Result* res) -> void { - if (res->Error != GameActions::Status::Ok) - return; - - auto actionResult = res->GetData(); - auto* staff = GetEntity(actionResult.StaffEntityId); - if (staff == nullptr) - return; - - // If autoposition of staff is disabled, pickup peep and then open the staff window - if (staff->State == PeepState::Picked) - { - CoordsXYZ nullLoc{}; - nullLoc.SetNull(); - - PeepPickupAction pickupAction{ PeepPickupType::Pickup, staff->Id, nullLoc, NetworkGetCurrentPlayerId() }; - pickupAction.SetCallback([staffId = staff->Id](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) - return; - - auto* staff2 = GetEntity(staffId); + auto* staff2 = GetEntity(staffId); + auto intent = Intent(WindowClass::Peep); + intent.PutExtra(INTENT_EXTRA_PEEP, staff2); + auto* wind = ContextOpenIntent(&intent); + if (wind != nullptr) + { + ToolSet(*wind, WC_STAFF__WIDX_PICKUP, Tool::Picker); + } + }); + GameActions::Execute(&pickupAction); + } + else + { + // Open window for new staff. auto intent = Intent(WindowClass::Peep); - intent.PutExtra(INTENT_EXTRA_PEEP, staff2); - auto* wind = ContextOpenIntent(&intent); - if (wind != nullptr) - { - ToolSet(*wind, WC_STAFF__WIDX_PICKUP, Tool::Picker); - } - }); - GameActions::Execute(&pickupAction); - } - else - { - // Open window for new staff. - auto intent = Intent(WindowClass::Peep); - intent.PutExtra(INTENT_EXTRA_PEEP, staff); - ContextOpenIntent(&intent); - } - }); + intent.PutExtra(INTENT_EXTRA_PEEP, staff); + ContextOpenIntent(&intent); + } + }); - GameActions::Execute(&hireStaffAction); - } + GameActions::Execute(&hireStaffAction); + } - StaffType GetSelectedStaffType() const - { - return static_cast(_selectedTab); - } - - void DrawTabImages(DrawPixelInfo& dpi) const - { - const auto& gameState = GetGameState(); - DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_HANDYMEN, PeepSpriteType::Handyman, gameState.StaffHandymanColour); - DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_MECHANICS, PeepSpriteType::Mechanic, gameState.StaffMechanicColour); - DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_SECURITY, PeepSpriteType::Security, gameState.StaffSecurityColour); - DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_ENTERTAINERS, PeepSpriteType::EntertainerElephant); - } - - void DrawTabImage(DrawPixelInfo& dpi, int32_t tabIndex, PeepSpriteType type, colour_t colour) const - { - auto widgetIndex = WIDX_STAFF_LIST_HANDYMEN_TAB + tabIndex; - const auto& widget = widgets[widgetIndex]; - auto imageId = (_selectedTab == tabIndex ? (_tabAnimationIndex & ~3) : 0); - imageId += GetPeepAnimation(type).base_image + 1; - GfxDrawSprite( - dpi, ImageId(imageId, colour), windowPos + ScreenCoordsXY{ (widget.left + widget.right) / 2, widget.bottom - 6 }); - } - - void DrawTabImage(DrawPixelInfo& dpi, int32_t tabIndex, PeepSpriteType type) const - { - auto widgetIndex = WIDX_STAFF_LIST_HANDYMEN_TAB + tabIndex; - const auto& widget = widgets[widgetIndex]; - DrawPixelInfo clippedDpi; - if (ClipDrawPixelInfo( - clippedDpi, dpi, windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }, widget.right - widget.left - 1, - widget.bottom - widget.top - 1)) + StaffType GetSelectedStaffType() const { - auto imageId = (_selectedTab == 3 ? (_tabAnimationIndex & ~3) : 0); + return static_cast(_selectedTab); + } + + void DrawTabImages(DrawPixelInfo& dpi) const + { + const auto& gameState = GetGameState(); + DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_HANDYMEN, PeepSpriteType::Handyman, gameState.StaffHandymanColour); + DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_MECHANICS, PeepSpriteType::Mechanic, gameState.StaffMechanicColour); + DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_SECURITY, PeepSpriteType::Security, gameState.StaffSecurityColour); + DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_ENTERTAINERS, PeepSpriteType::EntertainerElephant); + } + + void DrawTabImage(DrawPixelInfo& dpi, int32_t tabIndex, PeepSpriteType type, colour_t colour) const + { + auto widgetIndex = WIDX_STAFF_LIST_HANDYMEN_TAB + tabIndex; + const auto& widget = widgets[widgetIndex]; + auto imageId = (_selectedTab == tabIndex ? (_tabAnimationIndex & ~3) : 0); imageId += GetPeepAnimation(type).base_image + 1; - GfxDrawSprite(clippedDpi, ImageId(imageId), { 15, 23 }); + GfxDrawSprite( + dpi, ImageId(imageId, colour), + windowPos + ScreenCoordsXY{ (widget.left + widget.right) / 2, widget.bottom - 6 }); } - } - void CancelTools() - { - if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) + void DrawTabImage(DrawPixelInfo& dpi, int32_t tabIndex, PeepSpriteType type) const { - if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) + auto widgetIndex = WIDX_STAFF_LIST_HANDYMEN_TAB + tabIndex; + const auto& widget = widgets[widgetIndex]; + DrawPixelInfo clippedDpi; + if (ClipDrawPixelInfo( + clippedDpi, dpi, windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }, + widget.right - widget.left - 1, widget.bottom - widget.top - 1)) { - ToolCancel(); + auto imageId = (_selectedTab == 3 ? (_tabAnimationIndex & ~3) : 0); + imageId += GetPeepAnimation(type).base_image + 1; + GfxDrawSprite(clippedDpi, ImageId(imageId), { 15, 23 }); } } - } - Peep* GetClosestStaffMemberTo(const ScreenCoordsXY& screenCoords) - { - int32_t direction{}; - TileElement* tileElement{}; - auto footpathCoords = FootpathGetCoordinatesFromPos(screenCoords, &direction, &tileElement); - if (footpathCoords.IsNull()) - return nullptr; - - auto isPatrolAreaSet = IsPatrolAreaSetForStaffType(GetSelectedStaffType(), footpathCoords); - - Peep* closestPeep = nullptr; - auto closestPeepDistance = std::numeric_limits::max(); - for (auto peep : EntityList()) + void CancelTools() { - if (peep->AssignedStaffType != GetSelectedStaffType()) - continue; - - if (isPatrolAreaSet) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { - if (!peep->HasPatrolArea()) + if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) + { + ToolCancel(); + } + } + } + + Peep* GetClosestStaffMemberTo(const ScreenCoordsXY& screenCoords) + { + int32_t direction{}; + TileElement* tileElement{}; + auto footpathCoords = FootpathGetCoordinatesFromPos(screenCoords, &direction, &tileElement); + if (footpathCoords.IsNull()) + return nullptr; + + auto isPatrolAreaSet = IsPatrolAreaSetForStaffType(GetSelectedStaffType(), footpathCoords); + + Peep* closestPeep = nullptr; + auto closestPeepDistance = std::numeric_limits::max(); + for (auto peep : EntityList()) + { + if (peep->AssignedStaffType != GetSelectedStaffType()) + continue; + + if (isPatrolAreaSet) + { + if (!peep->HasPatrolArea()) + { + continue; + } + if (!peep->IsLocationInPatrol(footpathCoords)) + { + continue; + } + } + + if (peep->x == LOCATION_NULL) { continue; } - if (!peep->IsLocationInPatrol(footpathCoords)) + + auto distance = std::abs(footpathCoords.x - peep->x) + std::abs(footpathCoords.y - peep->y); + if (distance < closestPeepDistance) { - continue; + closestPeepDistance = distance; + closestPeep = peep; } } + return closestPeep; + } - if (peep->x == LOCATION_NULL) + static EntertainerCostume GetRandomEntertainerCostume() + { + auto result = EntertainerCostume::Panda; + EntertainerCostume costumeList[EnumValue(EntertainerCostume::Count)]; + int32_t numCostumes = StaffGetAvailableEntertainerCostumeList(costumeList); + if (numCostumes > 0) { - continue; + int32_t index = UtilRand() % numCostumes; + result = costumeList[index]; } + return result; + } - auto distance = std::abs(footpathCoords.x - peep->x) + std::abs(footpathCoords.y - peep->y); - if (distance < closestPeepDistance) + static constexpr StaffNamingConvention GetStaffNamingConvention(StaffType type) + { + switch (type) { - closestPeepDistance = distance; - closestPeep = peep; + default: + case StaffType::Handyman: + return { STR_HANDYMAN_PLURAL, STR_HANDYMAN_SINGULAR, STR_HIRE_HANDYMAN }; + case StaffType::Mechanic: + return { STR_MECHANIC_PLURAL, STR_MECHANIC_SINGULAR, STR_HIRE_MECHANIC }; + case StaffType::Security: + return { STR_SECURITY_GUARD_PLURAL, STR_SECURITY_GUARD_SINGULAR, STR_HIRE_SECURITY_GUARD }; + case StaffType::Entertainer: + return { STR_ENTERTAINER_PLURAL, STR_ENTERTAINER_SINGULAR, STR_HIRE_ENTERTAINER }; } } - return closestPeep; - } - static EntertainerCostume GetRandomEntertainerCostume() - { - auto result = EntertainerCostume::Panda; - EntertainerCostume costumeList[static_cast(EntertainerCostume::Count)]; - int32_t numCostumes = StaffGetAvailableEntertainerCostumeList(costumeList); - if (numCostumes > 0) + static uint32_t GetStaffOrderBaseSprite(StaffType type) { - int32_t index = UtilRand() % numCostumes; - result = costumeList[index]; + switch (type) + { + case StaffType::Handyman: + return SPR_STAFF_ORDERS_SWEEPING; + case StaffType::Mechanic: + return SPR_STAFF_ORDERS_INSPECT_RIDES; + default: + return 0; + } } - return result; + + static uint32_t GetEntertainerCostumeSprite(PeepSpriteType type) + { + switch (type) + { + default: + case PeepSpriteType::EntertainerPanda: + return SPR_STAFF_COSTUME_PANDA; + case PeepSpriteType::EntertainerTiger: + return SPR_STAFF_COSTUME_TIGER; + case PeepSpriteType::EntertainerElephant: + return SPR_STAFF_COSTUME_ELEPHANT; + case PeepSpriteType::EntertainerRoman: + return SPR_STAFF_COSTUME_ROMAN; + case PeepSpriteType::EntertainerGorilla: + return SPR_STAFF_COSTUME_GORILLA; + case PeepSpriteType::EntertainerSnowman: + return SPR_STAFF_COSTUME_SNOWMAN; + case PeepSpriteType::EntertainerKnight: + return SPR_STAFF_COSTUME_KNIGHT; + case PeepSpriteType::EntertainerAstronaut: + return SPR_STAFF_COSTUME_ASTRONAUT; + case PeepSpriteType::EntertainerBandit: + return SPR_STAFF_COSTUME_BANDIT; + case PeepSpriteType::EntertainerSheriff: + return SPR_STAFF_COSTUME_SHERIFF; + case PeepSpriteType::EntertainerPirate: + return SPR_STAFF_COSTUME_PIRATE; + } + } + }; + + WindowBase* StaffListOpen() + { + return WindowFocusOrCreate(WindowClass::StaffList, WW, WH, WF_10 | WF_RESIZABLE); } - static constexpr StaffNamingConvention GetStaffNamingConvention(StaffType type) + void WindowStaffListRefresh() { - switch (type) + auto* window = WindowFindByClass(WindowClass::StaffList); + if (window != nullptr) { - default: - case StaffType::Handyman: - return { STR_HANDYMAN_PLURAL, STR_HANDYMAN_SINGULAR, STR_HIRE_HANDYMAN }; - case StaffType::Mechanic: - return { STR_MECHANIC_PLURAL, STR_MECHANIC_SINGULAR, STR_HIRE_MECHANIC }; - case StaffType::Security: - return { STR_SECURITY_GUARD_PLURAL, STR_SECURITY_GUARD_SINGULAR, STR_HIRE_SECURITY_GUARD }; - case StaffType::Entertainer: - return { STR_ENTERTAINER_PLURAL, STR_ENTERTAINER_SINGULAR, STR_HIRE_ENTERTAINER }; + static_cast(window)->RefreshList(); } } - - static uint32_t GetStaffOrderBaseSprite(StaffType type) - { - switch (type) - { - case StaffType::Handyman: - return SPR_STAFF_ORDERS_SWEEPING; - case StaffType::Mechanic: - return SPR_STAFF_ORDERS_INSPECT_RIDES; - default: - return 0; - } - } - - static uint32_t GetEntertainerCostumeSprite(PeepSpriteType type) - { - switch (type) - { - default: - case PeepSpriteType::EntertainerPanda: - return SPR_STAFF_COSTUME_PANDA; - case PeepSpriteType::EntertainerTiger: - return SPR_STAFF_COSTUME_TIGER; - case PeepSpriteType::EntertainerElephant: - return SPR_STAFF_COSTUME_ELEPHANT; - case PeepSpriteType::EntertainerRoman: - return SPR_STAFF_COSTUME_ROMAN; - case PeepSpriteType::EntertainerGorilla: - return SPR_STAFF_COSTUME_GORILLA; - case PeepSpriteType::EntertainerSnowman: - return SPR_STAFF_COSTUME_SNOWMAN; - case PeepSpriteType::EntertainerKnight: - return SPR_STAFF_COSTUME_KNIGHT; - case PeepSpriteType::EntertainerAstronaut: - return SPR_STAFF_COSTUME_ASTRONAUT; - case PeepSpriteType::EntertainerBandit: - return SPR_STAFF_COSTUME_BANDIT; - case PeepSpriteType::EntertainerSheriff: - return SPR_STAFF_COSTUME_SHERIFF; - case PeepSpriteType::EntertainerPirate: - return SPR_STAFF_COSTUME_PIRATE; - } - } -}; - -WindowBase* WindowStaffListOpen() -{ - return WindowFocusOrCreate(WindowClass::StaffList, WW, WH, WF_10 | WF_RESIZABLE); -} - -void WindowStaffListRefresh() -{ - auto* window = WindowFindByClass(WindowClass::StaffList); - if (window != nullptr) - { - static_cast(window)->RefreshList(); - } -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index c6dea3ad2b..ea78ce6948 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -21,405 +21,411 @@ #include #include -static constexpr int32_t WW = 250; -static constexpr int32_t WH = 90; - -enum WindowTextInputWidgetIdx +namespace OpenRCT2::Ui::Windows { - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_CANCEL, - WIDX_OKAY -}; + static constexpr int32_t WW = 250; + static constexpr int32_t WH = 90; -static Widget _textInputWidgets[] = { - WINDOW_SHIM(STR_NONE, WW, WH), - MakeWidget({ 170, 68 }, { 71, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_CANCEL), - MakeWidget({ 10, 68 }, { 71, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_OK), - WIDGETS_END, -}; - -class TextInputWindow final : public Window -{ -private: - WidgetIdentifier _parentWidget{}; - - std::string _title; - StringId _titleStringId = STR_NONE; - - std::string _description; - StringId _descriptionStringId = STR_NONE; - Formatter _descriptionArgs; - - std::function _callback; - std::function _cancelCallback; - - int32_t _cursorBlink{}; - size_t _maxInputLength{}; - u8string _buffer; - -public: - void OnOpen() override + enum WindowTextInputWidgetIdx { - widgets = _textInputWidgets; - WindowInitScrollWidgets(*this); - SetParentWindow(nullptr, 0); - } + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_CANCEL, + WIDX_OKAY + }; - void SetParentWindow(WindowBase* parentWindow, WidgetIndex widgetIndex) + static Widget _textInputWidgets[] = { + WINDOW_SHIM(STR_NONE, WW, WH), + MakeWidget({ 170, 68 }, { 71, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_CANCEL), + MakeWidget({ 10, 68 }, { 71, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_OK), + kWidgetsEnd, + }; + + class TextInputWindow final : public Window { - // Save calling window details so that the information can be passed back to the correct window & widget - if (parentWindow == nullptr) + private: + WidgetIdentifier _parentWidget{}; + + std::string _title; + StringId _titleStringId = STR_NONE; + + std::string _description; + StringId _descriptionStringId = STR_NONE; + Formatter _descriptionArgs; + + std::function _callback; + std::function _cancelCallback; + + int32_t _cursorBlink{}; + size_t _maxInputLength{}; + u8string _buffer; + + public: + void OnOpen() override { - _parentWidget.window.classification = WindowClass::Null; - _parentWidget.window.number = 0; - _parentWidget.widget_index = 0; - - colours[0] = COLOUR_GREY; - colours[1] = COLOUR_GREY; - colours[2] = COLOUR_GREY; + widgets = _textInputWidgets; + WindowInitScrollWidgets(*this); + SetParentWindow(nullptr, 0); } - else + + void SetParentWindow(WindowBase* parentWindow, WidgetIndex widgetIndex) { - _parentWidget.window.classification = parentWindow->classification; - _parentWidget.window.number = parentWindow->number; - _parentWidget.widget_index = widgetIndex; - - colours[0] = parentWindow->colours[1]; - colours[1] = parentWindow->colours[1]; - colours[2] = parentWindow->colours[1]; - } - } - - void SetTitle(StringId title, StringId description, const Formatter& decriptionArgs) - { - _titleStringId = title; - _descriptionStringId = description; - _descriptionArgs = decriptionArgs; - } - - void SetTitle(std::string_view title, std::string_view description) - { - _titleStringId = STR_NONE; - _title = title; - _descriptionStringId = STR_NONE; - _description = description; - } - - void SetText(std::string_view text, size_t maxLength) - { - text = String::UTF8TruncateCodePoints(text, maxLength); - _buffer = u8string{ text }; - _maxInputLength = maxLength; - gTextInput = ContextStartTextInput(_buffer, maxLength); - } - - void SetCallback(std::function callback, std::function cancelCallback) - { - _callback = callback; - _cancelCallback = cancelCallback; - } - - void OnClose() override - { - // Make sure that we take it out of the text input - // mode otherwise problems may occur. - ContextStopTextInput(); - } - - void OnUpdate() override - { - if (HasParentWindow()) - { - // If the calling window is closed then close the text input window - auto parentWindow = GetParentWindow(); + // Save calling window details so that the information can be passed back to the correct window & widget if (parentWindow == nullptr) { - WindowClose(*this); - return; + _parentWidget.window.classification = WindowClass::Null; + _parentWidget.window.number = 0; + _parentWidget.widget_index = 0; + + colours[0] = COLOUR_GREY; + colours[1] = COLOUR_GREY; + colours[2] = COLOUR_GREY; + } + else + { + _parentWidget.window.classification = parentWindow->classification; + _parentWidget.window.number = parentWindow->number; + _parentWidget.widget_index = widgetIndex; + + colours[0] = parentWindow->colours[1]; + colours[1] = parentWindow->colours[1]; + colours[2] = parentWindow->colours[1]; } } - // Used to blink the cursor. - _cursorBlink++; - if (_cursorBlink > 30) - _cursorBlink = 0; - - Invalidate(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + void SetTitle(StringId title, StringId description, const Formatter& decriptionArgs) { - case WIDX_CANCEL: - case WIDX_CLOSE: - ContextStopTextInput(); - ExecuteCallback(false); - WindowClose(*this); - break; - case WIDX_OKAY: - ContextStopTextInput(); - ExecuteCallback(true); - WindowClose(*this); - } - } - - void OnPrepareDraw() override - { - // Change window size if required. - int32_t newHeight = CalculateWindowHeight(_buffer.data()); - if (newHeight != height) - { - WindowSetResize(*this, WW, newHeight, WW, newHeight); + _titleStringId = title; + _descriptionStringId = description; + _descriptionArgs = decriptionArgs; } - widgets[WIDX_OKAY].top = newHeight - 22; - widgets[WIDX_OKAY].bottom = newHeight - 9; - widgets[WIDX_CANCEL].top = newHeight - 22; - widgets[WIDX_CANCEL].bottom = newHeight - 9; - widgets[WIDX_BACKGROUND].bottom = newHeight - 1; - - // Set window title argument - if (_titleStringId == STR_NONE) + void SetTitle(std::string_view title, std::string_view description) { - auto ft = Formatter::Common(); - ft.Add(_title.c_str()); - widgets[WIDX_TITLE].text = STR_STRING; - } - else - { - widgets[WIDX_TITLE].text = _titleStringId; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - - ScreenCoordsXY screenCoords; - screenCoords.y = windowPos.y + 25; - - int32_t no_lines = 0; - - if (_descriptionStringId == STR_NONE) - { - auto ft = Formatter(); - ft.Add(_description.c_str()); - DrawTextWrapped( - dpi, { windowPos.x + WW / 2, screenCoords.y }, WW, STR_STRING, ft, { colours[1], TextAlignment::CENTRE }); - } - else - { - DrawTextWrapped( - dpi, { windowPos.x + WW / 2, screenCoords.y }, WW, _descriptionStringId, _descriptionArgs, - { colours[1], TextAlignment::CENTRE }); + _titleStringId = STR_NONE; + _title = title; + _descriptionStringId = STR_NONE; + _description = description; } - screenCoords.y += 25; - - // String length needs to add 12 either side of box - // +13 for cursor when max length. - u8string wrappedString; - GfxWrapString( - u8string_view{ _buffer.data(), _buffer.size() }, WW - (24 + 13), FontStyle::Medium, &wrappedString, &no_lines); - - GfxFillRectInset( - dpi, { { windowPos.x + 10, screenCoords.y }, { windowPos.x + WW - 10, screenCoords.y + 10 * (no_lines + 1) + 3 } }, - colours[1], INSET_RECT_F_60); - - screenCoords.y += 1; - - const utf8* wrapPointer = wrappedString.data(); - size_t char_count = 0; - uint8_t cur_drawn = 0; - - int32_t cursorX = 0; - int32_t cursorY = 0; - for (int32_t line = 0; line <= no_lines; line++) + void SetText(std::string_view text, size_t maxLength) { - screenCoords.x = windowPos.x + 12; - DrawText(dpi, screenCoords, { colours[1], FontStyle::Medium, TextAlignment::LEFT }, wrapPointer, true); + text = String::UTF8TruncateCodePoints(text, maxLength); + _buffer = u8string{ text }; + _maxInputLength = maxLength; + gTextInput = ContextStartTextInput(_buffer, maxLength); + } - size_t string_length = GetStringSize(wrapPointer) - 1; + void SetCallback(std::function callback, std::function cancelCallback) + { + _callback = callback; + _cancelCallback = cancelCallback; + } - if (!cur_drawn && (gTextInput->SelectionStart <= char_count + string_length)) + void OnClose() override + { + // Make sure that we take it out of the text input + // mode otherwise problems may occur. + ContextStopTextInput(); + } + + void OnUpdate() override + { + if (HasParentWindow()) { - // Make a view of the string for measuring the width. - cursorX = windowPos.x + 13 - + GfxGetStringWidthNoFormatting( - u8string_view{ wrapPointer, gTextInput->SelectionStart - char_count }, FontStyle::Medium); - cursorY = screenCoords.y; - - int32_t textWidth = 6; - if (gTextInput->SelectionStart < strlen(_buffer.data())) + // If the calling window is closed then close the text input window + auto parentWindow = GetParentWindow(); + if (parentWindow == nullptr) { - // Make a 1 utf8-character wide string for measuring the width - // of the currently selected character. - utf8 tmp[5] = {}; // This is easier than setting temp_string[0..5] - uint32_t codepoint = UTF8GetNext(_buffer.data() + gTextInput->SelectionStart, nullptr); - UTF8WriteCodepoint(tmp, codepoint); - textWidth = std::max(GfxGetStringWidthNoFormatting(tmp, FontStyle::Medium) - 2, 4); + WindowClose(*this); + return; + } + } + + // Used to blink the cursor. + _cursorBlink++; + if (_cursorBlink > 30) + _cursorBlink = 0; + + Invalidate(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CANCEL: + case WIDX_CLOSE: + ContextStopTextInput(); + ExecuteCallback(false); + WindowClose(*this); + break; + case WIDX_OKAY: + ContextStopTextInput(); + ExecuteCallback(true); + WindowClose(*this); + } + } + + void OnPrepareDraw() override + { + // Change window size if required. + int32_t newHeight = CalculateWindowHeight(_buffer.data()); + if (newHeight != height) + { + WindowSetResize(*this, WW, newHeight, WW, newHeight); + } + + widgets[WIDX_OKAY].top = newHeight - 22; + widgets[WIDX_OKAY].bottom = newHeight - 9; + widgets[WIDX_CANCEL].top = newHeight - 22; + widgets[WIDX_CANCEL].bottom = newHeight - 9; + widgets[WIDX_BACKGROUND].bottom = newHeight - 1; + + // Set window title argument + if (_titleStringId == STR_NONE) + { + auto ft = Formatter::Common(); + ft.Add(_title.c_str()); + widgets[WIDX_TITLE].text = STR_STRING; + } + else + { + widgets[WIDX_TITLE].text = _titleStringId; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + ScreenCoordsXY screenCoords; + screenCoords.y = windowPos.y + 25; + + int32_t no_lines = 0; + + if (_descriptionStringId == STR_NONE) + { + auto ft = Formatter(); + ft.Add(_description.c_str()); + DrawTextWrapped( + dpi, { windowPos.x + WW / 2, screenCoords.y }, WW, STR_STRING, ft, { colours[1], TextAlignment::CENTRE }); + } + else + { + DrawTextWrapped( + dpi, { windowPos.x + WW / 2, screenCoords.y }, WW, _descriptionStringId, _descriptionArgs, + { colours[1], TextAlignment::CENTRE }); + } + + screenCoords.y += 25; + + // String length needs to add 12 either side of box + // +13 for cursor when max length. + u8string wrappedString; + GfxWrapString( + u8string_view{ _buffer.data(), _buffer.size() }, WW - (24 + 13), FontStyle::Medium, &wrappedString, &no_lines); + + GfxFillRectInset( + dpi, + { { windowPos.x + 10, screenCoords.y }, { windowPos.x + WW - 10, screenCoords.y + 10 * (no_lines + 1) + 3 } }, + colours[1], INSET_RECT_F_60); + + screenCoords.y += 1; + + const utf8* wrapPointer = wrappedString.data(); + size_t char_count = 0; + uint8_t cur_drawn = 0; + + int32_t cursorX = 0; + int32_t cursorY = 0; + for (int32_t line = 0; line <= no_lines; line++) + { + screenCoords.x = windowPos.x + 12; + DrawText(dpi, screenCoords, { colours[1], FontStyle::Medium, TextAlignment::LEFT }, wrapPointer, true); + + size_t string_length = GetStringSize(wrapPointer) - 1; + + if (!cur_drawn && (gTextInput->SelectionStart <= char_count + string_length)) + { + // Make a view of the string for measuring the width. + cursorX = windowPos.x + 13 + + GfxGetStringWidthNoFormatting( + u8string_view{ wrapPointer, gTextInput->SelectionStart - char_count }, FontStyle::Medium); + cursorY = screenCoords.y; + + int32_t textWidth = 6; + if (gTextInput->SelectionStart < strlen(_buffer.data())) + { + // Make a 1 utf8-character wide string for measuring the width + // of the currently selected character. + utf8 tmp[5] = {}; // This is easier than setting temp_string[0..5] + uint32_t codepoint = UTF8GetNext(_buffer.data() + gTextInput->SelectionStart, nullptr); + UTF8WriteCodepoint(tmp, codepoint); + textWidth = std::max(GfxGetStringWidthNoFormatting(tmp, FontStyle::Medium) - 2, 4); + } + + if (_cursorBlink > 15) + { + uint8_t colour = ColourMapA[colours[1]].mid_light; + // TODO: palette index addition + GfxFillRect( + dpi, { { cursorX, screenCoords.y + 9 }, { cursorX + textWidth, screenCoords.y + 9 } }, colour + 5); + } + + cur_drawn++; } - if (_cursorBlink > 15) - { - uint8_t colour = ColourMapA[colours[1]].mid_light; - // TODO: palette index addition - GfxFillRect( - dpi, { { cursorX, screenCoords.y + 9 }, { cursorX + textWidth, screenCoords.y + 9 } }, colour + 5); - } + wrapPointer += string_length + 1; - cur_drawn++; + if (_buffer[char_count + string_length] == ' ') + char_count++; + char_count += string_length; + + screenCoords.y += 10; } - wrapPointer += string_length + 1; - - if (_buffer[char_count + string_length] == ' ') - char_count++; - char_count += string_length; - - screenCoords.y += 10; - } - - if (!cur_drawn) - { - cursorX = dpi.lastStringPos.x; - cursorY = screenCoords.y - 10; - } - - // IME composition - if (!String::IsNullOrEmpty(gTextInput->ImeBuffer)) - { - IMEComposition(cursorX, cursorY); - } - } - - void OnReturnPressed() - { - ContextStopTextInput(); - ExecuteCallback(true); - WindowClose(*this); - } - - static int32_t CalculateWindowHeight(std::string_view text) - { - // String length needs to add 12 either side of box +13 for cursor when max length. - int32_t numLines{}; - GfxWrapString(text, WW - (24 + 13), FontStyle::Medium, nullptr, &numLines); - return numLines * 10 + WH; - } - - void OnResize() override - { - ResizeFrame(); - } - -private: - static void IMEComposition(int32_t cursorX, int32_t cursorY) - { - SDL_Rect rect = { cursorX, cursorY, 100, 100 }; - SDL_SetTextInputRect(&rect); - } - - void ExecuteCallback(bool hasValue) - { - if (HasParentWindow()) - { - auto w = GetParentWindow(); - if (w != nullptr) + if (!cur_drawn) { - auto value = hasValue ? _buffer.data() : nullptr; - WindowEventTextinputCall(w, _parentWidget.widget_index, value); + cursorX = dpi.lastStringPos.x; + cursorY = screenCoords.y - 10; + } + + // IME composition + if (!String::IsNullOrEmpty(gTextInput->ImeBuffer)) + { + IMEComposition(cursorX, cursorY); } } - else + + void OnReturnPressed() { - if (hasValue) + ContextStopTextInput(); + ExecuteCallback(true); + WindowClose(*this); + } + + static int32_t CalculateWindowHeight(std::string_view text) + { + // String length needs to add 12 either side of box +13 for cursor when max length. + int32_t numLines{}; + GfxWrapString(text, WW - (24 + 13), FontStyle::Medium, nullptr, &numLines); + return numLines * 10 + WH; + } + + void OnResize() override + { + ResizeFrame(); + } + + private: + static void IMEComposition(int32_t cursorX, int32_t cursorY) + { + SDL_Rect rect = { cursorX, cursorY, 100, 100 }; + SDL_SetTextInputRect(&rect); + } + + void ExecuteCallback(bool hasValue) + { + if (HasParentWindow()) { - if (_callback) + if (hasValue) { - _callback(_buffer.data()); + auto w = GetParentWindow(); + if (w != nullptr) + { + w->OnTextInput(_parentWidget.widget_index, _buffer); + } } } else { - if (_cancelCallback) + if (hasValue) { - _cancelCallback(); + if (_callback) + { + _callback(_buffer.data()); + } + } + else + { + if (_cancelCallback) + { + _cancelCallback(); + } } } } - } - bool HasParentWindow() const - { - return _parentWidget.window.classification != WindowClass::Null; - } - - WindowBase* GetParentWindow() const - { - return HasParentWindow() ? WindowFindByNumber(_parentWidget.window.classification, _parentWidget.window.number) - : nullptr; - } -}; - -void WindowTextInputRawOpen( - WindowBase* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, - const_utf8string existing_text, int32_t maxLength) -{ - WindowCloseByClass(WindowClass::Textinput); - - auto height = TextInputWindow::CalculateWindowHeight(existing_text); - auto w = WindowCreate(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); - if (w != nullptr) - { - w->SetParentWindow(call_w, call_widget); - w->SetTitle(title, description, descriptionArgs); - w->SetText(existing_text, maxLength); - } -} - -void WindowTextInputOpen( - std::string_view title, std::string_view description, std::string_view initialValue, size_t maxLength, - std::function callback, std::function cancelCallback) -{ - auto height = TextInputWindow::CalculateWindowHeight(initialValue); - auto w = WindowCreate(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); - if (w != nullptr) - { - w->SetTitle(title, description); - w->SetText(initialValue, maxLength); - w->SetCallback(callback, cancelCallback); - } -} - -void WindowTextInputOpen( - WindowBase* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, - StringId existing_text, uintptr_t existing_args, int32_t maxLength) -{ - auto existingText = FormatStringID(existing_text, &existing_args); - WindowTextInputRawOpen(call_w, call_widget, title, description, descriptionArgs, existingText.c_str(), maxLength); -} - -void WindowTextInputKey(WindowBase* w, uint32_t keycode) -{ - const auto wndNumber = w->number; - const auto wndClass = w->classification; - - // If the return button is pressed stop text input - if (keycode == SDLK_RETURN || keycode == SDLK_KP_ENTER) - { - if (w->classification == WindowClass::Textinput) + bool HasParentWindow() const { - auto textInputWindow = static_cast(w); - textInputWindow->OnReturnPressed(); + return _parentWidget.window.classification != WindowClass::Null; + } + + WindowBase* GetParentWindow() const + { + return HasParentWindow() ? WindowFindByNumber(_parentWidget.window.classification, _parentWidget.window.number) + : nullptr; + } + }; + + void WindowTextInputRawOpen( + WindowBase* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, + const_utf8string existing_text, int32_t maxLength) + { + WindowCloseByClass(WindowClass::Textinput); + + auto height = TextInputWindow::CalculateWindowHeight(existing_text); + auto w = WindowCreate(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); + if (w != nullptr) + { + w->SetParentWindow(call_w, call_widget); + w->SetTitle(title, description, descriptionArgs); + w->SetText(existing_text, maxLength); } } - // The window can be potentially closed within a callback, we need to check if its still alive. - w = WindowFindByNumber(wndClass, wndNumber); - if (w != nullptr) - w->Invalidate(); -} + void WindowTextInputOpen( + std::string_view title, std::string_view description, std::string_view initialValue, size_t maxLength, + std::function callback, std::function cancelCallback) + { + auto height = TextInputWindow::CalculateWindowHeight(initialValue); + auto w = WindowCreate(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); + if (w != nullptr) + { + w->SetTitle(title, description); + w->SetText(initialValue, maxLength); + w->SetCallback(callback, cancelCallback); + } + } + + void WindowTextInputOpen( + WindowBase* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, + StringId existing_text, uintptr_t existing_args, int32_t maxLength) + { + auto existingText = FormatStringIDLegacy(existing_text, &existing_args); + WindowTextInputRawOpen(call_w, call_widget, title, description, descriptionArgs, existingText.c_str(), maxLength); + } + + void WindowTextInputKey(WindowBase* w, uint32_t keycode) + { + const auto wndNumber = w->number; + const auto wndClass = w->classification; + + // If the return button is pressed stop text input + if (keycode == SDLK_RETURN || keycode == SDLK_KP_ENTER) + { + if (w->classification == WindowClass::Textinput) + { + auto textInputWindow = static_cast(w); + textInputWindow->OnReturnPressed(); + } + } + + // The window can be potentially closed within a callback, we need to check if its still alive. + w = WindowFindByNumber(wndClass, wndNumber); + if (w != nullptr) + w->Invalidate(); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 9b778f30fd..52958a812c 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -22,55 +22,57 @@ #include #include -enum +namespace OpenRCT2::Ui::Windows { - WINDOW_THEMES_TAB_SETTINGS, - WINDOW_THEMES_TAB_MAIN_UI, - WINDOW_THEMES_TAB_PARK, - WINDOW_THEMES_TAB_TOOLS, - WINDOW_THEMES_TAB_RIDES_PEEPS, - WINDOW_THEMES_TAB_EDITORS, - WINDOW_THEMES_TAB_MISC, - WINDOW_THEMES_TAB_PROMPTS, - WINDOW_THEMES_TAB_FEATURES, - WINDOW_THEMES_TAB_COUNT -}; + enum + { + WINDOW_THEMES_TAB_SETTINGS, + WINDOW_THEMES_TAB_MAIN_UI, + WINDOW_THEMES_TAB_PARK, + WINDOW_THEMES_TAB_TOOLS, + WINDOW_THEMES_TAB_RIDES_PEEPS, + WINDOW_THEMES_TAB_EDITORS, + WINDOW_THEMES_TAB_MISC, + WINDOW_THEMES_TAB_PROMPTS, + WINDOW_THEMES_TAB_FEATURES, + WINDOW_THEMES_TAB_COUNT + }; -enum WindowThemesWidgetIdx -{ - WIDX_THEMES_BACKGROUND, - WIDX_THEMES_TITLE, - WIDX_THEMES_CLOSE, - WIDX_THEMES_TAB_CONTENT_PANEL, - WIDX_THEMES_SETTINGS_TAB, - WIDX_THEMES_MAIN_UI_TAB, - WIDX_THEMES_PARK_TAB, - WIDX_THEMES_TOOLS_TAB, - WIDX_THEMES_RIDE_PEEPS_TAB, - WIDX_THEMES_EDITORS_TAB, - WIDX_THEMES_MISC_TAB, - WIDX_THEMES_PROMPTS_TAB, - WIDX_THEMES_FEATURES_TAB, - WIDX_THEMES_HEADER_WINDOW, - WIDX_THEMES_HEADER_PALETTE, - WIDX_THEMES_PRESETS, - WIDX_THEMES_PRESETS_DROPDOWN, - WIDX_THEMES_DUPLICATE_BUTTON, - WIDX_THEMES_DELETE_BUTTON, - WIDX_THEMES_RENAME_BUTTON, - WIDX_THEMES_COLOURBTN_MASK, - WIDX_THEMES_LIST, - WIDX_THEMES_RCT1_RIDE_LIGHTS, - WIDX_THEMES_RCT1_PARK_LIGHTS, - WIDX_THEMES_RCT1_SCENARIO_FONT, - WIDX_THEMES_RCT1_BOTTOM_TOOLBAR -}; + enum WindowThemesWidgetIdx + { + WIDX_THEMES_BACKGROUND, + WIDX_THEMES_TITLE, + WIDX_THEMES_CLOSE, + WIDX_THEMES_TAB_CONTENT_PANEL, + WIDX_THEMES_SETTINGS_TAB, + WIDX_THEMES_MAIN_UI_TAB, + WIDX_THEMES_PARK_TAB, + WIDX_THEMES_TOOLS_TAB, + WIDX_THEMES_RIDE_PEEPS_TAB, + WIDX_THEMES_EDITORS_TAB, + WIDX_THEMES_MISC_TAB, + WIDX_THEMES_PROMPTS_TAB, + WIDX_THEMES_FEATURES_TAB, + WIDX_THEMES_HEADER_WINDOW, + WIDX_THEMES_HEADER_PALETTE, + WIDX_THEMES_PRESETS, + WIDX_THEMES_PRESETS_DROPDOWN, + WIDX_THEMES_DUPLICATE_BUTTON, + WIDX_THEMES_DELETE_BUTTON, + WIDX_THEMES_RENAME_BUTTON, + WIDX_THEMES_COLOURBTN_MASK, + WIDX_THEMES_LIST, + WIDX_THEMES_RCT1_RIDE_LIGHTS, + WIDX_THEMES_RCT1_PARK_LIGHTS, + WIDX_THEMES_RCT1_SCENARIO_FONT, + WIDX_THEMES_RCT1_BOTTOM_TOOLBAR + }; -static constexpr StringId WINDOW_TITLE = STR_THEMES_TITLE; -static constexpr int32_t WW = 320; -static constexpr int32_t WH = 107; + static constexpr StringId WINDOW_TITLE = STR_THEMES_TITLE; + static constexpr int32_t WW = 320; + static constexpr int32_t WH = 107; -// clang-format off + // clang-format off static Widget _themesWidgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, {320, 64}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab content panel @@ -96,7 +98,7 @@ static Widget _themesWidgets[] = { MakeWidget({ 10, 69}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_PARK_CONTROLS ), // rct1 park lights MakeWidget({ 10, 84}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_SCENARIO_SELECTION_FONT ), // rct1 scenario font MakeWidget({ 10, 99}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_BOTTOM_TOOLBAR ), // rct1 bottom toolbar - WIDGETS_END, + kWidgetsEnd, }; #pragma region Tabs @@ -219,665 +221,669 @@ static WindowClass window_themes_tab_7_classes[] = { WindowClass::LoadsaveOverwritePrompt, WindowClass::NetworkStatus, }; -// clang-format on + // clang-format on -static WindowClass* window_themes_tab_classes[] = { - nullptr, - window_themes_tab_1_classes, - window_themes_tab_2_classes, - window_themes_tab_3_classes, - window_themes_tab_4_classes, - window_themes_tab_5_classes, - window_themes_tab_6_classes, - window_themes_tab_7_classes, -}; + static WindowClass* window_themes_tab_classes[] = { + nullptr, + window_themes_tab_1_classes, + window_themes_tab_2_classes, + window_themes_tab_3_classes, + window_themes_tab_4_classes, + window_themes_tab_5_classes, + window_themes_tab_6_classes, + window_themes_tab_7_classes, + }; #pragma endregion -class ThemesWindow final : public Window -{ -private: - uint8_t _selected_tab = 0; - int16_t _colour_index_1 = -1; - int8_t _colour_index_2 = -1; - const uint8_t _row_height = 32; - const uint8_t _button_offset_x = 220; - const uint8_t _button_offset_y = 3; - const uint8_t _check_offset_y = 3 + 12 + 2; + class ThemesWindow final : public Window + { + private: + uint8_t _selected_tab = 0; + int16_t _colour_index_1 = -1; + int8_t _colour_index_2 = -1; + const uint8_t _row_height = 32; + const uint8_t _button_offset_x = 220; + const uint8_t _button_offset_y = 3; + const uint8_t _check_offset_y = 3 + 12 + 2; -public: + public: #pragma region Window Override Events - void OnOpen() override - { - widgets = _themesWidgets; - - WindowThemesInitVars(); - - WindowInitScrollWidgets(*this); - list_information_type = 0; - _colour_index_1 = -1; - _colour_index_2 = -1; - min_width = 320; - min_height = 107; - max_width = 320; - max_height = 107; - } - - void OnResize() override - { - if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) + void OnOpen() override { + widgets = _themesWidgets; + + WindowThemesInitVars(); + + WindowInitScrollWidgets(*this); + list_information_type = 0; + _colour_index_1 = -1; + _colour_index_2 = -1; min_width = 320; min_height = 107; max_width = 320; max_height = 107; - - if (width < min_width) - { - width = min_width; - GfxInvalidateScreen(); - } - if (height < min_height) - { - height = min_height; - GfxInvalidateScreen(); - } - if (width > max_width) - { - width = max_width; - GfxInvalidateScreen(); - } - if (height > max_height) - { - height = max_height; - GfxInvalidateScreen(); - } - } - else if (_selected_tab == WINDOW_THEMES_TAB_FEATURES) - { - min_width = 320; - min_height = 122; - max_width = 320; - max_height = 122; - - if (width < min_width) - { - width = min_width; - GfxInvalidateScreen(); - } - if (height < min_height) - { - height = min_height; - GfxInvalidateScreen(); - } - if (width > max_width) - { - width = max_width; - GfxInvalidateScreen(); - } - if (height > max_height) - { - height = max_height; - GfxInvalidateScreen(); - } - } - else - { - min_width = 320; - min_height = 270; - max_width = 320; - max_height = 450; - - if (width < min_width) - { - width = min_width; - Invalidate(); - } - if (height < min_height) - { - height = min_height; - Invalidate(); - } - if (width > max_width) - { - width = max_width; - Invalidate(); - } - if (height > max_height) - { - height = max_height; - Invalidate(); - } } - ResizeFrameWithPage(); - } - - void OnUpdate() override - { - frame_no++; - if (frame_no >= window_themes_tab_animation_loops[_selected_tab]) - frame_no = 0; - - WidgetInvalidate(*this, WIDX_THEMES_SETTINGS_TAB + _selected_tab); - } - - void OnPrepareDraw() override - { - int32_t pressedWidgets = pressed_widgets - & ~((1LL << WIDX_THEMES_SETTINGS_TAB) | (1LL << WIDX_THEMES_MAIN_UI_TAB) | (1LL << WIDX_THEMES_PARK_TAB) - | (1LL << WIDX_THEMES_TOOLS_TAB) | (1LL << WIDX_THEMES_RIDE_PEEPS_TAB) | (1LL << WIDX_THEMES_EDITORS_TAB) - | (1LL << WIDX_THEMES_MISC_TAB) | (1LL << WIDX_THEMES_PROMPTS_TAB) | (1LL << WIDX_THEMES_FEATURES_TAB)); - WidgetIndex widgetIndex = _selected_tab + WIDX_THEMES_SETTINGS_TAB; - - pressed_widgets = pressedWidgets | (1 << widgetIndex); - - if (WindowFindByClass(WindowClass::Dropdown) == nullptr) + void OnResize() override { - _colour_index_1 = -1; - _colour_index_2 = -1; + if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) + { + min_width = 320; + min_height = 107; + max_width = 320; + max_height = 107; + + if (width < min_width) + { + width = min_width; + GfxInvalidateScreen(); + } + if (height < min_height) + { + height = min_height; + GfxInvalidateScreen(); + } + if (width > max_width) + { + width = max_width; + GfxInvalidateScreen(); + } + if (height > max_height) + { + height = max_height; + GfxInvalidateScreen(); + } + } + else if (_selected_tab == WINDOW_THEMES_TAB_FEATURES) + { + min_width = 320; + min_height = 122; + max_width = 320; + max_height = 122; + + if (width < min_width) + { + width = min_width; + GfxInvalidateScreen(); + } + if (height < min_height) + { + height = min_height; + GfxInvalidateScreen(); + } + if (width > max_width) + { + width = max_width; + GfxInvalidateScreen(); + } + if (height > max_height) + { + height = max_height; + GfxInvalidateScreen(); + } + } + else + { + min_width = 320; + min_height = 270; + max_width = 320; + max_height = 450; + + if (width < min_width) + { + width = min_width; + Invalidate(); + } + if (height < min_height) + { + height = min_height; + Invalidate(); + } + if (width > max_width) + { + width = max_width; + Invalidate(); + } + if (height > max_height) + { + height = max_height; + Invalidate(); + } + } + + ResizeFrameWithPage(); } - ResizeFrameWithPage(); - widgets[WIDX_THEMES_LIST].right = width - 4; - widgets[WIDX_THEMES_LIST].bottom = height - 0x0F; - - if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) + void OnUpdate() override { - widgets[WIDX_THEMES_HEADER_WINDOW].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_HEADER_PALETTE].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_LIST].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_RCT1_BOTTOM_TOOLBAR].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WindowWidgetType::Button; - widgets[WIDX_THEMES_DELETE_BUTTON].type = WindowWidgetType::Button; - widgets[WIDX_THEMES_RENAME_BUTTON].type = WindowWidgetType::Button; - widgets[WIDX_THEMES_PRESETS].type = WindowWidgetType::DropdownMenu; - widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WindowWidgetType::Button; - widgets[WIDX_THEMES_COLOURBTN_MASK].type = WindowWidgetType::Empty; - } - else if (_selected_tab == WINDOW_THEMES_TAB_FEATURES) - { - widgets[WIDX_THEMES_HEADER_WINDOW].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_HEADER_PALETTE].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_LIST].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WindowWidgetType::Checkbox; - widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WindowWidgetType::Checkbox; - widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WindowWidgetType::Checkbox; - widgets[WIDX_THEMES_RCT1_BOTTOM_TOOLBAR].type = WindowWidgetType::Checkbox; - widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_DELETE_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_RENAME_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_PRESETS].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_COLOURBTN_MASK].type = WindowWidgetType::Empty; - - WidgetSetCheckboxValue(*this, WIDX_THEMES_RCT1_RIDE_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE); - WidgetSetCheckboxValue(*this, WIDX_THEMES_RCT1_PARK_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK); - WidgetSetCheckboxValue( - *this, WIDX_THEMES_RCT1_SCENARIO_FONT, ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT); - WidgetSetCheckboxValue( - *this, WIDX_THEMES_RCT1_BOTTOM_TOOLBAR, ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR); - } - else - { - widgets[WIDX_THEMES_HEADER_WINDOW].type = WindowWidgetType::TableHeader; - widgets[WIDX_THEMES_HEADER_PALETTE].type = WindowWidgetType::TableHeader; - widgets[WIDX_THEMES_LIST].type = WindowWidgetType::Scroll; - widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_RCT1_BOTTOM_TOOLBAR].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_DELETE_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_RENAME_BUTTON].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_PRESETS].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WindowWidgetType::Empty; - widgets[WIDX_THEMES_COLOURBTN_MASK].type = WindowWidgetType::Empty; - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - // Widgets - WindowDrawWidgets(*this, dpi); - WindowThemesDrawTabImages(dpi); - - if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) - { - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 10, widgets[WIDX_THEMES_PRESETS].top + 1 }, STR_THEMES_LABEL_CURRENT_THEME, {}, - { colours[1] }); - - size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); - const utf8* activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); - auto ft = Formatter(); - ft.Add(activeThemeName); - - auto screenPos = windowPos - + ScreenCoordsXY{ widgets[WIDX_THEMES_PRESETS].left + 1, widgets[WIDX_THEMES_PRESETS].top }; - auto newWidth = windowPos.x + widgets[WIDX_THEMES_PRESETS_DROPDOWN].left - widgets[WIDX_THEMES_PRESETS].left - 4; - - DrawTextEllipsised(dpi, screenPos, newWidth, STR_STRING, ft, { colours[1] }); - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - int16_t newSelectedTab; - int32_t num_items; - auto widget = &widgets[widgetIndex]; - - switch (widgetIndex) - { - case WIDX_THEMES_SETTINGS_TAB: - case WIDX_THEMES_MAIN_UI_TAB: - case WIDX_THEMES_PARK_TAB: - case WIDX_THEMES_TOOLS_TAB: - case WIDX_THEMES_RIDE_PEEPS_TAB: - case WIDX_THEMES_EDITORS_TAB: - case WIDX_THEMES_MISC_TAB: - case WIDX_THEMES_PROMPTS_TAB: - case WIDX_THEMES_FEATURES_TAB: - newSelectedTab = widgetIndex - WIDX_THEMES_SETTINGS_TAB; - if (_selected_tab == newSelectedTab) - break; - _selected_tab = static_cast(newSelectedTab); - scrolls[0].v_top = 0; + frame_no++; + if (frame_no >= window_themes_tab_animation_loops[_selected_tab]) frame_no = 0; - WindowEventResizeCall(this); - Invalidate(); - break; - case WIDX_THEMES_PRESETS_DROPDOWN: - ThemeManagerLoadAvailableThemes(); - num_items = static_cast(ThemeManagerGetNumAvailableThemes()); - widget--; - for (int32_t i = 0; i < num_items; i++) - { - gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItems[i].Args = reinterpret_cast(ThemeManagerGetAvailableThemeName(i)); - } - - WindowDropdownShowTextCustomWidth( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, num_items, widget->width() - 3); - - Dropdown::SetChecked(static_cast(ThemeManagerGetAvailableThemeIndex()), true); - break; - case WIDX_THEMES_RCT1_RIDE_LIGHTS: - if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) - { - ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); - } - else - { - ThemeSetFlags(ThemeGetFlags() ^ UITHEME_FLAG_USE_LIGHTS_RIDE); - ThemeSave(); - WindowInvalidateAll(); - } - break; - case WIDX_THEMES_RCT1_PARK_LIGHTS: - if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) - { - ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); - } - else - { - ThemeSetFlags(ThemeGetFlags() ^ static_cast(UITHEME_FLAG_USE_LIGHTS_PARK)); - ThemeSave(); - WindowInvalidateAll(); - } - break; - case WIDX_THEMES_RCT1_SCENARIO_FONT: - if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) - { - ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); - } - else - { - ThemeSetFlags(ThemeGetFlags() ^ static_cast(UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT)); - ThemeSave(); - WindowInvalidateAll(); - } - break; - case WIDX_THEMES_RCT1_BOTTOM_TOOLBAR: - if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) - { - ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); - } - else - { - ThemeSetFlags(ThemeGetFlags() ^ static_cast(UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR)); - ThemeSave(); - WindowInvalidateAll(); - } + WidgetInvalidate(*this, WIDX_THEMES_SETTINGS_TAB + _selected_tab); } - } - void OnMouseUp(WidgetIndex widgetIndex) override - { - size_t activeAvailableThemeIndex; - const utf8* activeThemeName; - - switch (widgetIndex) + void OnPrepareDraw() override { - case WIDX_THEMES_CLOSE: - Close(); - break; - case WIDX_THEMES_DUPLICATE_BUTTON:; - activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); - activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); - WindowTextInputOpen( - this, widgetIndex, STR_THEMES_ACTION_DUPLICATE, STR_THEMES_PROMPT_ENTER_THEME_NAME, {}, STR_STRING, - reinterpret_cast(activeThemeName), 64); - break; - case WIDX_THEMES_DELETE_BUTTON: - if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) - { - ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); - } - else - { - ThemeDelete(); - } - break; - case WIDX_THEMES_RENAME_BUTTON: - if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) - { - ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); - } - else - { + int32_t pressedWidgets = pressed_widgets + & ~((1LL << WIDX_THEMES_SETTINGS_TAB) | (1LL << WIDX_THEMES_MAIN_UI_TAB) | (1LL << WIDX_THEMES_PARK_TAB) + | (1LL << WIDX_THEMES_TOOLS_TAB) | (1LL << WIDX_THEMES_RIDE_PEEPS_TAB) | (1LL << WIDX_THEMES_EDITORS_TAB) + | (1LL << WIDX_THEMES_MISC_TAB) | (1LL << WIDX_THEMES_PROMPTS_TAB) | (1LL << WIDX_THEMES_FEATURES_TAB)); + WidgetIndex widgetIndex = _selected_tab + WIDX_THEMES_SETTINGS_TAB; + + pressed_widgets = pressedWidgets | (1 << widgetIndex); + + if (WindowFindByClass(WindowClass::Dropdown) == nullptr) + { + _colour_index_1 = -1; + _colour_index_2 = -1; + } + + ResizeFrameWithPage(); + widgets[WIDX_THEMES_LIST].right = width - 4; + widgets[WIDX_THEMES_LIST].bottom = height - 0x0F; + + if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) + { + widgets[WIDX_THEMES_HEADER_WINDOW].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_HEADER_PALETTE].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_LIST].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_RCT1_BOTTOM_TOOLBAR].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WindowWidgetType::Button; + widgets[WIDX_THEMES_DELETE_BUTTON].type = WindowWidgetType::Button; + widgets[WIDX_THEMES_RENAME_BUTTON].type = WindowWidgetType::Button; + widgets[WIDX_THEMES_PRESETS].type = WindowWidgetType::DropdownMenu; + widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WindowWidgetType::Button; + widgets[WIDX_THEMES_COLOURBTN_MASK].type = WindowWidgetType::Empty; + } + else if (_selected_tab == WINDOW_THEMES_TAB_FEATURES) + { + widgets[WIDX_THEMES_HEADER_WINDOW].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_HEADER_PALETTE].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_LIST].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WindowWidgetType::Checkbox; + widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WindowWidgetType::Checkbox; + widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WindowWidgetType::Checkbox; + widgets[WIDX_THEMES_RCT1_BOTTOM_TOOLBAR].type = WindowWidgetType::Checkbox; + widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_DELETE_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_RENAME_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_PRESETS].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_COLOURBTN_MASK].type = WindowWidgetType::Empty; + + WidgetSetCheckboxValue(*this, WIDX_THEMES_RCT1_RIDE_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE); + WidgetSetCheckboxValue(*this, WIDX_THEMES_RCT1_PARK_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK); + WidgetSetCheckboxValue( + *this, WIDX_THEMES_RCT1_SCENARIO_FONT, ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT); + WidgetSetCheckboxValue( + *this, WIDX_THEMES_RCT1_BOTTOM_TOOLBAR, ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR); + } + else + { + widgets[WIDX_THEMES_HEADER_WINDOW].type = WindowWidgetType::TableHeader; + widgets[WIDX_THEMES_HEADER_PALETTE].type = WindowWidgetType::TableHeader; + widgets[WIDX_THEMES_LIST].type = WindowWidgetType::Scroll; + widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_RCT1_BOTTOM_TOOLBAR].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_DELETE_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_RENAME_BUTTON].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_PRESETS].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WindowWidgetType::Empty; + widgets[WIDX_THEMES_COLOURBTN_MASK].type = WindowWidgetType::Empty; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + // Widgets + WindowDrawWidgets(*this, dpi); + WindowThemesDrawTabImages(dpi); + + if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) + { + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 10, widgets[WIDX_THEMES_PRESETS].top + 1 }, STR_THEMES_LABEL_CURRENT_THEME, + {}, { colours[1] }); + + size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); + const utf8* activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); + auto ft = Formatter(); + ft.Add(activeThemeName); + + auto screenPos = windowPos + + ScreenCoordsXY{ widgets[WIDX_THEMES_PRESETS].left + 1, widgets[WIDX_THEMES_PRESETS].top }; + auto newWidth = windowPos.x + widgets[WIDX_THEMES_PRESETS_DROPDOWN].left - widgets[WIDX_THEMES_PRESETS].left + - 4; + + DrawTextEllipsised(dpi, screenPos, newWidth, STR_STRING, ft, { colours[1] }); + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + int16_t newSelectedTab; + int32_t num_items; + auto widget = &widgets[widgetIndex]; + + switch (widgetIndex) + { + case WIDX_THEMES_SETTINGS_TAB: + case WIDX_THEMES_MAIN_UI_TAB: + case WIDX_THEMES_PARK_TAB: + case WIDX_THEMES_TOOLS_TAB: + case WIDX_THEMES_RIDE_PEEPS_TAB: + case WIDX_THEMES_EDITORS_TAB: + case WIDX_THEMES_MISC_TAB: + case WIDX_THEMES_PROMPTS_TAB: + case WIDX_THEMES_FEATURES_TAB: + newSelectedTab = widgetIndex - WIDX_THEMES_SETTINGS_TAB; + if (_selected_tab == newSelectedTab) + break; + _selected_tab = static_cast(newSelectedTab); + scrolls[0].v_top = 0; + frame_no = 0; + OnResize(); + Invalidate(); + break; + case WIDX_THEMES_PRESETS_DROPDOWN: + ThemeManagerLoadAvailableThemes(); + num_items = static_cast(ThemeManagerGetNumAvailableThemes()); + + widget--; + for (int32_t i = 0; i < num_items; i++) + { + gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; + gDropdownItems[i].Args = reinterpret_cast(ThemeManagerGetAvailableThemeName(i)); + } + + WindowDropdownShowTextCustomWidth( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, + Dropdown::Flag::StayOpen, num_items, widget->width() - 3); + + Dropdown::SetChecked(static_cast(ThemeManagerGetAvailableThemeIndex()), true); + break; + case WIDX_THEMES_RCT1_RIDE_LIGHTS: + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) + { + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + } + else + { + ThemeSetFlags(ThemeGetFlags() ^ UITHEME_FLAG_USE_LIGHTS_RIDE); + ThemeSave(); + WindowInvalidateAll(); + } + break; + case WIDX_THEMES_RCT1_PARK_LIGHTS: + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) + { + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + } + else + { + ThemeSetFlags(ThemeGetFlags() ^ static_cast(UITHEME_FLAG_USE_LIGHTS_PARK)); + ThemeSave(); + WindowInvalidateAll(); + } + break; + case WIDX_THEMES_RCT1_SCENARIO_FONT: + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) + { + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + } + else + { + ThemeSetFlags( + ThemeGetFlags() ^ static_cast(UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT)); + ThemeSave(); + WindowInvalidateAll(); + } + break; + case WIDX_THEMES_RCT1_BOTTOM_TOOLBAR: + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) + { + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + } + else + { + ThemeSetFlags(ThemeGetFlags() ^ static_cast(UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR)); + ThemeSave(); + WindowInvalidateAll(); + } + } + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + size_t activeAvailableThemeIndex; + const utf8* activeThemeName; + + switch (widgetIndex) + { + case WIDX_THEMES_CLOSE: + Close(); + break; + case WIDX_THEMES_DUPLICATE_BUTTON:; activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); WindowTextInputOpen( - this, widgetIndex, STR_TRACK_MANAGE_RENAME, STR_THEMES_PROMPT_ENTER_THEME_NAME, {}, STR_STRING, + this, widgetIndex, STR_THEMES_ACTION_DUPLICATE, STR_THEMES_PROMPT_ENTER_THEME_NAME, {}, STR_STRING, reinterpret_cast(activeThemeName), 64); - } - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - switch (widgetIndex) - { - case WIDX_THEMES_LIST: - if (selectedIndex != -1) - { - const auto newColour = ThemeOverrideExtendedColour(ColourDropDownIndexToColour(selectedIndex)); - WindowClass wc = GetWindowClassTabIndex(_colour_index_1); - uint8_t colour = ThemeGetColour(wc, _colour_index_2); - colour = (colour & COLOUR_FLAG_TRANSLUCENT) | newColour; - ThemeSetColour(wc, _colour_index_2, colour); - ColourSchemeUpdateAll(); - WindowInvalidateAll(); - _colour_index_1 = -1; - _colour_index_2 = -1; - } - break; - case WIDX_THEMES_PRESETS_DROPDOWN: - if (selectedIndex != -1) - { - ThemeManagerSetActiveAvailableTheme(selectedIndex); - } - break; - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - if (text.empty()) - return; - - switch (widgetIndex) - { - case WIDX_THEMES_DUPLICATE_BUTTON: - case WIDX_THEMES_RENAME_BUTTON: - if (Platform::IsFilenameValid(text)) - { - if (ThemeGetIndexForName(std::string(text).c_str()) == SIZE_MAX) + break; + case WIDX_THEMES_DELETE_BUTTON: + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { - if (widgetIndex == WIDX_THEMES_DUPLICATE_BUTTON) - { - ThemeDuplicate(std::string(text).c_str()); - } - else - { - ThemeRename(std::string(text).c_str()); - } - Invalidate(); + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { - ContextShowError(STR_THEMES_ERR_NAME_ALREADY_EXISTS, STR_NONE, {}); + ThemeDelete(); } - } - else - { - ContextShowError(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); - } - break; - } - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS || _selected_tab == WINDOW_THEMES_TAB_FEATURES) - return {}; - - int32_t scrollHeight = GetColourSchemeTabCount() * _row_height; - int32_t i = scrollHeight - widgets[WIDX_THEMES_LIST].bottom + widgets[WIDX_THEMES_LIST].top + 21; - if (i < 0) - i = 0; - if (i < scrolls[0].v_top) - { - scrolls[0].v_top = i; - Invalidate(); + break; + case WIDX_THEMES_RENAME_BUTTON: + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) + { + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + } + else + { + activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); + activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); + WindowTextInputOpen( + this, widgetIndex, STR_TRACK_MANAGE_RENAME, STR_THEMES_PROMPT_ENTER_THEME_NAME, {}, STR_STRING, + reinterpret_cast(activeThemeName), 64); + } + break; + } } - return { 420, scrollHeight }; - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - if (screenCoords.y / _row_height < GetColourSchemeTabCount()) + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { - int32_t y2 = screenCoords.y % _row_height; - _colour_index_1 = screenCoords.y / _row_height; - _colour_index_2 = ((screenCoords.x - _button_offset_x) / 12); - - WindowClass wc = GetWindowClassTabIndex(_colour_index_1); - int32_t numColours = ThemeDescGetNumColours(wc); - if (_colour_index_2 < numColours) + switch (widgetIndex) { - if (screenCoords.x >= _button_offset_x && screenCoords.x < _button_offset_x + 12 * 6 && y2 >= _button_offset_y - && y2 < _button_offset_y + 11) - { - if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) + case WIDX_THEMES_LIST: + if (selectedIndex != -1) { - ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {}); - } - else - { - widgets[WIDX_THEMES_COLOURBTN_MASK].type = WindowWidgetType::ColourBtn; - widgets[WIDX_THEMES_COLOURBTN_MASK].left = _button_offset_x + _colour_index_2 * 12 - + widgets[WIDX_THEMES_LIST].left; - widgets[WIDX_THEMES_COLOURBTN_MASK].top = _colour_index_1 * _row_height + _button_offset_y - - scrolls[0].v_top + widgets[WIDX_THEMES_LIST].top; - widgets[WIDX_THEMES_COLOURBTN_MASK].right = widgets[WIDX_THEMES_COLOURBTN_MASK].left + 12; - widgets[WIDX_THEMES_COLOURBTN_MASK].bottom = widgets[WIDX_THEMES_COLOURBTN_MASK].top + 12; - + const auto newColour = ThemeOverrideExtendedColour(ColourDropDownIndexToColour(selectedIndex)); + WindowClass wc = GetWindowClassTabIndex(_colour_index_1); uint8_t colour = ThemeGetColour(wc, _colour_index_2); - WindowDropdownShowColour(this, &(widgets[WIDX_THEMES_COLOURBTN_MASK]), colours[1], colour); - WidgetInvalidate(*this, WIDX_THEMES_LIST); - } - } - else if ( - screenCoords.x >= _button_offset_x && screenCoords.x < _button_offset_x + 12 * 6 - 1 - && y2 >= _check_offset_y && y2 < _check_offset_y + 11) - { - if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) - { - ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {}); - } - else - { - uint8_t colour = ThemeGetColour(wc, _colour_index_2); - if (colour & COLOUR_FLAG_TRANSLUCENT) - { - colour &= ~COLOUR_FLAG_TRANSLUCENT; - } - else - { - colour |= COLOUR_FLAG_TRANSLUCENT; - } + colour = (colour & COLOUR_FLAG_TRANSLUCENT) | newColour; ThemeSetColour(wc, _colour_index_2, colour); ColourSchemeUpdateAll(); WindowInvalidateAll(); + _colour_index_1 = -1; + _colour_index_2 = -1; } - } + break; + case WIDX_THEMES_PRESETS_DROPDOWN: + if (selectedIndex != -1) + { + ThemeManagerSetActiveAvailableTheme(selectedIndex); + } + break; } } - } - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - ScreenCoordsXY screenCoords; - - if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS || _selected_tab == WINDOW_THEMES_TAB_FEATURES) - return; - - if ((colours[1] & 0x80) == 0) - // GfxFillRect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, - // ColourMapA[colours[1]].mid_light); - GfxClear(&dpi, ColourMapA[colours[1]].mid_light); - screenCoords.y = 0; - for (int32_t i = 0; i < GetColourSchemeTabCount(); i++) + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override { - if (screenCoords.y > dpi.y + dpi.height) - { - break; - } - if (screenCoords.y + _row_height >= dpi.y) - { - if (i + 1 < GetColourSchemeTabCount()) - { - int32_t colour = colours[1]; + if (text.empty()) + return; - auto leftTop = ScreenCoordsXY{ 0, screenCoords.y + _row_height - 2 }; - auto rightBottom = ScreenCoordsXY{ widgets[WIDX_THEMES_LIST].right, screenCoords.y + _row_height - 2 }; - auto yPixelOffset = ScreenCoordsXY{ 0, 1 }; - - if (colour & COLOUR_FLAG_TRANSLUCENT) + switch (widgetIndex) + { + case WIDX_THEMES_DUPLICATE_BUTTON: + case WIDX_THEMES_RENAME_BUTTON: + if (Platform::IsFilenameValid(text)) { - TranslucentWindowPalette windowPalette = TranslucentWindowPalettes[BASE_COLOUR(colour)]; - - GfxFilterRect(dpi, { leftTop, rightBottom }, windowPalette.highlight); - GfxFilterRect(dpi, { leftTop + yPixelOffset, rightBottom + yPixelOffset }, windowPalette.shadow); + if (ThemeGetIndexForName(std::string(text).c_str()) == SIZE_MAX) + { + if (widgetIndex == WIDX_THEMES_DUPLICATE_BUTTON) + { + ThemeDuplicate(std::string(text).c_str()); + } + else + { + ThemeRename(std::string(text).c_str()); + } + Invalidate(); + } + else + { + ContextShowError(STR_THEMES_ERR_NAME_ALREADY_EXISTS, STR_NONE, {}); + } } else { - colour = ColourMapA[colours[1]].mid_dark; - GfxFillRect(dpi, { leftTop, rightBottom }, colour); - - colour = ColourMapA[colours[1]].lightest; - GfxFillRect(dpi, { leftTop + yPixelOffset, rightBottom + yPixelOffset }, colour); + ContextShowError(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); } - } + break; + } + } - WindowClass wc = GetWindowClassTabIndex(i); + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS || _selected_tab == WINDOW_THEMES_TAB_FEATURES) + return {}; + + int32_t scrollHeight = GetColourSchemeTabCount() * _row_height; + int32_t i = scrollHeight - widgets[WIDX_THEMES_LIST].bottom + widgets[WIDX_THEMES_LIST].top + 21; + if (i < 0) + i = 0; + if (i < scrolls[0].v_top) + { + scrolls[0].v_top = i; + Invalidate(); + } + + return { 420, scrollHeight }; + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + if (screenCoords.y / _row_height < GetColourSchemeTabCount()) + { + int32_t y2 = screenCoords.y % _row_height; + _colour_index_1 = screenCoords.y / _row_height; + _colour_index_2 = ((screenCoords.x - _button_offset_x) / 12); + + WindowClass wc = GetWindowClassTabIndex(_colour_index_1); int32_t numColours = ThemeDescGetNumColours(wc); - for (uint8_t j = 0; j < numColours; j++) + if (_colour_index_2 < numColours) { - DrawTextBasic(dpi, { 2, screenCoords.y + 4 }, ThemeDescGetName(wc), {}, { colours[1] }); - - uint8_t colour = ThemeGetColour(wc, j); - const bool isPressed = (i == _colour_index_1 && j == _colour_index_2); - auto image = ImageId( - isPressed ? SPR_PALETTE_BTN_PRESSED : SPR_PALETTE_BTN, colour & ~COLOUR_FLAG_TRANSLUCENT); - GfxDrawSprite(dpi, image, { _button_offset_x + 12 * j, screenCoords.y + _button_offset_y }); - - ScreenCoordsXY topLeft{ _button_offset_x + 12 * j, screenCoords.y + _check_offset_y }; - ScreenCoordsXY bottomRight{ _button_offset_x + 12 * j + 9, screenCoords.y + _check_offset_y + 10 }; - GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_E0); - if (colour & COLOUR_FLAG_TRANSLUCENT) + if (screenCoords.x >= _button_offset_x && screenCoords.x < _button_offset_x + 12 * 6 + && y2 >= _button_offset_y && y2 < _button_offset_y + 11) { - GfxDrawString( - dpi, topLeft, static_cast(CheckBoxMarkString), - { static_cast(colours[1] & 0x7F), FontStyle::Medium, TextDarkness::Dark }); + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) + { + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {}); + } + else + { + widgets[WIDX_THEMES_COLOURBTN_MASK].type = WindowWidgetType::ColourBtn; + widgets[WIDX_THEMES_COLOURBTN_MASK].left = _button_offset_x + _colour_index_2 * 12 + + widgets[WIDX_THEMES_LIST].left; + widgets[WIDX_THEMES_COLOURBTN_MASK].top = _colour_index_1 * _row_height + _button_offset_y + - scrolls[0].v_top + widgets[WIDX_THEMES_LIST].top; + widgets[WIDX_THEMES_COLOURBTN_MASK].right = widgets[WIDX_THEMES_COLOURBTN_MASK].left + 12; + widgets[WIDX_THEMES_COLOURBTN_MASK].bottom = widgets[WIDX_THEMES_COLOURBTN_MASK].top + 12; + + uint8_t colour = ThemeGetColour(wc, _colour_index_2); + WindowDropdownShowColour(this, &(widgets[WIDX_THEMES_COLOURBTN_MASK]), colours[1], colour); + WidgetInvalidate(*this, WIDX_THEMES_LIST); + } + } + else if ( + screenCoords.x >= _button_offset_x && screenCoords.x < _button_offset_x + 12 * 6 - 1 + && y2 >= _check_offset_y && y2 < _check_offset_y + 11) + { + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) + { + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {}); + } + else + { + uint8_t colour = ThemeGetColour(wc, _colour_index_2); + if (colour & COLOUR_FLAG_TRANSLUCENT) + { + colour &= ~COLOUR_FLAG_TRANSLUCENT; + } + else + { + colour |= COLOUR_FLAG_TRANSLUCENT; + } + ThemeSetColour(wc, _colour_index_2, colour); + ColourSchemeUpdateAll(); + WindowInvalidateAll(); + } } } } - - screenCoords.y += _row_height; } - } + + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + ScreenCoordsXY screenCoords; + + if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS || _selected_tab == WINDOW_THEMES_TAB_FEATURES) + return; + + if ((colours[1] & 0x80) == 0) + // GfxFillRect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, + // ColourMapA[colours[1]].mid_light); + GfxClear(dpi, ColourMapA[colours[1]].mid_light); + screenCoords.y = 0; + for (int32_t i = 0; i < GetColourSchemeTabCount(); i++) + { + if (screenCoords.y > dpi.y + dpi.height) + { + break; + } + if (screenCoords.y + _row_height >= dpi.y) + { + if (i + 1 < GetColourSchemeTabCount()) + { + int32_t colour = colours[1]; + + auto leftTop = ScreenCoordsXY{ 0, screenCoords.y + _row_height - 2 }; + auto rightBottom = ScreenCoordsXY{ widgets[WIDX_THEMES_LIST].right, screenCoords.y + _row_height - 2 }; + auto yPixelOffset = ScreenCoordsXY{ 0, 1 }; + + if (colour & COLOUR_FLAG_TRANSLUCENT) + { + TranslucentWindowPalette windowPalette = TranslucentWindowPalettes[BASE_COLOUR(colour)]; + + GfxFilterRect(dpi, { leftTop, rightBottom }, windowPalette.highlight); + GfxFilterRect(dpi, { leftTop + yPixelOffset, rightBottom + yPixelOffset }, windowPalette.shadow); + } + else + { + colour = ColourMapA[colours[1]].mid_dark; + GfxFillRect(dpi, { leftTop, rightBottom }, colour); + + colour = ColourMapA[colours[1]].lightest; + GfxFillRect(dpi, { leftTop + yPixelOffset, rightBottom + yPixelOffset }, colour); + } + } + + WindowClass wc = GetWindowClassTabIndex(i); + int32_t numColours = ThemeDescGetNumColours(wc); + for (uint8_t j = 0; j < numColours; j++) + { + DrawTextBasic(dpi, { 2, screenCoords.y + 4 }, ThemeDescGetName(wc), {}, { colours[1] }); + + uint8_t colour = ThemeGetColour(wc, j); + const bool isPressed = (i == _colour_index_1 && j == _colour_index_2); + auto image = ImageId( + isPressed ? SPR_PALETTE_BTN_PRESSED : SPR_PALETTE_BTN, colour & ~COLOUR_FLAG_TRANSLUCENT); + GfxDrawSprite(dpi, image, { _button_offset_x + 12 * j, screenCoords.y + _button_offset_y }); + + ScreenCoordsXY topLeft{ _button_offset_x + 12 * j, screenCoords.y + _check_offset_y }; + ScreenCoordsXY bottomRight{ _button_offset_x + 12 * j + 9, screenCoords.y + _check_offset_y + 10 }; + GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_E0); + if (colour & COLOUR_FLAG_TRANSLUCENT) + { + GfxDrawString( + dpi, topLeft, static_cast(CheckBoxMarkString), + { static_cast(colours[1] & 0x7F), FontStyle::Medium, TextDarkness::Dark }); + } + } + } + + screenCoords.y += _row_height; + } + } #pragma endregion - void WindowThemesInitVars() - { - _selected_tab = WINDOW_THEMES_TAB_SETTINGS; - } - - WindowClass GetWindowClassTabIndex(int32_t index) - { - WindowClass* classes = window_themes_tab_classes[_selected_tab]; - return classes[index]; - } - - int32_t GetColourSchemeTabCount() - { - switch (_selected_tab) + void WindowThemesInitVars() { - case 1: - return sizeof(window_themes_tab_1_classes); - case 2: - return sizeof(window_themes_tab_2_classes); - case 3: - return sizeof(window_themes_tab_3_classes); - case 4: - return sizeof(window_themes_tab_4_classes); - case 5: - return sizeof(window_themes_tab_5_classes); - case 6: - return sizeof(window_themes_tab_6_classes); - case 7: - return sizeof(window_themes_tab_7_classes); + _selected_tab = WINDOW_THEMES_TAB_SETTINGS; } - return 0; - } - void WindowThemesDrawTabImages(DrawPixelInfo& dpi) - { - for (int32_t i = 0; i < WINDOW_THEMES_TAB_COUNT; i++) + WindowClass GetWindowClassTabIndex(int32_t index) { - int32_t sprite_idx = window_themes_tab_sprites[i]; - if (_selected_tab == i) - sprite_idx += frame_no / window_themes_tab_animation_divisor[_selected_tab]; - GfxDrawSprite( - dpi, ImageId(sprite_idx), - windowPos - + ScreenCoordsXY{ widgets[WIDX_THEMES_SETTINGS_TAB + i].left, widgets[WIDX_THEMES_SETTINGS_TAB + i].top }); + WindowClass* classes = window_themes_tab_classes[_selected_tab]; + return classes[index]; } - } -}; -WindowBase* WindowThemesOpen() -{ - WindowBase* window; + int32_t GetColourSchemeTabCount() + { + switch (_selected_tab) + { + case 1: + return sizeof(window_themes_tab_1_classes); + case 2: + return sizeof(window_themes_tab_2_classes); + case 3: + return sizeof(window_themes_tab_3_classes); + case 4: + return sizeof(window_themes_tab_4_classes); + case 5: + return sizeof(window_themes_tab_5_classes); + case 6: + return sizeof(window_themes_tab_6_classes); + case 7: + return sizeof(window_themes_tab_7_classes); + } + return 0; + } + + void WindowThemesDrawTabImages(DrawPixelInfo& dpi) + { + for (int32_t i = 0; i < WINDOW_THEMES_TAB_COUNT; i++) + { + int32_t sprite_idx = window_themes_tab_sprites[i]; + if (_selected_tab == i) + sprite_idx += frame_no / window_themes_tab_animation_divisor[_selected_tab]; + GfxDrawSprite( + dpi, ImageId(sprite_idx), + windowPos + + ScreenCoordsXY{ widgets[WIDX_THEMES_SETTINGS_TAB + i].left, + widgets[WIDX_THEMES_SETTINGS_TAB + i].top }); + } + } + }; + + WindowBase* ThemesOpen() + { + WindowBase* window; + + // Check if window is already open + window = WindowBringToFrontByClass(WindowClass::Themes); + if (window != nullptr) + return window; + + window = WindowCreate(WindowClass::Themes, 320, 107, WF_10 | WF_RESIZABLE); - // Check if window is already open - window = WindowBringToFrontByClass(WindowClass::Themes); - if (window != nullptr) return window; - - window = WindowCreate(WindowClass::Themes, 320, 107, WF_10 | WF_RESIZABLE); - - return window; -} + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index b85e714e2b..cff7c067d2 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -41,204 +41,207 @@ #include #include -static constexpr StringId EntranceTypeStringIds[] = { - STR_TILE_INSPECTOR_ENTRANCE_TYPE_RIDE_ENTRANCE, - STR_TILE_INSPECTOR_ENTRANCE_TYPE_RIDE_EXIT, - STR_TILE_INSPECTOR_ENTRANCE_TYPE_PARK_ENTRANC, -}; - -static constexpr StringId ParkEntrancePartStringIds[] = { - STR_TILE_INSPECTOR_ENTRANCE_MIDDLE, - STR_TILE_INSPECTOR_ENTRANCE_LEFT, - STR_TILE_INSPECTOR_ENTRANCE_RIGHT, -}; - -static constexpr StringId WallSlopeStringIds[] = { - STR_TILE_INSPECTOR_WALL_FLAT, - STR_TILE_INSPECTOR_WALL_SLOPED_LEFT, - STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT, - STR_TILE_INSPECTOR_WALL_ANIMATION_FRAME, -}; - -enum WindowTileInspectorWidgetIdx +namespace OpenRCT2::Ui::Windows { - WIDX_BACKGROUND, - WIDX_TITLE, - WIDX_CLOSE, - WIDX_LIST, - WIDX_SPINNER_X, - WIDX_SPINNER_X_INCREASE, - WIDX_SPINNER_X_DECREASE, - WIDX_SPINNER_Y, - WIDX_SPINNER_Y_INCREASE, - WIDX_SPINNER_Y_DECREASE, - WIDX_BUTTON_REMOVE, - WIDX_BUTTON_MOVE_UP, - WIDX_BUTTON_MOVE_DOWN, - WIDX_BUTTON_ROTATE, - WIDX_BUTTON_SORT, - WIDX_BUTTON_PASTE, - WIDX_BUTTON_COPY, - WIDX_COLUMN_INVISIBLE, - WIDX_COLUMN_TYPE, - WIDX_COLUMN_BASEHEIGHT, - WIDX_COLUMN_CLEARANCEHEIGHT, - WIDX_COLUMN_DIRECTION, - WIDX_COLUMN_GHOSTFLAG, - WIDX_COLUMN_LASTFLAG, - WIDX_GROUPBOX_DETAILS, - WIDX_GROUPBOX_PROPERTIES, + static constexpr StringId EntranceTypeStringIds[] = { + STR_TILE_INSPECTOR_ENTRANCE_TYPE_RIDE_ENTRANCE, + STR_TILE_INSPECTOR_ENTRANCE_TYPE_RIDE_EXIT, + STR_TILE_INSPECTOR_ENTRANCE_TYPE_PARK_ENTRANC, + }; - PAGE_WIDGETS, + static constexpr StringId ParkEntrancePartStringIds[] = { + STR_TILE_INSPECTOR_ENTRANCE_MIDDLE, + STR_TILE_INSPECTOR_ENTRANCE_LEFT, + STR_TILE_INSPECTOR_ENTRANCE_RIGHT, + }; - // Surface - WIDX_SURFACE_SPINNER_HEIGHT = PAGE_WIDGETS, - WIDX_SURFACE_SPINNER_HEIGHT_INCREASE, - WIDX_SURFACE_SPINNER_HEIGHT_DECREASE, - WIDX_SURFACE_BUTTON_REMOVE_FENCES, - WIDX_SURFACE_BUTTON_RESTORE_FENCES, - WIDX_SURFACE_CHECK_CORNER_N, - WIDX_SURFACE_CHECK_CORNER_E, - WIDX_SURFACE_CHECK_CORNER_S, - WIDX_SURFACE_CHECK_CORNER_W, - WIDX_SURFACE_CHECK_DIAGONAL, + static constexpr StringId WallSlopeStringIds[] = { + STR_TILE_INSPECTOR_WALL_FLAT, + STR_TILE_INSPECTOR_WALL_SLOPED_LEFT, + STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT, + STR_TILE_INSPECTOR_WALL_ANIMATION_FRAME, + }; - // Path - WIDX_PATH_SPINNER_HEIGHT = PAGE_WIDGETS, - WIDX_PATH_SPINNER_HEIGHT_INCREASE, - WIDX_PATH_SPINNER_HEIGHT_DECREASE, - WIDX_PATH_CHECK_BROKEN, - WIDX_PATH_CHECK_SLOPED, - WIDX_PATH_CHECK_JUNCTION_RAILINGS, - WIDX_PATH_CHECK_EDGE_NE, // Note: This is NOT named after the world orientation, but after the way - WIDX_PATH_CHECK_EDGE_E, // it looks in the window (top corner is north). Their order is important, - WIDX_PATH_CHECK_EDGE_SE, // as this is the same order paths use for their corners / edges. - WIDX_PATH_CHECK_EDGE_S, // N - WIDX_PATH_CHECK_EDGE_SW, // NW-------NE - WIDX_PATH_CHECK_EDGE_W, // W ------------- E - WIDX_PATH_CHECK_EDGE_NW, // SW-------SE - WIDX_PATH_CHECK_EDGE_N, // S + enum WindowTileInspectorWidgetIdx + { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_LIST, + WIDX_SPINNER_X, + WIDX_SPINNER_X_INCREASE, + WIDX_SPINNER_X_DECREASE, + WIDX_SPINNER_Y, + WIDX_SPINNER_Y_INCREASE, + WIDX_SPINNER_Y_DECREASE, + WIDX_BUTTON_REMOVE, + WIDX_BUTTON_MOVE_UP, + WIDX_BUTTON_MOVE_DOWN, + WIDX_BUTTON_ROTATE, + WIDX_BUTTON_SORT, + WIDX_BUTTON_PASTE, + WIDX_BUTTON_COPY, + WIDX_COLUMN_INVISIBLE, + WIDX_COLUMN_TYPE, + WIDX_COLUMN_BASEHEIGHT, + WIDX_COLUMN_CLEARANCEHEIGHT, + WIDX_COLUMN_DIRECTION, + WIDX_COLUMN_GHOSTFLAG, + WIDX_COLUMN_LASTFLAG, + WIDX_GROUPBOX_DETAILS, + WIDX_GROUPBOX_PROPERTIES, - // Track - WIDX_TRACK_CHECK_APPLY_TO_ALL = PAGE_WIDGETS, - WIDX_TRACK_SPINNER_HEIGHT, - WIDX_TRACK_SPINNER_HEIGHT_INCREASE, - WIDX_TRACK_SPINNER_HEIGHT_DECREASE, - WIDX_TRACK_CHECK_CHAIN_LIFT, - WIDX_TRACK_CHECK_BRAKE_CLOSED, - WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE, + PAGE_WIDGETS, - // Scenery - WIDX_SCENERY_SPINNER_HEIGHT = PAGE_WIDGETS, - WIDX_SCENERY_SPINNER_HEIGHT_INCREASE, - WIDX_SCENERY_SPINNER_HEIGHT_DECREASE, - WIDX_SCENERY_CHECK_QUARTER_N, - WIDX_SCENERY_CHECK_QUARTER_E, - WIDX_SCENERY_CHECK_QUARTER_S, - WIDX_SCENERY_CHECK_QUARTER_W, - WIDX_SCENERY_CHECK_COLLISION_N, - WIDX_SCENERY_CHECK_COLLISION_E, - WIDX_SCENERY_CHECK_COLLISION_S, - WIDX_SCENERY_CHECK_COLLISION_W, + // Surface + WIDX_SURFACE_SPINNER_HEIGHT = PAGE_WIDGETS, + WIDX_SURFACE_SPINNER_HEIGHT_INCREASE, + WIDX_SURFACE_SPINNER_HEIGHT_DECREASE, + WIDX_SURFACE_BUTTON_REMOVE_FENCES, + WIDX_SURFACE_BUTTON_RESTORE_FENCES, + WIDX_SURFACE_CHECK_CORNER_N, + WIDX_SURFACE_CHECK_CORNER_E, + WIDX_SURFACE_CHECK_CORNER_S, + WIDX_SURFACE_CHECK_CORNER_W, + WIDX_SURFACE_CHECK_DIAGONAL, - // Entrance - WIDX_ENTRANCE_SPINNER_HEIGHT = PAGE_WIDGETS, - WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE, - WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE, - WIDX_ENTRANCE_BUTTON_MAKE_USABLE, + // Path + WIDX_PATH_SPINNER_HEIGHT = PAGE_WIDGETS, + WIDX_PATH_SPINNER_HEIGHT_INCREASE, + WIDX_PATH_SPINNER_HEIGHT_DECREASE, + WIDX_PATH_CHECK_BROKEN, + WIDX_PATH_CHECK_SLOPED, + WIDX_PATH_CHECK_JUNCTION_RAILINGS, + WIDX_PATH_CHECK_EDGE_NE, // Note: This is NOT named after the world orientation, but after the way + WIDX_PATH_CHECK_EDGE_E, // it looks in the window (top corner is north). Their order is important, + WIDX_PATH_CHECK_EDGE_SE, // as this is the same order paths use for their corners / edges. + WIDX_PATH_CHECK_EDGE_S, // N + WIDX_PATH_CHECK_EDGE_SW, // NW-------NE + WIDX_PATH_CHECK_EDGE_W, // W ------------- E + WIDX_PATH_CHECK_EDGE_NW, // SW-------SE + WIDX_PATH_CHECK_EDGE_N, // S - // Wall - WIDX_WALL_SPINNER_HEIGHT = PAGE_WIDGETS, - WIDX_WALL_SPINNER_HEIGHT_INCREASE, - WIDX_WALL_SPINNER_HEIGHT_DECREASE, - WIDX_WALL_DROPDOWN_SLOPE, - WIDX_WALL_DROPDOWN_SLOPE_BUTTON, - WIDX_WALL_SPINNER_ANIMATION_FRAME, - WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE, - WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE, + // Track + WIDX_TRACK_CHECK_APPLY_TO_ALL = PAGE_WIDGETS, + WIDX_TRACK_SPINNER_HEIGHT, + WIDX_TRACK_SPINNER_HEIGHT_INCREASE, + WIDX_TRACK_SPINNER_HEIGHT_DECREASE, + WIDX_TRACK_CHECK_CHAIN_LIFT, + WIDX_TRACK_CHECK_BRAKE_CLOSED, + WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE, - // Large - WIDX_LARGE_SCENERY_SPINNER_HEIGHT = PAGE_WIDGETS, - WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE, - WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE, + // Scenery + WIDX_SCENERY_SPINNER_HEIGHT = PAGE_WIDGETS, + WIDX_SCENERY_SPINNER_HEIGHT_INCREASE, + WIDX_SCENERY_SPINNER_HEIGHT_DECREASE, + WIDX_SCENERY_CHECK_QUARTER_N, + WIDX_SCENERY_CHECK_QUARTER_E, + WIDX_SCENERY_CHECK_QUARTER_S, + WIDX_SCENERY_CHECK_QUARTER_W, + WIDX_SCENERY_CHECK_COLLISION_N, + WIDX_SCENERY_CHECK_COLLISION_E, + WIDX_SCENERY_CHECK_COLLISION_S, + WIDX_SCENERY_CHECK_COLLISION_W, - // Banner - WIDX_BANNER_SPINNER_HEIGHT = PAGE_WIDGETS, - WIDX_BANNER_SPINNER_HEIGHT_INCREASE, - WIDX_BANNER_SPINNER_HEIGHT_DECREASE, - WIDX_BANNER_CHECK_BLOCK_NE, - WIDX_BANNER_CHECK_BLOCK_SE, - WIDX_BANNER_CHECK_BLOCK_SW, - WIDX_BANNER_CHECK_BLOCK_NW, -}; + // Entrance + WIDX_ENTRANCE_SPINNER_HEIGHT = PAGE_WIDGETS, + WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE, + WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE, + WIDX_ENTRANCE_BUTTON_MAKE_USABLE, -static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE == WIDX_BUTTON_ROTATE); -static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_COPY == WIDX_BUTTON_COPY); -static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE == WIDX_BUTTON_PASTE); -static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE == WIDX_BUTTON_REMOVE); -static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP == WIDX_BUTTON_MOVE_UP); -static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN == WIDX_BUTTON_MOVE_DOWN); -static_assert(WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE == WIDX_SPINNER_X_INCREASE); -static_assert(WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE == WIDX_SPINNER_X_DECREASE); -static_assert(WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE == WIDX_SPINNER_Y_INCREASE); -static_assert(WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE == WIDX_SPINNER_Y_DECREASE); + // Wall + WIDX_WALL_SPINNER_HEIGHT = PAGE_WIDGETS, + WIDX_WALL_SPINNER_HEIGHT_INCREASE, + WIDX_WALL_SPINNER_HEIGHT_DECREASE, + WIDX_WALL_DROPDOWN_SLOPE, + WIDX_WALL_DROPDOWN_SLOPE_BUTTON, + WIDX_WALL_SPINNER_ANIMATION_FRAME, + WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE, + WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE, + + // Large + WIDX_LARGE_SCENERY_SPINNER_HEIGHT = PAGE_WIDGETS, + WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE, + WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE, + + // Banner + WIDX_BANNER_SPINNER_HEIGHT = PAGE_WIDGETS, + WIDX_BANNER_SPINNER_HEIGHT_INCREASE, + WIDX_BANNER_SPINNER_HEIGHT_DECREASE, + WIDX_BANNER_CHECK_BLOCK_NE, + WIDX_BANNER_CHECK_BLOCK_SE, + WIDX_BANNER_CHECK_BLOCK_SW, + WIDX_BANNER_CHECK_BLOCK_NW, + }; + + static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE == WIDX_BUTTON_ROTATE); + static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_COPY == WIDX_BUTTON_COPY); + static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE == WIDX_BUTTON_PASTE); + static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_SORT == WIDX_BUTTON_SORT); + static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE == WIDX_BUTTON_REMOVE); + static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP == WIDX_BUTTON_MOVE_UP); + static_assert(WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN == WIDX_BUTTON_MOVE_DOWN); + static_assert(WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE == WIDX_SPINNER_X_INCREASE); + static_assert(WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE == WIDX_SPINNER_X_DECREASE); + static_assert(WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE == WIDX_SPINNER_Y_INCREASE); + static_assert(WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE == WIDX_SPINNER_Y_DECREASE); #pragma region MEASUREMENTS -static constexpr StringId WINDOW_TITLE = STR_TILE_INSPECTOR_TITLE; -// Window sizes -static constexpr int32_t WW = 400; -static constexpr int32_t WH = 170; + static constexpr StringId WINDOW_TITLE = STR_TILE_INSPECTOR_TITLE; + // Window sizes + static constexpr int32_t WW = 400; + static constexpr int32_t WH = 170; -constexpr int32_t MIN_WW = WW; -constexpr int32_t MAX_WW = WW; -constexpr int32_t MIN_WH = 130; -constexpr int32_t MAX_WH = 800; + constexpr int32_t MIN_WW = WW; + constexpr int32_t MAX_WW = WW; + constexpr int32_t MIN_WH = 130; + constexpr int32_t MAX_WH = 800; -// Button space for top buttons -constexpr auto ToolbarButtonAnchor = ScreenCoordsXY{ WW - 27, 17 }; -constexpr auto ToolbarButtonSize = ScreenSize{ 24, 24 }; -constexpr auto ToolbarButtonHalfSize = ScreenSize{ 24, 12 }; -constexpr auto ToolbarButtonOffsetX = ScreenSize{ -24, 0 }; + // Button space for top buttons + constexpr auto ToolbarButtonAnchor = ScreenCoordsXY{ WW - 27, 17 }; + constexpr auto ToolbarButtonSize = ScreenSize{ 24, 24 }; + constexpr auto ToolbarButtonHalfSize = ScreenSize{ 24, 12 }; + constexpr auto ToolbarButtonOffsetX = ScreenSize{ -24, 0 }; -// List's column offsets -constexpr auto InvisibleFlagColumnXY = ScreenCoordsXY{ 3, 42 }; -constexpr auto InvisibleFlagColumnSize = ScreenSize{ 20, 14 }; -constexpr auto TypeColumnXY = InvisibleFlagColumnXY + ScreenSize{ InvisibleFlagColumnSize.width, 0 }; -constexpr auto TypeColumnSize = ScreenSize{ 252, 14 }; -constexpr auto BaseHeightColumnXY = TypeColumnXY + ScreenSize{ TypeColumnSize.width, 0 }; -constexpr auto BaseHeightColumnSize = ScreenSize{ 30, 14 }; -constexpr auto ClearanceHeightColumnXY = BaseHeightColumnXY + ScreenCoordsXY{ BaseHeightColumnSize.width, 0 }; -constexpr auto ClearanceHeightColumnSize = ScreenSize{ 30, 14 }; -constexpr auto DirectionColumnXY = ClearanceHeightColumnXY + ScreenCoordsXY{ ClearanceHeightColumnSize.width, 0 }; -constexpr auto DirectionColumnSize = ScreenSize{ 15, 14 }; -constexpr auto GhostFlagColumnXY = DirectionColumnXY + ScreenCoordsXY{ DirectionColumnSize.width, 0 }; -constexpr auto GhostFlagColumnSize = ScreenSize{ 15, 14 }; -constexpr auto LastFlagColumnXY = GhostFlagColumnXY + ScreenCoordsXY{ GhostFlagColumnSize.width, 0 }; -constexpr auto LastFlagColumnSize = ScreenSize{ 32, 14 }; + // List's column offsets + constexpr auto InvisibleFlagColumnXY = ScreenCoordsXY{ 3, 42 }; + constexpr auto InvisibleFlagColumnSize = ScreenSize{ 20, 14 }; + constexpr auto TypeColumnXY = InvisibleFlagColumnXY + ScreenSize{ InvisibleFlagColumnSize.width, 0 }; + constexpr auto TypeColumnSize = ScreenSize{ 252, 14 }; + constexpr auto BaseHeightColumnXY = TypeColumnXY + ScreenSize{ TypeColumnSize.width, 0 }; + constexpr auto BaseHeightColumnSize = ScreenSize{ 30, 14 }; + constexpr auto ClearanceHeightColumnXY = BaseHeightColumnXY + ScreenCoordsXY{ BaseHeightColumnSize.width, 0 }; + constexpr auto ClearanceHeightColumnSize = ScreenSize{ 30, 14 }; + constexpr auto DirectionColumnXY = ClearanceHeightColumnXY + ScreenCoordsXY{ ClearanceHeightColumnSize.width, 0 }; + constexpr auto DirectionColumnSize = ScreenSize{ 15, 14 }; + constexpr auto GhostFlagColumnXY = DirectionColumnXY + ScreenCoordsXY{ DirectionColumnSize.width, 0 }; + constexpr auto GhostFlagColumnSize = ScreenSize{ 15, 14 }; + constexpr auto LastFlagColumnXY = GhostFlagColumnXY + ScreenCoordsXY{ GhostFlagColumnSize.width, 0 }; + constexpr auto LastFlagColumnSize = ScreenSize{ 32, 14 }; -constexpr int32_t PADDING_BOTTOM = 15; -constexpr int32_t GROUPBOX_PADDING = 6; -constexpr int32_t HORIZONTAL_GROUPBOX_PADDING = 5; -constexpr int32_t VERTICAL_GROUPBOX_PADDING = 4; -constexpr auto PropertyButtonSize = ScreenSize{ 130, 18 }; -constexpr auto PropertyFullWidth = ScreenSize{ 370, 18 }; + constexpr int32_t PADDING_BOTTOM = 15; + constexpr int32_t GROUPBOX_PADDING = 6; + constexpr int32_t HORIZONTAL_GROUPBOX_PADDING = 5; + constexpr int32_t VERTICAL_GROUPBOX_PADDING = 4; + constexpr auto PropertyButtonSize = ScreenSize{ 130, 18 }; + constexpr auto PropertyFullWidth = ScreenSize{ 370, 18 }; #pragma endregion -constexpr ScreenCoordsXY PropertyRowCol(ScreenCoordsXY anchor, int32_t row, int32_t column) -{ - return anchor - + ScreenCoordsXY{ column * (PropertyButtonSize.width + HORIZONTAL_GROUPBOX_PADDING), - row * (PropertyButtonSize.height + VERTICAL_GROUPBOX_PADDING) }; -} + constexpr ScreenCoordsXY PropertyRowCol(ScreenCoordsXY anchor, int32_t row, int32_t column) + { + return anchor + + ScreenCoordsXY{ column * (PropertyButtonSize.width + HORIZONTAL_GROUPBOX_PADDING), + row * (PropertyButtonSize.height + VERTICAL_GROUPBOX_PADDING) }; + } -constexpr ScreenCoordsXY CheckboxGroupOffset( - ScreenCoordsXY anchorPoint, int16_t horizontalMultiplier, int16_t verticalMultiplier) -{ - return anchorPoint + ScreenCoordsXY{ 14 * horizontalMultiplier, 7 * verticalMultiplier }; -} + constexpr ScreenCoordsXY CheckboxGroupOffset( + ScreenCoordsXY anchorPoint, int16_t horizontalMultiplier, int16_t verticalMultiplier) + { + return anchorPoint + ScreenCoordsXY{ 14 * horizontalMultiplier, 7 * verticalMultiplier }; + } -// clang-format off + // clang-format off // Macros for easily obtaining the top and bottom of a widget inside a properties group box #define GBBT(GROUPTOP, row) ((GROUPTOP) + 14 + row * (PropertyButtonSize.height + VERTICAL_GROUPBOX_PADDING)) #define GBBB(GROUPTOP, row) (GBBT((GROUPTOP), row) + PropertyButtonSize.height) @@ -271,7 +274,7 @@ constexpr ScreenCoordsXY CheckboxGroupOffset( static Widget DefaultWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, - WIDGETS_END, + kWidgetsEnd, }; constexpr int32_t NumSurfaceProperties = 4; @@ -288,7 +291,7 @@ static Widget SurfaceWidgets[] = { MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 3, 1), 1, 2), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SURFACE_CHECK_CORNER_S MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 3, 1), 0, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SURFACE_CHECK_CORNER_W MakeWidget(PropertyRowCol({ 12, 0 }, 4, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_SURFACE_DIAGONAL), // WIDX_SURFACE_CHECK_DIAGONAL - WIDGETS_END, + kWidgetsEnd, }; constexpr int32_t NumPathProperties = 6; @@ -309,7 +312,7 @@ static Widget PathWidgets[] = { MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 0, 2), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_PATH_CHECK_EDGE_W MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 1, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_PATH_CHECK_EDGE_NW MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 2, 0), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_PATH_CHECK_EDGE_N - WIDGETS_END, + kWidgetsEnd, }; constexpr int32_t NumTrackProperties = 5; @@ -323,7 +326,7 @@ static Widget TrackWidgets[] = { MakeWidget(PropertyRowCol({ 12, 0}, 2, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_CHAIN_LIFT), // WIDX_TRACK_CHECK_CHAIN_LIFT MakeWidget(PropertyRowCol({ 12, 0}, 3, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_BRAKE_CLOSED), // WIDX_TRACK_CHECK_BRAKE_CLOSED MakeWidget(PropertyRowCol({ 12, 0}, 4, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_IS_INDESTRUCTIBLE), // WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE - WIDGETS_END, + kWidgetsEnd, }; constexpr int32_t NumSceneryProperties = 4; // The checkbox groups both count for 2 rows @@ -341,7 +344,7 @@ static Widget SceneryWidgets[] = { MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 2, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_COLLISION_E MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 1, 2), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_COLLISION_S MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 0, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_COLLISION_W - WIDGETS_END, + kWidgetsEnd, }; constexpr int32_t NumEntranceProperties = 2; @@ -352,7 +355,7 @@ static Widget EntranceWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_ENTRANCE_SPINNER_HEIGHT{,_INCREASE,_DECREASE} MakeWidget(PropertyRowCol({ 12, 0 }, 1, 0), PropertyButtonSize, WindowWidgetType::Button, WindowColour::Secondary, STR_TILE_INSPECTOR_ENTRANCE_MAKE_USABLE, STR_TILE_INSPECTOR_ENTRANCE_MAKE_USABLE_TIP), // WIDX_ENTRANCE_BUTTON_MAKE_USABLE - WIDGETS_END, + kWidgetsEnd, }; constexpr int32_t NumWallProperties = 3; @@ -365,7 +368,7 @@ static Widget WallWidgets[] = { MakeWidget(PropertyRowCol({ 12, 0 }, 1, 1), PropertyButtonSize, WindowWidgetType::DropdownMenu, WindowColour::Secondary), // WIDX_WALL_DROPDOWN_SLOPE MakeWidget(PropertyRowCol({ 12 + PropertyButtonSize.width - 12, 0 }, 1, 1), { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH), // WIDX_WALL_DROPDOWN_SLOPE_BUTTON MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 2, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_WALL_SPINNER_ANIMATION_FRAME{,_INCREASE,_DECREASE} - WIDGETS_END, + kWidgetsEnd, }; constexpr int32_t NumLargeSceneryProperties = 1; @@ -375,7 +378,7 @@ constexpr int32_t LargeSceneryDetailsHeight = 20 + NumLargeSceneryDetails * 11; static Widget LargeSceneryWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_LARGE_SCENERY_SPINNER_HEIGHT{,_INCREASE,_DECREASE} - WIDGETS_END, + kWidgetsEnd, }; constexpr int32_t NumBannerProperties = 3; @@ -390,7 +393,7 @@ static Widget BannerWidgets[] = { MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 1, 3), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_BANNER_CHECK_BLOCK_SW MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 1, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_BANNER_CHECK_BLOCK_NW - WIDGETS_END, + kWidgetsEnd, }; static Widget *PageWidgets[] = { @@ -404,46 +407,46 @@ static Widget *PageWidgets[] = { LargeSceneryWidgets, BannerWidgets, }; -// clang-format on + // clang-format on -struct TileInspectorGroupboxSettings -{ - // Offsets from the bottom of the window - int16_t details_top_offset, details_bottom_offset; - int16_t properties_top_offset, properties_bottom_offset; - // String to be displayed in the details groupbox - StringId string_id; -}; + struct TileInspectorGroupboxSettings + { + // Offsets from the bottom of the window + int16_t details_top_offset, details_bottom_offset; + int16_t properties_top_offset, properties_bottom_offset; + // String to be displayed in the details groupbox + StringId string_id; + }; -static constexpr TileInspectorGroupboxSettings MakeGroupboxSettings( - int16_t detailsHeight, int16_t propertiesHeight, StringId stringId) -{ - TileInspectorGroupboxSettings settings{}; - decltype(settings.properties_bottom_offset) offsetSum = 0; - settings.properties_bottom_offset = (offsetSum += PADDING_BOTTOM); - settings.properties_top_offset = (offsetSum += propertiesHeight); - settings.details_bottom_offset = (offsetSum += GROUPBOX_PADDING); - settings.details_top_offset = (offsetSum += detailsHeight); - settings.string_id = stringId; - return settings; -} + static constexpr TileInspectorGroupboxSettings MakeGroupboxSettings( + int16_t detailsHeight, int16_t propertiesHeight, StringId stringId) + { + TileInspectorGroupboxSettings settings{}; + decltype(settings.properties_bottom_offset) offsetSum = 0; + settings.properties_bottom_offset = (offsetSum += PADDING_BOTTOM); + settings.properties_top_offset = (offsetSum += propertiesHeight); + settings.details_bottom_offset = (offsetSum += GROUPBOX_PADDING); + settings.details_top_offset = (offsetSum += detailsHeight); + settings.string_id = stringId; + return settings; + } -static constexpr TileInspectorGroupboxSettings PageGroupBoxSettings[] = { - MakeGroupboxSettings(SurfaceDetailsHeight, SurfacePropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_SURFACE_INFO), - MakeGroupboxSettings(PathDetailsHeight, PathPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_PATH_INFO), - MakeGroupboxSettings(TrackDetailsHeight, TrackPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_TRACK_INFO), - MakeGroupboxSettings(SceneryDetailsHeight, SceneryPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_SCENERY_INFO), - MakeGroupboxSettings(EntranceDetailsHeight, EntrancePropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_ENTRANCE_INFO), - MakeGroupboxSettings(WallDetailsHeight, WallPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_WALL_INFO), - MakeGroupboxSettings(LargeSceneryDetailsHeight, LargeSceneryPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_BANNER_INFO), - MakeGroupboxSettings(BannerDetailsHeight, BannerPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_BANNER_INFO), -}; + static constexpr TileInspectorGroupboxSettings PageGroupBoxSettings[] = { + MakeGroupboxSettings(SurfaceDetailsHeight, SurfacePropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_SURFACE_INFO), + MakeGroupboxSettings(PathDetailsHeight, PathPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_PATH_INFO), + MakeGroupboxSettings(TrackDetailsHeight, TrackPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_TRACK_INFO), + MakeGroupboxSettings(SceneryDetailsHeight, SceneryPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_SCENERY_INFO), + MakeGroupboxSettings(EntranceDetailsHeight, EntrancePropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_ENTRANCE_INFO), + MakeGroupboxSettings(WallDetailsHeight, WallPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_WALL_INFO), + MakeGroupboxSettings(LargeSceneryDetailsHeight, LargeSceneryPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_BANNER_INFO), + MakeGroupboxSettings(BannerDetailsHeight, BannerPropertiesHeight, STR_TILE_INSPECTOR_GROUPBOX_BANNER_INFO), + }; -static constexpr int32_t ViewportInteractionFlags = EnumsToFlags( - ViewportInteractionItem::Terrain, ViewportInteractionItem::Ride, ViewportInteractionItem::Scenery, - ViewportInteractionItem::Footpath, ViewportInteractionItem::PathAddition, ViewportInteractionItem::ParkEntrance, - ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery, ViewportInteractionItem::Banner); -// clang-format off + static constexpr int32_t ViewportInteractionFlags = EnumsToFlags( + ViewportInteractionItem::Terrain, ViewportInteractionItem::Ride, ViewportInteractionItem::Scenery, + ViewportInteractionItem::Footpath, ViewportInteractionItem::PathAddition, ViewportInteractionItem::ParkEntrance, + ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery, ViewportInteractionItem::Banner); + // clang-format off static uint64_t PageHoldDownWidgets[] = { (1uLL << WIDX_SPINNER_X_INCREASE) | (1uLL << WIDX_SPINNER_X_DECREASE) | (1uLL << WIDX_SPINNER_Y_INCREASE) | (1uLL << WIDX_SPINNER_Y_DECREASE), @@ -468,1919 +471,1943 @@ static uint64_t PageDisabledWidgets[] = { (1uLL << WIDX_BUTTON_ROTATE), 0, }; -// clang-format on + // clang-format on -class TileInspector final : public Window -{ -private: - int16_t _highlightedIndex = -1; - bool _tileSelected = false; - int32_t _toolMouseX = 0; - int32_t _toolMouseY = 0; - bool _toolCtrlDown = false; - CoordsXY _toolMap = {}; - bool _applyToAll = false; - bool _elementCopied = false; - TileElement _copiedElement; - Banner _copiedBanner; - -public: - void OnOpen() override + class TileInspector final : public Window { - min_width = MIN_WW; - min_height = MIN_WH; - max_width = MAX_WW; - max_height = MAX_WH; + private: + int16_t _highlightedIndex = -1; + bool _tileSelected = false; + int32_t _toolMouseX = 0; + int32_t _toolMouseY = 0; + bool _toolCtrlDown = false; + CoordsXY _toolMap = {}; + bool _applyToAll = false; + bool _elementCopied = false; + TileElement _copiedElement; + Banner _copiedBanner; - windowTileInspectorSelectedIndex = -1; - SetPage(TileInspectorPage::Default); - WindowInitScrollWidgets(*this); - _tileSelected = false; - - ToolSet(*this, WIDX_BACKGROUND, Tool::Crosshair); - } - - void OnUpdate() override - { - // Check if the mouse is hovering over the list - if (!WidgetIsHighlighted(*this, WIDX_LIST)) + public: + void OnOpen() override { - if (_highlightedIndex != -1) - InvalidateWidget(WIDX_LIST); - _highlightedIndex = -1; + min_width = MIN_WW; + min_height = MIN_WH; + max_width = MAX_WW; + max_height = MAX_WH; + + windowTileInspectorSelectedIndex = -1; + SetPage(TileInspectorPage::Default); + WindowInitScrollWidgets(*this); + _tileSelected = false; + + ToolSet(*this, WIDX_BACKGROUND, Tool::Crosshair); } - if (gCurrentToolWidget.window_classification != WindowClass::TileInspector) - Close(); - } - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + void OnUpdate() override { - case WIDX_CLOSE: + // Check if the mouse is hovering over the list + if (!WidgetIsHighlighted(*this, WIDX_LIST)) + { + if (_highlightedIndex != -1) + InvalidateWidget(WIDX_LIST); + _highlightedIndex = -1; + } + if (gCurrentToolWidget.window_classification != WindowClass::TileInspector) Close(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + return; + + case WIDX_BUTTON_REMOVE: + { + RemoveElement(windowTileInspectorSelectedIndex); + break; + } + + case WIDX_BUTTON_ROTATE: + RotateElement(windowTileInspectorSelectedIndex); + break; + + case WIDX_BUTTON_SORT: + SortElements(); + break; + + case WIDX_BUTTON_COPY: + CopyElement(); + break; + + case WIDX_BUTTON_PASTE: + PasteElement(); + break; + + case WIDX_BUTTON_MOVE_UP: + SwapElements(windowTileInspectorSelectedIndex, windowTileInspectorSelectedIndex + 1); + break; + + case WIDX_BUTTON_MOVE_DOWN: + SwapElements(windowTileInspectorSelectedIndex - 1, windowTileInspectorSelectedIndex); + break; + } + + // Only element-specific widgets from now on + if (tileInspectorPage == TileInspectorPage::Default || windowTileInspectorSelectedIndex == -1) return; - case WIDX_BUTTON_REMOVE: - { - RemoveElement(windowTileInspectorSelectedIndex); - break; - } - - case WIDX_BUTTON_ROTATE: - RotateElement(windowTileInspectorSelectedIndex); - break; - - case WIDX_BUTTON_SORT: - SortElements(); - break; - - case WIDX_BUTTON_COPY: - CopyElement(); - break; - - case WIDX_BUTTON_PASTE: - PasteElement(); - break; - - case WIDX_BUTTON_MOVE_UP: - SwapElements(windowTileInspectorSelectedIndex, windowTileInspectorSelectedIndex + 1); - break; - - case WIDX_BUTTON_MOVE_DOWN: - SwapElements(windowTileInspectorSelectedIndex - 1, windowTileInspectorSelectedIndex); - break; - } - - // Only element-specific widgets from now on - if (tileInspectorPage == TileInspectorPage::Default || windowTileInspectorSelectedIndex == -1) - return; - - const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); - - if (tileElement == nullptr) - return; - - // Page widgets - switch (tileElement->GetType()) - { - case TileElementType::Surface: - switch (widgetIndex) - { - case WIDX_SURFACE_BUTTON_REMOVE_FENCES: - SurfaceShowParkFences(false); - break; - - case WIDX_SURFACE_BUTTON_RESTORE_FENCES: - SurfaceShowParkFences(true); - break; - - case WIDX_SURFACE_CHECK_CORNER_N: - case WIDX_SURFACE_CHECK_CORNER_E: - case WIDX_SURFACE_CHECK_CORNER_S: - case WIDX_SURFACE_CHECK_CORNER_W: - SurfaceToggleCorner(((widgetIndex - WIDX_SURFACE_CHECK_CORNER_N) + 2 - GetCurrentRotation()) & 3); - break; - - case WIDX_SURFACE_CHECK_DIAGONAL: - SurfaceToggleDiagonal(); - break; - } // switch widgetindex - break; - case TileElementType::Path: - switch (widgetIndex) - { - case WIDX_PATH_CHECK_SLOPED: - PathSetSloped(windowTileInspectorSelectedIndex, !tileElement->AsPath()->IsSloped()); - break; - case WIDX_PATH_CHECK_JUNCTION_RAILINGS: - PathSetJunctionRailings( - windowTileInspectorSelectedIndex, !tileElement->AsPath()->HasJunctionRailings()); - break; - - case WIDX_PATH_CHECK_BROKEN: - PathSetBroken(windowTileInspectorSelectedIndex, !tileElement->AsPath()->IsBroken()); - break; - - case WIDX_PATH_CHECK_EDGE_E: - case WIDX_PATH_CHECK_EDGE_S: - case WIDX_PATH_CHECK_EDGE_W: - case WIDX_PATH_CHECK_EDGE_N: - { - // 0 = east/right, 1 = south/bottom, 2 = west/left, 3 = north/top - const int32_t eswn = (widgetIndex - WIDX_PATH_CHECK_EDGE_E) / 2; - // Transform to world orientation - const int32_t index = (eswn - GetCurrentRotation()) & 3; - PathToggleEdge( - windowTileInspectorSelectedIndex, - index + 4); // The corners are stored in the 4 most significant bits, hence the + 4 - break; - } - - case WIDX_PATH_CHECK_EDGE_NE: - case WIDX_PATH_CHECK_EDGE_SE: - case WIDX_PATH_CHECK_EDGE_SW: - case WIDX_PATH_CHECK_EDGE_NW: - { - // 0 = NE, 1 = SE, 2 = SW, 3 = NW - const int32_t neseswnw = (widgetIndex - WIDX_PATH_CHECK_EDGE_NE) / 2; - // Transform to world orientation - const int32_t index = (neseswnw - GetCurrentRotation()) & 3; - PathToggleEdge(windowTileInspectorSelectedIndex, index); - break; - } - } // switch widget index - break; - - case TileElementType::Track: - switch (widgetIndex) - { - case WIDX_TRACK_CHECK_APPLY_TO_ALL: - _applyToAll ^= 1; - InvalidateWidget(widgetIndex); - break; - - case WIDX_TRACK_CHECK_CHAIN_LIFT: - { - bool entireTrackBlock = IsWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL); - bool newLift = !tileElement->AsTrack()->HasChain(); - TrackBlockSetLift(windowTileInspectorSelectedIndex, entireTrackBlock, newLift); - break; - } - - case WIDX_TRACK_CHECK_BRAKE_CLOSED: - TrackSetBrakeClosed(windowTileInspectorSelectedIndex, !tileElement->AsTrack()->IsBrakeClosed()); - break; - - case WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE: - TrackSetIndestructible(windowTileInspectorSelectedIndex, !tileElement->AsTrack()->IsIndestructible()); - break; - } // switch widget index - break; - - case TileElementType::SmallScenery: - switch (widgetIndex) - { - case WIDX_SCENERY_CHECK_QUARTER_N: - case WIDX_SCENERY_CHECK_QUARTER_E: - case WIDX_SCENERY_CHECK_QUARTER_S: - case WIDX_SCENERY_CHECK_QUARTER_W: - QuarterTileSet(windowTileInspectorSelectedIndex, widgetIndex - WIDX_SCENERY_CHECK_QUARTER_N); - break; - - case WIDX_SCENERY_CHECK_COLLISION_N: - case WIDX_SCENERY_CHECK_COLLISION_E: - case WIDX_SCENERY_CHECK_COLLISION_S: - case WIDX_SCENERY_CHECK_COLLISION_W: - ToggleQuadrantCollosion(windowTileInspectorSelectedIndex, widgetIndex - WIDX_SCENERY_CHECK_COLLISION_N); - break; - } // switch widget index - break; - - case TileElementType::Entrance: - switch (widgetIndex) - { - case WIDX_ENTRANCE_BUTTON_MAKE_USABLE: - EntranceMakeUsable(windowTileInspectorSelectedIndex); - break; - } // switch widget index - break; - - case TileElementType::Banner: - switch (widgetIndex) - { - case WIDX_BANNER_CHECK_BLOCK_NE: - case WIDX_BANNER_CHECK_BLOCK_SE: - case WIDX_BANNER_CHECK_BLOCK_SW: - case WIDX_BANNER_CHECK_BLOCK_NW: - BannerToggleBlock(windowTileInspectorSelectedIndex, widgetIndex - WIDX_BANNER_CHECK_BLOCK_NE); - break; - } // switch widget index - break; - - case TileElementType::LargeScenery: - case TileElementType::Wall: - default: - break; - } - } - - void OnClose() override - { - ToolCancel(); - TileElement* const elem = OpenRCT2::TileInspector::GetSelectedElement(); - if (elem != nullptr) - { - MapInvalidateElement(_toolMap, elem); - } - windowTileInspectorSelectedIndex = -1; - } - - void OnResize() override - { - if (width < min_width) - { - Invalidate(); - width = min_width; - } - if (height < min_height) - { - Invalidate(); - height = min_height; - } - ResizeFrame(); - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_SPINNER_X_INCREASE: - windowTileInspectorTile.x = std::min(windowTileInspectorTile.x + 1, MAXIMUM_MAP_SIZE_TECHNICAL - 1); - _toolMap.x = std::min(_toolMap.x + 32, MAXIMUM_TILE_START_XY); - LoadTile(nullptr); - break; - - case WIDX_SPINNER_X_DECREASE: - windowTileInspectorTile.x = std::max(windowTileInspectorTile.x - 1, 0); - _toolMap.x = std::max(_toolMap.x - 32, 0); - LoadTile(nullptr); - break; - - case WIDX_SPINNER_Y_INCREASE: - windowTileInspectorTile.y = std::min(windowTileInspectorTile.y + 1, MAXIMUM_MAP_SIZE_TECHNICAL - 1); - _toolMap.y = std::min(_toolMap.y + 32, MAXIMUM_TILE_START_XY); - LoadTile(nullptr); - break; - - case WIDX_SPINNER_Y_DECREASE: - windowTileInspectorTile.y = std::max(windowTileInspectorTile.y - 1, 0); - _toolMap.y = std::max(_toolMap.y - 32, 0); - LoadTile(nullptr); - break; - } // switch widget index - - // Only element-specific widgets from now on - if (tileInspectorPage == TileInspectorPage::Default || windowTileInspectorSelectedIndex == -1) - return; - - const TileElement* tileElement = OpenRCT2::TileInspector::GetSelectedElement(); - if (tileElement == nullptr) - return; - - switch (tileElement->GetType()) - { - case TileElementType::Surface: - switch (widgetIndex) - { - case WIDX_SURFACE_SPINNER_HEIGHT_INCREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, 1); - break; - - case WIDX_SURFACE_SPINNER_HEIGHT_DECREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, -1); - break; - } // switch widget index - break; - - case TileElementType::Path: - switch (widgetIndex) - { - case WIDX_PATH_SPINNER_HEIGHT_INCREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, 1); - break; - - case WIDX_PATH_SPINNER_HEIGHT_DECREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, -1); - break; - } // switch widget index - break; - - case TileElementType::Track: - switch (widgetIndex) - { - case WIDX_TRACK_SPINNER_HEIGHT_INCREASE: - if (IsWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL)) - TrackBlockHeightOffset(windowTileInspectorSelectedIndex, 1); - else - BaseHeightOffset(windowTileInspectorSelectedIndex, 1); - break; - - case WIDX_TRACK_SPINNER_HEIGHT_DECREASE: - if (IsWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL)) - TrackBlockHeightOffset(windowTileInspectorSelectedIndex, -1); - else - BaseHeightOffset(windowTileInspectorSelectedIndex, -1); - break; - } // switch widget index - break; - - case TileElementType::SmallScenery: - switch (widgetIndex) - { - case WIDX_SCENERY_SPINNER_HEIGHT_INCREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, 1); - break; - - case WIDX_SCENERY_SPINNER_HEIGHT_DECREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, -1); - break; - } // switch widget index - break; - - case TileElementType::Entrance: - switch (widgetIndex) - { - case WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, 1); - break; - - case WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, -1); - break; - - case WIDX_ENTRANCE_BUTTON_MAKE_USABLE: - EntranceMakeUsable(windowTileInspectorSelectedIndex); - break; - } // switch widget index - break; - - case TileElementType::Wall: - switch (widgetIndex) - { - case WIDX_WALL_SPINNER_HEIGHT_INCREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, 1); - break; - - case WIDX_WALL_SPINNER_HEIGHT_DECREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, -1); - break; - - case WIDX_WALL_DROPDOWN_SLOPE_BUTTON: - { - Widget* widget = &widgets[widgetIndex]; - // Use dropdown instead of dropdown button - widget--; - // Fill dropdown list - gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[2].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[0].Args = STR_TILE_INSPECTOR_WALL_FLAT; - gDropdownItems[1].Args = STR_TILE_INSPECTOR_WALL_SLOPED_LEFT; - gDropdownItems[2].Args = STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT; - WindowDropdownShowTextCustomWidth( - { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, 3, widget->width() - 3); - - // Set current value as checked - Dropdown::SetChecked(tileElement->AsWall()->GetSlope(), true); - break; - } - - case WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE: - WallAnimationFrameOffset(windowTileInspectorSelectedIndex, 1); - break; - - case WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE: - WallAnimationFrameOffset(windowTileInspectorSelectedIndex, -1); - break; - } // switch widget index - break; - - case TileElementType::LargeScenery: - switch (widgetIndex) - { - case WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, 1); - break; - - case WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, -1); - break; - } // switch widget index - break; - - case TileElementType::Banner: - switch (widgetIndex) - { - case WIDX_BANNER_SPINNER_HEIGHT_INCREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, 1); - break; - - case WIDX_BANNER_SPINNER_HEIGHT_DECREASE: - BaseHeightOffset(windowTileInspectorSelectedIndex, -1); - break; - } // switch widget index - break; - - default: - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override - { - if (dropdownIndex == -1) - return; - // Get selected element - const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); - if (tileInspectorPage == TileInspectorPage::Wall) - { - Guard::Assert(tileElement->GetType() == TileElementType::Wall, "Element is not a wall"); - if (widgetIndex == WIDX_WALL_DROPDOWN_SLOPE_BUTTON) - WallSetSlope(windowTileInspectorSelectedIndex, dropdownIndex); - } - } - - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - MapInvalidateSelectionRect(); - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - - CoordsXY mapCoords; - TileElement* clickedElement = nullptr; - bool mouseOnViewport = false; - if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z)) - { - auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionFlags); - clickedElement = info.Element; - mapCoords = info.Loc; - } - // Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor - if (clickedElement == nullptr) - { - auto mouseCoords = ScreenPosToMapPos(screenCoords, nullptr); - if (mouseCoords.has_value()) - { - mouseOnViewport = true; - mapCoords = mouseCoords.value(); - } - } - if (mouseOnViewport) - gMapSelectPositionA = gMapSelectPositionB = mapCoords; - else if (_tileSelected) - gMapSelectPositionA = gMapSelectPositionB = _toolMap; - else - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - - gMapSelectType = MAP_SELECT_TYPE_FULL; - MapInvalidateSelectionRect(); - } - - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - UpdateSelectedTile(screenCoords); - } - - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - UpdateSelectedTile(screenCoords); - } - - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - return ScreenSize(WW - 30, windowTileInspectorElementCount * SCROLLABLE_ROW_HEIGHT); - } - - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - // There is nothing to interact with when no tile is selected - if (!_tileSelected) - return; - - // Because the list items are displayed in reverse order, subtract the calculated index from the amount of elements - const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1; - const ScreenRect checkboxColumnRect{ { 2, 0 }, { 15, screenCoords.y } }; - if (index >= 0 && checkboxColumnRect.Contains(screenCoords)) - { // Checkbox was clicked - ToggleInvisibility(index); - } - else - { - SelectElementFromList(index); - } - } - - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1; - if (index < 0 || index >= windowTileInspectorElementCount) - _highlightedIndex = -1; - else - _highlightedIndex = index; - InvalidateWidget(WIDX_LIST); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - ScreenCoordsXY screenCoords(windowPos.x, windowPos.y); - - // Draw coordinates - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(5, 24), "X:", { colours[1] }); - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(74, 24), "Y:", { colours[1] }); - if (_tileSelected) - { - auto tileCoords = TileCoordsXY{ _toolMap }; - auto ft = Formatter(); - ft.Add(tileCoords.x); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 43, 24 }, STR_FORMAT_INTEGER, ft, { colours[1], TextAlignment::RIGHT }); - ft = Formatter(); - ft.Add(tileCoords.y); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 113, 24 }, STR_FORMAT_INTEGER, ft, { colours[1], TextAlignment::RIGHT }); - } - else - { - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(43 - 7, 24), "-", { colours[1] }); - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(113 - 7, 24), "-", { colours[1] }); - } - - if (windowTileInspectorSelectedIndex != -1) - { - // X and Y of first element in detail box - screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_GROUPBOX_DETAILS].top + 14 }; - - // Get map element const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); + + if (tileElement == nullptr) + return; + + // Page widgets + switch (tileElement->GetType()) + { + case TileElementType::Surface: + switch (widgetIndex) + { + case WIDX_SURFACE_BUTTON_REMOVE_FENCES: + SurfaceShowParkFences(false); + break; + + case WIDX_SURFACE_BUTTON_RESTORE_FENCES: + SurfaceShowParkFences(true); + break; + + case WIDX_SURFACE_CHECK_CORNER_N: + case WIDX_SURFACE_CHECK_CORNER_E: + case WIDX_SURFACE_CHECK_CORNER_S: + case WIDX_SURFACE_CHECK_CORNER_W: + SurfaceToggleCorner(((widgetIndex - WIDX_SURFACE_CHECK_CORNER_N) + 2 - GetCurrentRotation()) & 3); + break; + + case WIDX_SURFACE_CHECK_DIAGONAL: + SurfaceToggleDiagonal(); + break; + } // switch widgetindex + break; + case TileElementType::Path: + switch (widgetIndex) + { + case WIDX_PATH_CHECK_SLOPED: + PathSetSloped(windowTileInspectorSelectedIndex, !tileElement->AsPath()->IsSloped()); + break; + case WIDX_PATH_CHECK_JUNCTION_RAILINGS: + PathSetJunctionRailings( + windowTileInspectorSelectedIndex, !tileElement->AsPath()->HasJunctionRailings()); + break; + + case WIDX_PATH_CHECK_BROKEN: + PathSetBroken(windowTileInspectorSelectedIndex, !tileElement->AsPath()->IsBroken()); + break; + + case WIDX_PATH_CHECK_EDGE_E: + case WIDX_PATH_CHECK_EDGE_S: + case WIDX_PATH_CHECK_EDGE_W: + case WIDX_PATH_CHECK_EDGE_N: + { + // 0 = east/right, 1 = south/bottom, 2 = west/left, 3 = north/top + const int32_t eswn = (widgetIndex - WIDX_PATH_CHECK_EDGE_E) / 2; + // Transform to world orientation + const int32_t index = (eswn - GetCurrentRotation()) & 3; + PathToggleEdge( + windowTileInspectorSelectedIndex, + index + 4); // The corners are stored in the 4 most significant bits, hence the + 4 + break; + } + + case WIDX_PATH_CHECK_EDGE_NE: + case WIDX_PATH_CHECK_EDGE_SE: + case WIDX_PATH_CHECK_EDGE_SW: + case WIDX_PATH_CHECK_EDGE_NW: + { + // 0 = NE, 1 = SE, 2 = SW, 3 = NW + const int32_t neseswnw = (widgetIndex - WIDX_PATH_CHECK_EDGE_NE) / 2; + // Transform to world orientation + const int32_t index = (neseswnw - GetCurrentRotation()) & 3; + PathToggleEdge(windowTileInspectorSelectedIndex, index); + break; + } + } // switch widget index + break; + + case TileElementType::Track: + switch (widgetIndex) + { + case WIDX_TRACK_CHECK_APPLY_TO_ALL: + _applyToAll ^= 1; + InvalidateWidget(widgetIndex); + break; + + case WIDX_TRACK_CHECK_CHAIN_LIFT: + { + bool entireTrackBlock = IsWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL); + bool newLift = !tileElement->AsTrack()->HasChain(); + TrackBlockSetLift(windowTileInspectorSelectedIndex, entireTrackBlock, newLift); + break; + } + + case WIDX_TRACK_CHECK_BRAKE_CLOSED: + TrackSetBrakeClosed(windowTileInspectorSelectedIndex, !tileElement->AsTrack()->IsBrakeClosed()); + break; + + case WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE: + TrackSetIndestructible( + windowTileInspectorSelectedIndex, !tileElement->AsTrack()->IsIndestructible()); + break; + } // switch widget index + break; + + case TileElementType::SmallScenery: + switch (widgetIndex) + { + case WIDX_SCENERY_CHECK_QUARTER_N: + case WIDX_SCENERY_CHECK_QUARTER_E: + case WIDX_SCENERY_CHECK_QUARTER_S: + case WIDX_SCENERY_CHECK_QUARTER_W: + QuarterTileSet(windowTileInspectorSelectedIndex, widgetIndex - WIDX_SCENERY_CHECK_QUARTER_N); + break; + + case WIDX_SCENERY_CHECK_COLLISION_N: + case WIDX_SCENERY_CHECK_COLLISION_E: + case WIDX_SCENERY_CHECK_COLLISION_S: + case WIDX_SCENERY_CHECK_COLLISION_W: + ToggleQuadrantCollosion( + windowTileInspectorSelectedIndex, widgetIndex - WIDX_SCENERY_CHECK_COLLISION_N); + break; + } // switch widget index + break; + + case TileElementType::Entrance: + switch (widgetIndex) + { + case WIDX_ENTRANCE_BUTTON_MAKE_USABLE: + EntranceMakeUsable(windowTileInspectorSelectedIndex); + break; + } // switch widget index + break; + + case TileElementType::Banner: + switch (widgetIndex) + { + case WIDX_BANNER_CHECK_BLOCK_NE: + case WIDX_BANNER_CHECK_BLOCK_SE: + case WIDX_BANNER_CHECK_BLOCK_SW: + case WIDX_BANNER_CHECK_BLOCK_NW: + BannerToggleBlock(windowTileInspectorSelectedIndex, widgetIndex - WIDX_BANNER_CHECK_BLOCK_NE); + break; + } // switch widget index + break; + + case TileElementType::LargeScenery: + case TileElementType::Wall: + default: + break; + } + } + + void OnClose() override + { + ToolCancel(); + TileElement* const elem = OpenRCT2::TileInspector::GetSelectedElement(); + if (elem != nullptr) + { + MapInvalidateElement(_toolMap, elem); + } + windowTileInspectorSelectedIndex = -1; + } + + void OnResize() override + { + if (width < min_width) + { + Invalidate(); + width = min_width; + } + if (height < min_height) + { + Invalidate(); + height = min_height; + } + ResizeFrame(); + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_SPINNER_X_INCREASE: + windowTileInspectorTile.x = std::min(windowTileInspectorTile.x + 1, kMaximumMapSizeTechnical - 1); + _toolMap.x = std::min(_toolMap.x + 32, MAXIMUM_TILE_START_XY); + LoadTile(nullptr); + break; + + case WIDX_SPINNER_X_DECREASE: + windowTileInspectorTile.x = std::max(windowTileInspectorTile.x - 1, 0); + _toolMap.x = std::max(_toolMap.x - 32, 0); + LoadTile(nullptr); + break; + + case WIDX_SPINNER_Y_INCREASE: + windowTileInspectorTile.y = std::min(windowTileInspectorTile.y + 1, kMaximumMapSizeTechnical - 1); + _toolMap.y = std::min(_toolMap.y + 32, MAXIMUM_TILE_START_XY); + LoadTile(nullptr); + break; + + case WIDX_SPINNER_Y_DECREASE: + windowTileInspectorTile.y = std::max(windowTileInspectorTile.y - 1, 0); + _toolMap.y = std::max(_toolMap.y - 32, 0); + LoadTile(nullptr); + break; + } // switch widget index + + // Only element-specific widgets from now on + if (tileInspectorPage == TileInspectorPage::Default || windowTileInspectorSelectedIndex == -1) + return; + + const TileElement* tileElement = OpenRCT2::TileInspector::GetSelectedElement(); if (tileElement == nullptr) return; switch (tileElement->GetType()) { case TileElementType::Surface: - { - // Details - // Terrain texture name - StringId terrainNameId = STR_EMPTY; - auto surfaceStyle = tileElement->AsSurface()->GetSurfaceObject(); - if (surfaceStyle != nullptr) - terrainNameId = surfaceStyle->NameStringId; - auto ft = Formatter(); - ft.Add(terrainNameId); - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SURFACE_TERAIN, ft, { colours[1] }); + switch (widgetIndex) + { + case WIDX_SURFACE_SPINNER_HEIGHT_INCREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, 1); + break; - // Edge texture name - StringId terrainEdgeNameId = STR_EMPTY; - auto edgeStyle = tileElement->AsSurface()->GetEdgeObject(); - if (edgeStyle != nullptr) - terrainEdgeNameId = edgeStyle->NameStringId; - ft = Formatter(); - ft.Add(terrainEdgeNameId); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_SURFACE_EDGE, ft, { colours[1] }); - - // Land ownership - StringId landOwnership; - if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_OWNED) - landOwnership = STR_LAND_OWNED; - else if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_AVAILABLE) - landOwnership = STR_LAND_SALE; - else if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED) - landOwnership = STR_CONSTRUCTION_RIGHTS_OWNED; - else if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) - landOwnership = STR_CONSTRUCTION_RIGHTS_SALE; - else - landOwnership = STR_TILE_INSPECTOR_LAND_NOT_OWNED_AND_NOT_AVAILABLE; - - ft = Formatter(); - ft.Add(landOwnership); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_SURFACE_OWNERSHIP, ft, { colours[1] }); - - // Water level - ft = Formatter(); - ft.Add(tileElement->AsSurface()->GetWaterHeight()); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 33 }, STR_TILE_INSPECTOR_SURFACE_WATER_LEVEL, ft, - { colours[1] }); - - // Properties - // Raise / lower label - screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_SURFACE_SPINNER_HEIGHT].top }; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); - - // Current base height - screenCoords.x = windowPos.x + widgets[WIDX_SURFACE_SPINNER_HEIGHT].left + 3; - ft = Formatter(); - ft.Add(tileElement->BaseHeight); - DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); - - // Raised corners - screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_SURFACE_CHECK_CORNER_E].top }; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SURFACE_CORNERS, {}, { colours[1] }); + case WIDX_SURFACE_SPINNER_HEIGHT_DECREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, -1); + break; + } // switch widget index break; - } + case TileElementType::Path: - { - // Details - auto pathEl = tileElement->AsPath(); - auto footpathObj = pathEl->GetLegacyPathEntry(); - if (footpathObj == nullptr) + switch (widgetIndex) { - // Surface name - auto surfaceObj = pathEl->GetSurfaceEntry(); - if (surfaceObj != nullptr) - { - auto ft = Formatter(); - ft.Add(surfaceObj->NameStringId); - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_FOOTPATH_SURFACE_NAME, ft, { COLOUR_WHITE }); - } + case WIDX_PATH_SPINNER_HEIGHT_INCREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, 1); + break; - // Railings name - auto railingsObj = pathEl->GetRailingsEntry(); - if (railingsObj != nullptr) - { - auto ft = Formatter(); - ft.Add(railingsObj->NameStringId); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_FOOTPATH_RAILINGS_NAME, ft, - { COLOUR_WHITE }); - } - } - else - { - // Legacy path name - auto footpathEntry = reinterpret_cast(footpathObj->GetLegacyData()); - auto ft = Formatter(); - ft.Add(footpathEntry->string_idx); - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_PATH_NAME, ft, { COLOUR_WHITE }); - } - - // Path addition - if (tileElement->AsPath()->HasAddition()) - { - const auto pathAdditionEntry = tileElement->AsPath()->GetAdditionEntry(); - StringId additionNameId = pathAdditionEntry != nullptr ? pathAdditionEntry->name - : static_cast(STR_UNKNOWN_OBJECT_TYPE); - auto ft = Formatter(); - ft.Add(additionNameId); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 2 * 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS, ft, - { COLOUR_WHITE }); - } - else - { - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 2 * 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS_NONE, {}, - { COLOUR_WHITE }); - } - - // Properties - // Raise / lower label - screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_PATH_SPINNER_HEIGHT].top }; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); - - // Current base height - screenCoords.x = windowPos.x + widgets[WIDX_PATH_SPINNER_HEIGHT].left + 3; - auto ft = Formatter(); - ft.Add(tileElement->BaseHeight); - DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); - - // Path connections - screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_PATH_CHECK_EDGE_W].top }; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_PATH_CONNECTED_EDGES, {}, { colours[1] }); + case WIDX_PATH_SPINNER_HEIGHT_DECREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, -1); + break; + } // switch widget index break; - } case TileElementType::Track: - { - auto trackElement = tileElement->AsTrack(); - RideId id = trackElement->GetRideIndex(); - auto rideTile = GetRide(id); - - // Ride ID - auto ft = Formatter(); - ft.Add(id); - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_TRACK_RIDE_ID, ft, { colours[1] }); - - // Ride name - if (rideTile != nullptr) + switch (widgetIndex) { - ft = Formatter(); - rideTile->FormatNameTo(ft); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_TRACK_RIDE_NAME, ft, - { colours[1] }); - } + case WIDX_TRACK_SPINNER_HEIGHT_INCREASE: + if (IsWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL)) + TrackBlockHeightOffset(windowTileInspectorSelectedIndex, 1); + else + BaseHeightOffset(windowTileInspectorSelectedIndex, 1); + break; - // Ride type. Individual pieces may be of a different ride type from the ride it belongs to. - const auto& rtd = GetRideTypeDescriptor(trackElement->GetRideType()); - ft = Formatter(); - ft.Add(rtd.Naming.Name); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_TRACK_RIDE_TYPE, ft, { colours[1] }); - - // Track - ft = Formatter(); - ft.Add(trackElement->GetTrackType()); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 33 }, STR_TILE_INSPECTOR_TRACK_PIECE_ID, ft, { colours[1] }); - - ft = Formatter(); - ft.Add(trackElement->GetSequenceIndex()); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 44 }, STR_TILE_INSPECTOR_TRACK_SEQUENCE, ft, { colours[1] }); - if (trackElement->IsStation()) - { - auto stationIndex = trackElement->GetStationIndex(); - ft = Formatter(); - ft.Add(STR_COMMA16); - ft.Add(stationIndex.ToUnderlying()); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 55 }, STR_TILE_INSPECTOR_STATION_INDEX, ft, { colours[1] }); - } - else - { - const char* stationNone = "-"; - ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(stationNone); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 55 }, STR_TILE_INSPECTOR_STATION_INDEX, ft, { colours[1] }); - } - - ft = Formatter(); - ft.Add(ColourSchemeNames[trackElement->GetColourScheme()]); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 66 }, STR_TILE_INSPECTOR_COLOUR_SCHEME, ft, { colours[1] }); - - // Properties - // Raise / lower label - screenCoords.y = windowPos.y + widgets[WIDX_TRACK_SPINNER_HEIGHT].top; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); - - // Current base height - screenCoords.x = windowPos.x + widgets[WIDX_TRACK_SPINNER_HEIGHT].left + 3; - ft = Formatter(); - ft.Add(tileElement->BaseHeight); - DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); + case WIDX_TRACK_SPINNER_HEIGHT_DECREASE: + if (IsWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL)) + TrackBlockHeightOffset(windowTileInspectorSelectedIndex, -1); + else + BaseHeightOffset(windowTileInspectorSelectedIndex, -1); + break; + } // switch widget index break; - } case TileElementType::SmallScenery: - { - // Details - // Age - auto ft = Formatter(); - ft.Add(tileElement->AsSmallScenery()->GetAge()); - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SCENERY_AGE, ft, { colours[1] }); - - // Quadrant value - const auto* sceneryEntry = tileElement->AsSmallScenery()->GetEntry(); - if (sceneryEntry != nullptr && !(sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE))) + switch (widgetIndex) { - int16_t quadrant = tileElement->AsSmallScenery()->GetSceneryQuadrant(); - static constexpr StringId _quadrantStringIdx[] = { - STR_TILE_INSPECTOR_SCENERY_QUADRANT_SW, - STR_TILE_INSPECTOR_SCENERY_QUADRANT_NW, - STR_TILE_INSPECTOR_SCENERY_QUADRANT_NE, - STR_TILE_INSPECTOR_SCENERY_QUADRANT_SE, - }; - ft = Formatter(); - ft.Add(_quadrantStringIdx[quadrant]); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_SCENERY_QUADRANT, ft, - { colours[1] }); - } + case WIDX_SCENERY_SPINNER_HEIGHT_INCREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, 1); + break; - // Scenery ID - ft = Formatter(); - ft.Add(tileElement->AsSmallScenery()->GetEntryIndex()); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_SCENERY_ENTRY_IDX, ft, { colours[1] }); - - // Properties - // Raise / Lower - screenCoords.y = windowPos.y + widgets[WIDX_SCENERY_SPINNER_HEIGHT].top; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); - - // Current base height - screenCoords.x = windowPos.x + widgets[WIDX_SCENERY_SPINNER_HEIGHT].left + 3; - ft = Formatter(); - ft.Add(tileElement->BaseHeight); - DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); - - // Quarter tile - screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_SCENERY_CHECK_QUARTER_E].top }; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SCENERY_QUADRANT_LABEL, {}, { colours[1] }); - - // Collision - screenCoords.y = windowPos.y + widgets[WIDX_SCENERY_CHECK_COLLISION_E].top; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_COLLISSION, {}, { colours[1] }); + case WIDX_SCENERY_SPINNER_HEIGHT_DECREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, -1); + break; + } // switch widget index break; - } case TileElementType::Entrance: - { - // Details - // Entrance type - auto ft = Formatter(); - ft.Add(EntranceTypeStringIds[tileElement->AsEntrance()->GetEntranceType()]); - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_ENTRANCE_TYPE, ft, { colours[1] }); + switch (widgetIndex) + { + case WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, 1); + break; - if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) + case WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, -1); + break; + + case WIDX_ENTRANCE_BUTTON_MAKE_USABLE: + EntranceMakeUsable(windowTileInspectorSelectedIndex); + break; + } // switch widget index + break; + + case TileElementType::Wall: + switch (widgetIndex) { - // TODO: Make this work with Left/Right park entrance parts - ft = Formatter(); - ft.Add(ParkEntranceGetIndex({ _toolMap, tileElement->GetBaseZ() })); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID, ft, - { colours[1] }); - } - else - { - ft = Formatter(); - ft.Add(tileElement->AsEntrance()->GetStationIndex().ToUnderlying()); - if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE) + case WIDX_WALL_SPINNER_HEIGHT_INCREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, 1); + break; + + case WIDX_WALL_SPINNER_HEIGHT_DECREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, -1); + break; + + case WIDX_WALL_DROPDOWN_SLOPE_BUTTON: { - // Ride entrance ID + Widget* widget = &widgets[widgetIndex]; + // Use dropdown instead of dropdown button + widget--; + // Fill dropdown list + gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[1].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[2].Format = STR_DROPDOWN_MENU_LABEL; + gDropdownItems[0].Args = STR_TILE_INSPECTOR_WALL_FLAT; + gDropdownItems[1].Args = STR_TILE_INSPECTOR_WALL_SLOPED_LEFT; + gDropdownItems[2].Args = STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT; + WindowDropdownShowTextCustomWidth( + { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, + Dropdown::Flag::StayOpen, 3, widget->width() - 3); + + // Set current value as checked + Dropdown::SetChecked(tileElement->AsWall()->GetSlope(), true); + break; + } + + case WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE: + WallAnimationFrameOffset(windowTileInspectorSelectedIndex, 1); + break; + + case WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE: + WallAnimationFrameOffset(windowTileInspectorSelectedIndex, -1); + break; + } // switch widget index + break; + + case TileElementType::LargeScenery: + switch (widgetIndex) + { + case WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, 1); + break; + + case WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, -1); + break; + } // switch widget index + break; + + case TileElementType::Banner: + switch (widgetIndex) + { + case WIDX_BANNER_SPINNER_HEIGHT_INCREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, 1); + break; + + case WIDX_BANNER_SPINNER_HEIGHT_DECREASE: + BaseHeightOffset(windowTileInspectorSelectedIndex, -1); + break; + } // switch widget index + break; + + default: + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + { + if (dropdownIndex == -1) + return; + // Get selected element + const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); + if (tileInspectorPage == TileInspectorPage::Wall) + { + Guard::Assert(tileElement->GetType() == TileElementType::Wall, "Element is not a wall"); + if (widgetIndex == WIDX_WALL_DROPDOWN_SLOPE_BUTTON) + WallSetSlope(windowTileInspectorSelectedIndex, dropdownIndex); + } + } + + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + MapInvalidateSelectionRect(); + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + + CoordsXY mapCoords; + TileElement* clickedElement = nullptr; + bool mouseOnViewport = false; + if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z)) + { + auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionFlags); + clickedElement = info.Element; + mapCoords = info.Loc; + } + // Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor + if (clickedElement == nullptr) + { + auto mouseCoords = ScreenPosToMapPos(screenCoords, nullptr); + if (mouseCoords.has_value()) + { + mouseOnViewport = true; + mapCoords = mouseCoords.value(); + } + } + if (mouseOnViewport) + gMapSelectPositionA = gMapSelectPositionB = mapCoords; + else if (_tileSelected) + gMapSelectPositionA = gMapSelectPositionB = _toolMap; + else + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + + gMapSelectType = MAP_SELECT_TYPE_FULL; + MapInvalidateSelectionRect(); + } + + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + UpdateSelectedTile(screenCoords); + } + + void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + UpdateSelectedTile(screenCoords); + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + return ScreenSize(WW - 30, windowTileInspectorElementCount * SCROLLABLE_ROW_HEIGHT); + } + + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + // There is nothing to interact with when no tile is selected + if (!_tileSelected) + return; + + // Because the list items are displayed in reverse order, subtract the calculated index from the amount of elements + const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1; + const ScreenRect checkboxColumnRect{ { 2, 0 }, { 15, screenCoords.y } }; + if (index >= 0 && checkboxColumnRect.Contains(screenCoords)) + { // Checkbox was clicked + ToggleInvisibility(index); + } + else + { + SelectElementFromList(index); + } + } + + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1; + if (index < 0 || index >= windowTileInspectorElementCount) + _highlightedIndex = -1; + else + _highlightedIndex = index; + InvalidateWidget(WIDX_LIST); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + ScreenCoordsXY screenCoords(windowPos.x, windowPos.y); + + // Draw coordinates + GfxDrawString(dpi, screenCoords + ScreenCoordsXY(5, 24), "X:", { colours[1] }); + GfxDrawString(dpi, screenCoords + ScreenCoordsXY(74, 24), "Y:", { colours[1] }); + if (_tileSelected) + { + auto tileCoords = TileCoordsXY{ _toolMap }; + auto ft = Formatter(); + ft.Add(tileCoords.x); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 43, 24 }, STR_FORMAT_INTEGER, ft, { colours[1], TextAlignment::RIGHT }); + ft = Formatter(); + ft.Add(tileCoords.y); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 113, 24 }, STR_FORMAT_INTEGER, ft, + { colours[1], TextAlignment::RIGHT }); + } + else + { + GfxDrawString(dpi, screenCoords + ScreenCoordsXY(43 - 7, 24), "-", { colours[1] }); + GfxDrawString(dpi, screenCoords + ScreenCoordsXY(113 - 7, 24), "-", { colours[1] }); + } + + if (windowTileInspectorSelectedIndex != -1) + { + // X and Y of first element in detail box + screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_GROUPBOX_DETAILS].top + 14 }; + + // Get map element + const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); + if (tileElement == nullptr) + return; + + switch (tileElement->GetType()) + { + case TileElementType::Surface: + { + // Details + // Terrain texture name + StringId terrainNameId = STR_EMPTY; + auto surfaceStyle = tileElement->AsSurface()->GetSurfaceObject(); + if (surfaceStyle != nullptr) + terrainNameId = surfaceStyle->NameStringId; + auto ft = Formatter(); + ft.Add(terrainNameId); + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SURFACE_TERAIN, ft, { colours[1] }); + + // Edge texture name + StringId terrainEdgeNameId = STR_EMPTY; + auto edgeStyle = tileElement->AsSurface()->GetEdgeObject(); + if (edgeStyle != nullptr) + terrainEdgeNameId = edgeStyle->NameStringId; + ft = Formatter(); + ft.Add(terrainEdgeNameId); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_SURFACE_EDGE, ft, { colours[1] }); + + // Land ownership + StringId landOwnership; + if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_OWNED) + landOwnership = STR_LAND_OWNED; + else if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_AVAILABLE) + landOwnership = STR_LAND_SALE; + else if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED) + landOwnership = STR_CONSTRUCTION_RIGHTS_OWNED; + else if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) + landOwnership = STR_CONSTRUCTION_RIGHTS_SALE; + else + landOwnership = STR_TILE_INSPECTOR_LAND_NOT_OWNED_AND_NOT_AVAILABLE; + + ft = Formatter(); + ft.Add(landOwnership); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_SURFACE_OWNERSHIP, ft, + { colours[1] }); + + // Water level + ft = Formatter(); + ft.Add(tileElement->AsSurface()->GetWaterHeight()); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 33 }, STR_TILE_INSPECTOR_SURFACE_WATER_LEVEL, ft, + { colours[1] }); + + // Properties + // Raise / lower label + screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, + widgets[WIDX_SURFACE_SPINNER_HEIGHT].top }; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); + + // Current base height + screenCoords.x = windowPos.x + widgets[WIDX_SURFACE_SPINNER_HEIGHT].left + 3; + ft = Formatter(); + ft.Add(tileElement->BaseHeight); + DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); + + // Raised corners + screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, + widgets[WIDX_SURFACE_CHECK_CORNER_E].top }; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SURFACE_CORNERS, {}, { colours[1] }); + break; + } + case TileElementType::Path: + { + // Details + auto pathEl = tileElement->AsPath(); + auto footpathObj = pathEl->GetLegacyPathEntry(); + if (footpathObj == nullptr) + { + // Surface name + auto surfaceObj = pathEl->GetSurfaceEntry(); + if (surfaceObj != nullptr) + { + auto ft = Formatter(); + ft.Add(surfaceObj->NameStringId); + DrawTextBasic( + dpi, screenCoords, STR_TILE_INSPECTOR_FOOTPATH_SURFACE_NAME, ft, { COLOUR_WHITE }); + } + + // Railings name + auto railingsObj = pathEl->GetRailingsEntry(); + if (railingsObj != nullptr) + { + auto ft = Formatter(); + ft.Add(railingsObj->NameStringId); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_FOOTPATH_RAILINGS_NAME, ft, + { COLOUR_WHITE }); + } + } + else + { + // Legacy path name + auto footpathEntry = reinterpret_cast(footpathObj->GetLegacyData()); + auto ft = Formatter(); + ft.Add(footpathEntry->string_idx); + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_PATH_NAME, ft, { COLOUR_WHITE }); + } + + // Path addition + if (tileElement->AsPath()->HasAddition()) + { + const auto pathAdditionEntry = tileElement->AsPath()->GetAdditionEntry(); + StringId additionNameId = pathAdditionEntry != nullptr + ? pathAdditionEntry->name + : static_cast(STR_UNKNOWN_OBJECT_TYPE); + auto ft = Formatter(); + ft.Add(additionNameId); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 2 * 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS, ft, + { COLOUR_WHITE }); + } + else + { + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 2 * 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS_NONE, {}, + { COLOUR_WHITE }); + } + + // Properties + // Raise / lower label + screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_PATH_SPINNER_HEIGHT].top }; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); + + // Current base height + screenCoords.x = windowPos.x + widgets[WIDX_PATH_SPINNER_HEIGHT].left + 3; + auto ft = Formatter(); + ft.Add(tileElement->BaseHeight); + DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); + + // Path connections + screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_PATH_CHECK_EDGE_W].top }; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_PATH_CONNECTED_EDGES, {}, { colours[1] }); + break; + } + + case TileElementType::Track: + { + auto trackElement = tileElement->AsTrack(); + RideId id = trackElement->GetRideIndex(); + auto rideTile = GetRide(id); + + // Ride ID + auto ft = Formatter(); + ft.Add(id); + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_TRACK_RIDE_ID, ft, { colours[1] }); + + // Ride name + if (rideTile != nullptr) + { + ft = Formatter(); + rideTile->FormatNameTo(ft); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_TRACK_RIDE_NAME, ft, + { colours[1] }); + } + + // Ride type. Individual pieces may be of a different ride type from the ride it belongs to. + const auto& rtd = GetRideTypeDescriptor(trackElement->GetRideType()); + ft = Formatter(); + ft.Add(rtd.Naming.Name); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_TRACK_RIDE_TYPE, ft, + { colours[1] }); + + // Track + ft = Formatter(); + ft.Add(trackElement->GetTrackType()); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 33 }, STR_TILE_INSPECTOR_TRACK_PIECE_ID, ft, { colours[1] }); + + ft = Formatter(); + ft.Add(trackElement->GetSequenceIndex()); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 44 }, STR_TILE_INSPECTOR_TRACK_SEQUENCE, ft, { colours[1] }); + if (trackElement->IsStation()) + { + auto stationIndex = trackElement->GetStationIndex(); + ft = Formatter(); + ft.Add(STR_COMMA16); + ft.Add(stationIndex.ToUnderlying()); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 55 }, STR_TILE_INSPECTOR_STATION_INDEX, ft, + { colours[1] }); + } + else + { + const char* stationNone = "-"; + ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(stationNone); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 55 }, STR_TILE_INSPECTOR_STATION_INDEX, ft, + { colours[1] }); + } + + ft = Formatter(); + ft.Add(ColourSchemeNames[trackElement->GetColourScheme()]); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 66 }, STR_TILE_INSPECTOR_COLOUR_SCHEME, ft, { colours[1] }); + + // Properties + // Raise / lower label + screenCoords.y = windowPos.y + widgets[WIDX_TRACK_SPINNER_HEIGHT].top; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); + + // Current base height + screenCoords.x = windowPos.x + widgets[WIDX_TRACK_SPINNER_HEIGHT].left + 3; + ft = Formatter(); + ft.Add(tileElement->BaseHeight); + DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); + break; + } + + case TileElementType::SmallScenery: + { + // Details + // Age + auto ft = Formatter(); + ft.Add(tileElement->AsSmallScenery()->GetAge()); + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SCENERY_AGE, ft, { colours[1] }); + + // Quadrant value + const auto* sceneryEntry = tileElement->AsSmallScenery()->GetEntry(); + if (sceneryEntry != nullptr && !(sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE))) + { + int16_t quadrant = tileElement->AsSmallScenery()->GetSceneryQuadrant(); + static constexpr StringId _quadrantStringIdx[] = { + STR_TILE_INSPECTOR_SCENERY_QUADRANT_SW, + STR_TILE_INSPECTOR_SCENERY_QUADRANT_NW, + STR_TILE_INSPECTOR_SCENERY_QUADRANT_NE, + STR_TILE_INSPECTOR_SCENERY_QUADRANT_SE, + }; + ft = Formatter(); + ft.Add(_quadrantStringIdx[quadrant]); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_SCENERY_QUADRANT, ft, + { colours[1] }); + } + + // Scenery ID + ft = Formatter(); + ft.Add(tileElement->AsSmallScenery()->GetEntryIndex()); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_SCENERY_ENTRY_IDX, ft, + { colours[1] }); + + // Properties + // Raise / Lower + screenCoords.y = windowPos.y + widgets[WIDX_SCENERY_SPINNER_HEIGHT].top; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); + + // Current base height + screenCoords.x = windowPos.x + widgets[WIDX_SCENERY_SPINNER_HEIGHT].left + 3; + ft = Formatter(); + ft.Add(tileElement->BaseHeight); + DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); + + // Quarter tile + screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, + widgets[WIDX_SCENERY_CHECK_QUARTER_E].top }; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SCENERY_QUADRANT_LABEL, {}, { colours[1] }); + + // Collision + screenCoords.y = windowPos.y + widgets[WIDX_SCENERY_CHECK_COLLISION_E].top; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_COLLISSION, {}, { colours[1] }); + break; + } + + case TileElementType::Entrance: + { + // Details + // Entrance type + auto ft = Formatter(); + ft.Add(EntranceTypeStringIds[tileElement->AsEntrance()->GetEntranceType()]); + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_ENTRANCE_TYPE, ft, { colours[1] }); + + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) + { + // TODO: Make this work with Left/Right park entrance parts + ft = Formatter(); + ft.Add(ParkEntranceGetIndex({ _toolMap, tileElement->GetBaseZ() })); DrawTextBasic( dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID, ft, { colours[1] }); } else { - // Ride exit ID + ft = Formatter(); + ft.Add(tileElement->AsEntrance()->GetStationIndex().ToUnderlying()); + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE) + { + // Ride entrance ID + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID, ft, + { colours[1] }); + } + else + { + // Ride exit ID + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_EXIT_ID, ft, + { colours[1] }); + } + } + + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) + { + // Entrance part + ft = Formatter(); + ft.Add(ParkEntrancePartStringIds[tileElement->AsEntrance()->GetSequenceIndex()]); DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_EXIT_ID, ft, + dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRANCE_PART, ft, + { colours[1] }); + } + else + { + // Ride ID + ft = Formatter(); + ft.Add(tileElement->AsEntrance()->GetRideIndex()); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRANCE_RIDE_ID, ft, + { colours[1] }); + // Station index + auto stationIndex = tileElement->AsEntrance()->GetStationIndex(); + ft = Formatter(); + ft.Add(STR_COMMA16); + ft.Add(stationIndex.ToUnderlying()); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 33 }, STR_TILE_INSPECTOR_STATION_INDEX, ft, { colours[1] }); } - } - if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) - { - // Entrance part + // Properties + // Raise / Lower + screenCoords.y = windowPos.y + widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].top; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); + + // Current base height + screenCoords.x = windowPos.x + widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].left + 3; ft = Formatter(); - ft.Add(ParkEntrancePartStringIds[tileElement->AsEntrance()->GetSequenceIndex()]); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRANCE_PART, ft, { colours[1] }); - } - else - { - // Ride ID - ft = Formatter(); - ft.Add(tileElement->AsEntrance()->GetRideIndex()); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRANCE_RIDE_ID, ft, - { colours[1] }); - // Station index - auto stationIndex = tileElement->AsEntrance()->GetStationIndex(); - ft = Formatter(); - ft.Add(STR_COMMA16); - ft.Add(stationIndex.ToUnderlying()); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 33 }, STR_TILE_INSPECTOR_STATION_INDEX, ft, { colours[1] }); + ft.Add(tileElement->BaseHeight); + DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); + break; } - // Properties - // Raise / Lower - screenCoords.y = windowPos.y + widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].top; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); - - // Current base height - screenCoords.x = windowPos.x + widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].left + 3; - ft = Formatter(); - ft.Add(tileElement->BaseHeight); - DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); - break; - } - - case TileElementType::Wall: - { - // Details - // Type - auto ft = Formatter(); - ft.Add(tileElement->AsWall()->GetEntryIndex()); - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_WALL_TYPE, ft, { colours[1] }); - - // Banner info - auto banner = tileElement->AsWall()->GetBanner(); - if (banner != nullptr) + case TileElementType::Wall: { - ft = Formatter(); - banner->FormatTextTo(ft); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft, - { colours[1] }); - } - else - { - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE, {}, - { colours[1] }); - } + // Details + // Type + auto ft = Formatter(); + ft.Add(tileElement->AsWall()->GetEntryIndex()); + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_WALL_TYPE, ft, { colours[1] }); - // Properties - // Raise / lower label - screenCoords.y = windowPos.y + widgets[WIDX_WALL_SPINNER_HEIGHT].top; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); - - // Current base height - screenCoords.x = windowPos.x + widgets[WIDX_WALL_SPINNER_HEIGHT].left + 3; - ft = Formatter(); - ft.Add(tileElement->BaseHeight); - DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); - - // Slope label - screenCoords = windowPos - + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_WALL_DROPDOWN_SLOPE].top }; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_WALL_SLOPE, {}, { colours[1] }); - - // Animation frame label - screenCoords.y = windowPos.y + widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME].top; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_WALL_ANIMATION_FRAME, {}, { colours[1] }); - - // Current animation frame - colour_t colour = colours[1]; - if (IsWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME)) - { - colour = colours[0] | COLOUR_FLAG_INSET; - } - screenCoords.x = windowPos.x + widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME].left + 3; - ft = Formatter(); - ft.Add(tileElement->AsWall()->GetAnimationFrame()); - DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colour }); - break; - } - - case TileElementType::LargeScenery: - { - // Details - // Type - auto sceneryElement = tileElement->AsLargeScenery(); - ObjectEntryIndex largeSceneryType = sceneryElement->GetEntryIndex(); - auto ft = Formatter(); - ft.Add(largeSceneryType); - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_LARGE_SCENERY_TYPE, ft, { colours[1] }); - - // Part ID - ft = Formatter(); - ft.Add(sceneryElement->GetSequenceIndex()); - DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_LARGE_SCENERY_PIECE_ID, ft, - { colours[1] }); - - // Banner info - auto* largeSceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(largeSceneryType); - if (largeSceneryEntry != nullptr && largeSceneryEntry->scrolling_mode != SCROLLING_MODE_NONE) - { - auto banner = sceneryElement->GetBanner(); + // Banner info + auto banner = tileElement->AsWall()->GetBanner(); if (banner != nullptr) { ft = Formatter(); banner->FormatTextTo(ft); DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft, + dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft, { colours[1] }); } + else + { + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE, {}, + { colours[1] }); + } + + // Properties + // Raise / lower label + screenCoords.y = windowPos.y + widgets[WIDX_WALL_SPINNER_HEIGHT].top; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); + + // Current base height + screenCoords.x = windowPos.x + widgets[WIDX_WALL_SPINNER_HEIGHT].left + 3; + ft = Formatter(); + ft.Add(tileElement->BaseHeight); + DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); + + // Slope label + screenCoords = windowPos + + ScreenCoordsXY{ widgets[WIDX_GROUPBOX_DETAILS].left + 7, widgets[WIDX_WALL_DROPDOWN_SLOPE].top }; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_WALL_SLOPE, {}, { colours[1] }); + + // Animation frame label + screenCoords.y = windowPos.y + widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME].top; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_WALL_ANIMATION_FRAME, {}, { colours[1] }); + + // Current animation frame + colour_t colour = colours[1]; + if (IsWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME)) + { + colour = colours[0] | COLOUR_FLAG_INSET; + } + screenCoords.x = windowPos.x + widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME].left + 3; + ft = Formatter(); + ft.Add(tileElement->AsWall()->GetAnimationFrame()); + DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colour }); + break; } - else + + case TileElementType::LargeScenery: { + // Details + // Type + auto sceneryElement = tileElement->AsLargeScenery(); + ObjectEntryIndex largeSceneryType = sceneryElement->GetEntryIndex(); + auto ft = Formatter(); + ft.Add(largeSceneryType); + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_LARGE_SCENERY_TYPE, ft, { colours[1] }); + + // Part ID + ft = Formatter(); + ft.Add(sceneryElement->GetSequenceIndex()); DrawTextBasic( - dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE, {}, + dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_LARGE_SCENERY_PIECE_ID, ft, { colours[1] }); + + // Banner info + auto* largeSceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(largeSceneryType); + if (largeSceneryEntry != nullptr && largeSceneryEntry->scrolling_mode != SCROLLING_MODE_NONE) + { + auto banner = sceneryElement->GetBanner(); + if (banner != nullptr) + { + ft = Formatter(); + banner->FormatTextTo(ft); + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft, + { colours[1] }); + } + } + else + { + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE, {}, + { colours[1] }); + } + + // Properties + // Raise / lower label + screenCoords.y = windowPos.y + widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].top; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); + + // Current base height + screenCoords.x = windowPos.x + widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].left + 3; + ft = Formatter(); + ft.Add(tileElement->BaseHeight); + DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); + break; } - // Properties - // Raise / lower label - screenCoords.y = windowPos.y + widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].top; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); - - // Current base height - screenCoords.x = windowPos.x + widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].left + 3; - ft = Formatter(); - ft.Add(tileElement->BaseHeight); - DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); - break; - } - - case TileElementType::Banner: - { - // Details - // Banner info - auto banner = tileElement->AsBanner()->GetBanner(); - if (banner != nullptr) + case TileElementType::Banner: { - Formatter ft; - banner->FormatTextTo(ft); - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft, { colours[1] }); + // Details + // Banner info + auto banner = tileElement->AsBanner()->GetBanner(); + if (banner != nullptr) + { + Formatter ft; + banner->FormatTextTo(ft); + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft, { colours[1] }); + } + + // Properties + // Raise / lower label + screenCoords.y = windowPos.y + widgets[WIDX_BANNER_SPINNER_HEIGHT].top; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); + + // Current base height + screenCoords.x = windowPos.x + widgets[WIDX_BANNER_SPINNER_HEIGHT].left + 3; + auto ft = Formatter(); + ft.Add(tileElement->BaseHeight); + DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); + + // Blocked paths + screenCoords.y += 28; + screenCoords.x = windowPos.x + widgets[WIDX_GROUPBOX_DETAILS].left + 7; + DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BANNER_BLOCKED_PATHS, {}, { colours[1] }); + break; } - // Properties - // Raise / lower label - screenCoords.y = windowPos.y + widgets[WIDX_BANNER_SPINNER_HEIGHT].top; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, {}, { colours[1] }); - - // Current base height - screenCoords.x = windowPos.x + widgets[WIDX_BANNER_SPINNER_HEIGHT].left + 3; - auto ft = Formatter(); - ft.Add(tileElement->BaseHeight); - DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colours[1] }); - - // Blocked paths - screenCoords.y += 28; - screenCoords.x = windowPos.x + widgets[WIDX_GROUPBOX_DETAILS].left + 7; - DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_BANNER_BLOCKED_PATHS, {}, { colours[1] }); - break; + default: + break; } - - default: - break; } } - } - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override - { - const int32_t listWidth = widgets[WIDX_LIST].width(); - GfxFillRect( - dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); - - // Show usage hint when nothing is selected - if (!_tileSelected) + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override { - auto& listWidget = widgets[WIDX_LIST]; - auto centrePos = ScreenCoordsXY{ listWidget.width() / 2, - (listWidget.height() - FontGetLineHeight(FontStyle::Medium)) / 2 }; - auto ft = Formatter{}; - auto textPaint = TextPaint{ colours[1], TextAlignment::CENTRE }; - DrawTextWrapped(dpi, centrePos, listWidth, STR_TILE_INSPECTOR_SELECT_TILE_HINT, ft, textPaint); - return; - } + const int32_t listWidth = widgets[WIDX_LIST].width(); + GfxFillRect( + dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, ColourMapA[colours[1]].mid_light); - ScreenCoordsXY screenCoords{}; - screenCoords.y = SCROLLABLE_ROW_HEIGHT * (windowTileInspectorElementCount - 1); - int32_t i = 0; - char buffer[256]; - - const TileElement* tileElement = MapGetFirstElementAt(_toolMap); - - do - { - if (tileElement == nullptr) - break; - - const bool selectedRow = i == windowTileInspectorSelectedIndex; - const bool hoveredRow = i == _highlightedIndex; - const char* typeName = ""; - - // Draw row background colour - auto fillRectangle = ScreenRect{ { 0, screenCoords.y }, { listWidth, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } }; - if (selectedRow) - GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark); - else if (hoveredRow) - GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark | 0x1000000); - // Zebra stripes - else if (((windowTileInspectorElementCount - i) & 1) == 0) - GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].light | 0x1000000); - - const StringId stringFormat = (selectedRow || hoveredRow) ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID; - auto checkboxFormatter = Formatter(); - checkboxFormatter.Add(STR_STRING); - checkboxFormatter.Add(CheckBoxMarkString); - - // Draw checkbox and check if visible - GfxFillRectInset(dpi, { { 2, screenCoords.y }, { 15, screenCoords.y + 11 } }, colours[1], INSET_RECT_F_E0); - if (!tileElement->IsInvisible()) + // Show usage hint when nothing is selected + if (!_tileSelected) { - auto eyeFormatter = Formatter(); - eyeFormatter.Add(STR_STRING); - eyeFormatter.Add(EyeString); - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 2, 1 }, stringFormat, eyeFormatter); + auto& listWidget = widgets[WIDX_LIST]; + auto centrePos = ScreenCoordsXY{ listWidget.width() / 2, + (listWidget.height() - FontGetLineHeight(FontStyle::Medium)) / 2 }; + auto ft = Formatter{}; + auto textPaint = TextPaint{ colours[1], TextAlignment::CENTRE }; + DrawTextWrapped(dpi, centrePos, listWidth, STR_TILE_INSPECTOR_SELECT_TILE_HINT, ft, textPaint); + return; } - const auto type = tileElement->GetType(); - switch (type) + ScreenCoordsXY screenCoords{}; + screenCoords.y = SCROLLABLE_ROW_HEIGHT * (windowTileInspectorElementCount - 1); + int32_t i = 0; + char buffer[256]; + + const TileElement* tileElement = MapGetFirstElementAt(_toolMap); + + do { - case TileElementType::Surface: - typeName = LanguageGetString(STR_TILE_INSPECTOR_SURFACE); + if (tileElement == nullptr) break; - case TileElementType::Path: - typeName = tileElement->AsPath()->IsQueue() ? LanguageGetString(STR_QUEUE_LINE_MAP_TIP) - : LanguageGetString(STR_FOOTPATH_MAP_TIP); - break; + const bool selectedRow = i == windowTileInspectorSelectedIndex; + const bool hoveredRow = i == _highlightedIndex; + const char* typeName = ""; - case TileElementType::Track: - typeName = LanguageGetString(STR_RIDE_COMPONENT_TRACK_CAPITALISED); - break; + // Draw row background colour + auto fillRectangle = ScreenRect{ { 0, screenCoords.y }, + { listWidth, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } }; + if (selectedRow) + GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark); + else if (hoveredRow) + GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark | 0x1000000); + // Zebra stripes + else if (((windowTileInspectorElementCount - i) & 1) == 0) + GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].light | 0x1000000); - case TileElementType::SmallScenery: + const StringId stringFormat = (selectedRow || hoveredRow) ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID; + auto checkboxFormatter = Formatter(); + checkboxFormatter.Add(STR_STRING); + checkboxFormatter.Add(CheckBoxMarkString); + + // Draw checkbox and check if visible + GfxFillRectInset(dpi, { { 2, screenCoords.y }, { 15, screenCoords.y + 11 } }, colours[1], INSET_RECT_F_E0); + if (!tileElement->IsInvisible()) { - const auto* sceneryEntry = tileElement->AsSmallScenery()->GetEntry(); - snprintf( - buffer, sizeof(buffer), "%s (%s)", LanguageGetString(STR_OBJECT_SELECTION_SMALL_SCENERY), - sceneryEntry != nullptr ? LanguageGetString(sceneryEntry->name) : ""); - typeName = buffer; - break; + auto eyeFormatter = Formatter(); + eyeFormatter.Add(STR_STRING); + eyeFormatter.Add(EyeString); + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 2, 1 }, stringFormat, eyeFormatter); } - case TileElementType::Entrance: - typeName = LanguageGetString(STR_RIDE_CONSTRUCTION_ENTRANCE); - break; - - case TileElementType::Wall: + const auto type = tileElement->GetType(); + switch (type) { - const auto* entry = tileElement->AsWall()->GetEntry(); - snprintf( - buffer, sizeof(buffer), "%s (%s)", LanguageGetString(STR_TILE_INSPECTOR_WALL), - entry != nullptr ? LanguageGetString(entry->name) : ""); - typeName = buffer; - break; + case TileElementType::Surface: + typeName = LanguageGetString(STR_TILE_INSPECTOR_SURFACE); + break; + + case TileElementType::Path: + typeName = tileElement->AsPath()->IsQueue() ? LanguageGetString(STR_QUEUE_LINE_MAP_TIP) + : LanguageGetString(STR_FOOTPATH_MAP_TIP); + break; + + case TileElementType::Track: + typeName = LanguageGetString(STR_RIDE_COMPONENT_TRACK_CAPITALISED); + break; + + case TileElementType::SmallScenery: + { + const auto* sceneryEntry = tileElement->AsSmallScenery()->GetEntry(); + snprintf( + buffer, sizeof(buffer), "%s (%s)", LanguageGetString(STR_OBJECT_SELECTION_SMALL_SCENERY), + sceneryEntry != nullptr ? LanguageGetString(sceneryEntry->name) : ""); + typeName = buffer; + break; + } + + case TileElementType::Entrance: + typeName = LanguageGetString(STR_RIDE_CONSTRUCTION_ENTRANCE); + break; + + case TileElementType::Wall: + { + const auto* entry = tileElement->AsWall()->GetEntry(); + snprintf( + buffer, sizeof(buffer), "%s (%s)", LanguageGetString(STR_TILE_INSPECTOR_WALL), + entry != nullptr ? LanguageGetString(entry->name) : ""); + typeName = buffer; + break; + } + + case TileElementType::LargeScenery: + typeName = LanguageGetString(STR_OBJECT_SELECTION_LARGE_SCENERY); + break; + + case TileElementType::Banner: + snprintf( + buffer, sizeof(buffer), "%s (%u)", LanguageGetString(STR_BANNER_WINDOW_TITLE), + tileElement->AsBanner()->GetIndex().ToUnderlying()); + typeName = buffer; + break; + + default: + snprintf( + buffer, sizeof(buffer), "%s (%d)", LanguageGetString(STR_UNKNOWN_OBJECT_TYPE), EnumValue(type)); + typeName = buffer; } - case TileElementType::LargeScenery: - typeName = LanguageGetString(STR_OBJECT_SELECTION_LARGE_SCENERY); - break; + const int32_t clearanceHeight = tileElement->ClearanceHeight; + const bool ghost = tileElement->IsGhost(); + const bool last = tileElement->IsLastForTile(); - case TileElementType::Banner: - snprintf( - buffer, sizeof(buffer), "%s (%u)", LanguageGetString(STR_BANNER_WINDOW_TITLE), - tileElement->AsBanner()->GetIndex().ToUnderlying()); - typeName = buffer; - break; + // Element name + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(typeName); + DrawTextEllipsised( + dpi, screenCoords + ScreenCoordsXY{ TypeColumnXY.x, 0 }, TypeColumnSize.width, stringFormat, ft); - default: - snprintf(buffer, sizeof(buffer), "%s (%d)", LanguageGetString(STR_UNKNOWN_OBJECT_TYPE), EnumValue(type)); - typeName = buffer; + // Base height + ft = Formatter(); + ft.Add(STR_FORMAT_INTEGER); + ft.Add(tileElement->BaseHeight); + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ BaseHeightColumnXY.x, 0 }, stringFormat, ft); + + // Clearance height + ft = Formatter(); + ft.Add(STR_FORMAT_INTEGER); + ft.Add(clearanceHeight); + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ ClearanceHeightColumnXY.x, 0 }, stringFormat, ft); + + // Direction + ft = Formatter(); + ft.Add(STR_FORMAT_INTEGER); + ft.Add(tileElement->GetDirection()); + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ DirectionColumnXY.x, 0 }, stringFormat, ft); + + // Checkmarks for ghost and last for tile + if (ghost) + DrawTextBasic( + dpi, screenCoords + ScreenCoordsXY{ GhostFlagColumnXY.x, 0 }, stringFormat, checkboxFormatter); + if (last) + DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ LastFlagColumnXY.x, 0 }, stringFormat, checkboxFormatter); + + screenCoords.y -= SCROLLABLE_ROW_HEIGHT; + i++; + } while (!(tileElement++)->IsLastForTile()); + } + + void ClearClipboard() + { + _elementCopied = false; + } + + void ToggleInvisibility() + { + if (windowTileInspectorSelectedIndex >= 0 && windowTileInspectorSelectedIndex < windowTileInspectorElementCount) + { + ToggleInvisibility(windowTileInspectorSelectedIndex); } - - const int32_t clearanceHeight = tileElement->ClearanceHeight; - const bool ghost = tileElement->IsGhost(); - const bool last = tileElement->IsLastForTile(); - - // Element name - auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(typeName); - DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ TypeColumnXY.x, 0 }, TypeColumnSize.width, stringFormat, ft); - - // Base height - ft = Formatter(); - ft.Add(STR_FORMAT_INTEGER); - ft.Add(tileElement->BaseHeight); - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ BaseHeightColumnXY.x, 0 }, stringFormat, ft); - - // Clearance height - ft = Formatter(); - ft.Add(STR_FORMAT_INTEGER); - ft.Add(clearanceHeight); - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ ClearanceHeightColumnXY.x, 0 }, stringFormat, ft); - - // Direction - ft = Formatter(); - ft.Add(STR_FORMAT_INTEGER); - ft.Add(tileElement->GetDirection()); - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ DirectionColumnXY.x, 0 }, stringFormat, ft); - - // Checkmarks for ghost and last for tile - if (ghost) - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ GhostFlagColumnXY.x, 0 }, stringFormat, checkboxFormatter); - if (last) - DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ LastFlagColumnXY.x, 0 }, stringFormat, checkboxFormatter); - - screenCoords.y -= SCROLLABLE_ROW_HEIGHT; - i++; - } while (!(tileElement++)->IsLastForTile()); - } - - void ClearClipboard() - { - _elementCopied = false; - } - - void ToggleInvisibility() - { - if (windowTileInspectorSelectedIndex >= 0 && windowTileInspectorSelectedIndex < windowTileInspectorElementCount) - { - ToggleInvisibility(windowTileInspectorSelectedIndex); - } - } - -private: - void SetPage(const TileInspectorPage p) - { - Invalidate(); - // subtract current page height, then add new page height - if (tileInspectorPage != TileInspectorPage::Default) - { - auto index = EnumValue(tileInspectorPage) - 1; - height -= PageGroupBoxSettings[index].details_top_offset - GROUPBOX_PADDING - 3; - min_height -= PageGroupBoxSettings[index].details_top_offset - GROUPBOX_PADDING - 3; - } - if (p != TileInspectorPage::Default) - { - auto index = EnumValue(p) - 1; - height += PageGroupBoxSettings[index].details_top_offset - GROUPBOX_PADDING - 3; - min_height += PageGroupBoxSettings[index].details_top_offset - GROUPBOX_PADDING - 3; - } - tileInspectorPage = p; - auto pageIndex = EnumValue(p); - widgets = PageWidgets[pageIndex]; - hold_down_widgets = PageHoldDownWidgets[pageIndex]; - disabled_widgets = PageDisabledWidgets[pageIndex]; - pressed_widgets = 0; - Invalidate(); - } - - void UpdateSelectedTile(const ScreenCoordsXY& screenCoords) - { - const bool ctrlIsHeldDown = InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z); - // Mouse hasn't moved - if (screenCoords.x == _toolMouseX && screenCoords.y == _toolMouseY && _toolCtrlDown == ctrlIsHeldDown) - return; - - _toolMouseX = screenCoords.x; - _toolMouseY = screenCoords.y; - _toolCtrlDown = ctrlIsHeldDown; - - CoordsXY mapCoords{}; - TileElement* clickedElement = nullptr; - if (ctrlIsHeldDown) - { - auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionFlags); - clickedElement = info.Element; - mapCoords = info.Loc; } - // Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor - if (clickedElement == nullptr) + private: + void SetPage(const TileInspectorPage p) { - auto mouseCoords = ScreenPosToMapPos(screenCoords, nullptr); - if (!mouseCoords.has_value()) + Invalidate(); + // subtract current page height, then add new page height + if (tileInspectorPage != TileInspectorPage::Default) + { + auto index = EnumValue(tileInspectorPage) - 1; + height -= PageGroupBoxSettings[index].details_top_offset - GROUPBOX_PADDING - 3; + min_height -= PageGroupBoxSettings[index].details_top_offset - GROUPBOX_PADDING - 3; + } + if (p != TileInspectorPage::Default) + { + auto index = EnumValue(p) - 1; + height += PageGroupBoxSettings[index].details_top_offset - GROUPBOX_PADDING - 3; + min_height += PageGroupBoxSettings[index].details_top_offset - GROUPBOX_PADDING - 3; + } + tileInspectorPage = p; + auto pageIndex = EnumValue(p); + widgets = PageWidgets[pageIndex]; + hold_down_widgets = PageHoldDownWidgets[pageIndex]; + disabled_widgets = PageDisabledWidgets[pageIndex]; + pressed_widgets = 0; + Invalidate(); + } + + void UpdateSelectedTile(const ScreenCoordsXY& screenCoords) + { + const bool ctrlIsHeldDown = InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z); + // Mouse hasn't moved + if (screenCoords.x == _toolMouseX && screenCoords.y == _toolMouseY && _toolCtrlDown == ctrlIsHeldDown) return; - mapCoords = mouseCoords.value(); - // Tile is already selected - if (_tileSelected && mapCoords.x == _toolMap.x && mapCoords.y == _toolMap.y) - return; + _toolMouseX = screenCoords.x; + _toolMouseY = screenCoords.y; + _toolCtrlDown = ctrlIsHeldDown; + + CoordsXY mapCoords{}; + TileElement* clickedElement = nullptr; + if (ctrlIsHeldDown) + { + auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionFlags); + clickedElement = info.Element; + mapCoords = info.Loc; + } + + // Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor + if (clickedElement == nullptr) + { + auto mouseCoords = ScreenPosToMapPos(screenCoords, nullptr); + if (!mouseCoords.has_value()) + return; + + mapCoords = mouseCoords.value(); + // Tile is already selected + if (_tileSelected && mapCoords.x == _toolMap.x && mapCoords.y == _toolMap.y) + return; + } + + // Invalidate the previous selection + if (auto* elem = OpenRCT2::TileInspector::GetSelectedElement(); elem != nullptr) + { + MapInvalidateElement(windowTileInspectorTile.ToCoordsXY(), elem); + } + + _tileSelected = true; + _toolMap = mapCoords; + windowTileInspectorTile = TileCoordsXY(mapCoords); + LoadTile(clickedElement); } - // Invalidate the previous selection - if (auto* elem = OpenRCT2::TileInspector::GetSelectedElement(); elem != nullptr) + void SelectElementFromList(int32_t index) { - MapInvalidateElement(windowTileInspectorTile.ToCoordsXY(), elem); + if (index < 0 || index >= windowTileInspectorElementCount) + { + windowTileInspectorSelectedIndex = -1; + } + else + { + windowTileInspectorSelectedIndex = index; + } + Invalidate(); } - _tileSelected = true; - _toolMap = mapCoords; - windowTileInspectorTile = TileCoordsXY(mapCoords); - LoadTile(clickedElement); - } - - void SelectElementFromList(int32_t index) - { - if (index < 0 || index >= windowTileInspectorElementCount) + void LoadTile(TileElement* elementToSelect) { windowTileInspectorSelectedIndex = -1; + scrolls[0].v_top = 0; + + TileElement* element = MapGetFirstElementAt(_toolMap); + int16_t numItems = 0; + do + { + if (element == nullptr) + break; + if (element == elementToSelect) + windowTileInspectorSelectedIndex = numItems; + + numItems++; + } while (!(element++)->IsLastForTile()); + windowTileInspectorElementCount = numItems; + Invalidate(); } - else + + void RemoveElement(int32_t elementIndex) { - windowTileInspectorSelectedIndex = index; + Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range"); + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyRemove, elementIndex); + GameActions::Execute(&modifyTile); } - Invalidate(); - } - void LoadTile(TileElement* elementToSelect) - { - windowTileInspectorSelectedIndex = -1; - scrolls[0].v_top = 0; - - TileElement* element = MapGetFirstElementAt(_toolMap); - int16_t numItems = 0; - do + void RotateElement(int32_t elementIndex) { - if (element == nullptr) - break; - if (element == elementToSelect) - windowTileInspectorSelectedIndex = numItems; - - numItems++; - } while (!(element++)->IsLastForTile()); - windowTileInspectorElementCount = numItems; - Invalidate(); - } - - void RemoveElement(int32_t elementIndex) - { - Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range"); - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyRemove, elementIndex); - GameActions::Execute(&modifyTile); - } - - void RotateElement(int32_t elementIndex) - { - Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range"); - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyRotate, elementIndex); - GameActions::Execute(&modifyTile); - } - - // Swap element with its parent - void SwapElements(int16_t first, int16_t second) - { - bool firstInRange = first >= 0 && first < windowTileInspectorElementCount; - bool secondInRange = second >= 0 && second < windowTileInspectorElementCount; - // This might happen if two people are modifying the same tile. - if (!firstInRange || !secondInRange) - return; - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnySwap, first, second); - GameActions::Execute(&modifyTile); - } - - void SortElements() - { - Guard::Assert(_tileSelected, "No tile selected"); - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnySort); - GameActions::Execute(&modifyTile); - } - - void CopyElement() - { - const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); - Guard::Assert(tileElement != nullptr, "Invalid tile element"); - // Copy value, in case the element gets moved - _copiedElement = *tileElement; - _copiedBanner = {}; - auto bannerIndex = _copiedElement.GetBannerIndex(); - if (bannerIndex != BannerIndex::GetNull()) - { - auto banner = GetBanner(bannerIndex); - if (banner != nullptr) - _copiedBanner = *banner; + Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range"); + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyRotate, elementIndex); + GameActions::Execute(&modifyTile); } - _elementCopied = true; - Invalidate(); - } - void PasteElement() - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyPaste, 0, 0, _copiedElement, _copiedBanner); - GameActions::Execute(&modifyTile); - } - - void BaseHeightOffset(int16_t elementIndex, int8_t heightOffset) - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyBaseHeightOffset, elementIndex, heightOffset); - GameActions::Execute(&modifyTile); - } - - void SurfaceShowParkFences(bool showFences) - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::SurfaceShowParkFences, showFences); - GameActions::Execute(&modifyTile); - } - - void SurfaceToggleCorner(int32_t cornerIndex) - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::SurfaceToggleCorner, cornerIndex); - GameActions::Execute(&modifyTile); - } - - void SurfaceToggleDiagonal() - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::SurfaceToggleDiagonal); - GameActions::Execute(&modifyTile); - } - - void PathSetSloped(int32_t elementIndex, bool sloped) - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::PathSetSlope, elementIndex, sloped); - GameActions::Execute(&modifyTile); - } - - void PathSetJunctionRailings(int32_t elementIndex, bool hasJunctionRailings) - { - auto modifyTile = TileModifyAction( - _toolMap, TileModifyType::PathSetJunctionRailings, elementIndex, hasJunctionRailings); - GameActions::Execute(&modifyTile); - } - - void PathSetBroken(int32_t elementIndex, bool broken) - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::PathSetBroken, elementIndex, broken); - GameActions::Execute(&modifyTile); - } - - void PathToggleEdge(int32_t elementIndex, int32_t cornerIndex) - { - Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range"); - Guard::Assert(cornerIndex >= 0 && cornerIndex < 8, "cornerIndex out of range"); - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::PathToggleEdge, elementIndex, cornerIndex); - GameActions::Execute(&modifyTile); - } - - void EntranceMakeUsable(int32_t elementIndex) - { - Guard::ArgumentInRange(elementIndex, 0, windowTileInspectorElementCount - 1); - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::EntranceMakeUsable, elementIndex); - GameActions::Execute(&modifyTile); - } - - void WallSetSlope(int32_t elementIndex, int32_t slopeValue) - { - // Make sure only the correct bits are set - Guard::Assert((slopeValue & 3) == slopeValue, "slopeValue doesn't match its mask"); - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::WallSetSlope, elementIndex, slopeValue); - GameActions::Execute(&modifyTile); - } - - void WallAnimationFrameOffset(int16_t elementIndex, int8_t animationFrameOffset) - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::WallSetAnimationFrame, elementIndex, animationFrameOffset); - GameActions::Execute(&modifyTile); - } - - void TrackBlockHeightOffset(int32_t elementIndex, int8_t heightOffset) - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::TrackBaseHeightOffset, elementIndex, heightOffset); - GameActions::Execute(&modifyTile); - } - - void TrackBlockSetLift(int32_t elementIndex, bool entireTrackBlock, bool chain) - { - auto modifyTile = TileModifyAction( - _toolMap, entireTrackBlock ? TileModifyType::TrackSetChainBlock : TileModifyType::TrackSetChain, elementIndex, - chain); - GameActions::Execute(&modifyTile); - } - - void TrackSetBrakeClosed(int32_t elementIndex, bool isClosed) - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::TrackSetBrake, elementIndex, isClosed); - GameActions::Execute(&modifyTile); - } - - void TrackSetIndestructible(int32_t elementIndex, bool isIndestructible) - { - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::TrackSetIndestructible, elementIndex, isIndestructible); - GameActions::Execute(&modifyTile); - } - - void QuarterTileSet(int32_t elementIndex, const int32_t quarterIndex) - { - // quarterIndex is widget index relative to WIDX_SCENERY_CHECK_QUARTER_N, so a value from 0-3 - Guard::Assert(quarterIndex >= 0 && quarterIndex < 4, "quarterIndex out of range"); - auto modifyTile = TileModifyAction( - _toolMap, TileModifyType::ScenerySetQuarterLocation, elementIndex, (quarterIndex - GetCurrentRotation()) & 3); - GameActions::Execute(&modifyTile); - } - - // ToggleQuadrantCollision? - void ToggleQuadrantCollosion(int32_t elementIndex, const int32_t quadrantIndex) - { - auto modifyTile = TileModifyAction( - _toolMap, TileModifyType::ScenerySetQuarterCollision, elementIndex, (quadrantIndex + 2 - GetCurrentRotation()) & 3); - GameActions::Execute(&modifyTile); - } - - void BannerToggleBlock(int32_t elementIndex, int32_t edgeIndex) - { - Guard::Assert(edgeIndex >= 0 && edgeIndex < 4, "edgeIndex out of range"); - // Make edgeIndex abstract - edgeIndex = (edgeIndex - GetCurrentRotation()) & 3; - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::BannerToggleBlockingEdge, elementIndex, edgeIndex); - GameActions::Execute(&modifyTile); - } - - void ToggleInvisibility(int32_t elementIndex) - { - Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range"); - auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyToggleInvisilibity, elementIndex); - GameActions::Execute(&modifyTile); - } - - void OnPrepareDraw() override - { - const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); - - // Set the correct page automatically - TileInspectorPage p = TileInspectorPage::Default; - if (tileElement != nullptr) + // Swap element with its parent + void SwapElements(int16_t first, int16_t second) { + bool firstInRange = first >= 0 && first < windowTileInspectorElementCount; + bool secondInRange = second >= 0 && second < windowTileInspectorElementCount; + // This might happen if two people are modifying the same tile. + if (!firstInRange || !secondInRange) + return; + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnySwap, first, second); + GameActions::Execute(&modifyTile); + } + + void SortElements() + { + Guard::Assert(_tileSelected, "No tile selected"); + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnySort); + GameActions::Execute(&modifyTile); + } + + void CopyElement() + { + const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); + Guard::Assert(tileElement != nullptr, "Invalid tile element"); + // Copy value, in case the element gets moved + _copiedElement = *tileElement; + _copiedBanner = {}; + auto bannerIndex = _copiedElement.GetBannerIndex(); + if (bannerIndex != BannerIndex::GetNull()) + { + auto banner = GetBanner(bannerIndex); + if (banner != nullptr) + _copiedBanner = *banner; + } + _elementCopied = true; + Invalidate(); + } + + void PasteElement() + { + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyPaste, 0, 0, _copiedElement, _copiedBanner); + GameActions::Execute(&modifyTile); + } + + void BaseHeightOffset(int16_t elementIndex, int8_t heightOffset) + { + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyBaseHeightOffset, elementIndex, heightOffset); + GameActions::Execute(&modifyTile); + } + + void SurfaceShowParkFences(bool showFences) + { + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::SurfaceShowParkFences, showFences); + GameActions::Execute(&modifyTile); + } + + void SurfaceToggleCorner(int32_t cornerIndex) + { + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::SurfaceToggleCorner, cornerIndex); + GameActions::Execute(&modifyTile); + } + + void SurfaceToggleDiagonal() + { + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::SurfaceToggleDiagonal); + GameActions::Execute(&modifyTile); + } + + void PathSetSloped(int32_t elementIndex, bool sloped) + { + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::PathSetSlope, elementIndex, sloped); + GameActions::Execute(&modifyTile); + } + + void PathSetJunctionRailings(int32_t elementIndex, bool hasJunctionRailings) + { + auto modifyTile = TileModifyAction( + _toolMap, TileModifyType::PathSetJunctionRailings, elementIndex, hasJunctionRailings); + GameActions::Execute(&modifyTile); + } + + void PathSetBroken(int32_t elementIndex, bool broken) + { + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::PathSetBroken, elementIndex, broken); + GameActions::Execute(&modifyTile); + } + + void PathToggleEdge(int32_t elementIndex, int32_t cornerIndex) + { + Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range"); + Guard::Assert(cornerIndex >= 0 && cornerIndex < 8, "cornerIndex out of range"); + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::PathToggleEdge, elementIndex, cornerIndex); + GameActions::Execute(&modifyTile); + } + + void EntranceMakeUsable(int32_t elementIndex) + { + Guard::ArgumentInRange(elementIndex, 0, windowTileInspectorElementCount - 1); + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::EntranceMakeUsable, elementIndex); + GameActions::Execute(&modifyTile); + } + + void WallSetSlope(int32_t elementIndex, int32_t slopeValue) + { + // Make sure only the correct bits are set + Guard::Assert((slopeValue & 3) == slopeValue, "slopeValue doesn't match its mask"); + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::WallSetSlope, elementIndex, slopeValue); + GameActions::Execute(&modifyTile); + } + + void WallAnimationFrameOffset(int16_t elementIndex, int8_t animationFrameOffset) + { + auto modifyTile = TileModifyAction( + _toolMap, TileModifyType::WallSetAnimationFrame, elementIndex, animationFrameOffset); + GameActions::Execute(&modifyTile); + } + + void TrackBlockHeightOffset(int32_t elementIndex, int8_t heightOffset) + { + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::TrackBaseHeightOffset, elementIndex, heightOffset); + GameActions::Execute(&modifyTile); + } + + void TrackBlockSetLift(int32_t elementIndex, bool entireTrackBlock, bool chain) + { + auto modifyTile = TileModifyAction( + _toolMap, entireTrackBlock ? TileModifyType::TrackSetChainBlock : TileModifyType::TrackSetChain, elementIndex, + chain); + GameActions::Execute(&modifyTile); + } + + void TrackSetBrakeClosed(int32_t elementIndex, bool isClosed) + { + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::TrackSetBrake, elementIndex, isClosed); + GameActions::Execute(&modifyTile); + } + + void TrackSetIndestructible(int32_t elementIndex, bool isIndestructible) + { + auto modifyTile = TileModifyAction( + _toolMap, TileModifyType::TrackSetIndestructible, elementIndex, isIndestructible); + GameActions::Execute(&modifyTile); + } + + void QuarterTileSet(int32_t elementIndex, const int32_t quarterIndex) + { + // quarterIndex is widget index relative to WIDX_SCENERY_CHECK_QUARTER_N, so a value from 0-3 + Guard::Assert(quarterIndex >= 0 && quarterIndex < 4, "quarterIndex out of range"); + auto modifyTile = TileModifyAction( + _toolMap, TileModifyType::ScenerySetQuarterLocation, elementIndex, (quarterIndex - GetCurrentRotation()) & 3); + GameActions::Execute(&modifyTile); + } + + // ToggleQuadrantCollision? + void ToggleQuadrantCollosion(int32_t elementIndex, const int32_t quadrantIndex) + { + auto modifyTile = TileModifyAction( + _toolMap, TileModifyType::ScenerySetQuarterCollision, elementIndex, + (quadrantIndex + 2 - GetCurrentRotation()) & 3); + GameActions::Execute(&modifyTile); + } + + void BannerToggleBlock(int32_t elementIndex, int32_t edgeIndex) + { + Guard::Assert(edgeIndex >= 0 && edgeIndex < 4, "edgeIndex out of range"); + // Make edgeIndex abstract + edgeIndex = (edgeIndex - GetCurrentRotation()) & 3; + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::BannerToggleBlockingEdge, elementIndex, edgeIndex); + GameActions::Execute(&modifyTile); + } + + void ToggleInvisibility(int32_t elementIndex) + { + Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range"); + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyToggleInvisilibity, elementIndex); + GameActions::Execute(&modifyTile); + } + + void OnPrepareDraw() override + { + const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); + + // Set the correct page automatically + TileInspectorPage p = TileInspectorPage::Default; + if (tileElement != nullptr) + { + switch (tileElement->GetType()) + { + case TileElementType::Surface: + p = TileInspectorPage::Surface; + break; + + case TileElementType::Path: + p = TileInspectorPage::Path; + break; + + case TileElementType::Track: + p = TileInspectorPage::Track; + break; + + case TileElementType::SmallScenery: + p = TileInspectorPage::Scenery; + break; + + case TileElementType::Entrance: + p = TileInspectorPage::Entrance; + break; + + case TileElementType::Wall: + p = TileInspectorPage::Wall; + break; + + case TileElementType::LargeScenery: + p = TileInspectorPage::LargeScenery; + break; + + case TileElementType::Banner: + p = TileInspectorPage::Banner; + break; + } + } + + if (tileInspectorPage != p) + { + SetPage(p); + Invalidate(); + } + // X and Y spinners + SetWidgetDisabledAndInvalidate( + WIDX_SPINNER_X_INCREASE, !(_tileSelected && ((_toolMap.x / 32) < kMaximumMapSizeTechnical - 1))); + SetWidgetDisabledAndInvalidate(WIDX_SPINNER_X_DECREASE, !(_tileSelected && ((_toolMap.x / 32) > 0))); + SetWidgetDisabledAndInvalidate( + WIDX_SPINNER_Y_INCREASE, !(_tileSelected && ((_toolMap.y / 32) < kMaximumMapSizeTechnical - 1))); + SetWidgetDisabledAndInvalidate(WIDX_SPINNER_Y_DECREASE, !(_tileSelected && ((_toolMap.y / 32) > 0))); + + // Sort buttons + SetWidgetDisabledAndInvalidate(WIDX_BUTTON_SORT, !(_tileSelected && windowTileInspectorElementCount > 1)); + + // Move Up button + SetWidgetDisabledAndInvalidate( + WIDX_BUTTON_MOVE_UP, + !(windowTileInspectorSelectedIndex != -1 + && windowTileInspectorSelectedIndex < windowTileInspectorElementCount - 1)); + + // Move Down button + SetWidgetDisabledAndInvalidate(WIDX_BUTTON_MOVE_DOWN, !(windowTileInspectorSelectedIndex > 0)); + + // Copy button + SetWidgetDisabledAndInvalidate(WIDX_BUTTON_COPY, !(windowTileInspectorSelectedIndex >= 0)); + + // Paste button + SetWidgetDisabledAndInvalidate(WIDX_BUTTON_PASTE, !(_tileSelected && _elementCopied)); + + widgets[WIDX_BACKGROUND].bottom = height - 1; + + if (tileInspectorPage == TileInspectorPage::Default) + { + widgets[WIDX_GROUPBOX_DETAILS].type = WindowWidgetType::Empty; + widgets[WIDX_GROUPBOX_PROPERTIES].type = WindowWidgetType::Empty; + widgets[WIDX_LIST].bottom = height - PADDING_BOTTOM; + } + else + { + widgets[WIDX_GROUPBOX_DETAILS].type = WindowWidgetType::Groupbox; + widgets[WIDX_GROUPBOX_PROPERTIES].type = WindowWidgetType::Groupbox; + auto pageIndex = EnumValue(tileInspectorPage) - 1; + widgets[WIDX_GROUPBOX_DETAILS].text = PageGroupBoxSettings[pageIndex].string_id; + widgets[WIDX_GROUPBOX_DETAILS].top = height - PageGroupBoxSettings[pageIndex].details_top_offset; + widgets[WIDX_GROUPBOX_DETAILS].bottom = height - PageGroupBoxSettings[pageIndex].details_bottom_offset; + widgets[WIDX_GROUPBOX_PROPERTIES].top = height - PageGroupBoxSettings[pageIndex].properties_top_offset; + widgets[WIDX_GROUPBOX_PROPERTIES].bottom = height - PageGroupBoxSettings[pageIndex].properties_bottom_offset; + widgets[WIDX_LIST].bottom = widgets[WIDX_GROUPBOX_DETAILS].top - GROUPBOX_PADDING; + } + + // The default page doesn't need further invalidation + if (tileInspectorPage == TileInspectorPage::Default) + return; + + // Using a switch, because I don't think giving each page their own callbacks is + // needed here, as only the mouseup and invalidate functions are different. + const int32_t propertiesAnchor = widgets[WIDX_GROUPBOX_PROPERTIES].top; + switch (tileElement->GetType()) { case TileElementType::Surface: - p = TileInspectorPage::Surface; + widgets[WIDX_SURFACE_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; + widgets[WIDX_SURFACE_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; + widgets[WIDX_SURFACE_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_SURFACE_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_SURFACE_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_SURFACE_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_SURFACE_BUTTON_REMOVE_FENCES].top = GBBT(propertiesAnchor, 1); + widgets[WIDX_SURFACE_BUTTON_REMOVE_FENCES].bottom = GBBB(propertiesAnchor, 1); + widgets[WIDX_SURFACE_BUTTON_RESTORE_FENCES].top = GBBT(propertiesAnchor, 1); + widgets[WIDX_SURFACE_BUTTON_RESTORE_FENCES].bottom = GBBB(propertiesAnchor, 1); + widgets[WIDX_SURFACE_CHECK_CORNER_N].top = GBBT(propertiesAnchor, 2) + 7 * 0; + widgets[WIDX_SURFACE_CHECK_CORNER_N].bottom = widgets[WIDX_SURFACE_CHECK_CORNER_N].top + 13; + widgets[WIDX_SURFACE_CHECK_CORNER_E].top = GBBT(propertiesAnchor, 2) + 7 * 1; + widgets[WIDX_SURFACE_CHECK_CORNER_E].bottom = widgets[WIDX_SURFACE_CHECK_CORNER_E].top + 13; + widgets[WIDX_SURFACE_CHECK_CORNER_S].top = GBBT(propertiesAnchor, 2) + 7 * 2; + widgets[WIDX_SURFACE_CHECK_CORNER_S].bottom = widgets[WIDX_SURFACE_CHECK_CORNER_S].top + 13; + widgets[WIDX_SURFACE_CHECK_CORNER_W].top = GBBT(propertiesAnchor, 2) + 7 * 1; + widgets[WIDX_SURFACE_CHECK_CORNER_W].bottom = widgets[WIDX_SURFACE_CHECK_CORNER_W].top + 13; + widgets[WIDX_SURFACE_CHECK_DIAGONAL].top = GBBT(propertiesAnchor, 3) + 7 * 1; + widgets[WIDX_SURFACE_CHECK_DIAGONAL].bottom = widgets[WIDX_SURFACE_CHECK_DIAGONAL].top + 13; + SetCheckboxValue( + WIDX_SURFACE_CHECK_CORNER_N, + tileElement->AsSurface()->GetSlope() & (1 << ((2 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_SURFACE_CHECK_CORNER_E, + tileElement->AsSurface()->GetSlope() & (1 << ((3 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_SURFACE_CHECK_CORNER_S, + tileElement->AsSurface()->GetSlope() & (1 << ((0 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_SURFACE_CHECK_CORNER_W, + tileElement->AsSurface()->GetSlope() & (1 << ((1 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_SURFACE_CHECK_DIAGONAL, tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT); break; case TileElementType::Path: - p = TileInspectorPage::Path; + widgets[WIDX_PATH_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; + widgets[WIDX_PATH_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; + widgets[WIDX_PATH_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_PATH_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_PATH_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_PATH_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_PATH_CHECK_BROKEN].top = GBBT(propertiesAnchor, 1); + widgets[WIDX_PATH_CHECK_BROKEN].bottom = GBBB(propertiesAnchor, 1); + widgets[WIDX_PATH_CHECK_SLOPED].top = GBBT(propertiesAnchor, 2); + widgets[WIDX_PATH_CHECK_SLOPED].bottom = GBBB(propertiesAnchor, 2); + widgets[WIDX_PATH_CHECK_JUNCTION_RAILINGS].top = GBBT(propertiesAnchor, 3); + widgets[WIDX_PATH_CHECK_JUNCTION_RAILINGS].bottom = GBBB(propertiesAnchor, 3); + widgets[WIDX_PATH_CHECK_EDGE_N].top = GBBT(propertiesAnchor, 4) + 7 * 0; + widgets[WIDX_PATH_CHECK_EDGE_N].bottom = widgets[WIDX_PATH_CHECK_EDGE_N].top + 13; + widgets[WIDX_PATH_CHECK_EDGE_NE].top = GBBT(propertiesAnchor, 4) + 7 * 1; + widgets[WIDX_PATH_CHECK_EDGE_NE].bottom = widgets[WIDX_PATH_CHECK_EDGE_NE].top + 13; + widgets[WIDX_PATH_CHECK_EDGE_E].top = GBBT(propertiesAnchor, 4) + 7 * 2; + widgets[WIDX_PATH_CHECK_EDGE_E].bottom = widgets[WIDX_PATH_CHECK_EDGE_E].top + 13; + widgets[WIDX_PATH_CHECK_EDGE_SE].top = GBBT(propertiesAnchor, 4) + 7 * 3; + widgets[WIDX_PATH_CHECK_EDGE_SE].bottom = widgets[WIDX_PATH_CHECK_EDGE_SE].top + 13; + widgets[WIDX_PATH_CHECK_EDGE_S].top = GBBT(propertiesAnchor, 4) + 7 * 4; + widgets[WIDX_PATH_CHECK_EDGE_S].bottom = widgets[WIDX_PATH_CHECK_EDGE_S].top + 13; + widgets[WIDX_PATH_CHECK_EDGE_SW].top = GBBT(propertiesAnchor, 4) + 7 * 3; + widgets[WIDX_PATH_CHECK_EDGE_SW].bottom = widgets[WIDX_PATH_CHECK_EDGE_SW].top + 13; + widgets[WIDX_PATH_CHECK_EDGE_W].top = GBBT(propertiesAnchor, 4) + 7 * 2; + widgets[WIDX_PATH_CHECK_EDGE_W].bottom = widgets[WIDX_PATH_CHECK_EDGE_W].top + 13; + widgets[WIDX_PATH_CHECK_EDGE_NW].top = GBBT(propertiesAnchor, 4) + 7 * 1; + widgets[WIDX_PATH_CHECK_EDGE_NW].bottom = widgets[WIDX_PATH_CHECK_EDGE_NW].top + 13; + SetCheckboxValue(WIDX_PATH_CHECK_SLOPED, tileElement->AsPath()->IsSloped()); + SetCheckboxValue(WIDX_PATH_CHECK_JUNCTION_RAILINGS, tileElement->AsPath()->HasJunctionRailings()); + SetCheckboxValue(WIDX_PATH_CHECK_BROKEN, tileElement->AsPath()->IsBroken()); + SetCheckboxValue( + WIDX_PATH_CHECK_EDGE_NE, tileElement->AsPath()->GetEdges() & (1 << ((0 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_PATH_CHECK_EDGE_SE, tileElement->AsPath()->GetEdges() & (1 << ((1 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_PATH_CHECK_EDGE_SW, tileElement->AsPath()->GetEdges() & (1 << ((2 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_PATH_CHECK_EDGE_NW, tileElement->AsPath()->GetEdges() & (1 << ((3 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_PATH_CHECK_EDGE_E, tileElement->AsPath()->GetCorners() & (1 << ((0 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_PATH_CHECK_EDGE_S, tileElement->AsPath()->GetCorners() & (1 << ((1 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_PATH_CHECK_EDGE_W, tileElement->AsPath()->GetCorners() & (1 << ((2 - GetCurrentRotation()) & 3))); + SetCheckboxValue( + WIDX_PATH_CHECK_EDGE_N, tileElement->AsPath()->GetCorners() & (1 << ((3 - GetCurrentRotation()) & 3))); break; case TileElementType::Track: - p = TileInspectorPage::Track; + widgets[WIDX_TRACK_CHECK_APPLY_TO_ALL].top = GBBT(propertiesAnchor, 0); + widgets[WIDX_TRACK_CHECK_APPLY_TO_ALL].bottom = GBBB(propertiesAnchor, 0); + widgets[WIDX_TRACK_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 1) + 3; + widgets[WIDX_TRACK_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 1) - 3; + widgets[WIDX_TRACK_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 1) + 4; + widgets[WIDX_TRACK_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 1) - 4; + widgets[WIDX_TRACK_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 1) + 4; + widgets[WIDX_TRACK_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 1) - 4; + widgets[WIDX_TRACK_CHECK_CHAIN_LIFT].top = GBBT(propertiesAnchor, 2); + widgets[WIDX_TRACK_CHECK_CHAIN_LIFT].bottom = GBBB(propertiesAnchor, 2); + widgets[WIDX_TRACK_CHECK_BRAKE_CLOSED].top = GBBT(propertiesAnchor, 3); + widgets[WIDX_TRACK_CHECK_BRAKE_CLOSED].bottom = GBBB(propertiesAnchor, 3); + widgets[WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE].top = GBBT(propertiesAnchor, 4); + widgets[WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE].bottom = GBBB(propertiesAnchor, 4); + SetCheckboxValue(WIDX_TRACK_CHECK_APPLY_TO_ALL, _applyToAll); + SetCheckboxValue(WIDX_TRACK_CHECK_CHAIN_LIFT, tileElement->AsTrack()->HasChain()); + SetCheckboxValue(WIDX_TRACK_CHECK_BRAKE_CLOSED, tileElement->AsTrack()->IsBrakeClosed()); + widgets[WIDX_TRACK_CHECK_BRAKE_CLOSED].content = tileElement->AsTrack()->IsBlockStart() + ? STR_TILE_INSPECTOR_TRACK_BLOCK_BRAKE + : STR_TILE_INSPECTOR_TRACK_BRAKE_CLOSED; + SetCheckboxValue(WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE, tileElement->AsTrack()->IsIndestructible()); break; case TileElementType::SmallScenery: - p = TileInspectorPage::Scenery; + { + // Raise / Lower + widgets[WIDX_SCENERY_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; + widgets[WIDX_SCENERY_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; + widgets[WIDX_SCENERY_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_SCENERY_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_SCENERY_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_SCENERY_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + + // Quadrant checkboxes + widgets[WIDX_SCENERY_CHECK_QUARTER_N].top = GBBT(propertiesAnchor, 1) - 5 + 7 * 0; + widgets[WIDX_SCENERY_CHECK_QUARTER_N].bottom = widgets[WIDX_SCENERY_CHECK_QUARTER_N].top + 13; + widgets[WIDX_SCENERY_CHECK_QUARTER_E].top = GBBT(propertiesAnchor, 1) - 5 + 7 * 1; + widgets[WIDX_SCENERY_CHECK_QUARTER_E].bottom = widgets[WIDX_SCENERY_CHECK_QUARTER_E].top + 13; + widgets[WIDX_SCENERY_CHECK_QUARTER_S].top = GBBT(propertiesAnchor, 1) - 5 + 7 * 2; + widgets[WIDX_SCENERY_CHECK_QUARTER_S].bottom = widgets[WIDX_SCENERY_CHECK_QUARTER_S].top + 13; + widgets[WIDX_SCENERY_CHECK_QUARTER_W].top = GBBT(propertiesAnchor, 1) - 5 + 7 * 1; + widgets[WIDX_SCENERY_CHECK_QUARTER_W].bottom = widgets[WIDX_SCENERY_CHECK_QUARTER_W].top + 13; + // This gets the relative rotation, by subtracting the camera's rotation, and wrapping it between 0-3 + // inclusive + bool N = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((0 - GetCurrentRotation()) & 3); + bool E = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((1 - GetCurrentRotation()) & 3); + bool S = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((2 - GetCurrentRotation()) & 3); + bool W = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((3 - GetCurrentRotation()) & 3); + SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_N, N); + SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_E, E); + SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_S, S); + SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_W, W); + + // Collision checkboxes + widgets[WIDX_SCENERY_CHECK_COLLISION_N].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 0; + widgets[WIDX_SCENERY_CHECK_COLLISION_N].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_N].top + 13; + widgets[WIDX_SCENERY_CHECK_COLLISION_E].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 1; + widgets[WIDX_SCENERY_CHECK_COLLISION_E].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_E].top + 13; + widgets[WIDX_SCENERY_CHECK_COLLISION_S].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 2; + widgets[WIDX_SCENERY_CHECK_COLLISION_S].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_S].top + 13; + widgets[WIDX_SCENERY_CHECK_COLLISION_W].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 1; + widgets[WIDX_SCENERY_CHECK_COLLISION_W].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_W].top + 13; + auto occupiedQuadrants = tileElement->GetOccupiedQuadrants(); + N = (occupiedQuadrants & (1 << ((2 - GetCurrentRotation()) & 3))) != 0; + E = (occupiedQuadrants & (1 << ((3 - GetCurrentRotation()) & 3))) != 0; + S = (occupiedQuadrants & (1 << ((0 - GetCurrentRotation()) & 3))) != 0; + W = (occupiedQuadrants & (1 << ((1 - GetCurrentRotation()) & 3))) != 0; + SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_N, N); + SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_E, E); + SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_S, S); + SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_W, W); break; + } case TileElementType::Entrance: - p = TileInspectorPage::Entrance; + widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; + widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; + widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_ENTRANCE_BUTTON_MAKE_USABLE].top = GBBT(propertiesAnchor, 1); + widgets[WIDX_ENTRANCE_BUTTON_MAKE_USABLE].bottom = GBBB(propertiesAnchor, 1); + SetWidgetDisabled( + WIDX_ENTRANCE_BUTTON_MAKE_USABLE, + !(tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)); break; case TileElementType::Wall: - p = TileInspectorPage::Wall; + { + bool canBeSloped = false; + bool hasAnimation = false; + const auto wallEntry = tileElement->AsWall()->GetEntry(); + if (wallEntry != nullptr) + { + canBeSloped = !(wallEntry->flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE); + hasAnimation = wallEntry->flags & WALL_SCENERY_IS_DOOR; + } + + widgets[WIDX_WALL_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; + widgets[WIDX_WALL_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; + widgets[WIDX_WALL_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_WALL_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_WALL_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_WALL_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_WALL_DROPDOWN_SLOPE].top = GBBT(propertiesAnchor, 1) + 3; + widgets[WIDX_WALL_DROPDOWN_SLOPE].bottom = GBBB(propertiesAnchor, 1) - 3; + widgets[WIDX_WALL_DROPDOWN_SLOPE].text = WallSlopeStringIds[tileElement->AsWall()->GetSlope()]; + widgets[WIDX_WALL_DROPDOWN_SLOPE_BUTTON].top = GBBT(propertiesAnchor, 1) + 4; + widgets[WIDX_WALL_DROPDOWN_SLOPE_BUTTON].bottom = GBBB(propertiesAnchor, 1) - 4; + widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME].top = GBBT(propertiesAnchor, 2) + 3; + widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME].bottom = GBBB(propertiesAnchor, 2) - 3; + widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE].top = GBBT(propertiesAnchor, 2) + 4; + widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE].bottom = GBBB(propertiesAnchor, 2) - 4; + widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE].top = GBBT(propertiesAnchor, 2) + 4; + widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE].bottom = GBBB(propertiesAnchor, 2) - 4; + + // Wall slope dropdown + SetWidgetDisabled(WIDX_WALL_DROPDOWN_SLOPE, !canBeSloped); + InvalidateWidget(WIDX_WALL_DROPDOWN_SLOPE); + SetWidgetDisabled(WIDX_WALL_DROPDOWN_SLOPE_BUTTON, !canBeSloped); + InvalidateWidget(WIDX_WALL_DROPDOWN_SLOPE_BUTTON); + // Wall animation frame spinner + SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME, !hasAnimation); + SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE, !hasAnimation); + SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE, !hasAnimation); break; + } case TileElementType::LargeScenery: - p = TileInspectorPage::LargeScenery; + widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; + widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; + widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; break; case TileElementType::Banner: - p = TileInspectorPage::Banner; + widgets[WIDX_BANNER_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; + widgets[WIDX_BANNER_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; + widgets[WIDX_BANNER_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_BANNER_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_BANNER_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; + widgets[WIDX_BANNER_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; + widgets[WIDX_BANNER_CHECK_BLOCK_NE].top = GBBT(propertiesAnchor, 1); + widgets[WIDX_BANNER_CHECK_BLOCK_NE].bottom = GBBB(propertiesAnchor, 1); + widgets[WIDX_BANNER_CHECK_BLOCK_SE].top = GBBT(propertiesAnchor, 2); + widgets[WIDX_BANNER_CHECK_BLOCK_SE].bottom = GBBB(propertiesAnchor, 2); + widgets[WIDX_BANNER_CHECK_BLOCK_SW].top = GBBT(propertiesAnchor, 2); + widgets[WIDX_BANNER_CHECK_BLOCK_SW].bottom = GBBB(propertiesAnchor, 2); + widgets[WIDX_BANNER_CHECK_BLOCK_NW].top = GBBT(propertiesAnchor, 1); + widgets[WIDX_BANNER_CHECK_BLOCK_NW].bottom = GBBB(propertiesAnchor, 1); + SetCheckboxValue( + WIDX_BANNER_CHECK_BLOCK_NE, + (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((0 - GetCurrentRotation()) & 3)))); + SetCheckboxValue( + WIDX_BANNER_CHECK_BLOCK_SE, + (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((1 - GetCurrentRotation()) & 3)))); + SetCheckboxValue( + WIDX_BANNER_CHECK_BLOCK_SW, + (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((2 - GetCurrentRotation()) & 3)))); + SetCheckboxValue( + WIDX_BANNER_CHECK_BLOCK_NW, + (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((3 - GetCurrentRotation()) & 3)))); break; + + default: + break; // Nothing. } } + }; - if (tileInspectorPage != p) - { - SetPage(p); - Invalidate(); - } - // X and Y spinners - SetWidgetDisabledAndInvalidate( - WIDX_SPINNER_X_INCREASE, !(_tileSelected && ((_toolMap.x / 32) < MAXIMUM_MAP_SIZE_TECHNICAL - 1))); - SetWidgetDisabledAndInvalidate(WIDX_SPINNER_X_DECREASE, !(_tileSelected && ((_toolMap.x / 32) > 0))); - SetWidgetDisabledAndInvalidate( - WIDX_SPINNER_Y_INCREASE, !(_tileSelected && ((_toolMap.y / 32) < MAXIMUM_MAP_SIZE_TECHNICAL - 1))); - SetWidgetDisabledAndInvalidate(WIDX_SPINNER_Y_DECREASE, !(_tileSelected && ((_toolMap.y / 32) > 0))); - - // Sort buttons - SetWidgetDisabledAndInvalidate(WIDX_BUTTON_SORT, !(_tileSelected && windowTileInspectorElementCount > 1)); - - // Move Up button - SetWidgetDisabledAndInvalidate( - WIDX_BUTTON_MOVE_UP, - !(windowTileInspectorSelectedIndex != -1 - && windowTileInspectorSelectedIndex < windowTileInspectorElementCount - 1)); - - // Move Down button - SetWidgetDisabledAndInvalidate(WIDX_BUTTON_MOVE_DOWN, !(windowTileInspectorSelectedIndex > 0)); - - // Copy button - SetWidgetDisabledAndInvalidate(WIDX_BUTTON_COPY, !(windowTileInspectorSelectedIndex >= 0)); - - // Paste button - SetWidgetDisabledAndInvalidate(WIDX_BUTTON_PASTE, !(_tileSelected && _elementCopied)); - - widgets[WIDX_BACKGROUND].bottom = height - 1; - - if (tileInspectorPage == TileInspectorPage::Default) - { - widgets[WIDX_GROUPBOX_DETAILS].type = WindowWidgetType::Empty; - widgets[WIDX_GROUPBOX_PROPERTIES].type = WindowWidgetType::Empty; - widgets[WIDX_LIST].bottom = height - PADDING_BOTTOM; - } - else - { - widgets[WIDX_GROUPBOX_DETAILS].type = WindowWidgetType::Groupbox; - widgets[WIDX_GROUPBOX_PROPERTIES].type = WindowWidgetType::Groupbox; - auto pageIndex = EnumValue(tileInspectorPage) - 1; - widgets[WIDX_GROUPBOX_DETAILS].text = PageGroupBoxSettings[pageIndex].string_id; - widgets[WIDX_GROUPBOX_DETAILS].top = height - PageGroupBoxSettings[pageIndex].details_top_offset; - widgets[WIDX_GROUPBOX_DETAILS].bottom = height - PageGroupBoxSettings[pageIndex].details_bottom_offset; - widgets[WIDX_GROUPBOX_PROPERTIES].top = height - PageGroupBoxSettings[pageIndex].properties_top_offset; - widgets[WIDX_GROUPBOX_PROPERTIES].bottom = height - PageGroupBoxSettings[pageIndex].properties_bottom_offset; - widgets[WIDX_LIST].bottom = widgets[WIDX_GROUPBOX_DETAILS].top - GROUPBOX_PADDING; - } - - // The default page doesn't need further invalidation - if (tileInspectorPage == TileInspectorPage::Default) - return; - - // Using a switch, because I don't think giving each page their own callbacks is - // needed here, as only the mouseup and invalidate functions are different. - const int32_t propertiesAnchor = widgets[WIDX_GROUPBOX_PROPERTIES].top; - - switch (tileElement->GetType()) - { - case TileElementType::Surface: - widgets[WIDX_SURFACE_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; - widgets[WIDX_SURFACE_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; - widgets[WIDX_SURFACE_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_SURFACE_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_SURFACE_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_SURFACE_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_SURFACE_BUTTON_REMOVE_FENCES].top = GBBT(propertiesAnchor, 1); - widgets[WIDX_SURFACE_BUTTON_REMOVE_FENCES].bottom = GBBB(propertiesAnchor, 1); - widgets[WIDX_SURFACE_BUTTON_RESTORE_FENCES].top = GBBT(propertiesAnchor, 1); - widgets[WIDX_SURFACE_BUTTON_RESTORE_FENCES].bottom = GBBB(propertiesAnchor, 1); - widgets[WIDX_SURFACE_CHECK_CORNER_N].top = GBBT(propertiesAnchor, 2) + 7 * 0; - widgets[WIDX_SURFACE_CHECK_CORNER_N].bottom = widgets[WIDX_SURFACE_CHECK_CORNER_N].top + 13; - widgets[WIDX_SURFACE_CHECK_CORNER_E].top = GBBT(propertiesAnchor, 2) + 7 * 1; - widgets[WIDX_SURFACE_CHECK_CORNER_E].bottom = widgets[WIDX_SURFACE_CHECK_CORNER_E].top + 13; - widgets[WIDX_SURFACE_CHECK_CORNER_S].top = GBBT(propertiesAnchor, 2) + 7 * 2; - widgets[WIDX_SURFACE_CHECK_CORNER_S].bottom = widgets[WIDX_SURFACE_CHECK_CORNER_S].top + 13; - widgets[WIDX_SURFACE_CHECK_CORNER_W].top = GBBT(propertiesAnchor, 2) + 7 * 1; - widgets[WIDX_SURFACE_CHECK_CORNER_W].bottom = widgets[WIDX_SURFACE_CHECK_CORNER_W].top + 13; - widgets[WIDX_SURFACE_CHECK_DIAGONAL].top = GBBT(propertiesAnchor, 3) + 7 * 1; - widgets[WIDX_SURFACE_CHECK_DIAGONAL].bottom = widgets[WIDX_SURFACE_CHECK_DIAGONAL].top + 13; - SetCheckboxValue( - WIDX_SURFACE_CHECK_CORNER_N, - tileElement->AsSurface()->GetSlope() & (1 << ((2 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_SURFACE_CHECK_CORNER_E, - tileElement->AsSurface()->GetSlope() & (1 << ((3 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_SURFACE_CHECK_CORNER_S, - tileElement->AsSurface()->GetSlope() & (1 << ((0 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_SURFACE_CHECK_CORNER_W, - tileElement->AsSurface()->GetSlope() & (1 << ((1 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_SURFACE_CHECK_DIAGONAL, tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT); - break; - - case TileElementType::Path: - widgets[WIDX_PATH_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; - widgets[WIDX_PATH_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; - widgets[WIDX_PATH_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_PATH_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_PATH_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_PATH_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_PATH_CHECK_BROKEN].top = GBBT(propertiesAnchor, 1); - widgets[WIDX_PATH_CHECK_BROKEN].bottom = GBBB(propertiesAnchor, 1); - widgets[WIDX_PATH_CHECK_SLOPED].top = GBBT(propertiesAnchor, 2); - widgets[WIDX_PATH_CHECK_SLOPED].bottom = GBBB(propertiesAnchor, 2); - widgets[WIDX_PATH_CHECK_JUNCTION_RAILINGS].top = GBBT(propertiesAnchor, 3); - widgets[WIDX_PATH_CHECK_JUNCTION_RAILINGS].bottom = GBBB(propertiesAnchor, 3); - widgets[WIDX_PATH_CHECK_EDGE_N].top = GBBT(propertiesAnchor, 4) + 7 * 0; - widgets[WIDX_PATH_CHECK_EDGE_N].bottom = widgets[WIDX_PATH_CHECK_EDGE_N].top + 13; - widgets[WIDX_PATH_CHECK_EDGE_NE].top = GBBT(propertiesAnchor, 4) + 7 * 1; - widgets[WIDX_PATH_CHECK_EDGE_NE].bottom = widgets[WIDX_PATH_CHECK_EDGE_NE].top + 13; - widgets[WIDX_PATH_CHECK_EDGE_E].top = GBBT(propertiesAnchor, 4) + 7 * 2; - widgets[WIDX_PATH_CHECK_EDGE_E].bottom = widgets[WIDX_PATH_CHECK_EDGE_E].top + 13; - widgets[WIDX_PATH_CHECK_EDGE_SE].top = GBBT(propertiesAnchor, 4) + 7 * 3; - widgets[WIDX_PATH_CHECK_EDGE_SE].bottom = widgets[WIDX_PATH_CHECK_EDGE_SE].top + 13; - widgets[WIDX_PATH_CHECK_EDGE_S].top = GBBT(propertiesAnchor, 4) + 7 * 4; - widgets[WIDX_PATH_CHECK_EDGE_S].bottom = widgets[WIDX_PATH_CHECK_EDGE_S].top + 13; - widgets[WIDX_PATH_CHECK_EDGE_SW].top = GBBT(propertiesAnchor, 4) + 7 * 3; - widgets[WIDX_PATH_CHECK_EDGE_SW].bottom = widgets[WIDX_PATH_CHECK_EDGE_SW].top + 13; - widgets[WIDX_PATH_CHECK_EDGE_W].top = GBBT(propertiesAnchor, 4) + 7 * 2; - widgets[WIDX_PATH_CHECK_EDGE_W].bottom = widgets[WIDX_PATH_CHECK_EDGE_W].top + 13; - widgets[WIDX_PATH_CHECK_EDGE_NW].top = GBBT(propertiesAnchor, 4) + 7 * 1; - widgets[WIDX_PATH_CHECK_EDGE_NW].bottom = widgets[WIDX_PATH_CHECK_EDGE_NW].top + 13; - SetCheckboxValue(WIDX_PATH_CHECK_SLOPED, tileElement->AsPath()->IsSloped()); - SetCheckboxValue(WIDX_PATH_CHECK_JUNCTION_RAILINGS, tileElement->AsPath()->HasJunctionRailings()); - SetCheckboxValue(WIDX_PATH_CHECK_BROKEN, tileElement->AsPath()->IsBroken()); - SetCheckboxValue( - WIDX_PATH_CHECK_EDGE_NE, tileElement->AsPath()->GetEdges() & (1 << ((0 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_PATH_CHECK_EDGE_SE, tileElement->AsPath()->GetEdges() & (1 << ((1 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_PATH_CHECK_EDGE_SW, tileElement->AsPath()->GetEdges() & (1 << ((2 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_PATH_CHECK_EDGE_NW, tileElement->AsPath()->GetEdges() & (1 << ((3 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_PATH_CHECK_EDGE_E, tileElement->AsPath()->GetCorners() & (1 << ((0 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_PATH_CHECK_EDGE_S, tileElement->AsPath()->GetCorners() & (1 << ((1 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_PATH_CHECK_EDGE_W, tileElement->AsPath()->GetCorners() & (1 << ((2 - GetCurrentRotation()) & 3))); - SetCheckboxValue( - WIDX_PATH_CHECK_EDGE_N, tileElement->AsPath()->GetCorners() & (1 << ((3 - GetCurrentRotation()) & 3))); - break; - - case TileElementType::Track: - widgets[WIDX_TRACK_CHECK_APPLY_TO_ALL].top = GBBT(propertiesAnchor, 0); - widgets[WIDX_TRACK_CHECK_APPLY_TO_ALL].bottom = GBBB(propertiesAnchor, 0); - widgets[WIDX_TRACK_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 1) + 3; - widgets[WIDX_TRACK_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 1) - 3; - widgets[WIDX_TRACK_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 1) + 4; - widgets[WIDX_TRACK_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 1) - 4; - widgets[WIDX_TRACK_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 1) + 4; - widgets[WIDX_TRACK_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 1) - 4; - widgets[WIDX_TRACK_CHECK_CHAIN_LIFT].top = GBBT(propertiesAnchor, 2); - widgets[WIDX_TRACK_CHECK_CHAIN_LIFT].bottom = GBBB(propertiesAnchor, 2); - widgets[WIDX_TRACK_CHECK_BRAKE_CLOSED].top = GBBT(propertiesAnchor, 3); - widgets[WIDX_TRACK_CHECK_BRAKE_CLOSED].bottom = GBBB(propertiesAnchor, 3); - widgets[WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE].top = GBBT(propertiesAnchor, 4); - widgets[WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE].bottom = GBBB(propertiesAnchor, 4); - SetCheckboxValue(WIDX_TRACK_CHECK_APPLY_TO_ALL, _applyToAll); - SetCheckboxValue(WIDX_TRACK_CHECK_CHAIN_LIFT, tileElement->AsTrack()->HasChain()); - SetCheckboxValue(WIDX_TRACK_CHECK_BRAKE_CLOSED, tileElement->AsTrack()->IsBrakeClosed()); - widgets[WIDX_TRACK_CHECK_BRAKE_CLOSED].content = tileElement->AsTrack()->IsBlockStart() - ? STR_TILE_INSPECTOR_TRACK_BLOCK_BRAKE - : STR_TILE_INSPECTOR_TRACK_BRAKE_CLOSED; - SetCheckboxValue(WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE, tileElement->AsTrack()->IsIndestructible()); - break; - - case TileElementType::SmallScenery: - { - // Raise / Lower - widgets[WIDX_SCENERY_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; - widgets[WIDX_SCENERY_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; - widgets[WIDX_SCENERY_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_SCENERY_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_SCENERY_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_SCENERY_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - - // Quadrant checkboxes - widgets[WIDX_SCENERY_CHECK_QUARTER_N].top = GBBT(propertiesAnchor, 1) - 5 + 7 * 0; - widgets[WIDX_SCENERY_CHECK_QUARTER_N].bottom = widgets[WIDX_SCENERY_CHECK_QUARTER_N].top + 13; - widgets[WIDX_SCENERY_CHECK_QUARTER_E].top = GBBT(propertiesAnchor, 1) - 5 + 7 * 1; - widgets[WIDX_SCENERY_CHECK_QUARTER_E].bottom = widgets[WIDX_SCENERY_CHECK_QUARTER_E].top + 13; - widgets[WIDX_SCENERY_CHECK_QUARTER_S].top = GBBT(propertiesAnchor, 1) - 5 + 7 * 2; - widgets[WIDX_SCENERY_CHECK_QUARTER_S].bottom = widgets[WIDX_SCENERY_CHECK_QUARTER_S].top + 13; - widgets[WIDX_SCENERY_CHECK_QUARTER_W].top = GBBT(propertiesAnchor, 1) - 5 + 7 * 1; - widgets[WIDX_SCENERY_CHECK_QUARTER_W].bottom = widgets[WIDX_SCENERY_CHECK_QUARTER_W].top + 13; - // This gets the relative rotation, by subtracting the camera's rotation, and wrapping it between 0-3 inclusive - bool N = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((0 - GetCurrentRotation()) & 3); - bool E = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((1 - GetCurrentRotation()) & 3); - bool S = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((2 - GetCurrentRotation()) & 3); - bool W = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((3 - GetCurrentRotation()) & 3); - SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_N, N); - SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_E, E); - SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_S, S); - SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_W, W); - - // Collision checkboxes - widgets[WIDX_SCENERY_CHECK_COLLISION_N].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 0; - widgets[WIDX_SCENERY_CHECK_COLLISION_N].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_N].top + 13; - widgets[WIDX_SCENERY_CHECK_COLLISION_E].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 1; - widgets[WIDX_SCENERY_CHECK_COLLISION_E].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_E].top + 13; - widgets[WIDX_SCENERY_CHECK_COLLISION_S].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 2; - widgets[WIDX_SCENERY_CHECK_COLLISION_S].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_S].top + 13; - widgets[WIDX_SCENERY_CHECK_COLLISION_W].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 1; - widgets[WIDX_SCENERY_CHECK_COLLISION_W].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_W].top + 13; - auto occupiedQuadrants = tileElement->GetOccupiedQuadrants(); - N = (occupiedQuadrants & (1 << ((2 - GetCurrentRotation()) & 3))) != 0; - E = (occupiedQuadrants & (1 << ((3 - GetCurrentRotation()) & 3))) != 0; - S = (occupiedQuadrants & (1 << ((0 - GetCurrentRotation()) & 3))) != 0; - W = (occupiedQuadrants & (1 << ((1 - GetCurrentRotation()) & 3))) != 0; - SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_N, N); - SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_E, E); - SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_S, S); - SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_W, W); - break; - } - - case TileElementType::Entrance: - widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; - widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; - widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_ENTRANCE_BUTTON_MAKE_USABLE].top = GBBT(propertiesAnchor, 1); - widgets[WIDX_ENTRANCE_BUTTON_MAKE_USABLE].bottom = GBBB(propertiesAnchor, 1); - SetWidgetDisabled( - WIDX_ENTRANCE_BUTTON_MAKE_USABLE, - !(tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)); - break; - - case TileElementType::Wall: - { - bool canBeSloped = false; - bool hasAnimation = false; - const auto wallEntry = tileElement->AsWall()->GetEntry(); - if (wallEntry != nullptr) - { - canBeSloped = !(wallEntry->flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE); - hasAnimation = wallEntry->flags & WALL_SCENERY_IS_DOOR; - } - - widgets[WIDX_WALL_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; - widgets[WIDX_WALL_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; - widgets[WIDX_WALL_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_WALL_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_WALL_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_WALL_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_WALL_DROPDOWN_SLOPE].top = GBBT(propertiesAnchor, 1) + 3; - widgets[WIDX_WALL_DROPDOWN_SLOPE].bottom = GBBB(propertiesAnchor, 1) - 3; - widgets[WIDX_WALL_DROPDOWN_SLOPE].text = WallSlopeStringIds[tileElement->AsWall()->GetSlope()]; - widgets[WIDX_WALL_DROPDOWN_SLOPE_BUTTON].top = GBBT(propertiesAnchor, 1) + 4; - widgets[WIDX_WALL_DROPDOWN_SLOPE_BUTTON].bottom = GBBB(propertiesAnchor, 1) - 4; - widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME].top = GBBT(propertiesAnchor, 2) + 3; - widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME].bottom = GBBB(propertiesAnchor, 2) - 3; - widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE].top = GBBT(propertiesAnchor, 2) + 4; - widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE].bottom = GBBB(propertiesAnchor, 2) - 4; - widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE].top = GBBT(propertiesAnchor, 2) + 4; - widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE].bottom = GBBB(propertiesAnchor, 2) - 4; - - // Wall slope dropdown - SetWidgetDisabled(WIDX_WALL_DROPDOWN_SLOPE, !canBeSloped); - InvalidateWidget(WIDX_WALL_DROPDOWN_SLOPE); - SetWidgetDisabled(WIDX_WALL_DROPDOWN_SLOPE_BUTTON, !canBeSloped); - InvalidateWidget(WIDX_WALL_DROPDOWN_SLOPE_BUTTON); - // Wall animation frame spinner - SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME, !hasAnimation); - SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE, !hasAnimation); - SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE, !hasAnimation); - break; - } - - case TileElementType::LargeScenery: - widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; - widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; - widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - break; - - case TileElementType::Banner: - widgets[WIDX_BANNER_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3; - widgets[WIDX_BANNER_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3; - widgets[WIDX_BANNER_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_BANNER_SPINNER_HEIGHT_INCREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_BANNER_SPINNER_HEIGHT_DECREASE].top = GBBT(propertiesAnchor, 0) + 4; - widgets[WIDX_BANNER_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; - widgets[WIDX_BANNER_CHECK_BLOCK_NE].top = GBBT(propertiesAnchor, 1); - widgets[WIDX_BANNER_CHECK_BLOCK_NE].bottom = GBBB(propertiesAnchor, 1); - widgets[WIDX_BANNER_CHECK_BLOCK_SE].top = GBBT(propertiesAnchor, 2); - widgets[WIDX_BANNER_CHECK_BLOCK_SE].bottom = GBBB(propertiesAnchor, 2); - widgets[WIDX_BANNER_CHECK_BLOCK_SW].top = GBBT(propertiesAnchor, 2); - widgets[WIDX_BANNER_CHECK_BLOCK_SW].bottom = GBBB(propertiesAnchor, 2); - widgets[WIDX_BANNER_CHECK_BLOCK_NW].top = GBBT(propertiesAnchor, 1); - widgets[WIDX_BANNER_CHECK_BLOCK_NW].bottom = GBBB(propertiesAnchor, 1); - SetCheckboxValue( - WIDX_BANNER_CHECK_BLOCK_NE, - (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((0 - GetCurrentRotation()) & 3)))); - SetCheckboxValue( - WIDX_BANNER_CHECK_BLOCK_SE, - (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((1 - GetCurrentRotation()) & 3)))); - SetCheckboxValue( - WIDX_BANNER_CHECK_BLOCK_SW, - (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((2 - GetCurrentRotation()) & 3)))); - SetCheckboxValue( - WIDX_BANNER_CHECK_BLOCK_NW, - (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((3 - GetCurrentRotation()) & 3)))); - break; - - default: - break; // Nothing. - } + WindowBase* TileInspectorOpen() + { + WindowBase* window = WindowBringToFrontByClass(WindowClass::TileInspector); + if (window == nullptr) + window = WindowCreate(WindowClass::TileInspector, ScreenCoordsXY(0, 29), WW, WH, WF_RESIZABLE); + return window; } -}; -WindowBase* WindowTileInspectorOpen() -{ - WindowBase* window = WindowBringToFrontByClass(WindowClass::TileInspector); - if (window == nullptr) - window = WindowCreate(WindowClass::TileInspector, ScreenCoordsXY(0, 29), WW, WH, WF_RESIZABLE); - return window; -} + void WindowTileInspectorClearClipboard() + { + auto* window = WindowFindByClass(WindowClass::TileInspector); + if (window != nullptr) + static_cast(window)->ClearClipboard(); + } -void WindowTileInspectorClearClipboard() -{ - auto* window = WindowFindByClass(WindowClass::TileInspector); - if (window != nullptr) - static_cast(window)->ClearClipboard(); -} - -void WindowTileInspectorKeyboardShortcutToggleInvisibility() -{ - auto* window = WindowFindByClass(WindowClass::TileInspector); - if (window != nullptr) - static_cast(window)->ToggleInvisibility(); -} + void WindowTileInspectorKeyboardShortcutToggleInvisibility() + { + auto* window = WindowFindByClass(WindowClass::TileInspector); + if (window != nullptr) + static_cast(window)->ToggleInvisibility(); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TitleExit.cpp b/src/openrct2-ui/windows/TitleExit.cpp index d6d42bd495..0c56d4ab6e 100644 --- a/src/openrct2-ui/windows/TitleExit.cpp +++ b/src/openrct2-ui/windows/TitleExit.cpp @@ -15,52 +15,55 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum WindowTitleExitWidgetIdx { WIDX_EXIT, }; static Widget _titleExitWidgets[] = { MakeWidget({0, 0}, {40, 64}, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_EXIT), STR_EXIT), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class TitleExitWindow final : public Window -{ - void OnOpen() override + class TitleExitWindow final : public Window { - widgets = _titleExitWidgets; - InitScrollWidgets(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - if (gIntroState != IntroState::None) - return; - - switch (widgetIndex) + void OnOpen() override { - case WIDX_EXIT: - ContextQuit(); - // game_do_command(0, 1, 0, 0, 5, 3, 0); - break; - }; - } + widgets = _titleExitWidgets; + InitScrollWidgets(); + } - void OnDraw(DrawPixelInfo& dpi) override + void OnMouseUp(WidgetIndex widgetIndex) override + { + if (gIntroState != IntroState::None) + return; + + switch (widgetIndex) + { + case WIDX_EXIT: + ContextQuit(); + // game_do_command(0, 1, 0, 0, 5, 3, 0); + break; + }; + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + } + }; + + /** + * Creates the window containing the exit button on the title screen. + * rct2: 0x0066B624 (part of 0x0066B3E8) + */ + WindowBase* TitleExitOpen() { - DrawWidgets(dpi); + return WindowCreate( + WindowClass::TitleExit, ScreenCoordsXY(ContextGetWidth() - 40, ContextGetHeight() - 64), 40, 64, + WF_STICK_TO_BACK | WF_TRANSPARENT); } -}; - -/** - * Creates the window containing the exit button on the title screen. - * rct2: 0x0066B624 (part of 0x0066B3E8) - */ -WindowBase* WindowTitleExitOpen() -{ - return WindowCreate( - WindowClass::TitleExit, ScreenCoordsXY(ContextGetWidth() - 40, ContextGetHeight() - 64), 40, 64, - WF_STICK_TO_BACK | WF_TRANSPARENT); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TitleLogo.cpp b/src/openrct2-ui/windows/TitleLogo.cpp index 629cd78ed6..16bd5bb8cd 100644 --- a/src/openrct2-ui/windows/TitleLogo.cpp +++ b/src/openrct2-ui/windows/TitleLogo.cpp @@ -14,64 +14,67 @@ #include #include -static constexpr int32_t WW = 232; -static constexpr int32_t WH = 136; - -enum +namespace OpenRCT2::Ui::Windows { - WIDX_LOGO -}; + static constexpr int32_t WW = 232; + static constexpr int32_t WH = 136; -static Widget _titleLogoWidgets[] = { - MakeWidget({ 0, 0 }, { WW + 1, WH + 1 }, WindowWidgetType::ImgBtn, WindowColour::Primary), - WIDGETS_END, -}; - -class TitleLogoWindow final : public Window -{ -public: - /** - * Creates the window containing the logo and the expansion packs on the title screen. - * rct2: 0x0066B679 (part of 0x0066B3E8) - */ - void OnOpen() override + enum { - widgets = _titleLogoWidgets; - WindowInitScrollWidgets(*this); - colours[0] = TRANSLUCENT(COLOUR_GREY); - colours[1] = TRANSLUCENT(COLOUR_GREY); - colours[2] = TRANSLUCENT(COLOUR_GREY); - } + WIDX_LOGO + }; - void OnMouseUp(WidgetIndex widgetIndex) override + static Widget _titleLogoWidgets[] = { + MakeWidget({ 0, 0 }, { WW + 1, WH + 1 }, WindowWidgetType::ImgBtn, WindowColour::Primary), + kWidgetsEnd, + }; + + class TitleLogoWindow final : public Window { - switch (widgetIndex) + public: + /** + * Creates the window containing the logo and the expansion packs on the title screen. + * rct2: 0x0066B679 (part of 0x0066B3E8) + */ + void OnOpen() override { - case WIDX_LOGO: - WindowAboutOpen(); - break; + widgets = _titleLogoWidgets; + WindowInitScrollWidgets(*this); + colours[0] = TRANSLUCENT(COLOUR_GREY); + colours[1] = TRANSLUCENT(COLOUR_GREY); + colours[2] = TRANSLUCENT(COLOUR_GREY); } - } - /** - * - * rct2: 0x0066B872 - */ - void OnDraw(DrawPixelInfo& dpi) override - { - auto screenCoords = windowPos + ScreenCoordsXY{ 2, 2 }; - GfxDrawSprite(dpi, ImageId(SPR_G2_LOGO), screenCoords); - GfxDrawSprite(dpi, ImageId(SPR_G2_TITLE), screenCoords + ScreenCoordsXY{ 104, 18 }); - } -}; + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_LOGO: + AboutOpen(); + break; + } + } -WindowBase* WindowTitleLogoOpen() -{ - auto* window = WindowBringToFrontByClass(WindowClass::TitleLogo); - if (window == nullptr) + /** + * + * rct2: 0x0066B872 + */ + void OnDraw(DrawPixelInfo& dpi) override + { + auto screenCoords = windowPos + ScreenCoordsXY{ 2, 2 }; + GfxDrawSprite(dpi, ImageId(SPR_G2_LOGO), screenCoords); + GfxDrawSprite(dpi, ImageId(SPR_G2_TITLE), screenCoords + ScreenCoordsXY{ 104, 18 }); + } + }; + + WindowBase* TitleLogoOpen() { - window = WindowCreate( - WindowClass::TitleLogo, ScreenCoordsXY(0, 0), WW, WH, WF_STICK_TO_BACK | WF_TRANSPARENT); + auto* window = WindowBringToFrontByClass(WindowClass::TitleLogo); + if (window == nullptr) + { + window = WindowCreate( + WindowClass::TitleLogo, ScreenCoordsXY(0, 0), WW, WH, WF_STICK_TO_BACK | WF_TRANSPARENT); + } + return window; } - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index 8b7a8d4482..e506ac4cf1 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -23,7 +23,9 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum { WIDX_START_NEW_GAME, WIDX_CONTINUE_SAVED_GAME, @@ -51,240 +53,241 @@ static Widget _titleMenuWidgets[] = { MakeWidget({0, UpdateButtonDims.height}, MenuButtonDims, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_G2_MENU_MULTIPLAYER), STR_SHOW_MULTIPLAYER_TIP), MakeWidget({0, UpdateButtonDims.height}, MenuButtonDims, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_TOOLBOX), STR_GAME_TOOLS_TIP), MakeWidget({0, 0}, UpdateButtonDims, WindowWidgetType::Empty, WindowColour::Secondary, STR_UPDATE_AVAILABLE), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -static void WindowTitleMenuScenarioselectCallback(const utf8* path) -{ - GameNotifyMapChange(); - OpenRCT2::GetContext()->LoadParkFromFile(path, false, true); - GameLoadScripts(); - GameNotifyMapChanged(); -} - -static void InvokeCustomToolboxMenuItem(size_t index) -{ -#ifdef ENABLE_SCRIPTING - const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; - size_t i = 0; - for (const auto& item : customMenuItems) + static void WindowTitleMenuScenarioselectCallback(const utf8* path) { - if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Toolbox) - { - if (i == index) - { - item.Invoke(); - break; - } - i++; - } + GameNotifyMapChange(); + OpenRCT2::GetContext()->LoadParkFromFile(path, false, true); + GameLoadScripts(); + GameNotifyMapChanged(); } -#endif -} -class TitleMenuWindow final : public Window -{ -private: - ScreenRect _filterRect; - -public: - void OnOpen() override + static void InvokeCustomToolboxMenuItem(size_t index) { - widgets = _titleMenuWidgets; +#ifdef ENABLE_SCRIPTING + const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; + size_t i = 0; + for (const auto& item : customMenuItems) + { + if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Toolbox) + { + if (i == index) + { + item.Invoke(); + break; + } + i++; + } + } +#endif + } + + class TitleMenuWindow final : public Window + { + private: + ScreenRect _filterRect; + + public: + void OnOpen() override + { + widgets = _titleMenuWidgets; #ifdef DISABLE_NETWORK - widgets[WIDX_MULTIPLAYER].type = WindowWidgetType::Empty; + widgets[WIDX_MULTIPLAYER].type = WindowWidgetType::Empty; #endif - int32_t x = 0; - for (Widget* widget = widgets; widget != &widgets[WIDX_NEW_VERSION]; widget++) - { - if (widget->type != WindowWidgetType::Empty) + int32_t x = 0; + for (Widget* widget = widgets; widget != &widgets[WIDX_NEW_VERSION]; widget++) { - widget->left = x; - widget->right = x + MenuButtonDims.width - 1; + if (widget->type != WindowWidgetType::Empty) + { + widget->left = x; + widget->right = x + MenuButtonDims.width - 1; - x += MenuButtonDims.width; + x += MenuButtonDims.width; + } + } + width = x; + widgets[WIDX_NEW_VERSION].right = width; + windowPos.x = (ContextGetWidth() - width) / 2; + colours[1] = TRANSLUCENT(COLOUR_LIGHT_ORANGE); + + InitScrollWidgets(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + WindowBase* windowToOpen = nullptr; + + switch (widgetIndex) + { + case WIDX_START_NEW_GAME: + windowToOpen = WindowFindByClass(WindowClass::ScenarioSelect); + if (windowToOpen != nullptr) + { + WindowBringToFront(*windowToOpen); + } + else + { + WindowCloseByClass(WindowClass::Loadsave); + WindowCloseByClass(WindowClass::ServerList); + ScenarioselectOpen(WindowTitleMenuScenarioselectCallback); + } + break; + case WIDX_CONTINUE_SAVED_GAME: + windowToOpen = WindowFindByClass(WindowClass::Loadsave); + if (windowToOpen != nullptr) + { + WindowBringToFront(*windowToOpen); + } + else + { + WindowCloseByClass(WindowClass::ScenarioSelect); + WindowCloseByClass(WindowClass::ServerList); + auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt); + GameActions::Execute(&loadOrQuitAction); + } + break; + case WIDX_MULTIPLAYER: + windowToOpen = WindowFindByClass(WindowClass::ServerList); + if (windowToOpen != nullptr) + { + WindowBringToFront(*windowToOpen); + } + else + { + WindowCloseByClass(WindowClass::ScenarioSelect); + WindowCloseByClass(WindowClass::Loadsave); + ContextOpenWindow(WindowClass::ServerList); + } + break; + case WIDX_NEW_VERSION: + ContextOpenWindowView(WV_NEW_VERSION_INFO); + break; } } - width = x; - widgets[WIDX_NEW_VERSION].right = width; - windowPos.x = (ContextGetWidth() - width) / 2; - colours[1] = TRANSLUCENT(COLOUR_LIGHT_ORANGE); - InitScrollWidgets(); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - WindowBase* windowToOpen = nullptr; - - switch (widgetIndex) + void OnMouseDown(WidgetIndex widgetIndex) override { - case WIDX_START_NEW_GAME: - windowToOpen = WindowFindByClass(WindowClass::ScenarioSelect); - if (windowToOpen != nullptr) - { - WindowBringToFront(*windowToOpen); - } - else - { - WindowCloseByClass(WindowClass::Loadsave); - WindowCloseByClass(WindowClass::ServerList); - WindowScenarioselectOpen(WindowTitleMenuScenarioselectCallback); - } - break; - case WIDX_CONTINUE_SAVED_GAME: - windowToOpen = WindowFindByClass(WindowClass::Loadsave); - if (windowToOpen != nullptr) - { - WindowBringToFront(*windowToOpen); - } - else - { - WindowCloseByClass(WindowClass::ScenarioSelect); - WindowCloseByClass(WindowClass::ServerList); - auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt); - GameActions::Execute(&loadOrQuitAction); - } - break; - case WIDX_MULTIPLAYER: - windowToOpen = WindowFindByClass(WindowClass::ServerList); - if (windowToOpen != nullptr) - { - WindowBringToFront(*windowToOpen); - } - else - { - WindowCloseByClass(WindowClass::ScenarioSelect); - WindowCloseByClass(WindowClass::Loadsave); - ContextOpenWindow(WindowClass::ServerList); - } - break; - case WIDX_NEW_VERSION: - ContextOpenWindowView(WV_NEW_VERSION_INFO); - break; - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - if (widgetIndex == WIDX_GAME_TOOLS) - { - int32_t i = 0; - gDropdownItems[i++].Format = STR_SCENARIO_EDITOR; - gDropdownItems[i++].Format = STR_CONVERT_SAVED_GAME_TO_SCENARIO; - gDropdownItems[i++].Format = STR_ROLLER_COASTER_DESIGNER; - gDropdownItems[i++].Format = STR_TRACK_DESIGNS_MANAGER; - gDropdownItems[i++].Format = STR_OPEN_USER_CONTENT_FOLDER; + if (widgetIndex == WIDX_GAME_TOOLS) + { + int32_t i = 0; + gDropdownItems[i++].Format = STR_SCENARIO_EDITOR; + gDropdownItems[i++].Format = STR_CONVERT_SAVED_GAME_TO_SCENARIO; + gDropdownItems[i++].Format = STR_ROLLER_COASTER_DESIGNER; + gDropdownItems[i++].Format = STR_TRACK_DESIGNS_MANAGER; + gDropdownItems[i++].Format = STR_OPEN_USER_CONTENT_FOLDER; #ifdef ENABLE_SCRIPTING - auto hasCustomItems = false; - const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; - if (!customMenuItems.empty()) - { - for (const auto& item : customMenuItems) + auto hasCustomItems = false; + const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; + if (!customMenuItems.empty()) { - if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Toolbox) + for (const auto& item : customMenuItems) { - // Add seperator - if (!hasCustomItems) + if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Toolbox) { - hasCustomItems = true; - gDropdownItems[i++].Format = STR_EMPTY; - } + // Add seperator + if (!hasCustomItems) + { + hasCustomItems = true; + gDropdownItems[i++].Format = STR_EMPTY; + } - gDropdownItems[i].Format = STR_STRING; - auto sz = item.Text.c_str(); - std::memcpy(&gDropdownItems[i].Args, &sz, sizeof(const char*)); - i++; + gDropdownItems[i].Format = STR_STRING; + auto sz = item.Text.c_str(); + std::memcpy(&gDropdownItems[i].Args, &sz, sizeof(const char*)); + i++; + } } } - } #endif - Widget* widget = &widgets[widgetIndex]; - int32_t yOffset = 0; - if (i > 5) - { - yOffset = -(widget->height() + 5 + (i * 12)); - } - - WindowDropdownShowText( - windowPos + ScreenCoordsXY{ widget->left, widget->top + yOffset }, widget->height() + 1, - TRANSLUCENT(colours[0]), Dropdown::Flag::StayOpen, i); - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - if (selectedIndex == -1) - { - return; - } - if (widgetIndex == WIDX_GAME_TOOLS) - { - switch (selectedIndex) - { - case DDIDX_SCENARIO_EDITOR: - Editor::Load(); - break; - case DDIDX_CONVERT_SAVED_GAME: - Editor::ConvertSaveToScenario(); - break; - case DDIDX_TRACK_DESIGNER: - Editor::LoadTrackDesigner(); - break; - case DDIDX_TRACK_MANAGER: - Editor::LoadTrackManager(); - break; - case DDIDX_OPEN_CONTENT_FOLDER: + Widget* widget = &widgets[widgetIndex]; + int32_t yOffset = 0; + if (i > 5) { - auto context = OpenRCT2::GetContext(); - auto env = context->GetPlatformEnvironment(); - auto uiContext = context->GetUiContext(); - uiContext->OpenFolder(env->GetDirectoryPath(OpenRCT2::DIRBASE::USER)); - break; + yOffset = -(widget->height() + 5 + (i * 12)); } - default: - InvokeCustomToolboxMenuItem(selectedIndex - DDIDX_CUSTOM_BEGIN); - break; + + WindowDropdownShowText( + windowPos + ScreenCoordsXY{ widget->left, widget->top + yOffset }, widget->height() + 1, + TRANSLUCENT(colours[0]), Dropdown::Flag::StayOpen, i); } } - } - CursorID OnCursor(WidgetIndex, const ScreenCoordsXY&, CursorID cursorId) override - { - gTooltipCloseTimeout = gCurrentRealTimeTicks + 2000; - return cursorId; - } - - void OnPrepareDraw() override - { - _filterRect = { windowPos + ScreenCoordsXY{ 0, UpdateButtonDims.height }, - windowPos + ScreenCoordsXY{ width - 1, MenuButtonDims.height + UpdateButtonDims.height - 1 } }; - if (OpenRCT2::GetContext()->HasNewVersionInfo()) + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { - widgets[WIDX_NEW_VERSION].type = WindowWidgetType::Button; - _filterRect.Point1.y = windowPos.y; + if (selectedIndex == -1) + { + return; + } + if (widgetIndex == WIDX_GAME_TOOLS) + { + switch (selectedIndex) + { + case DDIDX_SCENARIO_EDITOR: + Editor::Load(); + break; + case DDIDX_CONVERT_SAVED_GAME: + Editor::ConvertSaveToScenario(); + break; + case DDIDX_TRACK_DESIGNER: + Editor::LoadTrackDesigner(); + break; + case DDIDX_TRACK_MANAGER: + Editor::LoadTrackManager(); + break; + case DDIDX_OPEN_CONTENT_FOLDER: + { + auto context = OpenRCT2::GetContext(); + auto env = context->GetPlatformEnvironment(); + auto uiContext = context->GetUiContext(); + uiContext->OpenFolder(env->GetDirectoryPath(OpenRCT2::DIRBASE::USER)); + break; + } + default: + InvokeCustomToolboxMenuItem(selectedIndex - DDIDX_CUSTOM_BEGIN); + break; + } + } } - } - void OnDraw(DrawPixelInfo& dpi) override + CursorID OnCursor(WidgetIndex, const ScreenCoordsXY&, CursorID cursorId) override + { + gTooltipCloseTimeout = gCurrentRealTimeTicks + 2000; + return cursorId; + } + + void OnPrepareDraw() override + { + _filterRect = { windowPos + ScreenCoordsXY{ 0, UpdateButtonDims.height }, + windowPos + ScreenCoordsXY{ width - 1, MenuButtonDims.height + UpdateButtonDims.height - 1 } }; + if (OpenRCT2::GetContext()->HasNewVersionInfo()) + { + widgets[WIDX_NEW_VERSION].type = WindowWidgetType::Button; + _filterRect.Point1.y = windowPos.y; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + GfxFilterRect(dpi, _filterRect, FilterPaletteID::Palette51); + DrawWidgets(dpi); + } + }; + + /** + * Creates the window containing the menu buttons on the title screen. + */ + WindowBase* TitleMenuOpen() { - GfxFilterRect(dpi, _filterRect, FilterPaletteID::Palette51); - DrawWidgets(dpi); + const uint16_t windowHeight = MenuButtonDims.height + UpdateButtonDims.height; + return WindowCreate( + WindowClass::TitleMenu, ScreenCoordsXY(0, ContextGetHeight() - 182), 0, windowHeight, + WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND); } -}; - -/** - * Creates the window containing the menu buttons on the title screen. - */ -WindowBase* WindowTitleMenuOpen() -{ - const uint16_t windowHeight = MenuButtonDims.height + UpdateButtonDims.height; - return WindowCreate( - WindowClass::TitleMenu, ScreenCoordsXY(0, ContextGetHeight() - 182), 0, windowHeight, - WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TitleOptions.cpp b/src/openrct2-ui/windows/TitleOptions.cpp index bb8cd90211..07a359e3e7 100644 --- a/src/openrct2-ui/windows/TitleOptions.cpp +++ b/src/openrct2-ui/windows/TitleOptions.cpp @@ -14,53 +14,57 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum WindowTitleOptionsWidgetIdx { WIDX_OPTIONS, }; static Widget _windowTitleOptionsWidgets[] = { MakeWidget({0, 0}, {80, 15}, WindowWidgetType::Button, WindowColour::Tertiary, STR_OPTIONS, STR_OPTIONS_TIP), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class TitleOptionsWindow final : public Window -{ -public: - void OnOpen() override + class TitleOptionsWindow final : public Window { - widgets = _windowTitleOptionsWidgets; - WindowInitScrollWidgets(*this); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_OPTIONS: - ContextOpenWindow(WindowClass::Options); - break; + widgets = _windowTitleOptionsWidgets; + WindowInitScrollWidgets(*this); } - } - void OnDraw(DrawPixelInfo& dpi) override + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_OPTIONS: + ContextOpenWindow(WindowClass::Options); + break; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + } + }; + + /** + * Creates the window containing the options button on the title screen. + */ + WindowBase* TitleOptionsOpen() { - DrawWidgets(dpi); - } -}; + auto* window = WindowBringToFrontByClass(WindowClass::TitleOptions); + if (window == nullptr) + { + window = WindowCreate( + WindowClass::TitleOptions, ScreenCoordsXY(ContextGetWidth() - 80, 0), 80, 15, + WF_STICK_TO_BACK | WF_TRANSPARENT); + } -/** - * Creates the window containing the options button on the title screen. - */ -WindowBase* WindowTitleOptionsOpen() -{ - auto* window = WindowBringToFrontByClass(WindowClass::TitleOptions); - if (window == nullptr) - { - window = WindowCreate( - WindowClass::TitleOptions, ScreenCoordsXY(ContextGetWidth() - 80, 0), 80, 15, WF_STICK_TO_BACK | WF_TRANSPARENT); + return window; } - - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index b114d00710..8417ba037b 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -18,191 +18,195 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum { WIDX_BACKGROUND }; static Widget _tooltipWidgets[] = { MakeWidget({0, 0}, {200, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class TooltipWindow final : public Window -{ -private: - u8string _tooltipText; - int16_t _tooltipNumLines = 1; - -public: - TooltipWindow(const OpenRCT2String& message, ScreenCoordsXY screenCoords) + class TooltipWindow final : public Window { - int32_t textWidth = FormatTextForTooltip(message); - int32_t textHeight = ((_tooltipNumLines + 1) * FontGetLineHeight(FontStyle::Small)); + private: + u8string _tooltipText; + int16_t _tooltipNumLines = 1; - width = textWidth + 5; - height = textHeight + 4; + public: + TooltipWindow(const OpenRCT2String& message, ScreenCoordsXY screenCoords) + { + int32_t textWidth = FormatTextForTooltip(message); + int32_t textHeight = ((_tooltipNumLines + 1) * FontGetLineHeight(FontStyle::Small)); - widgets = _tooltipWidgets; - widgets[WIDX_BACKGROUND].right = width; - widgets[WIDX_BACKGROUND].bottom = height; + width = textWidth + 5; + height = textHeight + 4; - UpdatePosition(screenCoords); + widgets = _tooltipWidgets; + widgets[WIDX_BACKGROUND].right = width; + widgets[WIDX_BACKGROUND].bottom = height; + + UpdatePosition(screenCoords); + } + + void UpdatePosition(ScreenCoordsXY screenCoords) + { + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + screenCoords.x = std::clamp(screenCoords.x - (width / 2), 0, screenWidth - width); + + // TODO The cursor size will be relative to the window DPI. + // The amount to offset the y should be adjusted. + + const int32_t cursorHeight = 20; + const int32_t cursorMargin = 4; + const int32_t cursorOffset = cursorHeight + cursorMargin; + + const int32_t maxY = screenHeight - height; + + if (screenCoords.y + cursorOffset > maxY) + { + // Display the tooltip above the cursor if there is not enough space below. + screenCoords.y -= (height + cursorMargin); + } + else + { + // Display the tooltip under the cursor if there is enough space below. + screenCoords.y += cursorOffset; + } + + screenCoords.y = std::clamp(screenCoords.y, cursorOffset, maxY); + + if (windowPos != screenCoords) + { + WindowSetPosition(*this, screenCoords); + } + } + + void OnOpen() override + { + ResetTooltipNotShown(); + } + + void OnUpdate() override + { + UpdatePosition(gTooltipCursor); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + int32_t left = windowPos.x; + int32_t top = windowPos.y; + int32_t right = windowPos.x + width - 1; + int32_t bottom = windowPos.y + height - 1; + + // Background + GfxFilterRect(dpi, { { left + 1, top + 1 }, { right - 1, bottom - 1 } }, FilterPaletteID::Palette45); + GfxFilterRect(dpi, { { left + 1, top + 1 }, { right - 1, bottom - 1 } }, FilterPaletteID::PaletteGlassLightOrange); + + // Sides + GfxFilterRect(dpi, { { left + 0, top + 2 }, { left + 0, bottom - 2 } }, FilterPaletteID::PaletteDarken3); + GfxFilterRect(dpi, { { right + 0, top + 2 }, { right + 0, bottom - 2 } }, FilterPaletteID::PaletteDarken3); + GfxFilterRect(dpi, { { left + 2, bottom + 0 }, { right - 2, bottom + 0 } }, FilterPaletteID::PaletteDarken3); + GfxFilterRect(dpi, { { left + 2, top + 0 }, { right - 2, top + 0 } }, FilterPaletteID::PaletteDarken3); + + // Corners + GfxFilterPixel(dpi, { left + 1, top + 1 }, FilterPaletteID::PaletteDarken3); + GfxFilterPixel(dpi, { right - 1, top + 1 }, FilterPaletteID::PaletteDarken3); + GfxFilterPixel(dpi, { left + 1, bottom - 1 }, FilterPaletteID::PaletteDarken3); + GfxFilterPixel(dpi, { right - 1, bottom - 1 }, FilterPaletteID::PaletteDarken3); + + // Text + left = windowPos.x + ((width + 1) / 2) - 1; + top = windowPos.y + 1; + DrawStringCentredRaw(dpi, { left, top }, _tooltipNumLines, _tooltipText.data(), FontStyle::Small); + } + + private: + // Returns the width of the new tooltip text + int32_t FormatTextForTooltip(const OpenRCT2String& message) + { + const u8string tempString = FormatStringIDLegacy(message.str, message.args.Data()); + + OpenRCT2String formattedMessage{ STR_STRING_TOOLTIP, Formatter() }; + formattedMessage.args.Add(tempString.c_str()); + const u8string tooltipTextUnwrapped = FormatStringIDLegacy(formattedMessage.str, formattedMessage.args.Data()); + + auto textWidth = GfxGetStringWidthNewLined(tooltipTextUnwrapped, FontStyle::Small); + textWidth = std::min(textWidth, 196); + + int32_t numLines; + textWidth = GfxWrapString(tooltipTextUnwrapped, textWidth + 1, FontStyle::Small, &_tooltipText, &numLines); + _tooltipNumLines = numLines; + return textWidth; + } + }; + + void WindowTooltipReset(const ScreenCoordsXY& screenCoords) + { + gTooltipCursor = screenCoords; + gTooltipCloseTimeout = 0; + gTooltipWidget.window_classification = WindowClass::Null; + InputSetState(InputState::Normal); + InputSetFlag(INPUT_FLAG_4, false); } - void UpdatePosition(ScreenCoordsXY screenCoords) + void WindowTooltipShow(const OpenRCT2String& message, ScreenCoordsXY screenCoords) { - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - screenCoords.x = std::clamp(screenCoords.x - (width / 2), 0, screenWidth - width); + auto tooltipWindow = std::make_unique(message, screenCoords); + auto windowPos = tooltipWindow->windowPos; + auto width = tooltipWindow->width; + auto height = tooltipWindow->height; + WindowCreate( + std::move(tooltipWindow), WindowClass::Tooltip, windowPos, width, height, WF_TRANSPARENT | WF_STICK_TO_FRONT); + } - // TODO The cursor size will be relative to the window DPI. - // The amount to offset the y should be adjusted. + void WindowTooltipOpen(WindowBase* widgetWindow, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + { + if (widgetWindow == nullptr || widgetIndex == -1) + return; - const int32_t cursorHeight = 20; - const int32_t cursorMargin = 4; - const int32_t cursorOffset = cursorHeight + cursorMargin; + auto widget = &widgetWindow->widgets[widgetIndex]; + widgetWindow->OnPrepareDraw(); - const int32_t maxY = screenHeight - height; - - if (screenCoords.y + cursorOffset > maxY) + OpenRCT2String result; + if (widget->flags & WIDGET_FLAGS::TOOLTIP_IS_STRING) { - // Display the tooltip above the cursor if there is not enough space below. - screenCoords.y -= (height + cursorMargin); + auto tooltipString = widget->sztooltip; + if (*tooltipString == 0) + return; + + result.str = STR_STRING_TOOLTIP; + result.args = Formatter(); + result.args.Add(tooltipString); + + gTooltipWidget.window_classification = widgetWindow->classification; + gTooltipWidget.window_number = widgetWindow->number; + gTooltipWidget.widget_index = widgetIndex; } else { - // Display the tooltip under the cursor if there is enough space below. - screenCoords.y += cursorOffset; + auto stringId = widget->tooltip; + gTooltipWidget.window_classification = widgetWindow->classification; + gTooltipWidget.window_number = widgetWindow->number; + gTooltipWidget.widget_index = widgetIndex; + result = widgetWindow->OnTooltip(widgetIndex, stringId); + if (result.str == STR_NONE) + return; } - screenCoords.y = std::clamp(screenCoords.y, cursorOffset, maxY); - - if (windowPos != screenCoords) - { - WindowSetPosition(*this, screenCoords); - } + WindowTooltipShow(result, screenCoords); } - void OnOpen() override + void WindowTooltipClose() { - ResetTooltipNotShown(); + WindowCloseByClass(WindowClass::Tooltip); + gTooltipCloseTimeout = 0; + gTooltipWidget.window_classification = WindowClass::Null; } - - void OnUpdate() override - { - UpdatePosition(gTooltipCursor); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - int32_t left = windowPos.x; - int32_t top = windowPos.y; - int32_t right = windowPos.x + width - 1; - int32_t bottom = windowPos.y + height - 1; - - // Background - GfxFilterRect(dpi, { { left + 1, top + 1 }, { right - 1, bottom - 1 } }, FilterPaletteID::Palette45); - GfxFilterRect(dpi, { { left + 1, top + 1 }, { right - 1, bottom - 1 } }, FilterPaletteID::PaletteGlassLightOrange); - - // Sides - GfxFilterRect(dpi, { { left + 0, top + 2 }, { left + 0, bottom - 2 } }, FilterPaletteID::PaletteDarken3); - GfxFilterRect(dpi, { { right + 0, top + 2 }, { right + 0, bottom - 2 } }, FilterPaletteID::PaletteDarken3); - GfxFilterRect(dpi, { { left + 2, bottom + 0 }, { right - 2, bottom + 0 } }, FilterPaletteID::PaletteDarken3); - GfxFilterRect(dpi, { { left + 2, top + 0 }, { right - 2, top + 0 } }, FilterPaletteID::PaletteDarken3); - - // Corners - GfxFilterPixel(dpi, { left + 1, top + 1 }, FilterPaletteID::PaletteDarken3); - GfxFilterPixel(dpi, { right - 1, top + 1 }, FilterPaletteID::PaletteDarken3); - GfxFilterPixel(dpi, { left + 1, bottom - 1 }, FilterPaletteID::PaletteDarken3); - GfxFilterPixel(dpi, { right - 1, bottom - 1 }, FilterPaletteID::PaletteDarken3); - - // Text - left = windowPos.x + ((width + 1) / 2) - 1; - top = windowPos.y + 1; - DrawStringCentredRaw(dpi, { left, top }, _tooltipNumLines, _tooltipText.data(), FontStyle::Small); - } - -private: - // Returns the width of the new tooltip text - int32_t FormatTextForTooltip(const OpenRCT2String& message) - { - const u8string tempString = FormatStringID(message.str, message.args.Data()); - - OpenRCT2String formattedMessage{ STR_STRING_TOOLTIP, Formatter() }; - formattedMessage.args.Add(tempString.c_str()); - const u8string tooltipTextUnwrapped = FormatStringID(formattedMessage.str, formattedMessage.args.Data()); - - auto textWidth = GfxGetStringWidthNewLined(tooltipTextUnwrapped, FontStyle::Small); - textWidth = std::min(textWidth, 196); - - int32_t numLines; - textWidth = GfxWrapString(tooltipTextUnwrapped, textWidth + 1, FontStyle::Small, &_tooltipText, &numLines); - _tooltipNumLines = numLines; - return textWidth; - } -}; - -void WindowTooltipReset(const ScreenCoordsXY& screenCoords) -{ - gTooltipCursor = screenCoords; - gTooltipCloseTimeout = 0; - gTooltipWidget.window_classification = WindowClass::Null; - InputSetState(InputState::Normal); - InputSetFlag(INPUT_FLAG_4, false); -} - -void WindowTooltipShow(const OpenRCT2String& message, ScreenCoordsXY screenCoords) -{ - auto tooltipWindow = std::make_unique(message, screenCoords); - auto windowPos = tooltipWindow->windowPos; - auto width = tooltipWindow->width; - auto height = tooltipWindow->height; - WindowCreate(std::move(tooltipWindow), WindowClass::Tooltip, windowPos, width, height, WF_TRANSPARENT | WF_STICK_TO_FRONT); -} - -void WindowTooltipOpen(WindowBase* widgetWindow, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - if (widgetWindow == nullptr || widgetIndex == -1) - return; - - auto widget = &widgetWindow->widgets[widgetIndex]; - WindowEventOnPrepareDrawCall(widgetWindow); - - OpenRCT2String result; - if (widget->flags & WIDGET_FLAGS::TOOLTIP_IS_STRING) - { - auto tooltipString = widget->sztooltip; - if (*tooltipString == 0) - return; - - result.str = STR_STRING_TOOLTIP; - result.args = Formatter(); - result.args.Add(tooltipString); - - gTooltipWidget.window_classification = widgetWindow->classification; - gTooltipWidget.window_number = widgetWindow->number; - gTooltipWidget.widget_index = widgetIndex; - } - else - { - auto stringId = widget->tooltip; - gTooltipWidget.window_classification = widgetWindow->classification; - gTooltipWidget.window_number = widgetWindow->number; - gTooltipWidget.widget_index = widgetIndex; - result = WindowEventTooltipCall(widgetWindow, widgetIndex, stringId); - if (result.str == STR_NONE) - return; - } - - WindowTooltipShow(result, screenCoords); -} - -void WindowTooltipClose() -{ - WindowCloseByClass(WindowClass::Tooltip); - gTooltipCloseTimeout = 0; - gTooltipWidget.window_classification = WindowClass::Null; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 93845d9853..28cc31f993 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -73,143 +73,142 @@ #include #include -using namespace OpenRCT2; -using namespace OpenRCT2::Ui; - -enum +namespace OpenRCT2::Ui::Windows { - WIDX_PAUSE, - WIDX_FILE_MENU, - WIDX_MUTE, - WIDX_ZOOM_OUT, - WIDX_ZOOM_IN, - WIDX_ROTATE, - WIDX_VIEW_MENU, - WIDX_MAP, + enum + { + WIDX_PAUSE, + WIDX_FILE_MENU, + WIDX_MUTE, + WIDX_ZOOM_OUT, + WIDX_ZOOM_IN, + WIDX_ROTATE, + WIDX_VIEW_MENU, + WIDX_MAP, - WIDX_LAND, - WIDX_WATER, - WIDX_SCENERY, - WIDX_PATH, - WIDX_CONSTRUCT_RIDE, - WIDX_RIDES, - WIDX_PARK, - WIDX_STAFF, - WIDX_GUESTS, - WIDX_CLEAR_SCENERY, + WIDX_LAND, + WIDX_WATER, + WIDX_SCENERY, + WIDX_PATH, + WIDX_CONSTRUCT_RIDE, + WIDX_RIDES, + WIDX_PARK, + WIDX_STAFF, + WIDX_GUESTS, + WIDX_CLEAR_SCENERY, - WIDX_FASTFORWARD, - WIDX_CHEATS, - WIDX_DEBUG, - WIDX_FINANCES, - WIDX_RESEARCH, - WIDX_NEWS, - WIDX_NETWORK, - WIDX_CHAT, + WIDX_FASTFORWARD, + WIDX_CHEATS, + WIDX_DEBUG, + WIDX_FINANCES, + WIDX_RESEARCH, + WIDX_NEWS, + WIDX_NETWORK, + WIDX_CHAT, - WIDX_SEPARATOR, -}; + WIDX_SEPARATOR, + }; -validate_global_widx(WC_TOP_TOOLBAR, WIDX_PAUSE); -validate_global_widx(WC_TOP_TOOLBAR, WIDX_LAND); -validate_global_widx(WC_TOP_TOOLBAR, WIDX_WATER); -validate_global_widx(WC_TOP_TOOLBAR, WIDX_SCENERY); -validate_global_widx(WC_TOP_TOOLBAR, WIDX_PATH); + validate_global_widx(WC_TOP_TOOLBAR, WIDX_PAUSE); + validate_global_widx(WC_TOP_TOOLBAR, WIDX_LAND); + validate_global_widx(WC_TOP_TOOLBAR, WIDX_WATER); + validate_global_widx(WC_TOP_TOOLBAR, WIDX_SCENERY); + validate_global_widx(WC_TOP_TOOLBAR, WIDX_PATH); -enum FileMenuDdidx -{ - DDIDX_NEW_GAME = 0, - DDIDX_LOAD_GAME = 1, - DDIDX_SAVE_GAME = 2, - DDIDX_SAVE_GAME_AS = 3, - // separator - DDIDX_ABOUT = 5, - DDIDX_OPTIONS = 6, - DDIDX_SCREENSHOT = 7, - DDIDX_GIANT_SCREENSHOT = 8, - // separator - DDIDX_FILE_BUG_ON_GITHUB = 10, - DDIDX_UPDATE_AVAILABLE = 11, - // separator - DDIDX_QUIT_TO_MENU = 13, - DDIDX_EXIT_OPENRCT2 = 14, -}; + enum FileMenuDdidx + { + DDIDX_NEW_GAME = 0, + DDIDX_LOAD_GAME = 1, + DDIDX_SAVE_GAME = 2, + DDIDX_SAVE_GAME_AS = 3, + // separator + DDIDX_ABOUT = 5, + DDIDX_OPTIONS = 6, + DDIDX_SCREENSHOT = 7, + DDIDX_GIANT_SCREENSHOT = 8, + // separator + DDIDX_FILE_BUG_ON_GITHUB = 10, + DDIDX_UPDATE_AVAILABLE = 11, + // separator + DDIDX_QUIT_TO_MENU = 13, + DDIDX_EXIT_OPENRCT2 = 14, + }; -enum TopToolbarViewMenuDdidx -{ - DDIDX_UNDERGROUND_INSIDE = 0, - DDIDX_TRANSPARENT_WATER = 1, - DDIDX_HIDE_BASE = 2, - DDIDX_HIDE_VERTICAL = 3, - // separator - DDIDX_HIDE_RIDES = 5, - DDIDX_HIDE_VEHICLES = 6, - DDIDX_HIDE_VEGETATION = 7, - DDIDX_HIDE_SCENERY = 8, - DDIDX_HIDE_PATHS = 9, - DDIDX_HIDE_SUPPORTS = 10, - DDIDX_HIDE_GUESTS = 11, - DDIDX_HIDE_STAFF = 12, - // separator - DDIDX_LAND_HEIGHTS = 14, - DDIDX_TRACK_HEIGHTS = 15, - DDIDX_PATH_HEIGHTS = 16, - // separator - DDIDX_VIEW_CLIPPING = 18, - DDIDX_HIGHLIGHT_PATH_ISSUES = 19, - // separator - DDIDX_TRANSPARENCY = 21, + enum TopToolbarViewMenuDdidx + { + DDIDX_UNDERGROUND_INSIDE = 0, + DDIDX_TRANSPARENT_WATER = 1, + DDIDX_HIDE_BASE = 2, + DDIDX_HIDE_VERTICAL = 3, + // separator + DDIDX_HIDE_RIDES = 5, + DDIDX_HIDE_VEHICLES = 6, + DDIDX_HIDE_VEGETATION = 7, + DDIDX_HIDE_SCENERY = 8, + DDIDX_HIDE_PATHS = 9, + DDIDX_HIDE_SUPPORTS = 10, + DDIDX_HIDE_GUESTS = 11, + DDIDX_HIDE_STAFF = 12, + // separator + DDIDX_LAND_HEIGHTS = 14, + DDIDX_TRACK_HEIGHTS = 15, + DDIDX_PATH_HEIGHTS = 16, + // separator + DDIDX_VIEW_CLIPPING = 18, + DDIDX_HIGHLIGHT_PATH_ISSUES = 19, + // separator + DDIDX_TRANSPARENCY = 21, - TOP_TOOLBAR_VIEW_MENU_COUNT, -}; + TOP_TOOLBAR_VIEW_MENU_COUNT, + }; -enum TopToolbarDebugDdidx -{ - DDIDX_CONSOLE = 0, - DDIDX_DEBUG_PAINT = 1, + enum TopToolbarDebugDdidx + { + DDIDX_CONSOLE = 0, + DDIDX_DEBUG_PAINT = 1, - TOP_TOOLBAR_DEBUG_COUNT, -}; + TOP_TOOLBAR_DEBUG_COUNT, + }; -enum TopToolbarNetworkDdidx -{ - DDIDX_MULTIPLAYER = 0, - DDIDX_MULTIPLAYER_RECONNECT = 1, + enum TopToolbarNetworkDdidx + { + DDIDX_MULTIPLAYER = 0, + DDIDX_MULTIPLAYER_RECONNECT = 1, - TOP_TOOLBAR_NETWORK_COUNT, -}; + TOP_TOOLBAR_NETWORK_COUNT, + }; -enum -{ - DDIDX_CHEATS, - DDIDX_TILE_INSPECTOR = 1, - DDIDX_OBJECT_SELECTION = 2, - DDIDX_INVENTIONS_LIST = 3, - DDIDX_SCENARIO_OPTIONS = 4, - DDIDX_OBJECTIVE_OPTIONS = 5, - // 6 is a separator - DDIDX_ENABLE_SANDBOX_MODE = 7, - DDIDX_DISABLE_CLEARANCE_CHECKS = 8, - DDIDX_DISABLE_SUPPORT_LIMITS = 9, + enum + { + DDIDX_CHEATS, + DDIDX_TILE_INSPECTOR = 1, + DDIDX_OBJECT_SELECTION = 2, + DDIDX_INVENTIONS_LIST = 3, + DDIDX_SCENARIO_OPTIONS = 4, + DDIDX_OBJECTIVE_OPTIONS = 5, + // 6 is a separator + DDIDX_ENABLE_SANDBOX_MODE = 7, + DDIDX_DISABLE_CLEARANCE_CHECKS = 8, + DDIDX_DISABLE_SUPPORT_LIMITS = 9, - TOP_TOOLBAR_CHEATS_COUNT, -}; + TOP_TOOLBAR_CHEATS_COUNT, + }; -enum -{ - DDIDX_SHOW_MAP, - DDIDX_OPEN_VIEWPORT, -}; + enum + { + DDIDX_SHOW_MAP, + DDIDX_OPEN_VIEWPORT, + }; -enum -{ - DDIDX_ROTATE_CLOCKWISE, - DDIDX_ROTATE_ANTI_CLOCKWISE, -}; + enum + { + DDIDX_ROTATE_CLOCKWISE, + DDIDX_ROTATE_ANTI_CLOCKWISE, + }; #pragma region Toolbar_widget_ordering -// clang-format off + // clang-format off // from left to right static constexpr int32_t left_aligned_widgets_order[] = { WIDX_PAUSE, @@ -280,252 +279,329 @@ static Widget _topToolbarWidgets[] = { MakeRemapWidget({ 30, 0}, {30, TOP_TOOLBAR_HEIGHT + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_G2_TOOLBAR_MULTIPLAYER, STR_SHOW_MULTIPLAYER_STATUS_TIP ), // Network MakeRemapWidget({ 30, 0}, {30, TOP_TOOLBAR_HEIGHT + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_TAB_TOOLBAR, STR_TOOLBAR_CHAT_TIP ), // Chat MakeWidget ({ 0, 0}, {10, 1}, WindowWidgetType::Empty, WindowColour::Primary ), // Artificial widget separator - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -static void ScenarioSelectCallback(const utf8* path); + static void ScenarioSelectCallback(const utf8* path); -class TopToolbar final : public Window -{ -private: - bool _landToolBlocked{ false }; - uint8_t _unkF64F0E{ 0 }; - int16_t _unkF64F0A{ 0 }; - - void InitViewMenu(Widget& widget); - - void ViewMenuDropdown(int16_t dropdownIndex); - - void InitMapMenu(Widget& widget); - - void MapMenuDropdown(int16_t dropdownIndex); - - void InitFastforwardMenu(Widget& widget); - - void FastforwardMenuDropdown(int16_t dropdownIndex); - - void InitRotateMenu(Widget& widget); - - void RotateMenuDropdown(int16_t dropdownIndex); - - void InitCheatsMenu(Widget& widget); - - void CheatsMenuDropdown(int16_t dropdownIndex); - - void InitDebugMenu(Widget& widget); - - void DebugMenuDropdown(int16_t dropdownIndex); - - void InitNetworkMenu(Widget& widget); - - void NetworkMenuDropdown(int16_t dropdownIndex); - - /** - * - * rct2: 0x0066CCE7 - */ - void ToggleFootpathWindow() + class TopToolbar final : public Window { - if (WindowFindByClass(WindowClass::Footpath) == nullptr) - { - ContextOpenWindow(WindowClass::Footpath); - } - else - { - ToolCancel(); - WindowCloseByClass(WindowClass::Footpath); - } - } + private: + bool _landToolBlocked{ false }; + uint8_t _unkF64F0E{ 0 }; + int16_t _unkF64F0A{ 0 }; - /** - * - * rct2: 0x0066CD54 - */ - void ToggleLandWindow(WidgetIndex widgetIndex) - { - if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar - && gCurrentToolWidget.widget_index == WIDX_LAND) - { - ToolCancel(); - } - else - { - _landToolBlocked = false; - ShowGridlines(); - ToolSet(*this, widgetIndex, Tool::DigDown); - InputSetFlag(INPUT_FLAG_6, true); - ContextOpenWindow(WindowClass::Land); - } - } + void InitViewMenu(Widget& widget); - /** - * - * rct2: 0x0066CD0C - */ - void ToggleClearSceneryWindow(WidgetIndex widgetIndex) - { - if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar - && gCurrentToolWidget.widget_index == WIDX_CLEAR_SCENERY)) + void ViewMenuDropdown(int16_t dropdownIndex); + + void InitMapMenu(Widget& widget); + + void MapMenuDropdown(int16_t dropdownIndex); + + void InitFastforwardMenu(Widget& widget); + + void FastforwardMenuDropdown(int16_t dropdownIndex); + + void InitRotateMenu(Widget& widget); + + void RotateMenuDropdown(int16_t dropdownIndex); + + void InitCheatsMenu(Widget& widget); + + void CheatsMenuDropdown(int16_t dropdownIndex); + + void InitDebugMenu(Widget& widget); + + void DebugMenuDropdown(int16_t dropdownIndex); + + void InitNetworkMenu(Widget& widget); + + void NetworkMenuDropdown(int16_t dropdownIndex); + + /** + * + * rct2: 0x0066CCE7 + */ + void ToggleFootpathWindow() { - ToolCancel(); - } - else - { - ShowGridlines(); - ToolSet(*this, widgetIndex, Tool::Crosshair); - InputSetFlag(INPUT_FLAG_6, true); - ContextOpenWindow(WindowClass::ClearScenery); - } - } - - /** - * - * rct2: 0x0066CD9C - */ - void ToggleWaterWindow(WidgetIndex widgetIndex) - { - if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar - && gCurrentToolWidget.widget_index == WIDX_WATER) - { - ToolCancel(); - } - else - { - _landToolBlocked = false; - ShowGridlines(); - ToolSet(*this, widgetIndex, Tool::WaterDown); - InputSetFlag(INPUT_FLAG_6, true); - ContextOpenWindow(WindowClass::Water); - } - } - - /** - * - * rct2: 0x0068E213 - */ - void ToolUpdateSceneryClear(const ScreenCoordsXY& screenPos) - { - if (!ToolUpdateLandPaint(screenPos)) - return; - - auto action = GetClearAction(); - auto result = GameActions::Query(&action); - auto cost = (result.Error == GameActions::Status::Ok ? result.Cost : kMoney64Undefined); - if (gClearSceneryCost != cost) - { - gClearSceneryCost = cost; - WindowInvalidateByClass(WindowClass::ClearScenery); - } - } - - int8_t ToolUpdateLandPaint(const ScreenCoordsXY& screenPos) - { - uint8_t state_changed = 0; - - MapInvalidateSelectionRect(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - - auto mapTile = ScreenGetMapXY(screenPos, nullptr); - - if (!mapTile.has_value()) - { - if (gClearSceneryCost != kMoney64Undefined) + if (WindowFindByClass(WindowClass::Footpath) == nullptr) { - gClearSceneryCost = kMoney64Undefined; + ContextOpenWindow(WindowClass::Footpath); + } + else + { + ToolCancel(); + WindowCloseByClass(WindowClass::Footpath); + } + } + + /** + * + * rct2: 0x0066CD54 + */ + void ToggleLandWindow(WidgetIndex widgetIndex) + { + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar + && gCurrentToolWidget.widget_index == WIDX_LAND) + { + ToolCancel(); + } + else + { + _landToolBlocked = false; + ShowGridlines(); + ToolSet(*this, widgetIndex, Tool::DigDown); + InputSetFlag(INPUT_FLAG_6, true); + ContextOpenWindow(WindowClass::Land); + } + } + + /** + * + * rct2: 0x0066CD0C + */ + void ToggleClearSceneryWindow(WidgetIndex widgetIndex) + { + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar + && gCurrentToolWidget.widget_index == WIDX_CLEAR_SCENERY)) + { + ToolCancel(); + } + else + { + ShowGridlines(); + ToolSet(*this, widgetIndex, Tool::Crosshair); + InputSetFlag(INPUT_FLAG_6, true); + ContextOpenWindow(WindowClass::ClearScenery); + } + } + + /** + * + * rct2: 0x0066CD9C + */ + void ToggleWaterWindow(WidgetIndex widgetIndex) + { + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar + && gCurrentToolWidget.widget_index == WIDX_WATER) + { + ToolCancel(); + } + else + { + _landToolBlocked = false; + ShowGridlines(); + ToolSet(*this, widgetIndex, Tool::WaterDown); + InputSetFlag(INPUT_FLAG_6, true); + ContextOpenWindow(WindowClass::Water); + } + } + + /** + * + * rct2: 0x0068E213 + */ + void ToolUpdateSceneryClear(const ScreenCoordsXY& screenPos) + { + if (!ToolUpdateLandPaint(screenPos)) + return; + + auto action = GetClearAction(); + auto result = GameActions::Query(&action); + auto cost = (result.Error == GameActions::Status::Ok ? result.Cost : kMoney64Undefined); + if (gClearSceneryCost != cost) + { + gClearSceneryCost = cost; WindowInvalidateByClass(WindowClass::ClearScenery); } + } + + int8_t ToolUpdateLandPaint(const ScreenCoordsXY& screenPos) + { + uint8_t state_changed = 0; + + MapInvalidateSelectionRect(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + + auto mapTile = ScreenGetMapXY(screenPos, nullptr); + + if (!mapTile.has_value()) + { + if (gClearSceneryCost != kMoney64Undefined) + { + gClearSceneryCost = kMoney64Undefined; + WindowInvalidateByClass(WindowClass::ClearScenery); + } + return state_changed; + } + + if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) + { + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + state_changed++; + } + + if (gMapSelectType != MAP_SELECT_TYPE_FULL) + { + gMapSelectType = MAP_SELECT_TYPE_FULL; + state_changed++; + } + + int16_t tool_size = std::max(1, gLandToolSize); + int16_t tool_length = (tool_size - 1) * 32; + + // Move to tool bottom left + mapTile->x -= (tool_size - 1) * 16; + mapTile->y -= (tool_size - 1) * 16; + mapTile = mapTile->ToTileStart(); + + if (gMapSelectPositionA.x != mapTile->x) + { + gMapSelectPositionA.x = mapTile->x; + state_changed++; + } + + if (gMapSelectPositionA.y != mapTile->y) + { + gMapSelectPositionA.y = mapTile->y; + state_changed++; + } + + mapTile->x += tool_length; + mapTile->y += tool_length; + + if (gMapSelectPositionB.x != mapTile->x) + { + gMapSelectPositionB.x = mapTile->x; + state_changed++; + } + + if (gMapSelectPositionB.y != mapTile->y) + { + gMapSelectPositionB.y = mapTile->y; + state_changed++; + } + + MapInvalidateSelectionRect(); return state_changed; } - if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) + /** + * + * rct2: 0x00664280 + */ + void ToolUpdateLand(const ScreenCoordsXY& screenPos) { - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - state_changed++; - } + const bool mapCtrlPressed = InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z); - if (gMapSelectType != MAP_SELECT_TYPE_FULL) - { - gMapSelectType = MAP_SELECT_TYPE_FULL; - state_changed++; - } + MapInvalidateSelectionRect(); - int16_t tool_size = std::max(1, gLandToolSize); - int16_t tool_length = (tool_size - 1) * 32; - - // Move to tool bottom left - mapTile->x -= (tool_size - 1) * 16; - mapTile->y -= (tool_size - 1) * 16; - mapTile = mapTile->ToTileStart(); - - if (gMapSelectPositionA.x != mapTile->x) - { - gMapSelectPositionA.x = mapTile->x; - state_changed++; - } - - if (gMapSelectPositionA.y != mapTile->y) - { - gMapSelectPositionA.y = mapTile->y; - state_changed++; - } - - mapTile->x += tool_length; - mapTile->y += tool_length; - - if (gMapSelectPositionB.x != mapTile->x) - { - gMapSelectPositionB.x = mapTile->x; - state_changed++; - } - - if (gMapSelectPositionB.y != mapTile->y) - { - gMapSelectPositionB.y = mapTile->y; - state_changed++; - } - - MapInvalidateSelectionRect(); - return state_changed; - } - - /** - * - * rct2: 0x00664280 - */ - void ToolUpdateLand(const ScreenCoordsXY& screenPos) - { - const bool mapCtrlPressed = InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z); - - MapInvalidateSelectionRect(); - - if (gCurrentToolId == Tool::UpDownArrow) - { - if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) - return; - - money64 lower_cost = SelectionLowerLand(0); - money64 raise_cost = SelectionRaiseLand(0); - - if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) + if (gCurrentToolId == Tool::UpDownArrow) { - gLandToolRaiseCost = raise_cost; - gLandToolLowerCost = lower_cost; - WindowInvalidateByClass(WindowClass::Land); + if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) + return; + + money64 lower_cost = SelectionLowerLand(0); + money64 raise_cost = SelectionRaiseLand(0); + + if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) + { + gLandToolRaiseCost = raise_cost; + gLandToolLowerCost = lower_cost; + WindowInvalidateByClass(WindowClass::Land); + } + return; } - return; - } - int16_t tool_size = gLandToolSize; - std::optional mapTile; - uint8_t side{}; + int16_t tool_size = gLandToolSize; + std::optional mapTile; + uint8_t side{}; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - if (tool_size == 1) - { - int32_t selectionType; - // Get selection type and map coordinates from mouse x,y position - ScreenPosToMapPos(screenPos, &selectionType); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + if (tool_size == 1) + { + int32_t selectionType; + // Get selection type and map coordinates from mouse x,y position + ScreenPosToMapPos(screenPos, &selectionType); + mapTile = ScreenGetMapXYSide(screenPos, &side); + + if (!mapTile.has_value()) + { + money64 lower_cost = kMoney64Undefined; + money64 raise_cost = kMoney64Undefined; + + if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) + { + gLandToolRaiseCost = raise_cost; + gLandToolLowerCost = lower_cost; + WindowInvalidateByClass(WindowClass::Land); + } + return; + } + + uint8_t state_changed = 0; + + if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) + { + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + state_changed++; + } + + if (gMapSelectType != selectionType) + { + gMapSelectType = selectionType; + state_changed++; + } + + if ((gMapSelectType != MAP_SELECT_TYPE_EDGE_0 + (side & 0xFF)) && mapCtrlPressed) + { + gMapSelectType = MAP_SELECT_TYPE_EDGE_0 + (side & 0xFF); + state_changed++; + } + + if (gMapSelectPositionA.x != mapTile->x) + { + gMapSelectPositionA.x = mapTile->x; + state_changed++; + } + + if (gMapSelectPositionA.y != mapTile->y) + { + gMapSelectPositionA.y = mapTile->y; + state_changed++; + } + + if (gMapSelectPositionB.x != mapTile->x) + { + gMapSelectPositionB.x = mapTile->x; + state_changed++; + } + + if (gMapSelectPositionB.y != mapTile->y) + { + gMapSelectPositionB.y = mapTile->y; + state_changed++; + } + + MapInvalidateSelectionRect(); + if (!state_changed) + return; + + money64 lower_cost = SelectionLowerLand(0); + money64 raise_cost = SelectionRaiseLand(0); + + if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) + { + gLandToolRaiseCost = raise_cost; + gLandToolLowerCost = lower_cost; + WindowInvalidateByClass(WindowClass::Land); + } + return; + } + + // Get map coordinates and the side of the tile that is being hovered over mapTile = ScreenGetMapXYSide(screenPos, &side); if (!mapTile.has_value()) @@ -550,9 +626,9 @@ private: state_changed++; } - if (gMapSelectType != selectionType) + if (gMapSelectType != MAP_SELECT_TYPE_FULL) { - gMapSelectType = selectionType; + gMapSelectType = MAP_SELECT_TYPE_FULL; state_changed++; } @@ -562,6 +638,34 @@ private: state_changed++; } + if (tool_size == 0) + tool_size = 1; + + int16_t tool_length = (tool_size - 1) * 32; + + // Decide on shape of the brush for bigger selection size + switch (gMapSelectType) + { + case MAP_SELECT_TYPE_EDGE_0: + case MAP_SELECT_TYPE_EDGE_2: + // Line + mapTile->y -= (tool_size - 1) * 16; + mapTile->y = mapTile->ToTileStart().y; + break; + case MAP_SELECT_TYPE_EDGE_1: + case MAP_SELECT_TYPE_EDGE_3: + // Line + mapTile->x -= (tool_size - 1) * 16; + mapTile->x = mapTile->ToTileStart().x; + break; + default: + // Move to tool bottom left + mapTile->x -= (tool_size - 1) * 16; + mapTile->y -= (tool_size - 1) * 16; + mapTile = mapTile->ToTileStart(); + break; + } + if (gMapSelectPositionA.x != mapTile->x) { gMapSelectPositionA.x = mapTile->x; @@ -574,6 +678,27 @@ private: state_changed++; } + // Go to other side + switch (gMapSelectType) + { + case MAP_SELECT_TYPE_EDGE_0: + case MAP_SELECT_TYPE_EDGE_2: + // Line + mapTile->y += tool_length; + gMapSelectType = MAP_SELECT_TYPE_FULL; + break; + case MAP_SELECT_TYPE_EDGE_1: + case MAP_SELECT_TYPE_EDGE_3: + // Line + mapTile->x += tool_length; + gMapSelectType = MAP_SELECT_TYPE_FULL; + break; + default: + mapTile->x += tool_length; + mapTile->y += tool_length; + break; + } + if (gMapSelectPositionB.x != mapTile->x) { gMapSelectPositionB.x = mapTile->x; @@ -599,145 +724,111 @@ private: gLandToolLowerCost = lower_cost; WindowInvalidateByClass(WindowClass::Land); } - return; } - // Get map coordinates and the side of the tile that is being hovered over - mapTile = ScreenGetMapXYSide(screenPos, &side); - - if (!mapTile.has_value()) + /** + * + * rct2: 0x006E6BDC + */ + void ToolUpdateWater(const ScreenCoordsXY& screenPos) { - money64 lower_cost = kMoney64Undefined; - money64 raise_cost = kMoney64Undefined; + MapInvalidateSelectionRect(); - if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) + if (gCurrentToolId == Tool::UpDownArrow) { - gLandToolRaiseCost = raise_cost; - gLandToolLowerCost = lower_cost; - WindowInvalidateByClass(WindowClass::Land); + if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) + return; + + auto waterLowerAction = WaterLowerAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); + auto waterRaiseAction = WaterRaiseAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); + + auto res = GameActions::Query(&waterLowerAction); + money64 lowerCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; + + res = GameActions::Query(&waterRaiseAction); + money64 raiseCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; + + if (gWaterToolRaiseCost != raiseCost || gWaterToolLowerCost != lowerCost) + { + gWaterToolRaiseCost = raiseCost; + gWaterToolLowerCost = lowerCost; + WindowInvalidateByClass(WindowClass::Water); + } + return; } - return; - } - uint8_t state_changed = 0; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) - { - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - state_changed++; - } + auto info = GetMapCoordinatesFromPos( + screenPos, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water)); - if (gMapSelectType != MAP_SELECT_TYPE_FULL) - { - gMapSelectType = MAP_SELECT_TYPE_FULL; - state_changed++; - } + if (info.SpriteType == ViewportInteractionItem::None) + { + if (gWaterToolRaiseCost != kMoney64Undefined || gWaterToolLowerCost != kMoney64Undefined) + { + gWaterToolRaiseCost = kMoney64Undefined; + gWaterToolLowerCost = kMoney64Undefined; + WindowInvalidateByClass(WindowClass::Water); + } + return; + } - if ((gMapSelectType != MAP_SELECT_TYPE_EDGE_0 + (side & 0xFF)) && mapCtrlPressed) - { - gMapSelectType = MAP_SELECT_TYPE_EDGE_0 + (side & 0xFF); - state_changed++; - } + auto mapTile = info.Loc.ToTileCentre(); - if (tool_size == 0) - tool_size = 1; + uint8_t state_changed = 0; - int16_t tool_length = (tool_size - 1) * 32; - - // Decide on shape of the brush for bigger selection size - switch (gMapSelectType) - { - case MAP_SELECT_TYPE_EDGE_0: - case MAP_SELECT_TYPE_EDGE_2: - // Line - mapTile->y -= (tool_size - 1) * 16; - mapTile->y = mapTile->ToTileStart().y; - break; - case MAP_SELECT_TYPE_EDGE_1: - case MAP_SELECT_TYPE_EDGE_3: - // Line - mapTile->x -= (tool_size - 1) * 16; - mapTile->x = mapTile->ToTileStart().x; - break; - default: - // Move to tool bottom left - mapTile->x -= (tool_size - 1) * 16; - mapTile->y -= (tool_size - 1) * 16; - mapTile = mapTile->ToTileStart(); - break; - } - - if (gMapSelectPositionA.x != mapTile->x) - { - gMapSelectPositionA.x = mapTile->x; - state_changed++; - } - - if (gMapSelectPositionA.y != mapTile->y) - { - gMapSelectPositionA.y = mapTile->y; - state_changed++; - } - - // Go to other side - switch (gMapSelectType) - { - case MAP_SELECT_TYPE_EDGE_0: - case MAP_SELECT_TYPE_EDGE_2: - // Line - mapTile->y += tool_length; - gMapSelectType = MAP_SELECT_TYPE_FULL; - break; - case MAP_SELECT_TYPE_EDGE_1: - case MAP_SELECT_TYPE_EDGE_3: - // Line - mapTile->x += tool_length; - gMapSelectType = MAP_SELECT_TYPE_FULL; - break; - default: - mapTile->x += tool_length; - mapTile->y += tool_length; - break; - } - - if (gMapSelectPositionB.x != mapTile->x) - { - gMapSelectPositionB.x = mapTile->x; - state_changed++; - } - - if (gMapSelectPositionB.y != mapTile->y) - { - gMapSelectPositionB.y = mapTile->y; - state_changed++; - } - - MapInvalidateSelectionRect(); - if (!state_changed) - return; - - money64 lower_cost = SelectionLowerLand(0); - money64 raise_cost = SelectionRaiseLand(0); - - if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) - { - gLandToolRaiseCost = raise_cost; - gLandToolLowerCost = lower_cost; - WindowInvalidateByClass(WindowClass::Land); - } - } - - /** - * - * rct2: 0x006E6BDC - */ - void ToolUpdateWater(const ScreenCoordsXY& screenPos) - { - MapInvalidateSelectionRect(); - - if (gCurrentToolId == Tool::UpDownArrow) - { if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) + { + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + state_changed++; + } + + if (gMapSelectType != MAP_SELECT_TYPE_FULL_WATER) + { + gMapSelectType = MAP_SELECT_TYPE_FULL_WATER; + state_changed++; + } + + int16_t tool_size = std::max(1, gLandToolSize); + int16_t tool_length = (tool_size - 1) * 32; + + // Move to tool bottom left + mapTile.x -= (tool_size - 1) * 16; + mapTile.y -= (tool_size - 1) * 16; + mapTile.x &= 0xFFE0; + mapTile.y &= 0xFFE0; + + if (gMapSelectPositionA.x != mapTile.x) + { + gMapSelectPositionA.x = mapTile.x; + state_changed++; + } + + if (gMapSelectPositionA.y != mapTile.y) + { + gMapSelectPositionA.y = mapTile.y; + state_changed++; + } + + mapTile.x += tool_length; + mapTile.y += tool_length; + + if (gMapSelectPositionB.x != mapTile.x) + { + gMapSelectPositionB.x = mapTile.x; + state_changed++; + } + + if (gMapSelectPositionB.y != mapTile.y) + { + gMapSelectPositionB.y = mapTile.y; + state_changed++; + } + + MapInvalidateSelectionRect(); + if (!state_changed) return; auto waterLowerAction = WaterLowerAction( @@ -757,976 +848,1105 @@ private: gWaterToolLowerCost = lowerCost; WindowInvalidateByClass(WindowClass::Water); } - return; } - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - - auto info = GetMapCoordinatesFromPos( - screenPos, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water)); - - if (info.SpriteType == ViewportInteractionItem::None) + /** + * + * rct2: 0x006E287B + */ + void ToolUpdateScenery(const ScreenCoordsXY& screenPos) { - if (gWaterToolRaiseCost != kMoney64Undefined || gWaterToolLowerCost != kMoney64Undefined) + MapInvalidateSelectionRect(); + MapInvalidateMapSelectionTiles(); + + if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) { - gWaterToolRaiseCost = kMoney64Undefined; - gWaterToolLowerCost = kMoney64Undefined; - WindowInvalidateByClass(WindowClass::Water); + VirtualFloorInvalidate(); } - return; - } - auto mapTile = info.Loc.ToTileCentre(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - uint8_t state_changed = 0; + if (gWindowSceneryPaintEnabled) + return; + if (gWindowSceneryEyedropperEnabled) + return; - if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) - { - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - state_changed++; - } - - if (gMapSelectType != MAP_SELECT_TYPE_FULL_WATER) - { - gMapSelectType = MAP_SELECT_TYPE_FULL_WATER; - state_changed++; - } - - int16_t tool_size = std::max(1, gLandToolSize); - int16_t tool_length = (tool_size - 1) * 32; - - // Move to tool bottom left - mapTile.x -= (tool_size - 1) * 16; - mapTile.y -= (tool_size - 1) * 16; - mapTile.x &= 0xFFE0; - mapTile.y &= 0xFFE0; - - if (gMapSelectPositionA.x != mapTile.x) - { - gMapSelectPositionA.x = mapTile.x; - state_changed++; - } - - if (gMapSelectPositionA.y != mapTile.y) - { - gMapSelectPositionA.y = mapTile.y; - state_changed++; - } - - mapTile.x += tool_length; - mapTile.y += tool_length; - - if (gMapSelectPositionB.x != mapTile.x) - { - gMapSelectPositionB.x = mapTile.x; - state_changed++; - } - - if (gMapSelectPositionB.y != mapTile.y) - { - gMapSelectPositionB.y = mapTile.y; - state_changed++; - } - - MapInvalidateSelectionRect(); - if (!state_changed) - return; - - auto waterLowerAction = WaterLowerAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); - auto waterRaiseAction = WaterRaiseAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); - - auto res = GameActions::Query(&waterLowerAction); - money64 lowerCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; - - res = GameActions::Query(&waterRaiseAction); - money64 raiseCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; - - if (gWaterToolRaiseCost != raiseCost || gWaterToolLowerCost != lowerCost) - { - gWaterToolRaiseCost = raiseCost; - gWaterToolLowerCost = lowerCost; - WindowInvalidateByClass(WindowClass::Water); - } - } - - /** - * - * rct2: 0x006E287B - */ - void ToolUpdateScenery(const ScreenCoordsXY& screenPos) - { - MapInvalidateSelectionRect(); - MapInvalidateMapSelectionTiles(); - - if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) - { - VirtualFloorInvalidate(); - } - - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - - if (gWindowSceneryPaintEnabled) - return; - if (gWindowSceneryEyedropperEnabled) - return; - - const auto selection = WindowSceneryGetTabSelection(); - if (selection.IsUndefined()) - { - SceneryRemoveGhostToolPlacement(); - return; - } - - money64 cost = 0; - - switch (selection.SceneryType) - { - case SCENERY_TYPE_SMALL: + const auto selection = WindowSceneryGetTabSelection(); + if (selection.IsUndefined()) { - CoordsXY mapTile = {}; - uint8_t quadrant; - Direction rotation; + SceneryRemoveGhostToolPlacement(); + return; + } - Sub6E1F34SmallScenery(screenPos, selection.EntryIndex, mapTile, &quadrant, &rotation); + money64 cost = 0; - if (mapTile.IsNull()) + switch (selection.SceneryType) + { + case SCENERY_TYPE_SMALL: { - SceneryRemoveGhostToolPlacement(); - return; - } + CoordsXY mapTile = {}; + uint8_t quadrant; + Direction rotation; - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - if (gWindowSceneryScatterEnabled) - { - uint16_t cluster_size = (gWindowSceneryScatterSize - 1) * COORDS_XY_STEP; - gMapSelectPositionA.x = mapTile.x - cluster_size / 2; - gMapSelectPositionA.y = mapTile.y - cluster_size / 2; - gMapSelectPositionB.x = mapTile.x + cluster_size / 2; - gMapSelectPositionB.y = mapTile.y + cluster_size / 2; - if (gWindowSceneryScatterSize % 2 == 0) + Sub6E1F34SmallScenery(screenPos, selection.EntryIndex, mapTile, &quadrant, &rotation); + + if (mapTile.IsNull()) { - gMapSelectPositionB.x += COORDS_XY_STEP; - gMapSelectPositionB.y += COORDS_XY_STEP; + SceneryRemoveGhostToolPlacement(); + return; } + + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + if (gWindowSceneryScatterEnabled) + { + uint16_t cluster_size = (gWindowSceneryScatterSize - 1) * COORDS_XY_STEP; + gMapSelectPositionA.x = mapTile.x - cluster_size / 2; + gMapSelectPositionA.y = mapTile.y - cluster_size / 2; + gMapSelectPositionB.x = mapTile.x + cluster_size / 2; + gMapSelectPositionB.y = mapTile.y + cluster_size / 2; + if (gWindowSceneryScatterSize % 2 == 0) + { + gMapSelectPositionB.x += COORDS_XY_STEP; + gMapSelectPositionB.y += COORDS_XY_STEP; + } + } + else + { + gMapSelectPositionA.x = mapTile.x; + gMapSelectPositionA.y = mapTile.y; + gMapSelectPositionB.x = mapTile.x; + gMapSelectPositionB.y = mapTile.y; + } + + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(selection.EntryIndex); + + gMapSelectType = MAP_SELECT_TYPE_FULL; + if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE) && !gWindowSceneryScatterEnabled) + { + gMapSelectType = MAP_SELECT_TYPE_QUARTER_0 + (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 + && gSceneryPlaceObject.EntryIndex == selection.EntryIndex) + { + return; + } + + SceneryRemoveGhostToolPlacement(); + + _unkF64F0E = quadrant; + _unkF64F0A = gSceneryPlaceZ; + + uint8_t attemptsLeft = 1; + if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) + { + attemptsLeft = 20; + } + + for (; attemptsLeft != 0; attemptsLeft--) + { + cost = TryPlaceGhostSmallScenery( + { mapTile, gSceneryPlaceZ, rotation }, quadrant, selection.EntryIndex, gWindowSceneryPrimaryColour, + gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); + + if (cost != kMoney64Undefined) + break; + gSceneryPlaceZ += 8; + } + + gSceneryPlaceCost = cost; + break; } - else + case SCENERY_TYPE_PATH_ITEM: { + CoordsXY mapTile = {}; + int32_t z; + + Sub6E1F34PathItem(screenPos, selection.EntryIndex, mapTile, &z); + + if (mapTile.IsNull()) + { + SceneryRemoveGhostToolPlacement(); + return; + } + + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; gMapSelectPositionA.x = mapTile.x; gMapSelectPositionA.y = mapTile.y; gMapSelectPositionB.x = mapTile.x; gMapSelectPositionB.y = mapTile.y; - } + gMapSelectType = MAP_SELECT_TYPE_FULL; - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(selection.EntryIndex); + MapInvalidateSelectionRect(); - gMapSelectType = MAP_SELECT_TYPE_FULL; - if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE) && !gWindowSceneryScatterEnabled) - { - gMapSelectType = MAP_SELECT_TYPE_QUARTER_0 + (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 - && gSceneryPlaceObject.EntryIndex == selection.EntryIndex) - { - return; - } - - SceneryRemoveGhostToolPlacement(); - - _unkF64F0E = quadrant; - _unkF64F0A = gSceneryPlaceZ; - - uint8_t attemptsLeft = 1; - if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) - { - attemptsLeft = 20; - } - - for (; attemptsLeft != 0; attemptsLeft--) - { - cost = TryPlaceGhostSmallScenery( - { mapTile, gSceneryPlaceZ, rotation }, quadrant, selection.EntryIndex, gWindowSceneryPrimaryColour, - gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - - if (cost != kMoney64Undefined) - break; - gSceneryPlaceZ += 8; - } - - gSceneryPlaceCost = cost; - break; - } - case SCENERY_TYPE_PATH_ITEM: - { - CoordsXY mapTile = {}; - int32_t z; - - Sub6E1F34PathItem(screenPos, selection.EntryIndex, mapTile, &z); - - if (mapTile.IsNull()) - { - SceneryRemoveGhostToolPlacement(); - return; - } - - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectPositionA.x = mapTile.x; - gMapSelectPositionA.y = mapTile.y; - gMapSelectPositionB.x = mapTile.x; - gMapSelectPositionB.y = mapTile.y; - gMapSelectType = MAP_SELECT_TYPE_FULL; - - MapInvalidateSelectionRect(); - - // If no change in ghost placement - if ((gSceneryGhostType & SCENERY_GHOST_FLAG_1) && mapTile == gSceneryGhostPosition - && z == gSceneryGhostPosition.z) - { - return; - } - - SceneryRemoveGhostToolPlacement(); - - cost = TryPlaceGhostPathAddition({ mapTile, z }, selection.EntryIndex); - - gSceneryPlaceCost = cost; - break; - } - case SCENERY_TYPE_WALL: - { - CoordsXY mapTile = {}; - uint8_t edge; - - Sub6E1F34Wall(screenPos, selection.EntryIndex, mapTile, &edge); - - if (mapTile.IsNull()) - { - SceneryRemoveGhostToolPlacement(); - return; - } - - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectPositionA.x = mapTile.x; - gMapSelectPositionA.y = mapTile.y; - gMapSelectPositionB.x = mapTile.x; - gMapSelectPositionB.y = mapTile.y; - gMapSelectType = MAP_SELECT_TYPE_EDGE_0 + edge; - - MapInvalidateSelectionRect(); - - // If no change in ghost placement - if ((gSceneryGhostType & SCENERY_GHOST_FLAG_2) && mapTile == gSceneryGhostPosition - && edge == gSceneryGhostWallRotation && gSceneryPlaceZ == _unkF64F0A) - { - return; - } - - SceneryRemoveGhostToolPlacement(); - - gSceneryGhostWallRotation = edge; - _unkF64F0A = gSceneryPlaceZ; - - uint8_t attemptsLeft = 1; - if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) - { - attemptsLeft = 20; - } - - cost = 0; - for (; attemptsLeft != 0; attemptsLeft--) - { - cost = TryPlaceGhostWall( - { mapTile, gSceneryPlaceZ }, edge, selection.EntryIndex, gWindowSceneryPrimaryColour, - gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - - if (cost != kMoney64Undefined) - break; - gSceneryPlaceZ += 8; - } - - gSceneryPlaceCost = cost; - break; - } - case SCENERY_TYPE_LARGE: - { - CoordsXY mapTile = {}; - Direction direction; - - Sub6E1F34LargeScenery(screenPos, selection.EntryIndex, mapTile, &direction); - - if (mapTile.IsNull()) - { - SceneryRemoveGhostToolPlacement(); - return; - } - - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(selection.EntryIndex); - gMapSelectionTiles.clear(); - - for (auto* tile = sceneryEntry->tiles; tile->x_offset != static_cast(static_cast(0xFFFF)); - tile++) - { - CoordsXY tileLocation = { tile->x_offset, tile->y_offset }; - auto rotatedTileCoords = tileLocation.Rotate(direction); - - rotatedTileCoords.x += mapTile.x; - rotatedTileCoords.y += mapTile.y; - - gMapSelectionTiles.push_back(rotatedTileCoords); - } - - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - MapInvalidateMapSelectionTiles(); - - // If no change in ghost placement - if ((gSceneryGhostType & SCENERY_GHOST_FLAG_3) && mapTile == gSceneryGhostPosition - && gSceneryPlaceZ == _unkF64F0A && gSceneryPlaceObject.SceneryType == SCENERY_TYPE_LARGE - && gSceneryPlaceObject.EntryIndex == selection.EntryIndex) - { - return; - } - - SceneryRemoveGhostToolPlacement(); - - gSceneryPlaceObject.SceneryType = SCENERY_TYPE_LARGE; - gSceneryPlaceObject.EntryIndex = selection.EntryIndex; - _unkF64F0A = gSceneryPlaceZ; - - uint8_t attemptsLeft = 1; - if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) - { - attemptsLeft = 20; - } - - cost = 0; - for (; attemptsLeft != 0; attemptsLeft--) - { - cost = TryPlaceGhostLargeScenery( - { mapTile, gSceneryPlaceZ, direction }, selection.EntryIndex, gWindowSceneryPrimaryColour, - gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - - if (cost != kMoney64Undefined) - break; - gSceneryPlaceZ += COORDS_Z_STEP; - } - - gSceneryPlaceCost = cost; - break; - } - case SCENERY_TYPE_BANNER: - { - CoordsXY mapTile = {}; - Direction direction; - int32_t z; - - Sub6E1F34Banner(screenPos, selection.EntryIndex, mapTile, &z, &direction); - - if (mapTile.IsNull()) - { - SceneryRemoveGhostToolPlacement(); - return; - } - - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectPositionA.x = mapTile.x; - gMapSelectPositionA.y = mapTile.y; - gMapSelectPositionB.x = mapTile.x; - gMapSelectPositionB.y = mapTile.y; - gMapSelectType = MAP_SELECT_TYPE_FULL; - - MapInvalidateSelectionRect(); - - // If no change in ghost placement - if ((gSceneryGhostType & SCENERY_GHOST_FLAG_4) && mapTile == gSceneryGhostPosition - && z == gSceneryGhostPosition.z && direction == gSceneryPlaceRotation) - { - return; - } - - SceneryRemoveGhostToolPlacement(); - - cost = TryPlaceGhostBanner({ mapTile, z, direction }, selection.EntryIndex); - - gSceneryPlaceCost = cost; - break; - } - } - } - - /** - * - * rct2: 0x006644DD - */ - money64 SelectionRaiseLand(uint8_t flag) - { - int32_t centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2; - int32_t centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2; - centreX += 16; - centreY += 16; - - if (gLandMountainMode) - { - auto landSmoothAction = LandSmoothAction( - { centreX, centreY }, - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType, - false); - auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction) - : GameActions::Query(&landSmoothAction); - return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; - } - - auto landRaiseAction = LandRaiseAction( - { centreX, centreY }, - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType); - auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landRaiseAction) - : GameActions::Query(&landRaiseAction); - - return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; - } - - /** - * - * rct2: 0x006645B3 - */ - money64 SelectionLowerLand(uint8_t flag) - { - int32_t centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2; - int32_t centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2; - centreX += 16; - centreY += 16; - - if (gLandMountainMode) - { - auto landSmoothAction = LandSmoothAction( - { centreX, centreY }, - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType, - true); - auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction) - : GameActions::Query(&landSmoothAction); - return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; - } - - auto landLowerAction = LandLowerAction( - { centreX, centreY }, - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType); - auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landLowerAction) - : GameActions::Query(&landLowerAction); - - return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; - } - - /** - * part of window_top_toolbar_tool_drag(0x0066CB4E) - * rct2: 0x00664454 - */ - void LandToolDrag(const ScreenCoordsXY& screenPos) - { - auto* window = WindowFindFromPoint(screenPos); - if (window == nullptr) - return; - WidgetIndex widget_index = WindowFindWidgetFromPoint(*window, screenPos); - if (widget_index == -1) - return; - const auto& widget = window->widgets[widget_index]; - if (widget.type != WindowWidgetType::Viewport) - return; - const auto* selectedViewport = window->viewport; - if (selectedViewport == nullptr) - return; - - int16_t tile_height = selectedViewport->zoom.ApplyInversedTo(-16); - - int32_t y_diff = screenPos.y - gInputDragLast.y; - - if (y_diff <= tile_height) - { - gInputDragLast.y += tile_height; - - SelectionRaiseLand(GAME_COMMAND_FLAG_APPLY); - - gLandToolRaiseCost = kMoney64Undefined; - gLandToolLowerCost = kMoney64Undefined; - } - else if (y_diff >= -tile_height) - { - gInputDragLast.y -= tile_height; - - SelectionLowerLand(GAME_COMMAND_FLAG_APPLY); - - gLandToolRaiseCost = kMoney64Undefined; - gLandToolLowerCost = kMoney64Undefined; - } - } - - /** - * part of window_top_toolbar_tool_drag(0x0066CB4E) - * rct2: 0x006E6D4B - */ - void WaterToolDrag(const ScreenCoordsXY& screenPos) - { - auto* window = WindowFindFromPoint(screenPos); - if (window == nullptr || window->viewport == nullptr) - return; - - int16_t dx = window->viewport->zoom.ApplyInversedTo(-16); - - auto offsetPos = screenPos - ScreenCoordsXY{ 0, gInputDragLast.y }; - - if (offsetPos.y <= dx) - { - gInputDragLast.y += dx; - - auto waterRaiseAction = WaterRaiseAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); - GameActions::Execute(&waterRaiseAction); - - gWaterToolRaiseCost = kMoney64Undefined; - gWaterToolLowerCost = kMoney64Undefined; - - return; - } - - dx = -dx; - - if (offsetPos.y >= dx) - { - gInputDragLast.y += dx; - - auto waterLowerAction = WaterLowerAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); - GameActions::Execute(&waterLowerAction); - gWaterToolRaiseCost = kMoney64Undefined; - gWaterToolLowerCost = kMoney64Undefined; - - return; - } - } - - /** - * - * rct2: 0x006E24F6 - * On failure returns kMoney64Undefined - * On success places ghost scenery and returns cost to place proper - */ - money64 TryPlaceGhostSmallScenery( - CoordsXYZD loc, uint8_t quadrant, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour, - colour_t tertiaryColour) - { - SceneryRemoveGhostToolPlacement(); - - // 6e252b - auto smallSceneryPlaceAction = SmallSceneryPlaceAction( - loc, quadrant, entryIndex, primaryColour, secondaryColour, tertiaryColour); - smallSceneryPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); - auto res = GameActions::Execute(&smallSceneryPlaceAction); - if (res.Error != GameActions::Status::Ok) - return kMoney64Undefined; - - const auto placementData = res.GetData(); - - gSceneryPlaceRotation = loc.direction; - gSceneryPlaceObject.SceneryType = SCENERY_TYPE_SMALL; - gSceneryPlaceObject.EntryIndex = entryIndex; - - gSceneryGhostPosition = { loc, placementData.BaseHeight }; - gSceneryQuadrant = placementData.SceneryQuadrant; - if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND) - { - // Set underground on - ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOn); - } - else - { - // Set underground off - ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOff); - } - - gSceneryGhostType |= SCENERY_GHOST_FLAG_0; - return res.Cost; - } - - money64 TryPlaceGhostPathAddition(CoordsXYZ loc, ObjectEntryIndex entryIndex) - { - SceneryRemoveGhostToolPlacement(); - - // 6e265b - auto footpathAdditionPlaceAction = FootpathAdditionPlaceAction(loc, entryIndex); - footpathAdditionPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); - footpathAdditionPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) - { - return; - } - gSceneryGhostPosition = loc; - gSceneryGhostType |= SCENERY_GHOST_FLAG_1; - }); - auto res = GameActions::Execute(&footpathAdditionPlaceAction); - if (res.Error != GameActions::Status::Ok) - return kMoney64Undefined; - - return res.Cost; - } - - money64 TryPlaceGhostWall( - CoordsXYZ loc, uint8_t edge, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour, - colour_t tertiaryColour) - { - SceneryRemoveGhostToolPlacement(); - - // 6e26b0 - auto wallPlaceAction = 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.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) - return; - - const auto placementData = result->GetData(); - gSceneryGhostPosition = { loc, placementData.BaseHeight }; - gSceneryGhostWallRotation = edge; - - gSceneryGhostType |= SCENERY_GHOST_FLAG_2; - }); - - auto res = GameActions::Execute(&wallPlaceAction); - if (res.Error != GameActions::Status::Ok) - return kMoney64Undefined; - - return res.Cost; - } - - money64 TryPlaceGhostLargeScenery( - CoordsXYZD loc, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour, colour_t tertiaryColour) - { - SceneryRemoveGhostToolPlacement(); - - // 6e25a7 - auto sceneryPlaceAction = LargeSceneryPlaceAction(loc, entryIndex, primaryColour, secondaryColour, tertiaryColour); - sceneryPlaceAction.SetFlags( - GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND); - auto res = GameActions::Execute(&sceneryPlaceAction); - if (res.Error != GameActions::Status::Ok) - return kMoney64Undefined; - - const auto placementData = res.GetData(); - - gSceneryPlaceRotation = loc.direction; - - gSceneryGhostPosition = { loc, placementData.firstTileHeight }; - if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND) - { - // Set underground on - ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOn); - } - else - { - // Set underground off - ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOff); - } - - gSceneryGhostType |= SCENERY_GHOST_FLAG_3; - return res.Cost; - } - - money64 TryPlaceGhostBanner(CoordsXYZD loc, ObjectEntryIndex entryIndex) - { - SceneryRemoveGhostToolPlacement(); - - // 6e2612 - auto primaryColour = gWindowSceneryPrimaryColour; - auto bannerPlaceAction = BannerPlaceAction(loc, entryIndex, primaryColour); - bannerPlaceAction.SetFlags( - GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND); - auto res = GameActions::Execute(&bannerPlaceAction); - if (res.Error != GameActions::Status::Ok) - return kMoney64Undefined; - - gSceneryGhostPosition = loc; - gSceneryGhostPosition.z += PATH_HEIGHT_STEP; - gSceneryPlaceRotation = loc.direction; - gSceneryGhostType |= SCENERY_GHOST_FLAG_4; - return res.Cost; - } - - /** - * - * rct2: 0x006E3158 - */ - void RepaintSceneryToolDown(const ScreenCoordsXY& screenCoords, WidgetIndex widgetIndex) - { - auto flag = EnumsToFlags( - ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery, - ViewportInteractionItem::Banner); - auto info = GetMapCoordinatesFromPos(screenCoords, flag); - switch (info.SpriteType) - { - case ViewportInteractionItem::Scenery: - { - auto* sceneryEntry = info.Element->AsSmallScenery()->GetEntry(); - - // If can't repaint - if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS)) - return; - - uint8_t quadrant = info.Element->AsSmallScenery()->GetSceneryQuadrant(); - auto repaintScenery = SmallScenerySetColourAction( - { info.Loc, info.Element->GetBaseZ() }, quadrant, info.Element->AsSmallScenery()->GetEntryIndex(), - gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - - GameActions::Execute(&repaintScenery); - break; - } - case ViewportInteractionItem::Wall: - { - auto* scenery_entry = info.Element->AsWall()->GetEntry(); - - // If can't repaint - if (!(scenery_entry->flags & (WALL_SCENERY_HAS_PRIMARY_COLOUR | WALL_SCENERY_HAS_GLASS))) - return; - - auto repaintScenery = WallSetColourAction( - { info.Loc, info.Element->GetBaseZ(), info.Element->GetDirection() }, gWindowSceneryPrimaryColour, - gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - - GameActions::Execute(&repaintScenery); - break; - } - case ViewportInteractionItem::LargeScenery: - { - auto* sceneryEntry = info.Element->AsLargeScenery()->GetEntry(); - - // If can't repaint - if (!(sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR)) - return; - - auto repaintScenery = LargeScenerySetColourAction( - { info.Loc, info.Element->GetBaseZ(), info.Element->GetDirection() }, - info.Element->AsLargeScenery()->GetSequenceIndex(), gWindowSceneryPrimaryColour, - gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - - GameActions::Execute(&repaintScenery); - break; - } - case ViewportInteractionItem::Banner: - { - auto banner = info.Element->AsBanner()->GetBanner(); - if (banner != nullptr) - { - auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(banner->type); - if (bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR) + // If no change in ghost placement + if ((gSceneryGhostType & SCENERY_GHOST_FLAG_1) && mapTile == gSceneryGhostPosition + && z == gSceneryGhostPosition.z) { - auto repaintScenery = BannerSetColourAction( - { info.Loc, info.Element->GetBaseZ(), info.Element->AsBanner()->GetPosition() }, - gWindowSceneryPrimaryColour); - - GameActions::Execute(&repaintScenery); + return; } - } - break; - } - default: - return; - } - } - void SceneryEyedropperToolDown(const ScreenCoordsXY& screenCoords, WidgetIndex widgetIndex) - { - auto flag = EnumsToFlags( - ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery, - ViewportInteractionItem::Banner, ViewportInteractionItem::PathAddition); - auto info = GetMapCoordinatesFromPos(screenCoords, flag); - switch (info.SpriteType) + SceneryRemoveGhostToolPlacement(); + + cost = TryPlaceGhostPathAddition({ mapTile, z }, selection.EntryIndex); + + gSceneryPlaceCost = cost; + break; + } + case SCENERY_TYPE_WALL: + { + CoordsXY mapTile = {}; + uint8_t edge; + + Sub6E1F34Wall(screenPos, selection.EntryIndex, mapTile, &edge); + + if (mapTile.IsNull()) + { + SceneryRemoveGhostToolPlacement(); + return; + } + + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectPositionA.x = mapTile.x; + gMapSelectPositionA.y = mapTile.y; + gMapSelectPositionB.x = mapTile.x; + gMapSelectPositionB.y = mapTile.y; + gMapSelectType = MAP_SELECT_TYPE_EDGE_0 + edge; + + MapInvalidateSelectionRect(); + + // If no change in ghost placement + if ((gSceneryGhostType & SCENERY_GHOST_FLAG_2) && mapTile == gSceneryGhostPosition + && edge == gSceneryGhostWallRotation && gSceneryPlaceZ == _unkF64F0A) + { + return; + } + + SceneryRemoveGhostToolPlacement(); + + gSceneryGhostWallRotation = edge; + _unkF64F0A = gSceneryPlaceZ; + + uint8_t attemptsLeft = 1; + if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) + { + attemptsLeft = 20; + } + + cost = 0; + for (; attemptsLeft != 0; attemptsLeft--) + { + cost = TryPlaceGhostWall( + { mapTile, gSceneryPlaceZ }, edge, selection.EntryIndex, gWindowSceneryPrimaryColour, + gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); + + if (cost != kMoney64Undefined) + break; + gSceneryPlaceZ += 8; + } + + gSceneryPlaceCost = cost; + break; + } + case SCENERY_TYPE_LARGE: + { + CoordsXY mapTile = {}; + Direction direction; + + Sub6E1F34LargeScenery(screenPos, selection.EntryIndex, mapTile, &direction); + + if (mapTile.IsNull()) + { + SceneryRemoveGhostToolPlacement(); + return; + } + + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(selection.EntryIndex); + gMapSelectionTiles.clear(); + + for (auto* tile = sceneryEntry->tiles; + tile->x_offset != static_cast(static_cast(0xFFFF)); tile++) + { + CoordsXY tileLocation = { tile->x_offset, tile->y_offset }; + auto rotatedTileCoords = tileLocation.Rotate(direction); + + rotatedTileCoords.x += mapTile.x; + rotatedTileCoords.y += mapTile.y; + + gMapSelectionTiles.push_back(rotatedTileCoords); + } + + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + MapInvalidateMapSelectionTiles(); + + // If no change in ghost placement + if ((gSceneryGhostType & SCENERY_GHOST_FLAG_3) && mapTile == gSceneryGhostPosition + && gSceneryPlaceZ == _unkF64F0A && gSceneryPlaceObject.SceneryType == SCENERY_TYPE_LARGE + && gSceneryPlaceObject.EntryIndex == selection.EntryIndex) + { + return; + } + + SceneryRemoveGhostToolPlacement(); + + gSceneryPlaceObject.SceneryType = SCENERY_TYPE_LARGE; + gSceneryPlaceObject.EntryIndex = selection.EntryIndex; + _unkF64F0A = gSceneryPlaceZ; + + uint8_t attemptsLeft = 1; + if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) + { + attemptsLeft = 20; + } + + cost = 0; + for (; attemptsLeft != 0; attemptsLeft--) + { + cost = TryPlaceGhostLargeScenery( + { mapTile, gSceneryPlaceZ, direction }, selection.EntryIndex, gWindowSceneryPrimaryColour, + gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); + + if (cost != kMoney64Undefined) + break; + gSceneryPlaceZ += COORDS_Z_STEP; + } + + gSceneryPlaceCost = cost; + break; + } + case SCENERY_TYPE_BANNER: + { + CoordsXY mapTile = {}; + Direction direction; + int32_t z; + + Sub6E1F34Banner(screenPos, selection.EntryIndex, mapTile, &z, &direction); + + if (mapTile.IsNull()) + { + SceneryRemoveGhostToolPlacement(); + return; + } + + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectPositionA.x = mapTile.x; + gMapSelectPositionA.y = mapTile.y; + gMapSelectPositionB.x = mapTile.x; + gMapSelectPositionB.y = mapTile.y; + gMapSelectType = MAP_SELECT_TYPE_FULL; + + MapInvalidateSelectionRect(); + + // If no change in ghost placement + if ((gSceneryGhostType & SCENERY_GHOST_FLAG_4) && mapTile == gSceneryGhostPosition + && z == gSceneryGhostPosition.z && direction == gSceneryPlaceRotation) + { + return; + } + + SceneryRemoveGhostToolPlacement(); + + cost = TryPlaceGhostBanner({ mapTile, z, direction }, selection.EntryIndex); + + gSceneryPlaceCost = cost; + break; + } + } + } + + /** + * + * rct2: 0x006644DD + */ + money64 SelectionRaiseLand(uint8_t flag) { - case ViewportInteractionItem::Scenery: + int32_t centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2; + int32_t centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2; + centreX += 16; + centreY += 16; + + if (gLandMountainMode) { - SmallSceneryElement* sceneryElement = info.Element->AsSmallScenery(); - auto entryIndex = sceneryElement->GetEntryIndex(); - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(entryIndex); - if (sceneryEntry != nullptr) - { - WindowScenerySetSelectedItem( - { SCENERY_TYPE_SMALL, entryIndex }, sceneryElement->GetPrimaryColour(), - sceneryElement->GetSecondaryColour(), sceneryElement->GetTertiaryColour(), - sceneryElement->GetDirectionWithOffset(GetCurrentRotation())); - } - break; + auto landSmoothAction = LandSmoothAction( + { centreX, centreY }, + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + gMapSelectType, false); + auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction) + : GameActions::Query(&landSmoothAction); + return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; } - case ViewportInteractionItem::Wall: + + auto landRaiseAction = LandRaiseAction( + { centreX, centreY }, + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType); + auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landRaiseAction) + : GameActions::Query(&landRaiseAction); + + return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; + } + + /** + * + * rct2: 0x006645B3 + */ + money64 SelectionLowerLand(uint8_t flag) + { + int32_t centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2; + int32_t centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2; + centreX += 16; + centreY += 16; + + if (gLandMountainMode) { - auto entryIndex = info.Element->AsWall()->GetEntryIndex(); - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(entryIndex); - if (sceneryEntry != nullptr) - { - WindowScenerySetSelectedItem( - { SCENERY_TYPE_WALL, entryIndex }, info.Element->AsWall()->GetPrimaryColour(), - info.Element->AsWall()->GetSecondaryColour(), info.Element->AsWall()->GetTertiaryColour(), - std::nullopt); - } - break; + auto landSmoothAction = LandSmoothAction( + { centreX, centreY }, + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + gMapSelectType, true); + auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction) + : GameActions::Query(&landSmoothAction); + return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; } - case ViewportInteractionItem::LargeScenery: + + auto landLowerAction = LandLowerAction( + { centreX, centreY }, + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType); + auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landLowerAction) + : GameActions::Query(&landLowerAction); + + return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; + } + + /** + * part of window_top_toolbar_tool_drag(0x0066CB4E) + * rct2: 0x00664454 + */ + void LandToolDrag(const ScreenCoordsXY& screenPos) + { + auto* window = WindowFindFromPoint(screenPos); + if (window == nullptr) + return; + WidgetIndex widget_index = WindowFindWidgetFromPoint(*window, screenPos); + if (widget_index == -1) + return; + const auto& widget = window->widgets[widget_index]; + if (widget.type != WindowWidgetType::Viewport) + return; + const auto* selectedViewport = window->viewport; + if (selectedViewport == nullptr) + return; + + int16_t tile_height = selectedViewport->zoom.ApplyInversedTo(-16); + + int32_t y_diff = screenPos.y - gInputDragLast.y; + + if (y_diff <= tile_height) { - auto entryIndex = info.Element->AsLargeScenery()->GetEntryIndex(); - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(entryIndex); - if (sceneryEntry != nullptr) - { - WindowScenerySetSelectedItem( - { SCENERY_TYPE_LARGE, entryIndex }, info.Element->AsLargeScenery()->GetPrimaryColour(), - info.Element->AsLargeScenery()->GetSecondaryColour(), std::nullopt, - (GetCurrentRotation() + info.Element->GetDirection()) & 3); - } - break; + gInputDragLast.y += tile_height; + + SelectionRaiseLand(GAME_COMMAND_FLAG_APPLY); + + gLandToolRaiseCost = kMoney64Undefined; + gLandToolLowerCost = kMoney64Undefined; } - case ViewportInteractionItem::Banner: + else if (y_diff >= -tile_height) { - auto banner = info.Element->AsBanner()->GetBanner(); - if (banner != nullptr) + gInputDragLast.y -= tile_height; + + SelectionLowerLand(GAME_COMMAND_FLAG_APPLY); + + gLandToolRaiseCost = kMoney64Undefined; + gLandToolLowerCost = kMoney64Undefined; + } + } + + /** + * part of window_top_toolbar_tool_drag(0x0066CB4E) + * rct2: 0x006E6D4B + */ + void WaterToolDrag(const ScreenCoordsXY& screenPos) + { + auto* window = WindowFindFromPoint(screenPos); + if (window == nullptr || window->viewport == nullptr) + return; + + int16_t dx = window->viewport->zoom.ApplyInversedTo(-16); + + auto offsetPos = screenPos - ScreenCoordsXY{ 0, gInputDragLast.y }; + + if (offsetPos.y <= dx) + { + gInputDragLast.y += dx; + + auto waterRaiseAction = WaterRaiseAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); + GameActions::Execute(&waterRaiseAction); + + gWaterToolRaiseCost = kMoney64Undefined; + gWaterToolLowerCost = kMoney64Undefined; + + return; + } + + dx = -dx; + + if (offsetPos.y >= dx) + { + gInputDragLast.y += dx; + + auto waterLowerAction = WaterLowerAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); + GameActions::Execute(&waterLowerAction); + gWaterToolRaiseCost = kMoney64Undefined; + gWaterToolLowerCost = kMoney64Undefined; + + return; + } + } + + /** + * + * rct2: 0x006E24F6 + * On failure returns kMoney64Undefined + * On success places ghost scenery and returns cost to place proper + */ + money64 TryPlaceGhostSmallScenery( + CoordsXYZD loc, uint8_t quadrant, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour, + colour_t tertiaryColour) + { + SceneryRemoveGhostToolPlacement(); + + // 6e252b + auto smallSceneryPlaceAction = SmallSceneryPlaceAction( + loc, quadrant, entryIndex, primaryColour, secondaryColour, tertiaryColour); + smallSceneryPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); + auto res = GameActions::Execute(&smallSceneryPlaceAction); + if (res.Error != GameActions::Status::Ok) + return kMoney64Undefined; + + const auto placementData = res.GetData(); + + gSceneryPlaceRotation = loc.direction; + gSceneryPlaceObject.SceneryType = SCENERY_TYPE_SMALL; + gSceneryPlaceObject.EntryIndex = entryIndex; + + gSceneryGhostPosition = { loc, placementData.BaseHeight }; + gSceneryQuadrant = placementData.SceneryQuadrant; + if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND) + { + // Set underground on + ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOn); + } + else + { + // Set underground off + ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOff); + } + + gSceneryGhostType |= SCENERY_GHOST_FLAG_0; + return res.Cost; + } + + money64 TryPlaceGhostPathAddition(CoordsXYZ loc, ObjectEntryIndex entryIndex) + { + SceneryRemoveGhostToolPlacement(); + + // 6e265b + auto footpathAdditionPlaceAction = FootpathAdditionPlaceAction(loc, entryIndex); + footpathAdditionPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); + footpathAdditionPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) { - auto sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(banner->type); + return; + } + gSceneryGhostPosition = loc; + gSceneryGhostType |= SCENERY_GHOST_FLAG_1; + }); + auto res = GameActions::Execute(&footpathAdditionPlaceAction); + if (res.Error != GameActions::Status::Ok) + return kMoney64Undefined; + + return res.Cost; + } + + money64 TryPlaceGhostWall( + CoordsXYZ loc, uint8_t edge, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour, + colour_t tertiaryColour) + { + SceneryRemoveGhostToolPlacement(); + + // 6e26b0 + auto wallPlaceAction = 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.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) + return; + + const auto placementData = result->GetData(); + gSceneryGhostPosition = { loc, placementData.BaseHeight }; + gSceneryGhostWallRotation = edge; + + gSceneryGhostType |= SCENERY_GHOST_FLAG_2; + }); + + auto res = GameActions::Execute(&wallPlaceAction); + if (res.Error != GameActions::Status::Ok) + return kMoney64Undefined; + + return res.Cost; + } + + money64 TryPlaceGhostLargeScenery( + CoordsXYZD loc, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour, + colour_t tertiaryColour) + { + SceneryRemoveGhostToolPlacement(); + + // 6e25a7 + auto sceneryPlaceAction = LargeSceneryPlaceAction(loc, entryIndex, primaryColour, secondaryColour, tertiaryColour); + sceneryPlaceAction.SetFlags( + GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND); + auto res = GameActions::Execute(&sceneryPlaceAction); + if (res.Error != GameActions::Status::Ok) + return kMoney64Undefined; + + const auto placementData = res.GetData(); + + gSceneryPlaceRotation = loc.direction; + + gSceneryGhostPosition = { loc, placementData.firstTileHeight }; + if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND) + { + // Set underground on + ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOn); + } + else + { + // Set underground off + ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOff); + } + + gSceneryGhostType |= SCENERY_GHOST_FLAG_3; + return res.Cost; + } + + money64 TryPlaceGhostBanner(CoordsXYZD loc, ObjectEntryIndex entryIndex) + { + SceneryRemoveGhostToolPlacement(); + + // 6e2612 + auto primaryColour = gWindowSceneryPrimaryColour; + auto bannerPlaceAction = BannerPlaceAction(loc, entryIndex, primaryColour); + bannerPlaceAction.SetFlags( + GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND); + auto res = GameActions::Execute(&bannerPlaceAction); + if (res.Error != GameActions::Status::Ok) + return kMoney64Undefined; + + gSceneryGhostPosition = loc; + gSceneryGhostPosition.z += PATH_HEIGHT_STEP; + gSceneryPlaceRotation = loc.direction; + gSceneryGhostType |= SCENERY_GHOST_FLAG_4; + return res.Cost; + } + + /** + * + * rct2: 0x006E3158 + */ + void RepaintSceneryToolDown(const ScreenCoordsXY& screenCoords, WidgetIndex widgetIndex) + { + auto flag = EnumsToFlags( + ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery, + ViewportInteractionItem::Banner); + auto info = GetMapCoordinatesFromPos(screenCoords, flag); + switch (info.SpriteType) + { + case ViewportInteractionItem::Scenery: + { + auto* sceneryEntry = info.Element->AsSmallScenery()->GetEntry(); + + // If can't repaint + if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS)) + return; + + uint8_t quadrant = info.Element->AsSmallScenery()->GetSceneryQuadrant(); + auto repaintScenery = SmallScenerySetColourAction( + { info.Loc, info.Element->GetBaseZ() }, quadrant, info.Element->AsSmallScenery()->GetEntryIndex(), + gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); + + GameActions::Execute(&repaintScenery); + break; + } + case ViewportInteractionItem::Wall: + { + auto* scenery_entry = info.Element->AsWall()->GetEntry(); + + // If can't repaint + if (!(scenery_entry->flags & (WALL_SCENERY_HAS_PRIMARY_COLOUR | WALL_SCENERY_HAS_GLASS))) + return; + + auto repaintScenery = WallSetColourAction( + { info.Loc, info.Element->GetBaseZ(), info.Element->GetDirection() }, gWindowSceneryPrimaryColour, + gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); + + GameActions::Execute(&repaintScenery); + break; + } + case ViewportInteractionItem::LargeScenery: + { + auto* sceneryEntry = info.Element->AsLargeScenery()->GetEntry(); + + // If can't repaint + if (!(sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR)) + return; + + auto repaintScenery = LargeScenerySetColourAction( + { info.Loc, info.Element->GetBaseZ(), info.Element->GetDirection() }, + info.Element->AsLargeScenery()->GetSequenceIndex(), gWindowSceneryPrimaryColour, + gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); + + GameActions::Execute(&repaintScenery); + break; + } + case ViewportInteractionItem::Banner: + { + auto banner = info.Element->AsBanner()->GetBanner(); + if (banner != nullptr) + { + auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(banner->type); + if (bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR) + { + auto repaintScenery = BannerSetColourAction( + { info.Loc, info.Element->GetBaseZ(), info.Element->AsBanner()->GetPosition() }, + gWindowSceneryPrimaryColour); + + GameActions::Execute(&repaintScenery); + } + } + break; + } + default: + return; + } + } + + void SceneryEyedropperToolDown(const ScreenCoordsXY& screenCoords, WidgetIndex widgetIndex) + { + auto flag = EnumsToFlags( + ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery, + ViewportInteractionItem::Banner, ViewportInteractionItem::PathAddition); + auto info = GetMapCoordinatesFromPos(screenCoords, flag); + switch (info.SpriteType) + { + case ViewportInteractionItem::Scenery: + { + SmallSceneryElement* sceneryElement = info.Element->AsSmallScenery(); + auto entryIndex = sceneryElement->GetEntryIndex(); + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(entryIndex); if (sceneryEntry != nullptr) { WindowScenerySetSelectedItem( - { SCENERY_TYPE_BANNER, banner->type }, std::nullopt, std::nullopt, std::nullopt, std::nullopt); + { SCENERY_TYPE_SMALL, entryIndex }, sceneryElement->GetPrimaryColour(), + sceneryElement->GetSecondaryColour(), sceneryElement->GetTertiaryColour(), + sceneryElement->GetDirectionWithOffset(GetCurrentRotation())); } + break; } - break; - } - case ViewportInteractionItem::PathAddition: - { - auto entryIndex = info.Element->AsPath()->GetAdditionEntryIndex(); - auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry(entryIndex); - if (pathAdditionEntry != nullptr) + case ViewportInteractionItem::Wall: { - WindowScenerySetSelectedItem( - { SCENERY_TYPE_PATH_ITEM, entryIndex }, std::nullopt, std::nullopt, std::nullopt, std::nullopt); - } - break; - } - default: - break; - } - } - - void Sub6E1F34UpdateScreenCoordsAndButtonsPressed(bool canRaiseItem, ScreenCoordsXY& screenPos) - { - if (!canRaiseItem && !gCheatsDisableSupportLimits) - { - gSceneryCtrlPressed = false; - gSceneryShiftPressed = false; - } - else - { - if (!gSceneryCtrlPressed) - { - if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z)) - { - // CTRL pressed - constexpr auto flag = EnumsToFlags( - ViewportInteractionItem::Terrain, ViewportInteractionItem::Ride, ViewportInteractionItem::Scenery, - ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall, - ViewportInteractionItem::LargeScenery); - auto info = GetMapCoordinatesFromPos(screenPos, flag); - - if (info.SpriteType != ViewportInteractionItem::None) + auto entryIndex = info.Element->AsWall()->GetEntryIndex(); + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(entryIndex); + if (sceneryEntry != nullptr) { - gSceneryCtrlPressed = true; - gSceneryCtrlPressZ = info.Element->GetBaseZ(); + WindowScenerySetSelectedItem( + { SCENERY_TYPE_WALL, entryIndex }, info.Element->AsWall()->GetPrimaryColour(), + info.Element->AsWall()->GetSecondaryColour(), info.Element->AsWall()->GetTertiaryColour(), + std::nullopt); } + break; } + case ViewportInteractionItem::LargeScenery: + { + auto entryIndex = info.Element->AsLargeScenery()->GetEntryIndex(); + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(entryIndex); + if (sceneryEntry != nullptr) + { + WindowScenerySetSelectedItem( + { SCENERY_TYPE_LARGE, entryIndex }, info.Element->AsLargeScenery()->GetPrimaryColour(), + info.Element->AsLargeScenery()->GetSecondaryColour(), std::nullopt, + (GetCurrentRotation() + info.Element->GetDirection()) & 3); + } + break; + } + case ViewportInteractionItem::Banner: + { + auto banner = info.Element->AsBanner()->GetBanner(); + if (banner != nullptr) + { + auto sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(banner->type); + if (sceneryEntry != nullptr) + { + WindowScenerySetSelectedItem( + { SCENERY_TYPE_BANNER, banner->type }, std::nullopt, std::nullopt, std::nullopt, std::nullopt); + } + } + break; + } + case ViewportInteractionItem::PathAddition: + { + auto entryIndex = info.Element->AsPath()->GetAdditionEntryIndex(); + auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry(entryIndex); + if (pathAdditionEntry != nullptr) + { + WindowScenerySetSelectedItem( + { SCENERY_TYPE_PATH_ITEM, entryIndex }, std::nullopt, std::nullopt, std::nullopt, std::nullopt); + } + break; + } + default: + break; + } + } + + void Sub6E1F34UpdateScreenCoordsAndButtonsPressed(bool canRaiseItem, ScreenCoordsXY& screenPos) + { + if (!canRaiseItem && !GetGameState().Cheats.DisableSupportLimits) + { + gSceneryCtrlPressed = false; + gSceneryShiftPressed = false; } else { - if (!(InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z))) + if (!gSceneryCtrlPressed) { - // CTRL not pressed - gSceneryCtrlPressed = false; - } - } - - if (!gSceneryShiftPressed) - { - if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_SHIFT_Z)) - { - // SHIFT pressed - gSceneryShiftPressed = true; - gSceneryShiftPressX = screenPos.x; - gSceneryShiftPressY = screenPos.y; - gSceneryShiftPressZOffset = 0; - } - } - else - { - if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_SHIFT_Z)) - { - // SHIFT pressed - gSceneryShiftPressZOffset = (gSceneryShiftPressY - screenPos.y + 4); - // Scale delta by zoom to match mouse position. - auto* mainWnd = WindowGetMain(); - if (mainWnd != nullptr && mainWnd->viewport != nullptr) + if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z)) { - gSceneryShiftPressZOffset = mainWnd->viewport->zoom.ApplyTo(gSceneryShiftPressZOffset); - } - gSceneryShiftPressZOffset = Floor2(gSceneryShiftPressZOffset, 8); + // CTRL pressed + constexpr auto flag = EnumsToFlags( + ViewportInteractionItem::Terrain, ViewportInteractionItem::Ride, ViewportInteractionItem::Scenery, + ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall, + ViewportInteractionItem::LargeScenery); + auto info = GetMapCoordinatesFromPos(screenPos, flag); - screenPos.x = gSceneryShiftPressX; - screenPos.y = gSceneryShiftPressY; + if (info.SpriteType != ViewportInteractionItem::None) + { + gSceneryCtrlPressed = true; + gSceneryCtrlPressZ = info.Element->GetBaseZ(); + } + } } else { - // SHIFT not pressed - gSceneryShiftPressed = false; + if (!(InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z))) + { + // CTRL not pressed + gSceneryCtrlPressed = false; + } + } + + if (!gSceneryShiftPressed) + { + if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_SHIFT_Z)) + { + // SHIFT pressed + gSceneryShiftPressed = true; + gSceneryShiftPressX = screenPos.x; + gSceneryShiftPressY = screenPos.y; + gSceneryShiftPressZOffset = 0; + } + } + else + { + if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_SHIFT_Z)) + { + // SHIFT pressed + gSceneryShiftPressZOffset = (gSceneryShiftPressY - screenPos.y + 4); + // Scale delta by zoom to match mouse position. + auto* mainWnd = WindowGetMain(); + if (mainWnd != nullptr && mainWnd->viewport != nullptr) + { + gSceneryShiftPressZOffset = mainWnd->viewport->zoom.ApplyTo(gSceneryShiftPressZOffset); + } + gSceneryShiftPressZOffset = Floor2(gSceneryShiftPressZOffset, 8); + + screenPos.x = gSceneryShiftPressX; + screenPos.y = gSceneryShiftPressY; + } + else + { + // SHIFT not pressed + gSceneryShiftPressed = false; + } } } } - } - void Sub6E1F34SmallScenery( - const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, uint8_t* outQuadrant, - Direction* outRotation) - { - auto* w = WindowFindByClass(WindowClass::Scenery); - - if (w == nullptr) + void Sub6E1F34SmallScenery( + const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, uint8_t* outQuadrant, + Direction* outRotation) { - gridPos.SetNull(); - return; - } + auto* w = WindowFindByClass(WindowClass::Scenery); - auto screenPos = sourceScreenPos; - uint16_t maxPossibleHeight = ZoomLevel::max().ApplyTo( - std::numeric_limits::max() - 32); - bool can_raise_item = false; + if (w == nullptr) + { + gridPos.SetNull(); + return; + } - const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryIndex); - if (sceneryEntry == nullptr) - { - gridPos.SetNull(); - return; - } + auto screenPos = sourceScreenPos; + uint16_t maxPossibleHeight = ZoomLevel::max().ApplyTo( + std::numeric_limits::max() - 32); + bool can_raise_item = false; - maxPossibleHeight -= sceneryEntry->height; - if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_STACKABLE)) - { - can_raise_item = true; - } + const auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryIndex); + if (sceneryEntry == nullptr) + { + gridPos.SetNull(); + return; + } - Sub6E1F34UpdateScreenCoordsAndButtonsPressed(can_raise_item, screenPos); + maxPossibleHeight -= sceneryEntry->height; + if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_STACKABLE)) + { + can_raise_item = true; + } - // Small scenery - if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE)) - { - uint8_t quadrant = 0; + Sub6E1F34UpdateScreenCoordsAndButtonsPressed(can_raise_item, screenPos); + + // Small scenery + if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE)) + { + uint8_t quadrant = 0; + + // If CTRL not pressed + if (!gSceneryCtrlPressed) + { + auto gridCoords = ScreenGetMapXYQuadrant(screenPos, &quadrant); + if (!gridCoords.has_value()) + { + gridPos.SetNull(); + return; + } + gridPos = gridCoords.value(); + + gSceneryPlaceZ = 0; + + // If SHIFT pressed + if (gSceneryShiftPressed) + { + auto* surfaceElement = MapGetSurfaceElementAt(gridPos); + + if (surfaceElement == nullptr) + { + gridPos.SetNull(); + return; + } + + int16_t z = (surfaceElement->GetBaseZ()) & 0xFFF0; + z += gSceneryShiftPressZOffset; + + z = std::clamp(z, 16, maxPossibleHeight); + + gSceneryPlaceZ = z; + } + } + else + { + int16_t z = gSceneryCtrlPressZ; + + auto mapCoords = ScreenGetMapXYQuadrantWithZ(screenPos, z, &quadrant); + if (!mapCoords.has_value()) + { + gridPos.SetNull(); + return; + } + gridPos = mapCoords.value(); + + // If SHIFT pressed + if (gSceneryShiftPressed) + { + z += gSceneryShiftPressZOffset; + } + + z = std::clamp(z, 16, maxPossibleHeight); + + gSceneryPlaceZ = z; + } + + if (gridPos.IsNull()) + return; + + uint8_t rotation = gWindowSceneryRotation; + + if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE)) + { + rotation = UtilRand() & 0xFF; + } + + rotation -= GetCurrentRotation(); + rotation &= 0x3; + + if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) + { + VirtualFloorSetHeight(gSceneryPlaceZ); + } + + *outQuadrant = quadrant ^ 2; + *outRotation = rotation; + + return; + } // If CTRL not pressed if (!gSceneryCtrlPressed) { - auto gridCoords = ScreenGetMapXYQuadrant(screenPos, &quadrant); + constexpr auto flag = EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water); + + auto info = GetMapCoordinatesFromPos(screenPos, flag); + gridPos = info.Loc; + + if (info.SpriteType == ViewportInteractionItem::None) + { + gridPos.SetNull(); + return; + } + + // If CTRL and SHIFT not pressed + gSceneryPlaceZ = 0; + + // If SHIFT pressed + if (gSceneryShiftPressed) + { + auto surfaceElement = MapGetSurfaceElementAt(gridPos); + + if (surfaceElement == nullptr) + { + gridPos.SetNull(); + return; + } + + int16_t z = (surfaceElement->GetBaseZ()) & 0xFFF0; + z += gSceneryShiftPressZOffset; + + z = std::clamp(z, 16, maxPossibleHeight); + + gSceneryPlaceZ = z; + } + } + else + { + int16_t z = gSceneryCtrlPressZ; + auto coords = ScreenGetMapXYWithZ(screenPos, z); + if (coords.has_value()) + { + gridPos = *coords; + } + else + { + gridPos.SetNull(); + } + // If SHIFT pressed + if (gSceneryShiftPressed) + { + z += gSceneryShiftPressZOffset; + } + + z = std::clamp(z, 16, maxPossibleHeight); + + gSceneryPlaceZ = z; + } + + if (gridPos.IsNull()) + return; + + gridPos = gridPos.ToTileStart(); + uint8_t rotation = gWindowSceneryRotation; + + if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE)) + { + rotation = UtilRand() & 0xFF; + } + + rotation -= GetCurrentRotation(); + rotation &= 0x3; + + if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) + { + VirtualFloorSetHeight(gSceneryPlaceZ); + } + + *outQuadrant = 0; + *outRotation = rotation; + } + + void Sub6E1F34PathItem( + const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, int32_t* outZ) + { + auto* w = WindowFindByClass(WindowClass::Scenery); + + if (w == nullptr) + { + gridPos.SetNull(); + return; + } + + auto screenPos = sourceScreenPos; + Sub6E1F34UpdateScreenCoordsAndButtonsPressed(false, screenPos); + + // Path bits + constexpr auto flag = EnumsToFlags(ViewportInteractionItem::Footpath, ViewportInteractionItem::PathAddition); + auto info = GetMapCoordinatesFromPos(screenPos, flag); + gridPos = info.Loc; + + if (info.SpriteType == ViewportInteractionItem::None) + { + gridPos.SetNull(); + return; + } + + if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) + { + VirtualFloorSetHeight(gSceneryPlaceZ); + } + + *outZ = info.Element->GetBaseZ(); + } + + void Sub6E1F34Wall( + const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, uint8_t* outEdges) + { + auto* w = WindowFindByClass(WindowClass::Scenery); + + if (w == nullptr) + { + gridPos.SetNull(); + return; + } + + auto screenPos = sourceScreenPos; + uint16_t maxPossibleHeight = ZoomLevel::max().ApplyTo( + std::numeric_limits::max() - 32); + + auto* wallEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryIndex); + if (wallEntry != nullptr) + { + maxPossibleHeight -= wallEntry->height; + } + + Sub6E1F34UpdateScreenCoordsAndButtonsPressed(true, screenPos); + + // Walls + uint8_t edge; + // If CTRL not pressed + if (!gSceneryCtrlPressed) + { + auto gridCoords = ScreenGetMapXYSide(screenPos, &edge); if (!gridCoords.has_value()) { gridPos.SetNull(); @@ -1758,8 +1978,7 @@ private: else { int16_t z = gSceneryCtrlPressZ; - - auto mapCoords = ScreenGetMapXYQuadrantWithZ(screenPos, z, &quadrant); + auto mapCoords = ScreenGetMapXYSideWithZ(screenPos, z, &edge); if (!mapCoords.has_value()) { gridPos.SetNull(); @@ -1781,13 +2000,103 @@ private: if (gridPos.IsNull()) return; - uint8_t rotation = gWindowSceneryRotation; - - if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE)) + if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) { - rotation = UtilRand() & 0xFF; + VirtualFloorSetHeight(gSceneryPlaceZ); } + *outEdges = edge; + } + + void Sub6E1F34LargeScenery( + const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, Direction* outDirection) + { + auto* w = WindowFindByClass(WindowClass::Scenery); + + if (w == nullptr) + { + gridPos.SetNull(); + return; + } + + auto screenPos = sourceScreenPos; + uint16_t maxPossibleHeight = ZoomLevel::max().ApplyTo( + std::numeric_limits::max() - 32); + + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryIndex); + if (sceneryEntry) + { + int16_t maxClearZ = 0; + for (int32_t i = 0; sceneryEntry->tiles[i].x_offset != -1; ++i) + { + maxClearZ = std::max(maxClearZ, sceneryEntry->tiles[i].z_clearance); + } + maxPossibleHeight = std::max(0, maxPossibleHeight - maxClearZ); + } + + Sub6E1F34UpdateScreenCoordsAndButtonsPressed(true, screenPos); + + // Large scenery + // If CTRL not pressed + if (!gSceneryCtrlPressed) + { + const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenPos); + gridPos = mapCoords; + + if (gridPos.IsNull()) + return; + + gSceneryPlaceZ = 0; + + // If SHIFT pressed + if (gSceneryShiftPressed) + { + auto* surfaceElement = MapGetSurfaceElementAt(gridPos); + + if (surfaceElement == nullptr) + { + gridPos.SetNull(); + return; + } + + int16_t z = (surfaceElement->GetBaseZ()) & 0xFFF0; + z += gSceneryShiftPressZOffset; + + z = std::clamp(z, 16, maxPossibleHeight); + + gSceneryPlaceZ = z; + } + } + else + { + int16_t z = gSceneryCtrlPressZ; + auto coords = ScreenGetMapXYWithZ(screenPos, z); + if (coords.has_value()) + { + gridPos = *coords; + } + else + { + gridPos.SetNull(); + } + + // If SHIFT pressed + if (gSceneryShiftPressed) + { + z += gSceneryShiftPressZOffset; + } + + z = std::clamp(z, 16, maxPossibleHeight); + + gSceneryPlaceZ = z; + } + + if (gridPos.IsNull()) + return; + + gridPos = gridPos.ToTileStart(); + + Direction rotation = gWindowSceneryRotation; rotation -= GetCurrentRotation(); rotation &= 0x3; @@ -1796,17 +2105,26 @@ private: VirtualFloorSetHeight(gSceneryPlaceZ); } - *outQuadrant = quadrant ^ 2; - *outRotation = rotation; - - return; + *outDirection = rotation; } - // If CTRL not pressed - if (!gSceneryCtrlPressed) + void Sub6E1F34Banner( + const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, int32_t* outZ, + Direction* outDirection) { - constexpr auto flag = EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water); + auto* w = WindowFindByClass(WindowClass::Scenery); + if (w == nullptr) + { + gridPos.SetNull(); + return; + } + + auto screenPos = sourceScreenPos; + Sub6E1F34UpdateScreenCoordsAndButtonsPressed(false, screenPos); + + // Banner + constexpr auto flag = EnumsToFlags(ViewportInteractionItem::Footpath, ViewportInteractionItem::PathAddition); auto info = GetMapCoordinatesFromPos(screenPos, flag); gridPos = info.Loc; @@ -1816,1066 +2134,694 @@ private: return; } - // If CTRL and SHIFT not pressed - gSceneryPlaceZ = 0; + uint8_t rotation = gWindowSceneryRotation; + rotation -= GetCurrentRotation(); + rotation &= 0x3; - // If SHIFT pressed - if (gSceneryShiftPressed) + auto z = info.Element->GetBaseZ(); + + if (info.Element->AsPath()->IsSloped()) { - auto surfaceElement = MapGetSurfaceElementAt(gridPos); - - if (surfaceElement == nullptr) + if (rotation != DirectionReverse(info.Element->AsPath()->GetSlopeDirection())) { - gridPos.SetNull(); - return; + z += (2 * COORDS_Z_STEP); } - - int16_t z = (surfaceElement->GetBaseZ()) & 0xFFF0; - z += gSceneryShiftPressZOffset; - - z = std::clamp(z, 16, maxPossibleHeight); - - gSceneryPlaceZ = z; - } - } - else - { - int16_t z = gSceneryCtrlPressZ; - auto coords = ScreenGetMapXYWithZ(screenPos, z); - if (coords.has_value()) - { - gridPos = *coords; - } - else - { - gridPos.SetNull(); - } - // If SHIFT pressed - if (gSceneryShiftPressed) - { - z += gSceneryShiftPressZOffset; } - z = std::clamp(z, 16, maxPossibleHeight); - - gSceneryPlaceZ = z; - } - - if (gridPos.IsNull()) - return; - - gridPos = gridPos.ToTileStart(); - uint8_t rotation = gWindowSceneryRotation; - - if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE)) - { - rotation = UtilRand() & 0xFF; - } - - rotation -= GetCurrentRotation(); - rotation &= 0x3; - - if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) - { - VirtualFloorSetHeight(gSceneryPlaceZ); - } - - *outQuadrant = 0; - *outRotation = rotation; - } - - void Sub6E1F34PathItem( - const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, int32_t* outZ) - { - auto* w = WindowFindByClass(WindowClass::Scenery); - - if (w == nullptr) - { - gridPos.SetNull(); - return; - } - - auto screenPos = sourceScreenPos; - Sub6E1F34UpdateScreenCoordsAndButtonsPressed(false, screenPos); - - // Path bits - constexpr auto flag = EnumsToFlags(ViewportInteractionItem::Footpath, ViewportInteractionItem::PathAddition); - auto info = GetMapCoordinatesFromPos(screenPos, flag); - gridPos = info.Loc; - - if (info.SpriteType == ViewportInteractionItem::None) - { - gridPos.SetNull(); - return; - } - - if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) - { - VirtualFloorSetHeight(gSceneryPlaceZ); - } - - *outZ = info.Element->GetBaseZ(); - } - - void Sub6E1F34Wall( - const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, uint8_t* outEdges) - { - auto* w = WindowFindByClass(WindowClass::Scenery); - - if (w == nullptr) - { - gridPos.SetNull(); - return; - } - - auto screenPos = sourceScreenPos; - uint16_t maxPossibleHeight = ZoomLevel::max().ApplyTo( - std::numeric_limits::max() - 32); - - auto* wallEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryIndex); - if (wallEntry != nullptr) - { - maxPossibleHeight -= wallEntry->height; - } - - Sub6E1F34UpdateScreenCoordsAndButtonsPressed(true, screenPos); - - // Walls - uint8_t edge; - // If CTRL not pressed - if (!gSceneryCtrlPressed) - { - auto gridCoords = ScreenGetMapXYSide(screenPos, &edge); - if (!gridCoords.has_value()) + if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) { - gridPos.SetNull(); + VirtualFloorSetHeight(gSceneryPlaceZ); + } + + *outDirection = rotation; + *outZ = z; + } + + /** + * + * rct2: 0x006E2CC6 + */ + void SceneryToolDown(const ScreenCoordsXY& screenCoords, WidgetIndex widgetIndex) + { + SceneryRemoveGhostToolPlacement(); + if (gWindowSceneryPaintEnabled & 1) + { + RepaintSceneryToolDown(screenCoords, widgetIndex); return; } - gridPos = gridCoords.value(); - gSceneryPlaceZ = 0; - - // If SHIFT pressed - if (gSceneryShiftPressed) + if (gWindowSceneryEyedropperEnabled) { - auto* surfaceElement = MapGetSurfaceElementAt(gridPos); - - if (surfaceElement == nullptr) - { - gridPos.SetNull(); - return; - } - - int16_t z = (surfaceElement->GetBaseZ()) & 0xFFF0; - z += gSceneryShiftPressZOffset; - - z = std::clamp(z, 16, maxPossibleHeight); - - gSceneryPlaceZ = z; - } - } - else - { - int16_t z = gSceneryCtrlPressZ; - auto mapCoords = ScreenGetMapXYSideWithZ(screenPos, z, &edge); - if (!mapCoords.has_value()) - { - gridPos.SetNull(); + SceneryEyedropperToolDown(screenCoords, widgetIndex); return; } - gridPos = mapCoords.value(); - // If SHIFT pressed - if (gSceneryShiftPressed) + auto selectedTab = WindowSceneryGetTabSelection(); + uint8_t sceneryType = selectedTab.SceneryType; + uint16_t selectedScenery = selectedTab.EntryIndex; + CoordsXY gridPos; + + switch (sceneryType) { - z += gSceneryShiftPressZOffset; - } - - z = std::clamp(z, 16, maxPossibleHeight); - - gSceneryPlaceZ = z; - } - - if (gridPos.IsNull()) - return; - - if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) - { - VirtualFloorSetHeight(gSceneryPlaceZ); - } - - *outEdges = edge; - } - - void Sub6E1F34LargeScenery( - const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, Direction* outDirection) - { - auto* w = WindowFindByClass(WindowClass::Scenery); - - if (w == nullptr) - { - gridPos.SetNull(); - return; - } - - auto screenPos = sourceScreenPos; - uint16_t maxPossibleHeight = ZoomLevel::max().ApplyTo( - std::numeric_limits::max() - 32); - - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(sceneryIndex); - if (sceneryEntry) - { - int16_t maxClearZ = 0; - for (int32_t i = 0; sceneryEntry->tiles[i].x_offset != -1; ++i) - { - maxClearZ = std::max(maxClearZ, sceneryEntry->tiles[i].z_clearance); - } - maxPossibleHeight = std::max(0, maxPossibleHeight - maxClearZ); - } - - Sub6E1F34UpdateScreenCoordsAndButtonsPressed(true, screenPos); - - // Large scenery - // If CTRL not pressed - if (!gSceneryCtrlPressed) - { - const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenPos); - gridPos = mapCoords; - - if (gridPos.IsNull()) - return; - - gSceneryPlaceZ = 0; - - // If SHIFT pressed - if (gSceneryShiftPressed) - { - auto* surfaceElement = MapGetSurfaceElementAt(gridPos); - - if (surfaceElement == nullptr) + case SCENERY_TYPE_SMALL: { - gridPos.SetNull(); - return; - } + uint8_t quadrant; + Direction rotation; + Sub6E1F34SmallScenery(screenCoords, selectedScenery, gridPos, &quadrant, &rotation); + if (gridPos.IsNull()) + return; - int16_t z = (surfaceElement->GetBaseZ()) & 0xFFF0; - z += gSceneryShiftPressZOffset; - - z = std::clamp(z, 16, maxPossibleHeight); - - gSceneryPlaceZ = z; - } - } - else - { - int16_t z = gSceneryCtrlPressZ; - auto coords = ScreenGetMapXYWithZ(screenPos, z); - if (coords.has_value()) - { - gridPos = *coords; - } - else - { - gridPos.SetNull(); - } - - // If SHIFT pressed - if (gSceneryShiftPressed) - { - z += gSceneryShiftPressZOffset; - } - - z = std::clamp(z, 16, maxPossibleHeight); - - gSceneryPlaceZ = z; - } - - if (gridPos.IsNull()) - return; - - gridPos = gridPos.ToTileStart(); - - Direction rotation = gWindowSceneryRotation; - rotation -= GetCurrentRotation(); - rotation &= 0x3; - - if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) - { - VirtualFloorSetHeight(gSceneryPlaceZ); - } - - *outDirection = rotation; - } - - void Sub6E1F34Banner( - const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, int32_t* outZ, - Direction* outDirection) - { - auto* w = WindowFindByClass(WindowClass::Scenery); - - if (w == nullptr) - { - gridPos.SetNull(); - return; - } - - auto screenPos = sourceScreenPos; - Sub6E1F34UpdateScreenCoordsAndButtonsPressed(false, screenPos); - - // Banner - constexpr auto flag = EnumsToFlags(ViewportInteractionItem::Footpath, ViewportInteractionItem::PathAddition); - auto info = GetMapCoordinatesFromPos(screenPos, flag); - gridPos = info.Loc; - - if (info.SpriteType == ViewportInteractionItem::None) - { - gridPos.SetNull(); - return; - } - - uint8_t rotation = gWindowSceneryRotation; - rotation -= GetCurrentRotation(); - rotation &= 0x3; - - auto z = info.Element->GetBaseZ(); - - if (info.Element->AsPath()->IsSloped()) - { - if (rotation != DirectionReverse(info.Element->AsPath()->GetSlopeDirection())) - { - z += (2 * COORDS_Z_STEP); - } - } - - if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off) - { - VirtualFloorSetHeight(gSceneryPlaceZ); - } - - *outDirection = rotation; - *outZ = z; - } - - /** - * - * rct2: 0x006E2CC6 - */ - void SceneryToolDown(const ScreenCoordsXY& screenCoords, WidgetIndex widgetIndex) - { - SceneryRemoveGhostToolPlacement(); - if (gWindowSceneryPaintEnabled & 1) - { - RepaintSceneryToolDown(screenCoords, widgetIndex); - return; - } - - if (gWindowSceneryEyedropperEnabled) - { - SceneryEyedropperToolDown(screenCoords, widgetIndex); - return; - } - - auto selectedTab = WindowSceneryGetTabSelection(); - uint8_t sceneryType = selectedTab.SceneryType; - uint16_t selectedScenery = selectedTab.EntryIndex; - CoordsXY gridPos; - - switch (sceneryType) - { - case SCENERY_TYPE_SMALL: - { - uint8_t quadrant; - Direction rotation; - Sub6E1F34SmallScenery(screenCoords, selectedScenery, gridPos, &quadrant, &rotation); - if (gridPos.IsNull()) - return; - - int32_t quantity = 1; - bool isCluster = gWindowSceneryScatterEnabled - && (NetworkGetMode() != NETWORK_MODE_CLIENT - || NetworkCanPerformCommand(NetworkGetCurrentPlayerGroupIndex(), -2)); - - if (isCluster) - { - switch (gWindowSceneryScatterDensity) - { - case ScatterToolDensity::LowDensity: - quantity = gWindowSceneryScatterSize; - break; - - case ScatterToolDensity::MediumDensity: - quantity = gWindowSceneryScatterSize * 2; - break; - - case ScatterToolDensity::HighDensity: - quantity = gWindowSceneryScatterSize * 3; - break; - } - } - - bool forceError = true; - for (int32_t q = 0; q < quantity; q++) - { - int32_t zCoordinate = gSceneryPlaceZ; - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(selectedScenery); - - int16_t cur_grid_x = gridPos.x; - int16_t cur_grid_y = gridPos.y; + int32_t quantity = 1; + bool isCluster = gWindowSceneryScatterEnabled + && (NetworkGetMode() != NETWORK_MODE_CLIENT + || NetworkCanPerformCommand(NetworkGetCurrentPlayerGroupIndex(), -2)); if (isCluster) { - if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE)) + switch (gWindowSceneryScatterDensity) { - quadrant = UtilRand() & 3; - } + case ScatterToolDensity::LowDensity: + quantity = gWindowSceneryScatterSize; + break; - int16_t grid_x_offset = (UtilRand() % gWindowSceneryScatterSize) - (gWindowSceneryScatterSize / 2); - int16_t grid_y_offset = (UtilRand() % gWindowSceneryScatterSize) - (gWindowSceneryScatterSize / 2); - if (gWindowSceneryScatterSize % 2 == 0) - { - grid_x_offset += 1; - grid_y_offset += 1; - } - cur_grid_x += grid_x_offset * COORDS_XY_STEP; - cur_grid_y += grid_y_offset * COORDS_XY_STEP; + case ScatterToolDensity::MediumDensity: + quantity = gWindowSceneryScatterSize * 2; + break; - if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE)) - { - gSceneryPlaceRotation = (gSceneryPlaceRotation + 1) & 3; + case ScatterToolDensity::HighDensity: + quantity = gWindowSceneryScatterSize * 3; + break; } } + bool forceError = true; + for (int32_t q = 0; q < quantity; q++) + { + int32_t zCoordinate = gSceneryPlaceZ; + auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(selectedScenery); + + int16_t cur_grid_x = gridPos.x; + int16_t cur_grid_y = gridPos.y; + + if (isCluster) + { + if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE)) + { + quadrant = UtilRand() & 3; + } + + int16_t grid_x_offset = (UtilRand() % gWindowSceneryScatterSize) - (gWindowSceneryScatterSize / 2); + int16_t grid_y_offset = (UtilRand() % gWindowSceneryScatterSize) - (gWindowSceneryScatterSize / 2); + if (gWindowSceneryScatterSize % 2 == 0) + { + grid_x_offset += 1; + grid_y_offset += 1; + } + cur_grid_x += grid_x_offset * COORDS_XY_STEP; + cur_grid_y += grid_y_offset * COORDS_XY_STEP; + + if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE)) + { + gSceneryPlaceRotation = (gSceneryPlaceRotation + 1) & 3; + } + } + + uint8_t zAttemptRange = 1; + if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) + { + zAttemptRange = 20; + } + + auto success = GameActions::Status::Unknown; + // Try find a valid z coordinate + for (; zAttemptRange != 0; zAttemptRange--) + { + auto smallSceneryPlaceAction = SmallSceneryPlaceAction( + { cur_grid_x, cur_grid_y, gSceneryPlaceZ, gSceneryPlaceRotation }, quadrant, selectedScenery, + gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); + auto res = GameActions::Query(&smallSceneryPlaceAction); + success = res.Error; + if (res.Error == GameActions::Status::Ok) + { + break; + } + + if (res.Error == GameActions::Status::InsufficientFunds) + { + break; + } + if (zAttemptRange != 1) + { + gSceneryPlaceZ += 8; + } + } + + // Actually place + if (success == GameActions::Status::Ok || ((q + 1 == quantity) && forceError)) + { + auto smallSceneryPlaceAction = SmallSceneryPlaceAction( + { cur_grid_x, cur_grid_y, gSceneryPlaceZ, gSceneryPlaceRotation }, quadrant, selectedScenery, + gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); + + smallSceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { + if (result->Error == GameActions::Status::Ok) + { + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); + } + }); + auto res = GameActions::Execute(&smallSceneryPlaceAction); + if (res.Error == GameActions::Status::Ok) + { + forceError = false; + } + + if (res.Error == GameActions::Status::InsufficientFunds) + { + break; + } + } + gSceneryPlaceZ = zCoordinate; + } + break; + } + case SCENERY_TYPE_PATH_ITEM: + { + int32_t z; + Sub6E1F34PathItem(screenCoords, selectedScenery, gridPos, &z); + if (gridPos.IsNull()) + return; + + auto footpathAdditionPlaceAction = FootpathAdditionPlaceAction({ gridPos, z }, selectedScenery); + + footpathAdditionPlaceAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { + if (result->Error != GameActions::Status::Ok) + { + return; + } + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); + }); + auto res = GameActions::Execute(&footpathAdditionPlaceAction); + break; + } + case SCENERY_TYPE_WALL: + { + uint8_t edges; + Sub6E1F34Wall(screenCoords, selectedScenery, gridPos, &edges); + if (gridPos.IsNull()) + return; + uint8_t zAttemptRange = 1; if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) { zAttemptRange = 20; } - auto success = GameActions::Status::Unknown; - // Try find a valid z coordinate for (; zAttemptRange != 0; zAttemptRange--) { - auto smallSceneryPlaceAction = SmallSceneryPlaceAction( - { cur_grid_x, cur_grid_y, gSceneryPlaceZ, gSceneryPlaceRotation }, quadrant, selectedScenery, - gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - auto res = GameActions::Query(&smallSceneryPlaceAction); - success = res.Error; + auto wallPlaceAction = WallPlaceAction( + selectedScenery, { gridPos, gSceneryPlaceZ }, edges, gWindowSceneryPrimaryColour, + gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); + + auto res = GameActions::Query(&wallPlaceAction); if (res.Error == GameActions::Status::Ok) { break; } - if (res.Error == GameActions::Status::InsufficientFunds) + if (const auto* message = std::get_if(&res.ErrorMessage)) { - break; + if (*message == STR_NOT_ENOUGH_CASH_REQUIRES || *message == STR_CAN_ONLY_BUILD_THIS_ON_WATER) + { + break; + } } + if (zAttemptRange != 1) { gSceneryPlaceZ += 8; } } - // Actually place - if (success == GameActions::Status::Ok || ((q + 1 == quantity) && forceError)) - { - auto smallSceneryPlaceAction = SmallSceneryPlaceAction( - { cur_grid_x, cur_grid_y, gSceneryPlaceZ, gSceneryPlaceRotation }, quadrant, selectedScenery, - gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - - smallSceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { - if (result->Error == GameActions::Status::Ok) - { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); - } - }); - auto res = GameActions::Execute(&smallSceneryPlaceAction); - if (res.Error == GameActions::Status::Ok) - { - forceError = false; - } - - if (res.Error == GameActions::Status::InsufficientFunds) - { - break; - } - } - gSceneryPlaceZ = zCoordinate; - } - break; - } - case SCENERY_TYPE_PATH_ITEM: - { - int32_t z; - Sub6E1F34PathItem(screenCoords, selectedScenery, gridPos, &z); - if (gridPos.IsNull()) - return; - - auto footpathAdditionPlaceAction = FootpathAdditionPlaceAction({ gridPos, z }, selectedScenery); - - footpathAdditionPlaceAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { - if (result->Error != GameActions::Status::Ok) - { - return; - } - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); - }); - auto res = GameActions::Execute(&footpathAdditionPlaceAction); - break; - } - case SCENERY_TYPE_WALL: - { - uint8_t edges; - Sub6E1F34Wall(screenCoords, selectedScenery, gridPos, &edges); - if (gridPos.IsNull()) - return; - - uint8_t zAttemptRange = 1; - if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) - { - zAttemptRange = 20; - } - - for (; zAttemptRange != 0; zAttemptRange--) - { auto wallPlaceAction = WallPlaceAction( selectedScenery, { gridPos, gSceneryPlaceZ }, edges, gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - auto res = GameActions::Query(&wallPlaceAction); - if (res.Error == GameActions::Status::Ok) + wallPlaceAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { + if (result->Error == GameActions::Status::Ok) + { + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); + } + }); + auto res = GameActions::Execute(&wallPlaceAction); + break; + } + case SCENERY_TYPE_LARGE: + { + Direction direction; + Sub6E1F34LargeScenery(screenCoords, selectedScenery, gridPos, &direction); + if (gridPos.IsNull()) + return; + + uint8_t zAttemptRange = 1; + if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) { - break; + zAttemptRange = 20; } - if (const auto* message = std::get_if(&res.ErrorMessage)) + for (; zAttemptRange != 0; zAttemptRange--) { - if (*message == STR_NOT_ENOUGH_CASH_REQUIRES || *message == STR_CAN_ONLY_BUILD_THIS_ON_WATER) + CoordsXYZD loc = { gridPos, gSceneryPlaceZ, direction }; + + auto sceneryPlaceAction = LargeSceneryPlaceAction( + loc, selectedScenery, gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, + gWindowSceneryTertiaryColour); + + auto res = GameActions::Query(&sceneryPlaceAction); + if (res.Error == GameActions::Status::Ok) { break; } + + if (const auto* message = std::get_if(&res.ErrorMessage)) + { + if (*message == STR_NOT_ENOUGH_CASH_REQUIRES || *message == STR_CAN_ONLY_BUILD_THIS_ON_WATER) + { + break; + } + } + + if (zAttemptRange != 1) + { + gSceneryPlaceZ += 8; + } } - if (zAttemptRange != 1) - { - gSceneryPlaceZ += 8; - } - } - - auto wallPlaceAction = WallPlaceAction( - selectedScenery, { gridPos, gSceneryPlaceZ }, edges, gWindowSceneryPrimaryColour, - gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - - wallPlaceAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { - if (result->Error == GameActions::Status::Ok) - { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); - } - }); - auto res = GameActions::Execute(&wallPlaceAction); - break; - } - case SCENERY_TYPE_LARGE: - { - Direction direction; - Sub6E1F34LargeScenery(screenCoords, selectedScenery, gridPos, &direction); - if (gridPos.IsNull()) - return; - - uint8_t zAttemptRange = 1; - if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) - { - zAttemptRange = 20; - } - - for (; zAttemptRange != 0; zAttemptRange--) - { CoordsXYZD loc = { gridPos, gSceneryPlaceZ, direction }; auto sceneryPlaceAction = LargeSceneryPlaceAction( loc, selectedScenery, gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - - auto res = GameActions::Query(&sceneryPlaceAction); - if (res.Error == GameActions::Status::Ok) - { - break; - } - - if (const auto* message = std::get_if(&res.ErrorMessage)) - { - if (*message == STR_NOT_ENOUGH_CASH_REQUIRES || *message == STR_CAN_ONLY_BUILD_THIS_ON_WATER) + sceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { + if (result->Error == GameActions::Status::Ok) { - break; - } - } - - if (zAttemptRange != 1) - { - gSceneryPlaceZ += 8; - } - } - - CoordsXYZD loc = { gridPos, gSceneryPlaceZ, direction }; - - auto sceneryPlaceAction = LargeSceneryPlaceAction( - loc, selectedScenery, gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, - gWindowSceneryTertiaryColour); - sceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { - if (result->Error == GameActions::Status::Ok) - { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); - } - else - { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Error, { loc.x, loc.y, gSceneryPlaceZ }); - } - }); - auto res = GameActions::Execute(&sceneryPlaceAction); - break; - } - case SCENERY_TYPE_BANNER: - { - int32_t z; - Direction direction; - Sub6E1F34Banner(screenCoords, selectedScenery, gridPos, &z, &direction); - if (gridPos.IsNull()) - return; - - CoordsXYZD loc{ gridPos, z, direction }; - auto primaryColour = gWindowSceneryPrimaryColour; - auto bannerPlaceAction = BannerPlaceAction(loc, selectedScenery, primaryColour); - bannerPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { - if (result->Error == GameActions::Status::Ok) - { - auto data = result->GetData(); - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); - ContextOpenDetailWindow(WD_BANNER, data.bannerId.ToUnderlying()); - } - }); - GameActions::Execute(&bannerPlaceAction); - break; - } - } - } - - ClearAction GetClearAction() - { - auto range = MapRange(gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y); - - ClearableItems itemsToClear = 0; - - if (gClearSmallScenery) - itemsToClear |= CLEARABLE_ITEMS::SCENERY_SMALL; - if (gClearLargeScenery) - itemsToClear |= CLEARABLE_ITEMS::SCENERY_LARGE; - if (gClearFootpath) - itemsToClear |= CLEARABLE_ITEMS::SCENERY_FOOTPATH; - - return ClearAction(range, itemsToClear); - } - -public: - void OnMouseUp(WidgetIndex widgetIndex) override - { - WindowBase* mainWindow; - - switch (widgetIndex) - { - case WIDX_PAUSE: - if (NetworkGetMode() != NETWORK_MODE_CLIENT) - { - auto pauseToggleAction = PauseToggleAction(); - GameActions::Execute(&pauseToggleAction); - } - break; - case WIDX_ZOOM_OUT: - if ((mainWindow = WindowGetMain()) != nullptr) - WindowZoomOut(*mainWindow, false); - break; - case WIDX_ZOOM_IN: - if ((mainWindow = WindowGetMain()) != nullptr) - WindowZoomIn(*mainWindow, false); - break; - case WIDX_CLEAR_SCENERY: - ToggleClearSceneryWindow(WIDX_CLEAR_SCENERY); - break; - case WIDX_LAND: - ToggleLandWindow(WIDX_LAND); - break; - case WIDX_WATER: - ToggleWaterWindow(WIDX_WATER); - break; - case WIDX_SCENERY: - if (!ToolSet(*this, WIDX_SCENERY, Tool::Arrow)) - { - InputSetFlag(INPUT_FLAG_6, true); - ContextOpenWindow(WindowClass::Scenery); - } - break; - case WIDX_PATH: - ToggleFootpathWindow(); - break; - case WIDX_CONSTRUCT_RIDE: - ContextOpenWindow(WindowClass::ConstructRide); - break; - case WIDX_RIDES: - ContextOpenWindow(WindowClass::RideList); - break; - case WIDX_PARK: - ContextOpenWindow(WindowClass::ParkInformation); - break; - case WIDX_STAFF: - ContextOpenWindow(WindowClass::StaffList); - break; - case WIDX_GUESTS: - ContextOpenWindow(WindowClass::GuestList); - break; - case WIDX_FINANCES: - ContextOpenWindow(WindowClass::Finances); - break; - case WIDX_RESEARCH: - ContextOpenWindow(WindowClass::Research); - break; - case WIDX_NEWS: - ContextOpenWindow(WindowClass::RecentNews); - break; - case WIDX_MUTE: - OpenRCT2::Audio::ToggleAllSounds(); - break; - case WIDX_CHAT: - if (ChatAvailable()) - { - ChatToggle(); - } - else - { - ContextShowError(STR_CHAT_UNAVAILABLE, STR_NONE, {}); - } - break; - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - int32_t numItems = 0; - Widget& widget = widgets[widgetIndex]; - - switch (widgetIndex) - { - case WIDX_FILE_MENU: - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) - { - gDropdownItems[numItems++].Format = STR_ABOUT; - gDropdownItems[numItems++].Format = STR_OPTIONS; - gDropdownItems[numItems++].Format = STR_SCREENSHOT; - gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT; - gDropdownItems[numItems++].Format = STR_EMPTY; - gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB; - - if (OpenRCT2::GetContext()->HasNewVersionInfo()) - gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE; - - gDropdownItems[numItems++].Format = STR_EMPTY; - - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) - gDropdownItems[numItems++].Format = STR_QUIT_ROLLERCOASTER_DESIGNER; - else - gDropdownItems[numItems++].Format = STR_QUIT_TRACK_DESIGNS_MANAGER; - - gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2; - } - else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) - { - gDropdownItems[numItems++].Format = STR_LOAD_LANDSCAPE; - gDropdownItems[numItems++].Format = STR_SAVE_LANDSCAPE; - gDropdownItems[numItems++].Format = STR_EMPTY; - gDropdownItems[numItems++].Format = STR_ABOUT; - gDropdownItems[numItems++].Format = STR_OPTIONS; - gDropdownItems[numItems++].Format = STR_SCREENSHOT; - gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT; - gDropdownItems[numItems++].Format = STR_EMPTY; - gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB; - - if (OpenRCT2::GetContext()->HasNewVersionInfo()) - gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE; - - gDropdownItems[numItems++].Format = STR_EMPTY; - gDropdownItems[numItems++].Format = STR_QUIT_SCENARIO_EDITOR; - gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2; - } - else - { - gDropdownItems[numItems++].Format = STR_NEW_GAME; - gDropdownItems[numItems++].Format = STR_LOAD_GAME; - gDropdownItems[numItems++].Format = STR_SAVE_GAME; - gDropdownItems[numItems++].Format = STR_SAVE_GAME_AS; - gDropdownItems[numItems++].Format = STR_EMPTY; - gDropdownItems[numItems++].Format = STR_ABOUT; - gDropdownItems[numItems++].Format = STR_OPTIONS; - gDropdownItems[numItems++].Format = STR_SCREENSHOT; - gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT; - gDropdownItems[numItems++].Format = STR_EMPTY; - gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB; - - if (OpenRCT2::GetContext()->HasNewVersionInfo()) - gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE; - - gDropdownItems[numItems++].Format = STR_EMPTY; - gDropdownItems[numItems++].Format = STR_QUIT_TO_MENU; - gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2; - } - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, - Dropdown::Flag::StayOpen, numItems); - break; - case WIDX_CHEATS: - InitCheatsMenu(widget); - break; - case WIDX_VIEW_MENU: - InitViewMenu(widget); - break; - case WIDX_MAP: - InitMapMenu(widget); - break; - case WIDX_FASTFORWARD: - InitFastforwardMenu(widget); - break; - case WIDX_ROTATE: - InitRotateMenu(widget); - break; - case WIDX_DEBUG: - InitDebugMenu(widget); - break; - case WIDX_NETWORK: - InitNetworkMenu(widget); - break; - } - } - - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override - { - if (selectedIndex == -1) - { - return; - } - switch (widgetIndex) - { - case WIDX_FILE_MENU: - - // New game is only available in the normal game. Skip one position to avoid incorrect mappings in the menus of - // the other modes. - if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR)) - selectedIndex += 1; - - // Quicksave is only available in the normal game. Skip one position to avoid incorrect mappings in the menus of - // the other modes. - if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR) && selectedIndex > DDIDX_LOAD_GAME) - selectedIndex += 1; - - // Track designer and track designs manager start with About, not Load/save - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) - selectedIndex += DDIDX_ABOUT; - - // The "Update available" menu item is only available when there is one - if (selectedIndex >= DDIDX_UPDATE_AVAILABLE && !OpenRCT2::GetContext()->HasNewVersionInfo()) - selectedIndex += 1; - - switch (selectedIndex) - { - case DDIDX_NEW_GAME: - { - auto intent = Intent(WindowClass::ScenarioSelect); - intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(ScenarioSelectCallback)); - ContextOpenIntent(&intent); - break; - } - case DDIDX_LOAD_GAME: - { - auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt); - GameActions::Execute(&loadOrQuitAction); - break; - } - case DDIDX_SAVE_GAME: - ToolCancel(); - SaveGame(); - break; - case DDIDX_SAVE_GAME_AS: - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) - { - auto intent = Intent(WindowClass::Loadsave); - intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); - intent.PutExtra(INTENT_EXTRA_PATH, GetGameState().ScenarioName); - ContextOpenIntent(&intent); + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); } else { - ToolCancel(); - SaveGameAs(); + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Error, { loc.x, loc.y, gSceneryPlaceZ }); } - break; - case DDIDX_ABOUT: - ContextOpenWindow(WindowClass::About); - break; - case DDIDX_OPTIONS: - ContextOpenWindow(WindowClass::Options); - break; - case DDIDX_SCREENSHOT: - gScreenshotCountdown = 10; - break; - case DDIDX_GIANT_SCREENSHOT: - ScreenshotGiant(); - break; - case DDIDX_FILE_BUG_ON_GITHUB: + }); + auto res = GameActions::Execute(&sceneryPlaceAction); + break; + } + case SCENERY_TYPE_BANNER: + { + int32_t z; + Direction direction; + Sub6E1F34Banner(screenCoords, selectedScenery, gridPos, &z, &direction); + if (gridPos.IsNull()) + return; + + CoordsXYZD loc{ gridPos, z, direction }; + auto primaryColour = gWindowSceneryPrimaryColour; + auto bannerPlaceAction = BannerPlaceAction(loc, selectedScenery, primaryColour); + bannerPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) { + if (result->Error == GameActions::Status::Ok) + { + auto data = result->GetData(); + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); + ContextOpenDetailWindow(WD_BANNER, data.bannerId.ToUnderlying()); + } + }); + GameActions::Execute(&bannerPlaceAction); + break; + } + } + } + + ClearAction GetClearAction() + { + auto range = MapRange(gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y); + + ClearableItems itemsToClear = 0; + + if (gClearSmallScenery) + itemsToClear |= CLEARABLE_ITEMS::SCENERY_SMALL; + if (gClearLargeScenery) + itemsToClear |= CLEARABLE_ITEMS::SCENERY_LARGE; + if (gClearFootpath) + itemsToClear |= CLEARABLE_ITEMS::SCENERY_FOOTPATH; + + return ClearAction(range, itemsToClear); + } + + public: + void OnMouseUp(WidgetIndex widgetIndex) override + { + WindowBase* mainWindow; + + switch (widgetIndex) + { + case WIDX_PAUSE: + if (NetworkGetMode() != NETWORK_MODE_CLIENT) { - std::string url = "https://github.com/OpenRCT2/OpenRCT2/issues/new?" - "assignees=&labels=bug&template=bug_report.yaml"; - // Automatically fill the "OpenRCT2 build" input - auto versionStr = String::URLEncode(gVersionInfoFull); - url.append("&f299dd2a20432827d99b648f73eb4649b23f8ec98d158d6f82b81e43196ee36b=" + versionStr); - OpenRCT2::GetContext()->GetUiContext()->OpenURL(url); + auto pauseToggleAction = PauseToggleAction(); + GameActions::Execute(&pauseToggleAction); } break; - case DDIDX_UPDATE_AVAILABLE: - ContextOpenWindowView(WV_NEW_VERSION_INFO); - break; - case DDIDX_QUIT_TO_MENU: + case WIDX_ZOOM_OUT: + if ((mainWindow = WindowGetMain()) != nullptr) + WindowZoomOut(*mainWindow, false); + break; + case WIDX_ZOOM_IN: + if ((mainWindow = WindowGetMain()) != nullptr) + WindowZoomIn(*mainWindow, false); + break; + case WIDX_CLEAR_SCENERY: + ToggleClearSceneryWindow(WIDX_CLEAR_SCENERY); + break; + case WIDX_LAND: + ToggleLandWindow(WIDX_LAND); + break; + case WIDX_WATER: + ToggleWaterWindow(WIDX_WATER); + break; + case WIDX_SCENERY: + if (!ToolSet(*this, WIDX_SCENERY, Tool::Arrow)) { - WindowCloseByClass(WindowClass::ManageTrackDesign); - WindowCloseByClass(WindowClass::TrackDeletePrompt); - auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt, PromptMode::SaveBeforeQuit); - GameActions::Execute(&loadOrQuitAction); - break; + InputSetFlag(INPUT_FLAG_6, true); + ContextOpenWindow(WindowClass::Scenery); } - case DDIDX_EXIT_OPENRCT2: - ContextQuit(); + break; + case WIDX_PATH: + ToggleFootpathWindow(); + break; + case WIDX_CONSTRUCT_RIDE: + ContextOpenWindow(WindowClass::ConstructRide); + break; + case WIDX_RIDES: + ContextOpenWindow(WindowClass::RideList); + break; + case WIDX_PARK: + ContextOpenWindow(WindowClass::ParkInformation); + break; + case WIDX_STAFF: + ContextOpenWindow(WindowClass::StaffList); + break; + case WIDX_GUESTS: + ContextOpenWindow(WindowClass::GuestList); + break; + case WIDX_FINANCES: + ContextOpenWindow(WindowClass::Finances); + break; + case WIDX_RESEARCH: + ContextOpenWindow(WindowClass::Research); + break; + case WIDX_NEWS: + ContextOpenWindow(WindowClass::RecentNews); + break; + case WIDX_MUTE: + OpenRCT2::Audio::ToggleAllSounds(); + break; + case WIDX_CHAT: + if (ChatAvailable()) + { + ChatToggle(); + } + else + { + ContextShowError(STR_CHAT_UNAVAILABLE, STR_NONE, {}); + } + break; + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + int32_t numItems = 0; + Widget& widget = widgets[widgetIndex]; + + switch (widgetIndex) + { + case WIDX_FILE_MENU: + if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + { + gDropdownItems[numItems++].Format = STR_ABOUT; + gDropdownItems[numItems++].Format = STR_OPTIONS; + gDropdownItems[numItems++].Format = STR_SCREENSHOT; + gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT; + gDropdownItems[numItems++].Format = STR_EMPTY; + gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB; + + if (OpenRCT2::GetContext()->HasNewVersionInfo()) + gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE; + + gDropdownItems[numItems++].Format = STR_EMPTY; + + if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + gDropdownItems[numItems++].Format = STR_QUIT_ROLLERCOASTER_DESIGNER; + else + gDropdownItems[numItems++].Format = STR_QUIT_TRACK_DESIGNS_MANAGER; + + gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2; + } + else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + { + gDropdownItems[numItems++].Format = STR_LOAD_LANDSCAPE; + gDropdownItems[numItems++].Format = STR_SAVE_LANDSCAPE; + gDropdownItems[numItems++].Format = STR_EMPTY; + gDropdownItems[numItems++].Format = STR_ABOUT; + gDropdownItems[numItems++].Format = STR_OPTIONS; + gDropdownItems[numItems++].Format = STR_SCREENSHOT; + gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT; + gDropdownItems[numItems++].Format = STR_EMPTY; + gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB; + + if (OpenRCT2::GetContext()->HasNewVersionInfo()) + gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE; + + gDropdownItems[numItems++].Format = STR_EMPTY; + gDropdownItems[numItems++].Format = STR_QUIT_SCENARIO_EDITOR; + gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2; + } + else + { + gDropdownItems[numItems++].Format = STR_NEW_GAME; + gDropdownItems[numItems++].Format = STR_LOAD_GAME; + gDropdownItems[numItems++].Format = STR_SAVE_GAME; + gDropdownItems[numItems++].Format = STR_SAVE_GAME_AS; + gDropdownItems[numItems++].Format = STR_EMPTY; + gDropdownItems[numItems++].Format = STR_ABOUT; + gDropdownItems[numItems++].Format = STR_OPTIONS; + gDropdownItems[numItems++].Format = STR_SCREENSHOT; + gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT; + gDropdownItems[numItems++].Format = STR_EMPTY; + gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB; + + if (OpenRCT2::GetContext()->HasNewVersionInfo()) + gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE; + + gDropdownItems[numItems++].Format = STR_EMPTY; + gDropdownItems[numItems++].Format = STR_QUIT_TO_MENU; + gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2; + } + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, + Dropdown::Flag::StayOpen, numItems); + break; + case WIDX_CHEATS: + InitCheatsMenu(widget); + break; + case WIDX_VIEW_MENU: + InitViewMenu(widget); + break; + case WIDX_MAP: + InitMapMenu(widget); + break; + case WIDX_FASTFORWARD: + InitFastforwardMenu(widget); + break; + case WIDX_ROTATE: + InitRotateMenu(widget); + break; + case WIDX_DEBUG: + InitDebugMenu(widget); + break; + case WIDX_NETWORK: + InitNetworkMenu(widget); + break; + } + } + + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + if (selectedIndex == -1) + { + return; + } + switch (widgetIndex) + { + case WIDX_FILE_MENU: + + // New game is only available in the normal game. Skip one position to avoid incorrect mappings in the menus + // of the other modes. + if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR)) + selectedIndex += 1; + + // Quicksave is only available in the normal game. Skip one position to avoid incorrect mappings in the + // menus of the other modes. + if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR) && selectedIndex > DDIDX_LOAD_GAME) + selectedIndex += 1; + + // Track designer and track designs manager start with About, not Load/save + if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + selectedIndex += DDIDX_ABOUT; + + // The "Update available" menu item is only available when there is one + if (selectedIndex >= DDIDX_UPDATE_AVAILABLE && !OpenRCT2::GetContext()->HasNewVersionInfo()) + selectedIndex += 1; + + switch (selectedIndex) + { + case DDIDX_NEW_GAME: + { + auto intent = Intent(WindowClass::ScenarioSelect); + intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(ScenarioSelectCallback)); + ContextOpenIntent(&intent); + break; + } + case DDIDX_LOAD_GAME: + { + auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt); + GameActions::Execute(&loadOrQuitAction); + break; + } + case DDIDX_SAVE_GAME: + ToolCancel(); + SaveGame(); + break; + case DDIDX_SAVE_GAME_AS: + if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + { + auto intent = Intent(WindowClass::Loadsave); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); + intent.PutExtra(INTENT_EXTRA_PATH, GetGameState().ScenarioName); + ContextOpenIntent(&intent); + } + else + { + ToolCancel(); + SaveGameAs(); + } + break; + case DDIDX_ABOUT: + ContextOpenWindow(WindowClass::About); + break; + case DDIDX_OPTIONS: + ContextOpenWindow(WindowClass::Options); + break; + case DDIDX_SCREENSHOT: + gScreenshotCountdown = 10; + break; + case DDIDX_GIANT_SCREENSHOT: + ScreenshotGiant(); + break; + case DDIDX_FILE_BUG_ON_GITHUB: + { + std::string url = "https://github.com/OpenRCT2/OpenRCT2/issues/new?" + "assignees=&labels=bug&template=bug_report.yaml"; + // Automatically fill the "OpenRCT2 build" input + auto versionStr = String::URLEncode(gVersionInfoFull); + url.append("&f299dd2a20432827d99b648f73eb4649b23f8ec98d158d6f82b81e43196ee36b=" + versionStr); + OpenRCT2::GetContext()->GetUiContext()->OpenURL(url); + } break; - } - break; - case WIDX_CHEATS: - CheatsMenuDropdown(selectedIndex); - break; - case WIDX_VIEW_MENU: - ViewMenuDropdown(selectedIndex); - break; - case WIDX_MAP: - MapMenuDropdown(selectedIndex); - break; - case WIDX_FASTFORWARD: - FastforwardMenuDropdown(selectedIndex); - break; - case WIDX_ROTATE: - RotateMenuDropdown(selectedIndex); - break; - case WIDX_DEBUG: - DebugMenuDropdown(selectedIndex); - break; - case WIDX_NETWORK: - NetworkMenuDropdown(selectedIndex); - break; + case DDIDX_UPDATE_AVAILABLE: + ContextOpenWindowView(WV_NEW_VERSION_INFO); + break; + case DDIDX_QUIT_TO_MENU: + { + WindowCloseByClass(WindowClass::ManageTrackDesign); + WindowCloseByClass(WindowClass::TrackDeletePrompt); + auto loadOrQuitAction = LoadOrQuitAction( + LoadOrQuitModes::OpenSavePrompt, PromptMode::SaveBeforeQuit); + GameActions::Execute(&loadOrQuitAction); + break; + } + case DDIDX_EXIT_OPENRCT2: + ContextQuit(); + break; + } + break; + case WIDX_CHEATS: + CheatsMenuDropdown(selectedIndex); + break; + case WIDX_VIEW_MENU: + ViewMenuDropdown(selectedIndex); + break; + case WIDX_MAP: + MapMenuDropdown(selectedIndex); + break; + case WIDX_FASTFORWARD: + FastforwardMenuDropdown(selectedIndex); + break; + case WIDX_ROTATE: + RotateMenuDropdown(selectedIndex); + break; + case WIDX_DEBUG: + DebugMenuDropdown(selectedIndex); + break; + case WIDX_NETWORK: + NetworkMenuDropdown(selectedIndex); + break; + } } - } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (widgetIndex) + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - case WIDX_CLEAR_SCENERY: - ToolUpdateSceneryClear(screenCoords); - break; - case WIDX_LAND: - if (gLandPaintMode) - ToolUpdateLandPaint(screenCoords); - else - ToolUpdateLand(screenCoords); - break; - case WIDX_WATER: - ToolUpdateWater(screenCoords); - break; - case WIDX_SCENERY: - ToolUpdateScenery(screenCoords); - break; + switch (widgetIndex) + { + case WIDX_CLEAR_SCENERY: + ToolUpdateSceneryClear(screenCoords); + break; + case WIDX_LAND: + if (gLandPaintMode) + ToolUpdateLandPaint(screenCoords); + else + ToolUpdateLand(screenCoords); + break; + case WIDX_WATER: + ToolUpdateWater(screenCoords); + break; + case WIDX_SCENERY: + ToolUpdateScenery(screenCoords); + break; #ifdef ENABLE_SCRIPTING - default: - auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; - if (customTool) - { - customTool->OnUpdate(screenCoords); - } - break; + default: + auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; + if (customTool) + { + customTool->OnUpdate(screenCoords); + } + break; #endif + } } - } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (widgetIndex) + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - case WIDX_CLEAR_SCENERY: - if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) - { - auto action = GetClearAction(); - GameActions::Execute(&action); - gCurrentToolId = Tool::Crosshair; - } - break; - case WIDX_LAND: - if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) - { - auto surfaceSetStyleAction = SurfaceSetStyleAction( - { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, - gLandToolTerrainSurface, gLandToolTerrainEdge); - - GameActions::Execute(&surfaceSetStyleAction); - - gCurrentToolId = Tool::UpDownArrow; - } - else - { - _landToolBlocked = true; - } - break; - case WIDX_WATER: - if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) - { - gCurrentToolId = Tool::UpDownArrow; - } - else - { - _landToolBlocked = true; - } - break; - case WIDX_SCENERY: - SceneryToolDown(screenCoords, widgetIndex); - break; -#ifdef ENABLE_SCRIPTING - default: - auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; - if (customTool) - { - customTool->OnDown(screenCoords); - } - break; -#endif - } - } - - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - switch (widgetIndex) - { - case WIDX_CLEAR_SCENERY: - if (WindowFindByClass(WindowClass::Error) == nullptr && (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) - { - auto action = GetClearAction(); - GameActions::Execute(&action); - gCurrentToolId = Tool::Crosshair; - } - break; - case WIDX_LAND: - // Custom setting to only change land style instead of raising or lowering land - if (gLandPaintMode) - { + switch (widgetIndex) + { + case WIDX_CLEAR_SCENERY: + if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) + { + auto action = GetClearAction(); + GameActions::Execute(&action); + gCurrentToolId = Tool::Crosshair; + } + break; + case WIDX_LAND: if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) { auto surfaceSetStyleAction = SurfaceSetStyleAction( @@ -2884,987 +2830,1039 @@ public: GameActions::Execute(&surfaceSetStyleAction); - // The tool is set to 12 here instead of 3 so that the dragging cursor is not the elevation change - // cursor + gCurrentToolId = Tool::UpDownArrow; + } + else + { + _landToolBlocked = true; + } + break; + case WIDX_WATER: + if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) + { + gCurrentToolId = Tool::UpDownArrow; + } + else + { + _landToolBlocked = true; + } + break; + case WIDX_SCENERY: + SceneryToolDown(screenCoords, widgetIndex); + break; +#ifdef ENABLE_SCRIPTING + default: + auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; + if (customTool) + { + customTool->OnDown(screenCoords); + } + break; +#endif + } + } + + void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + switch (widgetIndex) + { + case WIDX_CLEAR_SCENERY: + if (WindowFindByClass(WindowClass::Error) == nullptr && (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) + { + auto action = GetClearAction(); + GameActions::Execute(&action); gCurrentToolId = Tool::Crosshair; } - } - else - { + break; + case WIDX_LAND: + // Custom setting to only change land style instead of raising or lowering land + if (gLandPaintMode) + { + if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) + { + auto surfaceSetStyleAction = SurfaceSetStyleAction( + { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, + gLandToolTerrainSurface, gLandToolTerrainEdge); + + GameActions::Execute(&surfaceSetStyleAction); + + // The tool is set to 12 here instead of 3 so that the dragging cursor is not the elevation change + // cursor + gCurrentToolId = Tool::Crosshair; + } + } + else + { + if (!_landToolBlocked) + { + LandToolDrag(screenCoords); + } + } + break; + case WIDX_WATER: if (!_landToolBlocked) { - LandToolDrag(screenCoords); + WaterToolDrag(screenCoords); } - } - break; - case WIDX_WATER: - if (!_landToolBlocked) - { - WaterToolDrag(screenCoords); - } - break; - case WIDX_SCENERY: - if (gWindowSceneryPaintEnabled & 1) - SceneryToolDown(screenCoords, widgetIndex); - if (gWindowSceneryEyedropperEnabled) - SceneryToolDown(screenCoords, widgetIndex); - break; + break; + case WIDX_SCENERY: + if (gWindowSceneryPaintEnabled & 1) + SceneryToolDown(screenCoords, widgetIndex); + if (gWindowSceneryEyedropperEnabled) + SceneryToolDown(screenCoords, widgetIndex); + break; #ifdef ENABLE_SCRIPTING - default: - auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; - if (customTool) - { - customTool->OnDrag(screenCoords); - } - break; + default: + auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; + if (customTool) + { + customTool->OnDrag(screenCoords); + } + break; #endif - } - } - - void OnToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - _landToolBlocked = false; - switch (widgetIndex) - { - case WIDX_LAND: - MapInvalidateSelectionRect(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gCurrentToolId = Tool::DigDown; - break; - case WIDX_WATER: - MapInvalidateSelectionRect(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gCurrentToolId = Tool::WaterDown; - break; - case WIDX_CLEAR_SCENERY: - MapInvalidateSelectionRect(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gCurrentToolId = Tool::Crosshair; - break; -#ifdef ENABLE_SCRIPTING - default: - auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; - if (customTool) - { - customTool->OnUp(screenCoords); - } - break; -#endif - } - } - - void OnToolAbort(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_LAND: - case WIDX_WATER: - case WIDX_CLEAR_SCENERY: - HideGridlines(); - break; -#ifdef ENABLE_SCRIPTING - default: - auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; - if (customTool) - { - customTool->OnAbort(); - customTool = {}; - } - break; -#endif - } - } - - void OnPrepareDraw() override - { - int32_t x, widgetIndex, widgetWidth, firstAlignment; - Widget* widget; - - // Enable / disable buttons - widgets[WIDX_PAUSE].type = WindowWidgetType::TrnBtn; - widgets[WIDX_FILE_MENU].type = WindowWidgetType::TrnBtn; - widgets[WIDX_ZOOM_OUT].type = WindowWidgetType::TrnBtn; - widgets[WIDX_ZOOM_IN].type = WindowWidgetType::TrnBtn; - widgets[WIDX_ROTATE].type = WindowWidgetType::TrnBtn; - widgets[WIDX_VIEW_MENU].type = WindowWidgetType::TrnBtn; - widgets[WIDX_MAP].type = WindowWidgetType::TrnBtn; - widgets[WIDX_MUTE].type = WindowWidgetType::TrnBtn; - widgets[WIDX_CHAT].type = WindowWidgetType::TrnBtn; - widgets[WIDX_LAND].type = WindowWidgetType::TrnBtn; - widgets[WIDX_WATER].type = WindowWidgetType::TrnBtn; - widgets[WIDX_SCENERY].type = WindowWidgetType::TrnBtn; - widgets[WIDX_PATH].type = WindowWidgetType::TrnBtn; - widgets[WIDX_CONSTRUCT_RIDE].type = WindowWidgetType::TrnBtn; - widgets[WIDX_RIDES].type = WindowWidgetType::TrnBtn; - widgets[WIDX_PARK].type = WindowWidgetType::TrnBtn; - widgets[WIDX_STAFF].type = WindowWidgetType::TrnBtn; - widgets[WIDX_GUESTS].type = WindowWidgetType::TrnBtn; - widgets[WIDX_CLEAR_SCENERY].type = WindowWidgetType::TrnBtn; - widgets[WIDX_FINANCES].type = WindowWidgetType::TrnBtn; - widgets[WIDX_RESEARCH].type = WindowWidgetType::TrnBtn; - widgets[WIDX_FASTFORWARD].type = WindowWidgetType::TrnBtn; - widgets[WIDX_CHEATS].type = WindowWidgetType::TrnBtn; - widgets[WIDX_DEBUG].type = gConfigGeneral.DebuggingTools ? WindowWidgetType::TrnBtn : WindowWidgetType::Empty; - widgets[WIDX_NEWS].type = WindowWidgetType::TrnBtn; - widgets[WIDX_NETWORK].type = WindowWidgetType::TrnBtn; - - if (!gConfigInterface.ToolbarShowMute) - widgets[WIDX_MUTE].type = WindowWidgetType::Empty; - - if (!gConfigInterface.ToolbarShowChat) - widgets[WIDX_CHAT].type = WindowWidgetType::Empty; - - if (!gConfigInterface.ToolbarShowResearch) - widgets[WIDX_RESEARCH].type = WindowWidgetType::Empty; - - if (!gConfigInterface.ToolbarShowCheats) - widgets[WIDX_CHEATS].type = WindowWidgetType::Empty; - - if (!gConfigInterface.ToolbarShowNews) - widgets[WIDX_NEWS].type = WindowWidgetType::Empty; - - if (!gConfigInterface.ToolbarShowZoom) - { - widgets[WIDX_ZOOM_IN].type = WindowWidgetType::Empty; - widgets[WIDX_ZOOM_OUT].type = WindowWidgetType::Empty; - } - - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR || gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - widgets[WIDX_PAUSE].type = WindowWidgetType::Empty; - } - - if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) || !gConfigInterface.ToolbarShowFinances) - widgets[WIDX_FINANCES].type = WindowWidgetType::Empty; - - if (gScreenFlags & SCREEN_FLAGS_EDITOR) - { - widgets[WIDX_PARK].type = WindowWidgetType::Empty; - widgets[WIDX_STAFF].type = WindowWidgetType::Empty; - widgets[WIDX_GUESTS].type = WindowWidgetType::Empty; - widgets[WIDX_FINANCES].type = WindowWidgetType::Empty; - widgets[WIDX_RESEARCH].type = WindowWidgetType::Empty; - widgets[WIDX_NEWS].type = WindowWidgetType::Empty; - widgets[WIDX_NETWORK].type = WindowWidgetType::Empty; - - auto& gameState = GetGameState(); - if (gameState.EditorStep != EditorStep::LandscapeEditor) - { - widgets[WIDX_LAND].type = WindowWidgetType::Empty; - widgets[WIDX_WATER].type = WindowWidgetType::Empty; - } - - if (gameState.EditorStep != EditorStep::RollercoasterDesigner) - { - widgets[WIDX_RIDES].type = WindowWidgetType::Empty; - widgets[WIDX_CONSTRUCT_RIDE].type = WindowWidgetType::Empty; - widgets[WIDX_FASTFORWARD].type = WindowWidgetType::Empty; - } - - if (gameState.EditorStep != EditorStep::LandscapeEditor - && gameState.EditorStep != EditorStep::RollercoasterDesigner) - { - widgets[WIDX_MAP].type = WindowWidgetType::Empty; - widgets[WIDX_SCENERY].type = WindowWidgetType::Empty; - widgets[WIDX_PATH].type = WindowWidgetType::Empty; - widgets[WIDX_CLEAR_SCENERY].type = WindowWidgetType::Empty; - - widgets[WIDX_ZOOM_OUT].type = WindowWidgetType::Empty; - widgets[WIDX_ZOOM_IN].type = WindowWidgetType::Empty; - widgets[WIDX_ROTATE].type = WindowWidgetType::Empty; - widgets[WIDX_VIEW_MENU].type = WindowWidgetType::Empty; } } - switch (NetworkGetMode()) + void OnToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - case NETWORK_MODE_NONE: - widgets[WIDX_NETWORK].type = WindowWidgetType::Empty; + _landToolBlocked = false; + switch (widgetIndex) + { + case WIDX_LAND: + MapInvalidateSelectionRect(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gCurrentToolId = Tool::DigDown; + break; + case WIDX_WATER: + MapInvalidateSelectionRect(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gCurrentToolId = Tool::WaterDown; + break; + case WIDX_CLEAR_SCENERY: + MapInvalidateSelectionRect(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gCurrentToolId = Tool::Crosshair; + break; +#ifdef ENABLE_SCRIPTING + default: + auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; + if (customTool) + { + customTool->OnUp(screenCoords); + } + break; +#endif + } + } + + void OnToolAbort(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_LAND: + case WIDX_WATER: + case WIDX_CLEAR_SCENERY: + HideGridlines(); + break; +#ifdef ENABLE_SCRIPTING + default: + auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; + if (customTool) + { + customTool->OnAbort(); + customTool = {}; + } + break; +#endif + } + } + + void OnPrepareDraw() override + { + int32_t x, widgetIndex, widgetWidth, firstAlignment; + Widget* widget; + + // Enable / disable buttons + widgets[WIDX_PAUSE].type = WindowWidgetType::TrnBtn; + widgets[WIDX_FILE_MENU].type = WindowWidgetType::TrnBtn; + widgets[WIDX_ZOOM_OUT].type = WindowWidgetType::TrnBtn; + widgets[WIDX_ZOOM_IN].type = WindowWidgetType::TrnBtn; + widgets[WIDX_ROTATE].type = WindowWidgetType::TrnBtn; + widgets[WIDX_VIEW_MENU].type = WindowWidgetType::TrnBtn; + widgets[WIDX_MAP].type = WindowWidgetType::TrnBtn; + widgets[WIDX_MUTE].type = WindowWidgetType::TrnBtn; + widgets[WIDX_CHAT].type = WindowWidgetType::TrnBtn; + widgets[WIDX_LAND].type = WindowWidgetType::TrnBtn; + widgets[WIDX_WATER].type = WindowWidgetType::TrnBtn; + widgets[WIDX_SCENERY].type = WindowWidgetType::TrnBtn; + widgets[WIDX_PATH].type = WindowWidgetType::TrnBtn; + widgets[WIDX_CONSTRUCT_RIDE].type = WindowWidgetType::TrnBtn; + widgets[WIDX_RIDES].type = WindowWidgetType::TrnBtn; + widgets[WIDX_PARK].type = WindowWidgetType::TrnBtn; + widgets[WIDX_STAFF].type = WindowWidgetType::TrnBtn; + widgets[WIDX_GUESTS].type = WindowWidgetType::TrnBtn; + widgets[WIDX_CLEAR_SCENERY].type = WindowWidgetType::TrnBtn; + widgets[WIDX_FINANCES].type = WindowWidgetType::TrnBtn; + widgets[WIDX_RESEARCH].type = WindowWidgetType::TrnBtn; + widgets[WIDX_FASTFORWARD].type = WindowWidgetType::TrnBtn; + widgets[WIDX_CHEATS].type = WindowWidgetType::TrnBtn; + widgets[WIDX_DEBUG].type = gConfigGeneral.DebuggingTools ? WindowWidgetType::TrnBtn : WindowWidgetType::Empty; + widgets[WIDX_NEWS].type = WindowWidgetType::TrnBtn; + widgets[WIDX_NETWORK].type = WindowWidgetType::TrnBtn; + + if (!gConfigInterface.ToolbarShowMute) + widgets[WIDX_MUTE].type = WindowWidgetType::Empty; + + if (!gConfigInterface.ToolbarShowChat) widgets[WIDX_CHAT].type = WindowWidgetType::Empty; - break; - case NETWORK_MODE_CLIENT: + + if (!gConfigInterface.ToolbarShowResearch) + widgets[WIDX_RESEARCH].type = WindowWidgetType::Empty; + + if (!gConfigInterface.ToolbarShowCheats) + widgets[WIDX_CHEATS].type = WindowWidgetType::Empty; + + if (!gConfigInterface.ToolbarShowNews) + widgets[WIDX_NEWS].type = WindowWidgetType::Empty; + + if (!gConfigInterface.ToolbarShowZoom) + { + widgets[WIDX_ZOOM_IN].type = WindowWidgetType::Empty; + widgets[WIDX_ZOOM_OUT].type = WindowWidgetType::Empty; + } + + if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR || gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + { widgets[WIDX_PAUSE].type = WindowWidgetType::Empty; - [[fallthrough]]; - case NETWORK_MODE_SERVER: - widgets[WIDX_FASTFORWARD].type = WindowWidgetType::Empty; - break; - } - - // Align left hand side toolbar buttons - firstAlignment = 1; - x = 0; - for (size_t i = 0; i < std::size(left_aligned_widgets_order); ++i) - { - widgetIndex = left_aligned_widgets_order[i]; - widget = &widgets[widgetIndex]; - if (widget->type == WindowWidgetType::Empty && widgetIndex != WIDX_SEPARATOR) - continue; - - if (firstAlignment && widgetIndex == WIDX_SEPARATOR) - continue; - - widgetWidth = widget->width(); - widget->left = x; - x += widgetWidth; - widget->right = x; - x += 1; - firstAlignment = 0; - } - - // Align right hand side toolbar buttons if necessary - int32_t screenWidth = ContextGetWidth(); - firstAlignment = 1; - x = std::max(640, screenWidth); - for (size_t i = 0; i < std::size(right_aligned_widgets_order); ++i) - { - widgetIndex = right_aligned_widgets_order[i]; - widget = &widgets[widgetIndex]; - if (widget->type == WindowWidgetType::Empty && widgetIndex != WIDX_SEPARATOR) - continue; - - if (firstAlignment && widgetIndex == WIDX_SEPARATOR) - continue; - - widgetWidth = widget->width(); - x -= 1; - widget->right = x; - x -= widgetWidth; - widget->left = x; - firstAlignment = 0; - } - - // Footpath button pressed down - if (WindowFindByClass(WindowClass::Footpath) == nullptr) - pressed_widgets &= ~(1uLL << WIDX_PATH); - else - pressed_widgets |= (1uLL << WIDX_PATH); - - if (gGamePaused & GAME_PAUSED_NORMAL) - pressed_widgets |= (1uLL << WIDX_PAUSE); - else - pressed_widgets &= ~(1uLL << WIDX_PAUSE); - - if (!OpenRCT2::Audio::gGameSoundsOff) - widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_MUTE, FilterPaletteID::PaletteNull); - else - widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_UNMUTE, FilterPaletteID::PaletteNull); - - // Set map button to the right image. - if (widgets[WIDX_MAP].type != WindowWidgetType::Empty) - { - static constexpr uint32_t _imageIdByRotation[] = { - SPR_G2_MAP_NORTH, - SPR_G2_MAP_WEST, - SPR_G2_MAP_SOUTH, - SPR_G2_MAP_EAST, - }; - - uint32_t mapImageId = _imageIdByRotation[GetCurrentRotation()]; - widgets[WIDX_MAP].image = ImageId(mapImageId, FilterPaletteID::PaletteNull); - } - - // Zoomed out/in disable. Not sure where this code is in the original. - const auto* mainWindow = WindowGetMain(); - if (mainWindow == nullptr || mainWindow->viewport == nullptr) - { - LOG_ERROR("mainWindow or mainWindow->viewport is null!"); - return; - } - - if (mainWindow->viewport->zoom == ZoomLevel::min()) - { - disabled_widgets |= (1uLL << WIDX_ZOOM_IN); - } - else if (mainWindow->viewport->zoom >= ZoomLevel::max()) - { - disabled_widgets |= (1uLL << WIDX_ZOOM_OUT); - } - else - { - disabled_widgets &= ~((1uLL << WIDX_ZOOM_IN) | (1uLL << WIDX_ZOOM_OUT)); - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - const auto& gameState = GetGameState(); - int32_t imgId; - - WindowDrawWidgets(*this, dpi); - - ScreenCoordsXY screenPos{}; - // Draw staff button image (setting masks to the staff colours) - if (widgets[WIDX_STAFF].type != WindowWidgetType::Empty) - { - screenPos = { windowPos.x + widgets[WIDX_STAFF].left, windowPos.y + widgets[WIDX_STAFF].top }; - imgId = SPR_TOOLBAR_STAFF; - if (WidgetIsPressed(*this, WIDX_STAFF)) - imgId++; - GfxDrawSprite(dpi, ImageId(imgId, gameState.StaffHandymanColour, gameState.StaffMechanicColour), screenPos); - } - - // Draw fast forward button - if (widgets[WIDX_FASTFORWARD].type != WindowWidgetType::Empty) - { - screenPos = { windowPos.x + widgets[WIDX_FASTFORWARD].left + 0, windowPos.y + widgets[WIDX_FASTFORWARD].top + 0 }; - if (WidgetIsPressed(*this, WIDX_FASTFORWARD)) - screenPos.y++; - GfxDrawSprite(dpi, ImageId(SPR_G2_FASTFORWARD), screenPos + ScreenCoordsXY{ 6, 3 }); - - for (int32_t i = 0; i < gGameSpeed && gGameSpeed <= 4; i++) - { - GfxDrawSprite(dpi, ImageId(SPR_G2_SPEED_ARROW), screenPos + ScreenCoordsXY{ 5 + i * 5, 15 }); } - for (int32_t i = 0; i < 3 && i < gGameSpeed - 4 && gGameSpeed >= 5; i++) + + if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) || !gConfigInterface.ToolbarShowFinances) + widgets[WIDX_FINANCES].type = WindowWidgetType::Empty; + + if (gScreenFlags & SCREEN_FLAGS_EDITOR) { - GfxDrawSprite(dpi, ImageId(SPR_G2_HYPER_ARROW), screenPos + ScreenCoordsXY{ 5 + i * 6, 15 }); + widgets[WIDX_PARK].type = WindowWidgetType::Empty; + widgets[WIDX_STAFF].type = WindowWidgetType::Empty; + widgets[WIDX_GUESTS].type = WindowWidgetType::Empty; + widgets[WIDX_FINANCES].type = WindowWidgetType::Empty; + widgets[WIDX_RESEARCH].type = WindowWidgetType::Empty; + widgets[WIDX_NEWS].type = WindowWidgetType::Empty; + widgets[WIDX_NETWORK].type = WindowWidgetType::Empty; + + auto& gameState = GetGameState(); + if (gameState.EditorStep != EditorStep::LandscapeEditor) + { + widgets[WIDX_LAND].type = WindowWidgetType::Empty; + widgets[WIDX_WATER].type = WindowWidgetType::Empty; + } + + if (gameState.EditorStep != EditorStep::RollercoasterDesigner) + { + widgets[WIDX_RIDES].type = WindowWidgetType::Empty; + widgets[WIDX_CONSTRUCT_RIDE].type = WindowWidgetType::Empty; + widgets[WIDX_FASTFORWARD].type = WindowWidgetType::Empty; + } + + if (gameState.EditorStep != EditorStep::LandscapeEditor + && gameState.EditorStep != EditorStep::RollercoasterDesigner) + { + widgets[WIDX_MAP].type = WindowWidgetType::Empty; + widgets[WIDX_SCENERY].type = WindowWidgetType::Empty; + widgets[WIDX_PATH].type = WindowWidgetType::Empty; + widgets[WIDX_CLEAR_SCENERY].type = WindowWidgetType::Empty; + + widgets[WIDX_ZOOM_OUT].type = WindowWidgetType::Empty; + widgets[WIDX_ZOOM_IN].type = WindowWidgetType::Empty; + widgets[WIDX_ROTATE].type = WindowWidgetType::Empty; + widgets[WIDX_VIEW_MENU].type = WindowWidgetType::Empty; + } + } + + switch (NetworkGetMode()) + { + case NETWORK_MODE_NONE: + widgets[WIDX_NETWORK].type = WindowWidgetType::Empty; + widgets[WIDX_CHAT].type = WindowWidgetType::Empty; + break; + case NETWORK_MODE_CLIENT: + widgets[WIDX_PAUSE].type = WindowWidgetType::Empty; + [[fallthrough]]; + case NETWORK_MODE_SERVER: + widgets[WIDX_FASTFORWARD].type = WindowWidgetType::Empty; + break; + } + + // Align left hand side toolbar buttons + firstAlignment = 1; + x = 0; + for (size_t i = 0; i < std::size(left_aligned_widgets_order); ++i) + { + widgetIndex = left_aligned_widgets_order[i]; + widget = &widgets[widgetIndex]; + if (widget->type == WindowWidgetType::Empty && widgetIndex != WIDX_SEPARATOR) + continue; + + if (firstAlignment && widgetIndex == WIDX_SEPARATOR) + continue; + + widgetWidth = widget->width(); + widget->left = x; + x += widgetWidth; + widget->right = x; + x += 1; + firstAlignment = 0; + } + + // Align right hand side toolbar buttons if necessary + int32_t screenWidth = ContextGetWidth(); + firstAlignment = 1; + x = std::max(640, screenWidth); + for (size_t i = 0; i < std::size(right_aligned_widgets_order); ++i) + { + widgetIndex = right_aligned_widgets_order[i]; + widget = &widgets[widgetIndex]; + if (widget->type == WindowWidgetType::Empty && widgetIndex != WIDX_SEPARATOR) + continue; + + if (firstAlignment && widgetIndex == WIDX_SEPARATOR) + continue; + + widgetWidth = widget->width(); + x -= 1; + widget->right = x; + x -= widgetWidth; + widget->left = x; + firstAlignment = 0; + } + + // Footpath button pressed down + if (WindowFindByClass(WindowClass::Footpath) == nullptr) + pressed_widgets &= ~(1uLL << WIDX_PATH); + else + pressed_widgets |= (1uLL << WIDX_PATH); + + if (gGamePaused & GAME_PAUSED_NORMAL) + pressed_widgets |= (1uLL << WIDX_PAUSE); + else + pressed_widgets &= ~(1uLL << WIDX_PAUSE); + + if (!OpenRCT2::Audio::gGameSoundsOff) + widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_MUTE, FilterPaletteID::PaletteNull); + else + widgets[WIDX_MUTE].image = ImageId(SPR_G2_TOOLBAR_UNMUTE, FilterPaletteID::PaletteNull); + + // Set map button to the right image. + if (widgets[WIDX_MAP].type != WindowWidgetType::Empty) + { + static constexpr uint32_t _imageIdByRotation[] = { + SPR_G2_MAP_NORTH, + SPR_G2_MAP_WEST, + SPR_G2_MAP_SOUTH, + SPR_G2_MAP_EAST, + }; + + uint32_t mapImageId = _imageIdByRotation[GetCurrentRotation()]; + widgets[WIDX_MAP].image = ImageId(mapImageId, FilterPaletteID::PaletteNull); + } + + // Zoomed out/in disable. Not sure where this code is in the original. + const auto* mainWindow = WindowGetMain(); + if (mainWindow == nullptr || mainWindow->viewport == nullptr) + { + LOG_ERROR("mainWindow or mainWindow->viewport is null!"); + return; + } + + if (mainWindow->viewport->zoom == ZoomLevel::min()) + { + disabled_widgets |= (1uLL << WIDX_ZOOM_IN); + } + else if (mainWindow->viewport->zoom >= ZoomLevel::max()) + { + disabled_widgets |= (1uLL << WIDX_ZOOM_OUT); + } + else + { + disabled_widgets &= ~((1uLL << WIDX_ZOOM_IN) | (1uLL << WIDX_ZOOM_OUT)); } } - // Draw cheats button - if (widgets[WIDX_CHEATS].type != WindowWidgetType::Empty) + void OnDraw(DrawPixelInfo& dpi) override { - screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_CHEATS].left - 1, widgets[WIDX_CHEATS].top - 1 }; - if (WidgetIsPressed(*this, WIDX_CHEATS)) - screenPos.y++; - GfxDrawSprite(dpi, ImageId(SPR_G2_SANDBOX), screenPos); + const auto& gameState = GetGameState(); + int32_t imgId; - // Draw an overlay if clearance checks are disabled - if (gCheatsDisableClearanceChecks) + WindowDrawWidgets(*this, dpi); + + ScreenCoordsXY screenPos{}; + // Draw staff button image (setting masks to the staff colours) + if (widgets[WIDX_STAFF].type != WindowWidgetType::Empty) { - auto colour = static_cast(EnumValue(COLOUR_DARK_ORANGE) | EnumValue(COLOUR_FLAG_OUTLINE)); - DrawTextBasic( - dpi, screenPos + ScreenCoordsXY{ 26, 2 }, STR_OVERLAY_CLEARANCE_CHECKS_DISABLED, {}, - { colour, TextAlignment::RIGHT }); + screenPos = { windowPos.x + widgets[WIDX_STAFF].left, windowPos.y + widgets[WIDX_STAFF].top }; + imgId = SPR_TOOLBAR_STAFF; + if (WidgetIsPressed(*this, WIDX_STAFF)) + imgId++; + GfxDrawSprite(dpi, ImageId(imgId, gameState.StaffHandymanColour, gameState.StaffMechanicColour), screenPos); + } + + // Draw fast forward button + if (widgets[WIDX_FASTFORWARD].type != WindowWidgetType::Empty) + { + screenPos = { windowPos.x + widgets[WIDX_FASTFORWARD].left + 0, + windowPos.y + widgets[WIDX_FASTFORWARD].top + 0 }; + if (WidgetIsPressed(*this, WIDX_FASTFORWARD)) + screenPos.y++; + GfxDrawSprite(dpi, ImageId(SPR_G2_FASTFORWARD), screenPos + ScreenCoordsXY{ 6, 3 }); + + for (int32_t i = 0; i < gGameSpeed && gGameSpeed <= 4; i++) + { + GfxDrawSprite(dpi, ImageId(SPR_G2_SPEED_ARROW), screenPos + ScreenCoordsXY{ 5 + i * 5, 15 }); + } + for (int32_t i = 0; i < 3 && i < gGameSpeed - 4 && gGameSpeed >= 5; i++) + { + GfxDrawSprite(dpi, ImageId(SPR_G2_HYPER_ARROW), screenPos + ScreenCoordsXY{ 5 + i * 6, 15 }); + } + } + + // Draw cheats button + if (widgets[WIDX_CHEATS].type != WindowWidgetType::Empty) + { + screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_CHEATS].left - 1, widgets[WIDX_CHEATS].top - 1 }; + if (WidgetIsPressed(*this, WIDX_CHEATS)) + screenPos.y++; + GfxDrawSprite(dpi, ImageId(SPR_G2_SANDBOX), screenPos); + + // Draw an overlay if clearance checks are disabled + if (GetGameState().Cheats.DisableClearanceChecks) + { + auto colour = static_cast(EnumValue(COLOUR_DARK_ORANGE) | EnumValue(COLOUR_FLAG_OUTLINE)); + DrawTextBasic( + dpi, screenPos + ScreenCoordsXY{ 26, 2 }, STR_OVERLAY_CLEARANCE_CHECKS_DISABLED, {}, + { colour, TextAlignment::RIGHT }); + } + } + + // Draw chat button + if (widgets[WIDX_CHAT].type != WindowWidgetType::Empty) + { + screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_CHAT].left, widgets[WIDX_CHAT].top - 2 }; + if (WidgetIsPressed(*this, WIDX_CHAT)) + screenPos.y++; + GfxDrawSprite(dpi, ImageId(SPR_G2_CHAT), screenPos); + } + + // Draw debug button + if (widgets[WIDX_DEBUG].type != WindowWidgetType::Empty) + { + screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_DEBUG].left, widgets[WIDX_DEBUG].top - 1 }; + if (WidgetIsPressed(*this, WIDX_DEBUG)) + screenPos.y++; + GfxDrawSprite(dpi, ImageId(SPR_TAB_GEARS_0), screenPos); + } + + // Draw research button + if (widgets[WIDX_RESEARCH].type != WindowWidgetType::Empty) + { + screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_RESEARCH].left - 1, widgets[WIDX_RESEARCH].top }; + if (WidgetIsPressed(*this, WIDX_RESEARCH)) + screenPos.y++; + GfxDrawSprite(dpi, ImageId(SPR_TAB_FINANCES_RESEARCH_0), screenPos); + } + + // Draw finances button + if (widgets[WIDX_FINANCES].type != WindowWidgetType::Empty) + { + screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_FINANCES].left + 3, widgets[WIDX_FINANCES].top + 1 }; + if (WidgetIsPressed(*this, WIDX_FINANCES)) + screenPos.y++; + GfxDrawSprite(dpi, ImageId(SPR_FINANCE), screenPos); + } + + // Draw news button + if (widgets[WIDX_NEWS].type != WindowWidgetType::Empty) + { + screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_NEWS].left + 3, widgets[WIDX_NEWS].top + 0 }; + if (WidgetIsPressed(*this, WIDX_NEWS)) + screenPos.y++; + GfxDrawSprite(dpi, ImageId(SPR_G2_TAB_NEWS), screenPos); + } + + // Draw network button + if (widgets[WIDX_NETWORK].type != WindowWidgetType::Empty) + { + screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_NETWORK].left + 3, widgets[WIDX_NETWORK].top + 0 }; + if (WidgetIsPressed(*this, WIDX_NETWORK)) + screenPos.y++; + + // Draw (de)sync icon. + imgId = (NetworkIsDesynchronised() ? SPR_G2_MULTIPLAYER_DESYNC : SPR_G2_MULTIPLAYER_SYNC); + GfxDrawSprite(dpi, ImageId(imgId), screenPos + ScreenCoordsXY{ 3, 11 }); + + // Draw number of players. + auto ft = Formatter(); + ft.Add(NetworkGetNumVisiblePlayers()); + auto colour = static_cast(EnumValue(COLOUR_WHITE) | EnumValue(COLOUR_FLAG_OUTLINE)); + DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ 23, 1 }, STR_COMMA16, ft, { colour, TextAlignment::RIGHT }); } } - - // Draw chat button - if (widgets[WIDX_CHAT].type != WindowWidgetType::Empty) - { - screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_CHAT].left, widgets[WIDX_CHAT].top - 2 }; - if (WidgetIsPressed(*this, WIDX_CHAT)) - screenPos.y++; - GfxDrawSprite(dpi, ImageId(SPR_G2_CHAT), screenPos); - } - - // Draw debug button - if (widgets[WIDX_DEBUG].type != WindowWidgetType::Empty) - { - screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_DEBUG].left, widgets[WIDX_DEBUG].top - 1 }; - if (WidgetIsPressed(*this, WIDX_DEBUG)) - screenPos.y++; - GfxDrawSprite(dpi, ImageId(SPR_TAB_GEARS_0), screenPos); - } - - // Draw research button - if (widgets[WIDX_RESEARCH].type != WindowWidgetType::Empty) - { - screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_RESEARCH].left - 1, widgets[WIDX_RESEARCH].top }; - if (WidgetIsPressed(*this, WIDX_RESEARCH)) - screenPos.y++; - GfxDrawSprite(dpi, ImageId(SPR_TAB_FINANCES_RESEARCH_0), screenPos); - } - - // Draw finances button - if (widgets[WIDX_FINANCES].type != WindowWidgetType::Empty) - { - screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_FINANCES].left + 3, widgets[WIDX_FINANCES].top + 1 }; - if (WidgetIsPressed(*this, WIDX_FINANCES)) - screenPos.y++; - GfxDrawSprite(dpi, ImageId(SPR_FINANCE), screenPos); - } - - // Draw news button - if (widgets[WIDX_NEWS].type != WindowWidgetType::Empty) - { - screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_NEWS].left + 3, widgets[WIDX_NEWS].top + 0 }; - if (WidgetIsPressed(*this, WIDX_NEWS)) - screenPos.y++; - GfxDrawSprite(dpi, ImageId(SPR_G2_TAB_NEWS), screenPos); - } - - // Draw network button - if (widgets[WIDX_NETWORK].type != WindowWidgetType::Empty) - { - screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_NETWORK].left + 3, widgets[WIDX_NETWORK].top + 0 }; - if (WidgetIsPressed(*this, WIDX_NETWORK)) - screenPos.y++; - - // Draw (de)sync icon. - imgId = (NetworkIsDesynchronised() ? SPR_G2_MULTIPLAYER_DESYNC : SPR_G2_MULTIPLAYER_SYNC); - GfxDrawSprite(dpi, ImageId(imgId), screenPos + ScreenCoordsXY{ 3, 11 }); - - // Draw number of players. - auto ft = Formatter(); - ft.Add(NetworkGetNumVisiblePlayers()); - auto colour = static_cast(EnumValue(COLOUR_WHITE) | EnumValue(COLOUR_FLAG_OUTLINE)); - DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ 23, 1 }, STR_COMMA16, ft, { colour, TextAlignment::RIGHT }); - } - } -}; - -static void ScenarioSelectCallback(const utf8* path) -{ - WindowCloseByClass(WindowClass::EditorObjectSelection); - GameNotifyMapChange(); - GetContext()->LoadParkFromFile(path, false, true); - GameLoadScripts(); - GameNotifyMapChanged(); -} - -/** - * Creates the main game top toolbar window. - * rct2: 0x0066B485 (part of 0x0066B3E8) - */ -WindowBase* WindowTopToolbarOpen() -{ - TopToolbar* window = WindowCreate( - WindowClass::TopToolbar, ScreenCoordsXY(0, 0), ContextGetWidth(), TOP_TOOLBAR_HEIGHT + 1, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); - - window->widgets = _topToolbarWidgets; - - WindowInitScrollWidgets(*window); - - return window; -} - -/** - * - * rct2: 0x0066D104 - */ -bool LandToolIsActive() -{ - if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) - return false; - if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) - return false; - if (gCurrentToolWidget.widget_index != WIDX_LAND) - return false; - return true; -} - -/** - * - * rct2: 0x0066D125 - */ -bool ClearSceneryToolIsActive() -{ - if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) - return false; - if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) - return false; - if (gCurrentToolWidget.widget_index != WIDX_CLEAR_SCENERY) - return false; - return true; -} - -/** - * - * rct2: 0x0066D125 - */ -bool WaterToolIsActive() -{ - if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) - return false; - if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) - return false; - if (gCurrentToolWidget.widget_index != WIDX_WATER) - return false; - return true; -} - -void TopToolbar::InitViewMenu(Widget& widget) -{ - using namespace Dropdown; - constexpr ItemExt items[] = { - ToggleOption(DDIDX_UNDERGROUND_INSIDE, STR_UNDERGROUND_VIEW), - ToggleOption(DDIDX_TRANSPARENT_WATER, STR_VIEWPORT_TRANSPARENT_WATER), - ToggleOption(DDIDX_HIDE_BASE, STR_REMOVE_BASE_LAND), - ToggleOption(DDIDX_HIDE_VERTICAL, STR_REMOVE_VERTICAL_FACES), - Separator(), - ToggleOption(DDIDX_HIDE_RIDES, STR_SEE_THROUGH_RIDES), - ToggleOption(DDIDX_HIDE_VEHICLES, STR_SEE_THROUGH_VEHICLES), - ToggleOption(DDIDX_HIDE_VEGETATION, STR_SEE_THROUGH_VEGETATION), - ToggleOption(DDIDX_HIDE_SCENERY, STR_SEE_THROUGH_SCENERY), - ToggleOption(DDIDX_HIDE_PATHS, STR_SEE_THROUGH_PATHS), - ToggleOption(DDIDX_HIDE_SUPPORTS, STR_SEE_THROUGH_SUPPORTS), - ToggleOption(DDIDX_HIDE_GUESTS, STR_SEE_THROUGH_GUESTS), - ToggleOption(DDIDX_HIDE_STAFF, STR_SEE_THROUGH_STAFF), - Separator(), - ToggleOption(DDIDX_LAND_HEIGHTS, STR_HEIGHT_MARKS_ON_LAND), - ToggleOption(DDIDX_TRACK_HEIGHTS, STR_HEIGHT_MARKS_ON_RIDE_TRACKS), - ToggleOption(DDIDX_PATH_HEIGHTS, STR_HEIGHT_MARKS_ON_PATHS), - Separator(), - ToggleOption(DDIDX_VIEW_CLIPPING, STR_VIEW_CLIPPING_MENU), - ToggleOption(DDIDX_HIGHLIGHT_PATH_ISSUES, STR_HIGHLIGHT_PATH_ISSUES_MENU), - Separator(), - ToggleOption(DDIDX_TRANSPARENCY, STR_TRANSPARENCY_OPTIONS), }; - static_assert(ItemIDsMatchIndices(items)); - - SetItems(items); - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1] | 0x80, 0, - TOP_TOOLBAR_VIEW_MENU_COUNT); - - // Set checkmarks - auto* mainViewport = WindowGetMain()->viewport; - if (mainViewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE) - Dropdown::SetChecked(DDIDX_UNDERGROUND_INSIDE, true); - if (gConfigGeneral.TransparentWater) - Dropdown::SetChecked(DDIDX_TRANSPARENT_WATER, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIDE_BASE) - Dropdown::SetChecked(DDIDX_HIDE_BASE, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VERTICAL) - Dropdown::SetChecked(DDIDX_HIDE_VERTICAL, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIDE_RIDES) - Dropdown::SetChecked(DDIDX_HIDE_RIDES, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VEHICLES) - Dropdown::SetChecked(DDIDX_HIDE_VEHICLES, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VEGETATION) - Dropdown::SetChecked(DDIDX_HIDE_VEGETATION, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIDE_SCENERY) - Dropdown::SetChecked(DDIDX_HIDE_SCENERY, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIDE_PATHS) - Dropdown::SetChecked(DDIDX_HIDE_PATHS, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIDE_SUPPORTS) - Dropdown::SetChecked(DDIDX_HIDE_SUPPORTS, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIDE_GUESTS) - Dropdown::SetChecked(DDIDX_HIDE_GUESTS, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIDE_STAFF) - Dropdown::SetChecked(DDIDX_HIDE_STAFF, true); - if (mainViewport->flags & VIEWPORT_FLAG_LAND_HEIGHTS) - Dropdown::SetChecked(DDIDX_LAND_HEIGHTS, true); - if (mainViewport->flags & VIEWPORT_FLAG_TRACK_HEIGHTS) - Dropdown::SetChecked(DDIDX_TRACK_HEIGHTS, true); - if (mainViewport->flags & VIEWPORT_FLAG_PATH_HEIGHTS) - Dropdown::SetChecked(DDIDX_PATH_HEIGHTS, true); - if (mainViewport->flags & VIEWPORT_FLAG_CLIP_VIEW) - Dropdown::SetChecked(DDIDX_VIEW_CLIPPING, true); - if (mainViewport->flags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) - Dropdown::SetChecked(DDIDX_HIGHLIGHT_PATH_ISSUES, true); - - gDropdownDefaultIndex = DDIDX_UNDERGROUND_INSIDE; - - // Opaque water relies on RCT1 sprites. - if (!IsCsgLoaded()) + static void ScenarioSelectCallback(const utf8* path) { - Dropdown::SetDisabled(DDIDX_TRANSPARENT_WATER, true); + WindowCloseByClass(WindowClass::EditorObjectSelection); + GameNotifyMapChange(); + GetContext()->LoadParkFromFile(path, false, true); + GameLoadScripts(); + GameNotifyMapChanged(); } -} -void TopToolbar::ViewMenuDropdown(int16_t dropdownIndex) -{ - auto* w = WindowGetMain(); - if (w != nullptr) + /** + * Creates the main game top toolbar window. + * rct2: 0x0066B485 (part of 0x0066B3E8) + */ + WindowBase* TopToolbarOpen() { - switch (dropdownIndex) + TopToolbar* window = WindowCreate( + WindowClass::TopToolbar, ScreenCoordsXY(0, 0), ContextGetWidth(), TOP_TOOLBAR_HEIGHT + 1, + WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); + + window->widgets = _topToolbarWidgets; + + WindowInitScrollWidgets(*window); + + return window; + } + + /** + * + * rct2: 0x0066D104 + */ + bool LandToolIsActive() + { + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) + return false; + if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) + return false; + if (gCurrentToolWidget.widget_index != WIDX_LAND) + return false; + return true; + } + + /** + * + * rct2: 0x0066D125 + */ + bool ClearSceneryToolIsActive() + { + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) + return false; + if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) + return false; + if (gCurrentToolWidget.widget_index != WIDX_CLEAR_SCENERY) + return false; + return true; + } + + /** + * + * rct2: 0x0066D125 + */ + bool WaterToolIsActive() + { + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) + return false; + if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) + return false; + if (gCurrentToolWidget.widget_index != WIDX_WATER) + return false; + return true; + } + + void TopToolbar::InitViewMenu(Widget& widget) + { + using namespace Dropdown; + constexpr ItemExt items[] = { + ToggleOption(DDIDX_UNDERGROUND_INSIDE, STR_UNDERGROUND_VIEW), + ToggleOption(DDIDX_TRANSPARENT_WATER, STR_VIEWPORT_TRANSPARENT_WATER), + ToggleOption(DDIDX_HIDE_BASE, STR_REMOVE_BASE_LAND), + ToggleOption(DDIDX_HIDE_VERTICAL, STR_REMOVE_VERTICAL_FACES), + Separator(), + ToggleOption(DDIDX_HIDE_RIDES, STR_SEE_THROUGH_RIDES), + ToggleOption(DDIDX_HIDE_VEHICLES, STR_SEE_THROUGH_VEHICLES), + ToggleOption(DDIDX_HIDE_VEGETATION, STR_SEE_THROUGH_VEGETATION), + ToggleOption(DDIDX_HIDE_SCENERY, STR_SEE_THROUGH_SCENERY), + ToggleOption(DDIDX_HIDE_PATHS, STR_SEE_THROUGH_PATHS), + ToggleOption(DDIDX_HIDE_SUPPORTS, STR_SEE_THROUGH_SUPPORTS), + ToggleOption(DDIDX_HIDE_GUESTS, STR_SEE_THROUGH_GUESTS), + ToggleOption(DDIDX_HIDE_STAFF, STR_SEE_THROUGH_STAFF), + Separator(), + ToggleOption(DDIDX_LAND_HEIGHTS, STR_HEIGHT_MARKS_ON_LAND), + ToggleOption(DDIDX_TRACK_HEIGHTS, STR_HEIGHT_MARKS_ON_RIDE_TRACKS), + ToggleOption(DDIDX_PATH_HEIGHTS, STR_HEIGHT_MARKS_ON_PATHS), + Separator(), + ToggleOption(DDIDX_VIEW_CLIPPING, STR_VIEW_CLIPPING_MENU), + ToggleOption(DDIDX_HIGHLIGHT_PATH_ISSUES, STR_HIGHLIGHT_PATH_ISSUES_MENU), + Separator(), + ToggleOption(DDIDX_TRANSPARENCY, STR_TRANSPARENCY_OPTIONS), + }; + + static_assert(ItemIDsMatchIndices(items)); + + SetItems(items); + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1] | 0x80, 0, + TOP_TOOLBAR_VIEW_MENU_COUNT); + + // Set checkmarks + auto* mainViewport = WindowGetMain()->viewport; + if (mainViewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE) + Dropdown::SetChecked(DDIDX_UNDERGROUND_INSIDE, true); + if (gConfigGeneral.TransparentWater) + Dropdown::SetChecked(DDIDX_TRANSPARENT_WATER, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIDE_BASE) + Dropdown::SetChecked(DDIDX_HIDE_BASE, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VERTICAL) + Dropdown::SetChecked(DDIDX_HIDE_VERTICAL, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIDE_RIDES) + Dropdown::SetChecked(DDIDX_HIDE_RIDES, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VEHICLES) + Dropdown::SetChecked(DDIDX_HIDE_VEHICLES, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VEGETATION) + Dropdown::SetChecked(DDIDX_HIDE_VEGETATION, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIDE_SCENERY) + Dropdown::SetChecked(DDIDX_HIDE_SCENERY, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIDE_PATHS) + Dropdown::SetChecked(DDIDX_HIDE_PATHS, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIDE_SUPPORTS) + Dropdown::SetChecked(DDIDX_HIDE_SUPPORTS, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIDE_GUESTS) + Dropdown::SetChecked(DDIDX_HIDE_GUESTS, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIDE_STAFF) + Dropdown::SetChecked(DDIDX_HIDE_STAFF, true); + if (mainViewport->flags & VIEWPORT_FLAG_LAND_HEIGHTS) + Dropdown::SetChecked(DDIDX_LAND_HEIGHTS, true); + if (mainViewport->flags & VIEWPORT_FLAG_TRACK_HEIGHTS) + Dropdown::SetChecked(DDIDX_TRACK_HEIGHTS, true); + if (mainViewport->flags & VIEWPORT_FLAG_PATH_HEIGHTS) + Dropdown::SetChecked(DDIDX_PATH_HEIGHTS, true); + if (mainViewport->flags & VIEWPORT_FLAG_CLIP_VIEW) + Dropdown::SetChecked(DDIDX_VIEW_CLIPPING, true); + if (mainViewport->flags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) + Dropdown::SetChecked(DDIDX_HIGHLIGHT_PATH_ISSUES, true); + + gDropdownDefaultIndex = DDIDX_UNDERGROUND_INSIDE; + + // Opaque water relies on RCT1 sprites. + if (!IsCsgLoaded()) { - case DDIDX_UNDERGROUND_INSIDE: - w->viewport->flags ^= VIEWPORT_FLAG_UNDERGROUND_INSIDE; - break; - case DDIDX_TRANSPARENT_WATER: - gConfigGeneral.TransparentWater ^= 1; - ConfigSaveDefault(); - break; - case DDIDX_HIDE_BASE: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_BASE; - break; - case DDIDX_HIDE_VERTICAL: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VERTICAL; - break; - case DDIDX_HIDE_RIDES: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_RIDES; - break; - case DDIDX_HIDE_VEHICLES: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VEHICLES; - break; - case DDIDX_HIDE_VEGETATION: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VEGETATION; - break; - case DDIDX_HIDE_SCENERY: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_SCENERY; - break; - case DDIDX_HIDE_PATHS: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_PATHS; - break; - case DDIDX_HIDE_SUPPORTS: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_SUPPORTS; - break; - case DDIDX_HIDE_GUESTS: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_GUESTS; - break; - case DDIDX_HIDE_STAFF: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_STAFF; - break; - case DDIDX_LAND_HEIGHTS: - w->viewport->flags ^= VIEWPORT_FLAG_LAND_HEIGHTS; - break; - case DDIDX_TRACK_HEIGHTS: - w->viewport->flags ^= VIEWPORT_FLAG_TRACK_HEIGHTS; - break; - case DDIDX_PATH_HEIGHTS: - w->viewport->flags ^= VIEWPORT_FLAG_PATH_HEIGHTS; - break; - case DDIDX_VIEW_CLIPPING: - if (WindowFindByClass(WindowClass::ViewClipping) == nullptr) - { - ContextOpenWindow(WindowClass::ViewClipping); - } - else - { - // If window is already open, toggle the view clipping on/off - w->viewport->flags ^= VIEWPORT_FLAG_CLIP_VIEW; - } - break; - case DDIDX_HIGHLIGHT_PATH_ISSUES: - w->viewport->flags ^= VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES; - break; - case DDIDX_TRANSPARENCY: - ContextOpenWindow(WindowClass::Transparency); - break; - default: - return; + Dropdown::SetDisabled(DDIDX_TRANSPARENT_WATER, true); } - w->Invalidate(); - } -} - -void TopToolbar::InitMapMenu(Widget& widget) -{ - auto i = 0; - gDropdownItems[i++].Format = STR_SHORTCUT_SHOW_MAP; - gDropdownItems[i++].Format = STR_EXTRA_VIEWPORT; - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && GetGameState().EditorStep == EditorStep::LandscapeEditor) - { - gDropdownItems[i++].Format = STR_MAPGEN_WINDOW_TITLE; } -#ifdef ENABLE_SCRIPTING - const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; - if (!customMenuItems.empty()) + void TopToolbar::ViewMenuDropdown(int16_t dropdownIndex) { - gDropdownItems[i++].Format = STR_EMPTY; - for (const auto& item : customMenuItems) + auto* w = WindowGetMain(); + if (w != nullptr) { - if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Standard) + switch (dropdownIndex) { - gDropdownItems[i].Format = STR_STRING; - auto sz = item.Text.c_str(); - std::memcpy(&gDropdownItems[i].Args, &sz, sizeof(const char*)); - i++; + case DDIDX_UNDERGROUND_INSIDE: + w->viewport->flags ^= VIEWPORT_FLAG_UNDERGROUND_INSIDE; + break; + case DDIDX_TRANSPARENT_WATER: + gConfigGeneral.TransparentWater ^= 1; + ConfigSaveDefault(); + break; + case DDIDX_HIDE_BASE: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_BASE; + break; + case DDIDX_HIDE_VERTICAL: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VERTICAL; + break; + case DDIDX_HIDE_RIDES: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_RIDES; + break; + case DDIDX_HIDE_VEHICLES: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VEHICLES; + break; + case DDIDX_HIDE_VEGETATION: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VEGETATION; + break; + case DDIDX_HIDE_SCENERY: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_SCENERY; + break; + case DDIDX_HIDE_PATHS: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_PATHS; + break; + case DDIDX_HIDE_SUPPORTS: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_SUPPORTS; + break; + case DDIDX_HIDE_GUESTS: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_GUESTS; + break; + case DDIDX_HIDE_STAFF: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_STAFF; + break; + case DDIDX_LAND_HEIGHTS: + w->viewport->flags ^= VIEWPORT_FLAG_LAND_HEIGHTS; + break; + case DDIDX_TRACK_HEIGHTS: + w->viewport->flags ^= VIEWPORT_FLAG_TRACK_HEIGHTS; + break; + case DDIDX_PATH_HEIGHTS: + w->viewport->flags ^= VIEWPORT_FLAG_PATH_HEIGHTS; + break; + case DDIDX_VIEW_CLIPPING: + if (WindowFindByClass(WindowClass::ViewClipping) == nullptr) + { + ContextOpenWindow(WindowClass::ViewClipping); + } + else + { + // If window is already open, toggle the view clipping on/off + w->viewport->flags ^= VIEWPORT_FLAG_CLIP_VIEW; + } + break; + case DDIDX_HIGHLIGHT_PATH_ISSUES: + w->viewport->flags ^= VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES; + break; + case DDIDX_TRANSPARENCY: + ContextOpenWindow(WindowClass::Transparency); + break; + default: + return; } + w->Invalidate(); } } -#endif - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1] | 0x80, 0, i); - gDropdownDefaultIndex = DDIDX_SHOW_MAP; -} - -void TopToolbar::MapMenuDropdown(int16_t dropdownIndex) -{ - int32_t customStartIndex = 3; - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && GetGameState().EditorStep == EditorStep::LandscapeEditor) + void TopToolbar::InitMapMenu(Widget& widget) { - customStartIndex++; - } - - if (dropdownIndex < customStartIndex) - { - switch (dropdownIndex) + auto i = 0; + gDropdownItems[i++].Format = STR_SHORTCUT_SHOW_MAP; + gDropdownItems[i++].Format = STR_EXTRA_VIEWPORT; + if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && GetGameState().EditorStep == EditorStep::LandscapeEditor) { - case 0: - ContextOpenWindow(WindowClass::Map); - break; - case 1: - ContextOpenWindow(WindowClass::Viewport); - break; - case 2: - ContextOpenWindow(WindowClass::Mapgen); - break; + gDropdownItems[i++].Format = STR_MAPGEN_WINDOW_TITLE; } - } - else - { + #ifdef ENABLE_SCRIPTING const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; - auto customIndex = static_cast(dropdownIndex - customStartIndex); - size_t i = 0; - for (const auto& item : customMenuItems) + if (!customMenuItems.empty()) { - if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Standard) + gDropdownItems[i++].Format = STR_EMPTY; + for (const auto& item : customMenuItems) { - if (i == customIndex) + if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Standard) { - item.Invoke(); - break; + gDropdownItems[i].Format = STR_STRING; + auto sz = item.Text.c_str(); + std::memcpy(&gDropdownItems[i].Args, &sz, sizeof(const char*)); + i++; } - i++; } } #endif - } -} -void TopToolbar::InitFastforwardMenu(Widget& widget) -{ - int32_t num_items = 4; - gDropdownItems[0].Format = STR_TOGGLE_OPTION; - gDropdownItems[1].Format = STR_TOGGLE_OPTION; - gDropdownItems[2].Format = STR_TOGGLE_OPTION; - gDropdownItems[3].Format = STR_TOGGLE_OPTION; - if (gConfigGeneral.DebuggingTools) - { - gDropdownItems[4].Format = STR_EMPTY; - gDropdownItems[5].Format = STR_TOGGLE_OPTION; - gDropdownItems[5].Args = STR_SPEED_HYPER; - num_items = 6; + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1] | 0x80, 0, i); + gDropdownDefaultIndex = DDIDX_SHOW_MAP; } - gDropdownItems[0].Args = STR_SPEED_NORMAL; - gDropdownItems[1].Args = STR_SPEED_QUICK; - gDropdownItems[2].Args = STR_SPEED_FAST; - gDropdownItems[3].Args = STR_SPEED_TURBO; - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, 0, num_items); - - // Set checkmarks - if (gGameSpeed <= 4) + void TopToolbar::MapMenuDropdown(int16_t dropdownIndex) { - Dropdown::SetChecked(gGameSpeed - 1, true); - } - if (gGameSpeed == 8) - { - Dropdown::SetChecked(5, true); - } - - if (gConfigGeneral.DebuggingTools) - { - gDropdownDefaultIndex = (gGameSpeed == 8 ? 0 : gGameSpeed); - } - else - { - gDropdownDefaultIndex = (gGameSpeed >= 4 ? 0 : gGameSpeed); - } - if (gDropdownDefaultIndex == 4) - { - gDropdownDefaultIndex = 5; - } -} - -void TopToolbar::FastforwardMenuDropdown(int16_t dropdownIndex) -{ - auto* w = WindowGetMain(); - if (w != nullptr) - { - if (dropdownIndex >= 0 && dropdownIndex <= 5) + int32_t customStartIndex = 3; + if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && GetGameState().EditorStep == EditorStep::LandscapeEditor) { - auto newSpeed = dropdownIndex + 1; - if (newSpeed >= 5) - newSpeed = 8; + customStartIndex++; + } - auto setSpeedAction = GameSetSpeedAction(newSpeed); - GameActions::Execute(&setSpeedAction); + if (dropdownIndex < customStartIndex) + { + switch (dropdownIndex) + { + case 0: + ContextOpenWindow(WindowClass::Map); + break; + case 1: + ContextOpenWindow(WindowClass::Viewport); + break; + case 2: + ContextOpenWindow(WindowClass::Mapgen); + break; + } + } + else + { +#ifdef ENABLE_SCRIPTING + const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; + auto customIndex = static_cast(dropdownIndex - customStartIndex); + size_t i = 0; + for (const auto& item : customMenuItems) + { + if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Standard) + { + if (i == customIndex) + { + item.Invoke(); + break; + } + i++; + } + } +#endif } } -} -void TopToolbar::InitRotateMenu(Widget& widget) -{ - gDropdownItems[0].Format = STR_ROTATE_CLOCKWISE; - gDropdownItems[1].Format = STR_ROTATE_ANTI_CLOCKWISE; + void TopToolbar::InitFastforwardMenu(Widget& widget) + { + int32_t num_items = 4; + gDropdownItems[0].Format = STR_TOGGLE_OPTION; + gDropdownItems[1].Format = STR_TOGGLE_OPTION; + gDropdownItems[2].Format = STR_TOGGLE_OPTION; + gDropdownItems[3].Format = STR_TOGGLE_OPTION; + if (gConfigGeneral.DebuggingTools) + { + gDropdownItems[4].Format = STR_EMPTY; + gDropdownItems[5].Format = STR_TOGGLE_OPTION; + gDropdownItems[5].Args = STR_SPEED_HYPER; + num_items = 6; + } - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1] | 0x80, 0, 2); + gDropdownItems[0].Args = STR_SPEED_NORMAL; + gDropdownItems[1].Args = STR_SPEED_QUICK; + gDropdownItems[2].Args = STR_SPEED_FAST; + gDropdownItems[3].Args = STR_SPEED_TURBO; - gDropdownDefaultIndex = DDIDX_ROTATE_CLOCKWISE; -} + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, 0, num_items); -void TopToolbar::RotateMenuDropdown(int16_t dropdownIndex) -{ - auto* w = WindowGetMain(); - if (w != nullptr) + // Set checkmarks + if (gGameSpeed <= 4) + { + Dropdown::SetChecked(gGameSpeed - 1, true); + } + if (gGameSpeed == 8) + { + Dropdown::SetChecked(5, true); + } + + if (gConfigGeneral.DebuggingTools) + { + gDropdownDefaultIndex = (gGameSpeed == 8 ? 0 : gGameSpeed); + } + else + { + gDropdownDefaultIndex = (gGameSpeed >= 4 ? 0 : gGameSpeed); + } + if (gDropdownDefaultIndex == 4) + { + gDropdownDefaultIndex = 5; + } + } + + void TopToolbar::FastforwardMenuDropdown(int16_t dropdownIndex) + { + auto* w = WindowGetMain(); + if (w != nullptr) + { + if (dropdownIndex >= 0 && dropdownIndex <= 5) + { + auto newSpeed = dropdownIndex + 1; + if (newSpeed >= 5) + newSpeed = 8; + + auto setSpeedAction = GameSetSpeedAction(newSpeed); + GameActions::Execute(&setSpeedAction); + } + } + } + + void TopToolbar::InitRotateMenu(Widget& widget) + { + gDropdownItems[0].Format = STR_ROTATE_CLOCKWISE; + gDropdownItems[1].Format = STR_ROTATE_ANTI_CLOCKWISE; + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1] | 0x80, 0, 2); + + gDropdownDefaultIndex = DDIDX_ROTATE_CLOCKWISE; + } + + void TopToolbar::RotateMenuDropdown(int16_t dropdownIndex) { if (dropdownIndex == 0) { - WindowRotateCamera(*w, 1); - w->Invalidate(); + ViewportRotateAll(1); } else if (dropdownIndex == 1) { - WindowRotateCamera(*w, -1); - w->Invalidate(); + ViewportRotateAll(-1); } } -} -void TopToolbar::InitCheatsMenu(Widget& widget) -{ - using namespace Dropdown; - - constexpr ItemExt items[] = { - ToggleOption(DDIDX_CHEATS, STR_CHEAT_TITLE), - ToggleOption(DDIDX_TILE_INSPECTOR, STR_DEBUG_DROPDOWN_TILE_INSPECTOR), - ToggleOption(DDIDX_OBJECT_SELECTION, STR_DEBUG_DROPDOWN_OBJECT_SELECTION), - ToggleOption(DDIDX_INVENTIONS_LIST, STR_DEBUG_DROPDOWN_INVENTIONS_LIST), - ToggleOption(DDIDX_SCENARIO_OPTIONS, STR_DEBUG_DROPDOWN_SCENARIO_OPTIONS), - ToggleOption(DDIDX_OBJECTIVE_OPTIONS, STR_CHEATS_MENU_OBJECTIVE_OPTIONS), - Separator(), - ToggleOption(DDIDX_ENABLE_SANDBOX_MODE, STR_ENABLE_SANDBOX_MODE), - ToggleOption(DDIDX_DISABLE_CLEARANCE_CHECKS, STR_DISABLE_CLEARANCE_CHECKS), - ToggleOption(DDIDX_DISABLE_SUPPORT_LIMITS, STR_DISABLE_SUPPORT_LIMITS), - }; - static_assert(ItemIDsMatchIndices(items)); - - SetItems(items); - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, 0, - TOP_TOOLBAR_CHEATS_COUNT); - - // Disable items that are not yet available in multiplayer - if (NetworkGetMode() != NETWORK_MODE_NONE) + void TopToolbar::InitCheatsMenu(Widget& widget) { - Dropdown::SetDisabled(DDIDX_OBJECT_SELECTION, true); - Dropdown::SetDisabled(DDIDX_INVENTIONS_LIST, true); - Dropdown::SetDisabled(DDIDX_OBJECTIVE_OPTIONS, true); + using namespace Dropdown; + + constexpr ItemExt items[] = { + ToggleOption(DDIDX_CHEATS, STR_CHEAT_TITLE), + ToggleOption(DDIDX_TILE_INSPECTOR, STR_DEBUG_DROPDOWN_TILE_INSPECTOR), + ToggleOption(DDIDX_OBJECT_SELECTION, STR_DEBUG_DROPDOWN_OBJECT_SELECTION), + ToggleOption(DDIDX_INVENTIONS_LIST, STR_DEBUG_DROPDOWN_INVENTIONS_LIST), + ToggleOption(DDIDX_SCENARIO_OPTIONS, STR_DEBUG_DROPDOWN_SCENARIO_OPTIONS), + ToggleOption(DDIDX_OBJECTIVE_OPTIONS, STR_CHEATS_MENU_OBJECTIVE_OPTIONS), + Separator(), + ToggleOption(DDIDX_ENABLE_SANDBOX_MODE, STR_ENABLE_SANDBOX_MODE), + ToggleOption(DDIDX_DISABLE_CLEARANCE_CHECKS, STR_DISABLE_CLEARANCE_CHECKS), + ToggleOption(DDIDX_DISABLE_SUPPORT_LIMITS, STR_DISABLE_SUPPORT_LIMITS), + }; + static_assert(ItemIDsMatchIndices(items)); + + SetItems(items); + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, 0, + TOP_TOOLBAR_CHEATS_COUNT); + + // Disable items that are not yet available in multiplayer + if (NetworkGetMode() != NETWORK_MODE_NONE) + { + Dropdown::SetDisabled(DDIDX_OBJECT_SELECTION, true); + Dropdown::SetDisabled(DDIDX_INVENTIONS_LIST, true); + Dropdown::SetDisabled(DDIDX_OBJECTIVE_OPTIONS, true); + } + + if (gScreenFlags & SCREEN_FLAGS_EDITOR) + { + Dropdown::SetDisabled(DDIDX_OBJECT_SELECTION, true); + Dropdown::SetDisabled(DDIDX_INVENTIONS_LIST, true); + Dropdown::SetDisabled(DDIDX_SCENARIO_OPTIONS, true); + Dropdown::SetDisabled(DDIDX_OBJECTIVE_OPTIONS, true); + Dropdown::SetDisabled(DDIDX_ENABLE_SANDBOX_MODE, true); + } + + if (GetGameState().Cheats.SandboxMode) + { + Dropdown::SetChecked(DDIDX_ENABLE_SANDBOX_MODE, true); + } + if (GetGameState().Cheats.DisableClearanceChecks) + { + Dropdown::SetChecked(DDIDX_DISABLE_CLEARANCE_CHECKS, true); + } + if (GetGameState().Cheats.DisableSupportLimits) + { + Dropdown::SetChecked(DDIDX_DISABLE_SUPPORT_LIMITS, true); + } + + gDropdownDefaultIndex = DDIDX_CHEATS; } - if (gScreenFlags & SCREEN_FLAGS_EDITOR) - { - Dropdown::SetDisabled(DDIDX_OBJECT_SELECTION, true); - Dropdown::SetDisabled(DDIDX_INVENTIONS_LIST, true); - Dropdown::SetDisabled(DDIDX_SCENARIO_OPTIONS, true); - Dropdown::SetDisabled(DDIDX_OBJECTIVE_OPTIONS, true); - Dropdown::SetDisabled(DDIDX_ENABLE_SANDBOX_MODE, true); - } - - if (gCheatsSandboxMode) - { - Dropdown::SetChecked(DDIDX_ENABLE_SANDBOX_MODE, true); - } - if (gCheatsDisableClearanceChecks) - { - Dropdown::SetChecked(DDIDX_DISABLE_CLEARANCE_CHECKS, true); - } - if (gCheatsDisableSupportLimits) - { - Dropdown::SetChecked(DDIDX_DISABLE_SUPPORT_LIMITS, true); - } - - gDropdownDefaultIndex = DDIDX_CHEATS; -} - -void TopToolbar::CheatsMenuDropdown(int16_t dropdownIndex) -{ - switch (dropdownIndex) - { - case DDIDX_CHEATS: - ContextOpenWindow(WindowClass::Cheats); - break; - case DDIDX_TILE_INSPECTOR: - ContextOpenWindow(WindowClass::TileInspector); - break; - case DDIDX_OBJECT_SELECTION: - WindowCloseAll(); - ContextOpenWindow(WindowClass::EditorObjectSelection); - break; - case DDIDX_INVENTIONS_LIST: - ContextOpenWindow(WindowClass::EditorInventionList); - break; - case DDIDX_SCENARIO_OPTIONS: - ContextOpenWindow(WindowClass::EditorScenarioOptions); - break; - case DDIDX_OBJECTIVE_OPTIONS: - ContextOpenWindow(WindowClass::EditorObjectiveOptions); - break; - case DDIDX_ENABLE_SANDBOX_MODE: - CheatsSet(CheatType::SandboxMode, !gCheatsSandboxMode); - break; - case DDIDX_DISABLE_CLEARANCE_CHECKS: - CheatsSet(CheatType::DisableClearanceChecks, !gCheatsDisableClearanceChecks); - break; - case DDIDX_DISABLE_SUPPORT_LIMITS: - CheatsSet(CheatType::DisableSupportLimits, !gCheatsDisableSupportLimits); - break; - } -} - -void TopToolbar::InitDebugMenu(Widget& widget) -{ - gDropdownItems[DDIDX_CONSOLE].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIDX_CONSOLE].Args = STR_DEBUG_DROPDOWN_CONSOLE; - gDropdownItems[DDIDX_DEBUG_PAINT].Format = STR_TOGGLE_OPTION; - gDropdownItems[DDIDX_DEBUG_PAINT].Args = STR_DEBUG_DROPDOWN_DEBUG_PAINT; - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, - Dropdown::Flag::StayOpen, TOP_TOOLBAR_DEBUG_COUNT); - - Dropdown::SetChecked(DDIDX_DEBUG_PAINT, WindowFindByClass(WindowClass::DebugPaint) != nullptr); -} - -void TopToolbar::DebugMenuDropdown(int16_t dropdownIndex) -{ - auto* w = WindowGetMain(); - if (w != nullptr) + void TopToolbar::CheatsMenuDropdown(int16_t dropdownIndex) { switch (dropdownIndex) { - case DDIDX_CONSOLE: + case DDIDX_CHEATS: + ContextOpenWindow(WindowClass::Cheats); + break; + case DDIDX_TILE_INSPECTOR: + ContextOpenWindow(WindowClass::TileInspector); + break; + case DDIDX_OBJECT_SELECTION: + WindowCloseAll(); + ContextOpenWindow(WindowClass::EditorObjectSelection); + break; + case DDIDX_INVENTIONS_LIST: + ContextOpenWindow(WindowClass::EditorInventionList); + break; + case DDIDX_SCENARIO_OPTIONS: + ContextOpenWindow(WindowClass::EditorScenarioOptions); + break; + case DDIDX_OBJECTIVE_OPTIONS: + ContextOpenWindow(WindowClass::EditorObjectiveOptions); + break; + case DDIDX_ENABLE_SANDBOX_MODE: + CheatsSet(CheatType::SandboxMode, !GetGameState().Cheats.SandboxMode); + break; + case DDIDX_DISABLE_CLEARANCE_CHECKS: + CheatsSet(CheatType::DisableClearanceChecks, !GetGameState().Cheats.DisableClearanceChecks); + break; + case DDIDX_DISABLE_SUPPORT_LIMITS: + CheatsSet(CheatType::DisableSupportLimits, !GetGameState().Cheats.DisableSupportLimits); + break; + } + } + + void TopToolbar::InitDebugMenu(Widget& widget) + { + gDropdownItems[DDIDX_CONSOLE].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIDX_CONSOLE].Args = STR_DEBUG_DROPDOWN_CONSOLE; + gDropdownItems[DDIDX_DEBUG_PAINT].Format = STR_TOGGLE_OPTION; + gDropdownItems[DDIDX_DEBUG_PAINT].Args = STR_DEBUG_DROPDOWN_DEBUG_PAINT; + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, + Dropdown::Flag::StayOpen, TOP_TOOLBAR_DEBUG_COUNT); + + Dropdown::SetChecked(DDIDX_DEBUG_PAINT, WindowFindByClass(WindowClass::DebugPaint) != nullptr); + } + + void TopToolbar::DebugMenuDropdown(int16_t dropdownIndex) + { + auto* w = WindowGetMain(); + if (w != nullptr) + { + switch (dropdownIndex) { - auto& console = GetInGameConsole(); - console.Open(); - break; + case DDIDX_CONSOLE: + { + auto& console = GetInGameConsole(); + console.Open(); + break; + } + case DDIDX_DEBUG_PAINT: + if (WindowFindByClass(WindowClass::DebugPaint) == nullptr) + { + ContextOpenWindow(WindowClass::DebugPaint); + } + else + { + WindowCloseByClass(WindowClass::DebugPaint); + } + break; } - case DDIDX_DEBUG_PAINT: - if (WindowFindByClass(WindowClass::DebugPaint) == nullptr) - { - ContextOpenWindow(WindowClass::DebugPaint); - } - else - { - WindowCloseByClass(WindowClass::DebugPaint); - } - break; } } -} -void TopToolbar::InitNetworkMenu(Widget& widget) -{ - gDropdownItems[DDIDX_MULTIPLAYER].Format = STR_MULTIPLAYER; - gDropdownItems[DDIDX_MULTIPLAYER_RECONNECT].Format = STR_MULTIPLAYER_RECONNECT; - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, 0, - TOP_TOOLBAR_NETWORK_COUNT); - - Dropdown::SetDisabled(DDIDX_MULTIPLAYER_RECONNECT, !NetworkIsDesynchronised()); - - gDropdownDefaultIndex = DDIDX_MULTIPLAYER; -} - -void TopToolbar::NetworkMenuDropdown(int16_t dropdownIndex) -{ - auto* w = WindowGetMain(); - if (w != nullptr) + void TopToolbar::InitNetworkMenu(Widget& widget) { - switch (dropdownIndex) + gDropdownItems[DDIDX_MULTIPLAYER].Format = STR_MULTIPLAYER; + gDropdownItems[DDIDX_MULTIPLAYER_RECONNECT].Format = STR_MULTIPLAYER_RECONNECT; + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, 0, + TOP_TOOLBAR_NETWORK_COUNT); + + Dropdown::SetDisabled(DDIDX_MULTIPLAYER_RECONNECT, !NetworkIsDesynchronised()); + + gDropdownDefaultIndex = DDIDX_MULTIPLAYER; + } + + void TopToolbar::NetworkMenuDropdown(int16_t dropdownIndex) + { + auto* w = WindowGetMain(); + if (w != nullptr) { - case DDIDX_MULTIPLAYER: - ContextOpenWindow(WindowClass::Multiplayer); - break; - case DDIDX_MULTIPLAYER_RECONNECT: - NetworkReconnect(); - break; + switch (dropdownIndex) + { + case DDIDX_MULTIPLAYER: + ContextOpenWindow(WindowClass::Multiplayer); + break; + case DDIDX_MULTIPLAYER_RECONNECT: + NetworkReconnect(); + break; + } } } -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp index 74d1b1ec8a..7283d4e41d 100644 --- a/src/openrct2-ui/windows/TrackDesignManage.cpp +++ b/src/openrct2-ui/windows/TrackDesignManage.cpp @@ -17,16 +17,18 @@ #include #include -static constexpr StringId WINDOW_TITLE = STR_STRING; -static constexpr int32_t WH = 44; -static constexpr int32_t WW = 250; -static constexpr int32_t WH_DELETE_PROMPT = 74; -static constexpr int32_t WW_DELETE_PROMPT = 250; -static constexpr int32_t TrackDesignNameMaxLength = 127; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_STRING; + static constexpr int32_t WH = 44; + static constexpr int32_t WW = 250; + static constexpr int32_t WH_DELETE_PROMPT = 74; + static constexpr int32_t WW_DELETE_PROMPT = 250; + static constexpr int32_t TrackDesignNameMaxLength = 127; #pragma region Widgets -// clang-format off + // clang-format off enum { WIDX_BACKGROUND, WIDX_TITLE, @@ -42,25 +44,28 @@ static Widget _trackManageWidgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget({ 10, 24}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_TRACK_MANAGE_RENAME), MakeWidget({130, 24}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_TRACK_MANAGE_DELETE), - WIDGETS_END, + kWidgetsEnd, }; static Widget _trackDeletePromptWidgets[] = { WINDOW_SHIM(STR_DELETE_FILE, WW_DELETE_PROMPT, WH_DELETE_PROMPT), MakeWidget({ 10, 54}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_TRACK_MANAGE_DELETE), MakeWidget({130, 54}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_CANCEL ), - WIDGETS_END, + kWidgetsEnd, }; - +// clang-format on #pragma endregion -class TrackDesignManageWindow final : public Window -{ + class TrackDesignManageWindow final : public Window + { private: - TrackDesignFileRef* _trackDesignFileReference{nullptr}; + TrackDesignFileRef* _trackDesignFileReference{ nullptr }; public: - TrackDesignManageWindow(TrackDesignFileRef* tdFileRef) : _trackDesignFileReference(tdFileRef){} + TrackDesignManageWindow(TrackDesignFileRef* tdFileRef) + : _trackDesignFileReference(tdFileRef) + { + } void OnOpen() override; void OnClose() override; @@ -68,170 +73,174 @@ class TrackDesignManageWindow final : public Window void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override; void OnDraw(DrawPixelInfo& dpi) override; - void OnResize() override - { - ResizeFrame(); - } -}; + void OnResize() override + { + ResizeFrame(); + } + }; -class TrackDeletePromptWindow final : public Window -{ + class TrackDeletePromptWindow final : public Window + { private: - TrackDesignFileRef* _trackDesignFileReference{nullptr}; + TrackDesignFileRef* _trackDesignFileReference{ nullptr }; public: - TrackDeletePromptWindow(TrackDesignFileRef* tdFileRef) : _trackDesignFileReference(tdFileRef){} + TrackDeletePromptWindow(TrackDesignFileRef* tdFileRef) + : _trackDesignFileReference(tdFileRef) + { + } void OnOpen() override; void OnMouseUp(WidgetIndex widgetIndex) override; void OnDraw(DrawPixelInfo& dpi) override; - void OnResize() override + void OnResize() override + { + ResizeFrame(); + } + }; + + static void WindowTrackDeletePromptOpen(TrackDesignFileRef* tdFileRef); + + /** + * + * rct2: 0x006D348F + */ + WindowBase* TrackManageOpen(TrackDesignFileRef* tdFileRef) { - ResizeFrame(); + WindowCloseByClass(WindowClass::ManageTrackDesign); + auto trackDesignManageWindow = std::make_unique(tdFileRef); + auto* window = WindowCreate( + std::move(trackDesignManageWindow), WindowClass::ManageTrackDesign, {}, WW, WH, + WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_AUTO_POSITION); + + return window; } -}; -static void WindowTrackDeletePromptOpen(TrackDesignFileRef* tdFileRef); - -/** - * - * rct2: 0x006D348F - */ -WindowBase* WindowTrackManageOpen(TrackDesignFileRef* tdFileRef) -{ - WindowCloseByClass(WindowClass::ManageTrackDesign); - auto trackDesignManageWindow = std::make_unique(tdFileRef); - auto* window = WindowCreate( - std::move(trackDesignManageWindow), WindowClass::ManageTrackDesign, {}, WW, WH, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_AUTO_POSITION); - - return window; -} - -void TrackDesignManageWindow::OnOpen() -{ - widgets = _trackManageWidgets; - WindowInitScrollWidgets(*this); - - WindowTrackDesignListSetBeingUpdated(true); -} - -void TrackDesignManageWindow::OnClose() -{ - WindowTrackDesignListSetBeingUpdated(false); -} - -void TrackDesignManageWindow::OnMouseUp(WidgetIndex widgetIndex) -{ - switch (widgetIndex) + void TrackDesignManageWindow::OnOpen() { - case WIDX_CLOSE: + widgets = _trackManageWidgets; + WindowInitScrollWidgets(*this); + + WindowTrackDesignListSetBeingUpdated(true); + } + + void TrackDesignManageWindow::OnClose() + { + WindowTrackDesignListSetBeingUpdated(false); + } + + void TrackDesignManageWindow::OnMouseUp(WidgetIndex widgetIndex) + { + switch (widgetIndex) + { + case WIDX_CLOSE: + WindowCloseByClass(WindowClass::TrackDeletePrompt); + Close(); + break; + case WIDX_RENAME: + WindowTextInputRawOpen( + this, widgetIndex, STR_TRACK_DESIGN_RENAME_TITLE, STR_TRACK_DESIGN_RENAME_DESC, {}, + _trackDesignFileReference->name.c_str(), TrackDesignNameMaxLength); + break; + case WIDX_DELETE: + WindowTrackDeletePromptOpen(_trackDesignFileReference); + break; + } + } + + void TrackDesignManageWindow::OnTextInput(WidgetIndex widgetIndex, std::string_view text) + { + if (widgetIndex != WIDX_RENAME) + { + return; + } + else if (text.empty()) + { + ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_NONE, {}); + return; + } + else if (!Platform::IsFilenameValid(text)) + { + ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_NEW_NAME_CONTAINS_INVALID_CHARACTERS, {}); + return; + } + + if (TrackRepositoryRename(_trackDesignFileReference->path, std::string(text))) + { WindowCloseByClass(WindowClass::TrackDeletePrompt); Close(); - break; - case WIDX_RENAME: - WindowTextInputRawOpen( - this, widgetIndex, STR_TRACK_DESIGN_RENAME_TITLE, STR_TRACK_DESIGN_RENAME_DESC, {}, - _trackDesignFileReference->name.c_str(), TrackDesignNameMaxLength); - break; - case WIDX_DELETE: - WindowTrackDeletePromptOpen(_trackDesignFileReference); - break; - } -} - -void TrackDesignManageWindow::OnTextInput(WidgetIndex widgetIndex, std::string_view text) -{ - if (widgetIndex != WIDX_RENAME) - { - return; - } - else if (text.empty()) - { - ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_NONE, {}); - return; - } - else if (!Platform::IsFilenameValid(text)) - { - ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_NEW_NAME_CONTAINS_INVALID_CHARACTERS, {}); - return; + WindowTrackDesignListReloadTracks(); + } + else + { + ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED, {}); + } } - if (TrackRepositoryRename(_trackDesignFileReference->path, std::string(text))) + void TrackDesignManageWindow::OnDraw(DrawPixelInfo& dpi) + { + Formatter::Common().Add(_trackDesignFileReference->name.c_str()); + DrawWidgets(dpi); + } + + /** + * + * rct2: 0x006D35CD + */ + static void WindowTrackDeletePromptOpen(TrackDesignFileRef* tdFileRef) { WindowCloseByClass(WindowClass::TrackDeletePrompt); - Close(); - WindowTrackDesignListReloadTracks(); + + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + auto trackDeletePromptWindow = std::make_unique(tdFileRef); + WindowCreate( + std::move(trackDeletePromptWindow), WindowClass::TrackDeletePrompt, + ScreenCoordsXY( + std::max(TOP_TOOLBAR_HEIGHT + 1, (screenWidth - WW_DELETE_PROMPT) / 2), (screenHeight - WH_DELETE_PROMPT) / 2), + WW_DELETE_PROMPT, WH_DELETE_PROMPT, WF_STICK_TO_FRONT | WF_TRANSPARENT); } - else + + void TrackDeletePromptWindow::OnOpen() { - ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED, {}); + widgets = _trackDeletePromptWidgets; + WindowInitScrollWidgets(*this); } -} -void TrackDesignManageWindow::OnDraw(DrawPixelInfo& dpi) -{ - Formatter::Common().Add(_trackDesignFileReference->name.c_str()); - DrawWidgets(dpi); -} - -/** - * - * rct2: 0x006D35CD - */ -static void WindowTrackDeletePromptOpen(TrackDesignFileRef* tdFileRef) -{ - WindowCloseByClass(WindowClass::TrackDeletePrompt); - - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - auto trackDeletePromptWindow = std::make_unique(tdFileRef); - WindowCreate( - std::move(trackDeletePromptWindow), WindowClass::TrackDeletePrompt, ScreenCoordsXY( - std::max(TOP_TOOLBAR_HEIGHT + 1, (screenWidth - WW_DELETE_PROMPT) / 2), (screenHeight - WH_DELETE_PROMPT) / 2), WW_DELETE_PROMPT, WH_DELETE_PROMPT, - WF_STICK_TO_FRONT | WF_TRANSPARENT); -} - -void TrackDeletePromptWindow::OnOpen() -{ - widgets = _trackDeletePromptWidgets; - WindowInitScrollWidgets(*this); -} - -void TrackDeletePromptWindow::OnMouseUp(WidgetIndex widgetIndex) -{ - switch (widgetIndex) + void TrackDeletePromptWindow::OnMouseUp(WidgetIndex widgetIndex) { - case WIDX_CLOSE: - case WIDX_PROMPT_CANCEL: - Close(); - break; - case WIDX_PROMPT_DELETE: - // tdPath has to be saved before window is closed, as that would blank it out. - auto tdPath = _trackDesignFileReference->path; - Close(); - if (TrackRepositoryDelete(tdPath)) - { - WindowCloseByClass(WindowClass::ManageTrackDesign); - WindowTrackDesignListReloadTracks(); - } - else - { - ContextShowError(STR_CANT_DELETE_TRACK_DESIGN, STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED, {}); - } - break; + switch (widgetIndex) + { + case WIDX_CLOSE: + case WIDX_PROMPT_CANCEL: + Close(); + break; + case WIDX_PROMPT_DELETE: + // tdPath has to be saved before window is closed, as that would blank it out. + auto tdPath = _trackDesignFileReference->path; + Close(); + if (TrackRepositoryDelete(tdPath)) + { + WindowCloseByClass(WindowClass::ManageTrackDesign); + WindowTrackDesignListReloadTracks(); + } + else + { + ContextShowError(STR_CANT_DELETE_TRACK_DESIGN, STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED, {}); + } + break; + } } -} -void TrackDeletePromptWindow::OnDraw(DrawPixelInfo& dpi) -{ - DrawWidgets(dpi); - - auto ft = Formatter(); - ft.Add(_trackDesignFileReference->name.c_str()); - DrawTextWrapped( - dpi, { windowPos.x + (WW_DELETE_PROMPT / 2), windowPos.y + ((WH_DELETE_PROMPT / 2) - 9) }, (WW_DELETE_PROMPT - 4), - STR_ARE_YOU_SURE_YOU_WANT_TO_PERMANENTLY_DELETE_TRACK, ft, { TextAlignment::CENTRE }); -} + void TrackDeletePromptWindow::OnDraw(DrawPixelInfo& dpi) + { + DrawWidgets(dpi); + auto ft = Formatter(); + ft.Add(_trackDesignFileReference->name.c_str()); + DrawTextWrapped( + dpi, { windowPos.x + (WW_DELETE_PROMPT / 2), windowPos.y + ((WH_DELETE_PROMPT / 2) - 9) }, (WW_DELETE_PROMPT - 4), + STR_ARE_YOU_SURE_YOU_WANT_TO_PERMANENTLY_DELETE_TRACK, ft, { TextAlignment::CENTRE }); + } +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index b8f73b0454..83b47a8ce3 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -34,22 +34,23 @@ #include #include -using namespace OpenRCT2; using namespace OpenRCT2::TrackMetaData; -static constexpr StringId WINDOW_TITLE = STR_STRING; -static constexpr int32_t WH = 124; -static constexpr int32_t WW = 200; -constexpr int16_t TRACK_MINI_PREVIEW_WIDTH = 168; -constexpr int16_t TRACK_MINI_PREVIEW_HEIGHT = 78; -constexpr uint16_t TRACK_MINI_PREVIEW_SIZE = TRACK_MINI_PREVIEW_WIDTH * TRACK_MINI_PREVIEW_HEIGHT; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_STRING; + static constexpr int32_t WH = 124; + static constexpr int32_t WW = 200; + constexpr int16_t TRACK_MINI_PREVIEW_WIDTH = 168; + constexpr int16_t TRACK_MINI_PREVIEW_HEIGHT = 78; + constexpr uint16_t TRACK_MINI_PREVIEW_SIZE = TRACK_MINI_PREVIEW_WIDTH * TRACK_MINI_PREVIEW_HEIGHT; -static constexpr uint8_t _PaletteIndexColourEntrance = PALETTE_INDEX_20; // White -static constexpr uint8_t _PaletteIndexColourExit = PALETTE_INDEX_10; // Black -static constexpr uint8_t _PaletteIndexColourTrack = PALETTE_INDEX_248; // Grey (dark) -static constexpr uint8_t _PaletteIndexColourStation = PALETTE_INDEX_252; // Grey (light) + static constexpr uint8_t _PaletteIndexColourEntrance = PALETTE_INDEX_20; // White + static constexpr uint8_t _PaletteIndexColourExit = PALETTE_INDEX_10; // Black + static constexpr uint8_t _PaletteIndexColourTrack = PALETTE_INDEX_248; // Grey (dark) + static constexpr uint8_t _PaletteIndexColourStation = PALETTE_INDEX_252; // Grey (light) -// clang-format off + // clang-format off enum { WIDX_BACKGROUND, WIDX_TITLE, @@ -68,583 +69,586 @@ static Widget _trackPlaceWidgets[] = { MakeWidget({173, 59}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_MIRROR_ARROW), STR_MIRROR_IMAGE_TIP ), MakeWidget({ 4, 109}, {192, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_SELECT_A_DIFFERENT_DESIGN, STR_GO_BACK_TO_DESIGN_SELECTION_WINDOW_TIP), MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class TrackDesignPlaceWindow final : public Window -{ -public: - void OnOpen() override + class TrackDesignPlaceWindow final : public Window { - widgets = _trackPlaceWidgets; - WindowInitScrollWidgets(*this); - ToolSet(*this, WIDX_PRICE, Tool::Crosshair); - InputSetFlag(INPUT_FLAG_6, true); - WindowPushOthersRight(*this); - ShowGridlines(); - _miniPreview.resize(TRACK_MINI_PREVIEW_SIZE); - _placementCost = kMoney64Undefined; - _placementLoc.SetNull(); - _currentTrackPieceDirection = (2 - GetCurrentRotation()) & 3; - } - - void OnClose() override - { - ClearProvisional(); - ViewportSetVisibility(ViewportVisibility::Default); - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - HideGridlines(); - _miniPreview.clear(); - _miniPreview.shrink_to_fit(); - _trackDesign = nullptr; - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + public: + void OnOpen() override { - case WIDX_CLOSE: - Close(); - break; - case WIDX_ROTATE: + widgets = _trackPlaceWidgets; + WindowInitScrollWidgets(*this); + ToolSet(*this, WIDX_PRICE, Tool::Crosshair); + InputSetFlag(INPUT_FLAG_6, true); + WindowPushOthersRight(*this); + ShowGridlines(); + _miniPreview.resize(TRACK_MINI_PREVIEW_SIZE); + _placementCost = kMoney64Undefined; + _placementLoc.SetNull(); + _currentTrackPieceDirection = (2 - GetCurrentRotation()) & 3; + } + + void OnClose() override + { + ClearProvisional(); + ViewportSetVisibility(ViewportVisibility::Default); + MapInvalidateMapSelectionTiles(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + HideGridlines(); + _miniPreview.clear(); + _miniPreview.shrink_to_fit(); + _trackDesign = nullptr; + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_ROTATE: + ClearProvisional(); + _currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3; + Invalidate(); + _placementLoc.SetNull(); + DrawMiniPreview(_trackDesign.get()); + break; + case WIDX_MIRROR: + TrackDesignMirror(_trackDesign.get()); + _currentTrackPieceDirection = (0 - _currentTrackPieceDirection) & 3; + Invalidate(); + _placementLoc.SetNull(); + DrawMiniPreview(_trackDesign.get()); + break; + case WIDX_SELECT_DIFFERENT_DESIGN: + Close(); + + auto intent = Intent(WindowClass::TrackDesignList); + intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, _window_track_list_item.Type); + intent.PutExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, _window_track_list_item.EntryIndex); + ContextOpenIntent(&intent); + break; + } + } + + void OnUpdate() override + { + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) + if (gCurrentToolWidget.window_classification != WindowClass::TrackDesignPlace) + Close(); + } + + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + TrackDesignState tds{}; + int16_t mapZ; + + MapInvalidateMapSelectionTiles(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; + + // Get the tool map position + CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); + if (mapCoords.IsNull()) + { ClearProvisional(); - _currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3; - Invalidate(); - _placementLoc.SetNull(); - DrawMiniPreview(_trackDesign.get()); - break; - case WIDX_MIRROR: - TrackDesignMirror(_trackDesign.get()); - _currentTrackPieceDirection = (0 - _currentTrackPieceDirection) & 3; - Invalidate(); - _placementLoc.SetNull(); - DrawMiniPreview(_trackDesign.get()); - break; - case WIDX_SELECT_DIFFERENT_DESIGN: - Close(); + return; + } - auto intent = Intent(WindowClass::TrackDesignList); - intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, _window_track_list_item.Type); - intent.PutExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, _window_track_list_item.EntryIndex); - ContextOpenIntent(&intent); - break; + // Check if tool map position has changed since last update + if (mapCoords == _placementLoc) + { + TrackDesignPreviewDrawOutlines( + tds, _trackDesign.get(), RideGetTemporaryForPreview(), { mapCoords, 0, _currentTrackPieceDirection }); + return; + } + + money64 cost = kMoney64Undefined; + + // Get base Z position + mapZ = GetBaseZ(mapCoords); + CoordsXYZD trackLoc = { mapCoords, mapZ, _currentTrackPieceDirection }; + + if (GameIsNotPaused() || GetGameState().Cheats.BuildInPauseMode) + { + ClearProvisional(); + auto res = FindValidTrackDesignPlaceHeight(trackLoc, GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); + + if (res.Error == GameActions::Status::Ok) + { + // Valid location found. Place the ghost at the location. + auto tdAction = TrackDesignAction(trackLoc, *_trackDesign); + tdAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); + tdAction.SetCallback([&](const GameAction*, const GameActions::Result* result) { + if (result->Error == GameActions::Status::Ok) + { + _placementGhostRideId = result->GetData(); + _placementGhostLoc = trackLoc; + _hasPlacementGhost = true; + } + }); + res = GameActions::Execute(&tdAction); + cost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; + } + } + + _placementLoc = trackLoc; + if (cost != _placementCost) + { + _placementCost = cost; + WidgetInvalidate(*this, WIDX_PRICE); + } + + TrackDesignPreviewDrawOutlines(tds, _trackDesign.get(), RideGetTemporaryForPreview(), trackLoc); } - } - void OnUpdate() override - { - if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) - if (gCurrentToolWidget.window_classification != WindowClass::TrackDesignPlace) - Close(); - } - - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - TrackDesignState tds{}; - int16_t mapZ; - - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - - // Get the tool map position - CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); - if (mapCoords.IsNull()) + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { ClearProvisional(); - return; - } + MapInvalidateMapSelectionTiles(); + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; + gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - // Check if tool map position has changed since last update - if (mapCoords == _placementLoc) - { - TrackDesignPreviewDrawOutlines( - tds, _trackDesign.get(), RideGetTemporaryForPreview(), { mapCoords, 0, _currentTrackPieceDirection }); - return; - } + const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); + if (mapCoords.IsNull()) + return; - money64 cost = kMoney64Undefined; - - // Get base Z position - mapZ = GetBaseZ(mapCoords); - CoordsXYZD trackLoc = { mapCoords, mapZ, _currentTrackPieceDirection }; - - if (GameIsNotPaused() || gCheatsBuildInPauseMode) - { - ClearProvisional(); - auto res = FindValidTrackDesignPlaceHeight(trackLoc, GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); + // Try increasing Z until a feasible placement is found + int16_t mapZ = GetBaseZ(mapCoords); + CoordsXYZ trackLoc = { mapCoords, mapZ }; + auto res = FindValidTrackDesignPlaceHeight(trackLoc, 0); if (res.Error == GameActions::Status::Ok) { - // Valid location found. Place the ghost at the location. - auto tdAction = TrackDesignAction(trackLoc, *_trackDesign); - tdAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); + auto tdAction = TrackDesignAction({ trackLoc, _currentTrackPieceDirection }, *_trackDesign); tdAction.SetCallback([&](const GameAction*, const GameActions::Result* result) { if (result->Error == GameActions::Status::Ok) { - _placementGhostRideId = result->GetData(); - _placementGhostLoc = trackLoc; - _hasPlacementGhost = true; + rideId = result->GetData(); + auto getRide = GetRide(rideId); + if (getRide != nullptr) + { + WindowCloseByClass(WindowClass::Error); + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, trackLoc); + + _currentRideIndex = rideId; + if (TrackDesignAreEntranceAndExitPlaced()) + { + auto intent = Intent(WindowClass::Ride); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, rideId.ToUnderlying()); + ContextOpenIntent(&intent); + auto wnd = WindowFindByClass(WindowClass::TrackDesignPlace); + WindowClose(*wnd); + } + else + { + RideInitialiseConstructionWindow(*getRide); + auto wnd = WindowFindByClass(WindowClass::RideConstruction); + wnd->OnMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); + } + } + } + else + { + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Error, result->Position); } }); - res = GameActions::Execute(&tdAction); - cost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; + GameActions::Execute(&tdAction); + return; + } + + // Unable to build track + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Error, trackLoc); + + auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); + windowManager->ShowError(res.GetErrorTitle(), res.GetErrorMessage()); + } + + void OnToolAbort(WidgetIndex widgetIndex) override + { + ClearProvisional(); + } + + void OnViewportRotate() override + { + DrawMiniPreview(_trackDesign.get()); + } + + void OnPrepareDraw() override + { + DrawMiniPreview(_trackDesign.get()); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + auto ft = Formatter::Common(); + ft.Add(_trackDesign->name.c_str()); + WindowDrawWidgets(*this, dpi); + + // Draw mini tile preview + DrawPixelInfo clippedDpi; + if (ClipDrawPixelInfo(clippedDpi, dpi, this->windowPos + ScreenCoordsXY{ 4, 18 }, 168, 78)) + { + G1Element g1temp = {}; + g1temp.offset = _miniPreview.data(); + g1temp.width = TRACK_MINI_PREVIEW_WIDTH; + g1temp.height = TRACK_MINI_PREVIEW_HEIGHT; + GfxSetG1Element(SPR_TEMP, &g1temp); + DrawingEngineInvalidateImage(SPR_TEMP); + GfxDrawSprite(clippedDpi, ImageId(SPR_TEMP, NOT_TRANSLUCENT(this->colours[0])), { 0, 0 }); + } + + // Price + if (_placementCost != kMoney64Undefined && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + ft = Formatter(); + ft.Add(_placementCost); + DrawTextBasic(dpi, this->windowPos + ScreenCoordsXY{ 88, 94 }, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); } } - _placementLoc = trackLoc; - if (cost != _placementCost) + void OnResize() override { - _placementCost = cost; - WidgetInvalidate(*this, WIDX_PRICE); + ResizeFrame(); } - TrackDesignPreviewDrawOutlines(tds, _trackDesign.get(), RideGetTemporaryForPreview(), trackLoc); - } - - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - ClearProvisional(); - MapInvalidateMapSelectionTiles(); - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - - const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); - if (mapCoords.IsNull()) - return; - - // Try increasing Z until a feasible placement is found - int16_t mapZ = GetBaseZ(mapCoords); - CoordsXYZ trackLoc = { mapCoords, mapZ }; - - auto res = FindValidTrackDesignPlaceHeight(trackLoc, 0); - if (res.Error == GameActions::Status::Ok) + void ClearProvisionalTemporarily() { - auto tdAction = TrackDesignAction({ trackLoc, _currentTrackPieceDirection }, *_trackDesign); - tdAction.SetCallback([&](const GameAction*, const GameActions::Result* result) { - if (result->Error == GameActions::Status::Ok) + if (_hasPlacementGhost) + { + auto provRide = GetRide(_placementGhostRideId); + if (provRide != nullptr) { - rideId = result->GetData(); - auto getRide = GetRide(rideId); - if (getRide != nullptr) - { - WindowCloseByClass(WindowClass::Error); - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, trackLoc); + TrackDesignPreviewRemoveGhosts(_trackDesign.get(), *provRide, _placementGhostLoc); + } + } + } - _currentRideIndex = rideId; - if (TrackDesignAreEntranceAndExitPlaced()) - { - auto intent = Intent(WindowClass::Ride); - intent.PutExtra(INTENT_EXTRA_RIDE_ID, rideId.ToUnderlying()); - ContextOpenIntent(&intent); - auto wnd = WindowFindByClass(WindowClass::TrackDesignPlace); - WindowClose(*wnd); - } - else - { - RideInitialiseConstructionWindow(*getRide); - auto wnd = WindowFindByClass(WindowClass::RideConstruction); - WindowEventMouseUpCall(wnd, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); - } - } + void RestoreProvisional() + { + if (_hasPlacementGhost) + { + auto tdAction = TrackDesignAction({ _placementGhostLoc }, *_trackDesign); + tdAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); + auto res = GameActions::Execute(&tdAction); + if (res.Error != GameActions::Status::Ok) + { + _hasPlacementGhost = false; + } + } + } + + void Init(std::unique_ptr&& trackDesign) + { + _trackDesign = std::move(trackDesign); + } + + void DrawMiniPreview(TrackDesign* td6) + { + ClearMiniPreview(); + + // First pass is used to determine the width and height of the image so it can centre it + CoordsXY min = { 0, 0 }; + CoordsXY max = { 0, 0 }; + for (int32_t pass = 0; pass < 2; pass++) + { + CoordsXY origin = { 0, 0 }; + if (pass == 1) + { + origin.x -= ((max.x + min.x) >> 6) * COORDS_XY_STEP; + origin.y -= ((max.y + min.y) >> 6) * COORDS_XY_STEP; + } + + const auto& rtd = GetRideTypeDescriptor(td6->type); + if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) + { + DrawMiniPreviewMaze(td6, pass, origin, min, max); } else { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Error, result->Position); + DrawMiniPreviewTrack(td6, pass, origin, min, max); } - }); - GameActions::Execute(&tdAction); - return; - } - - // Unable to build track - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Error, trackLoc); - - auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); - windowManager->ShowError(res.GetErrorTitle(), res.GetErrorMessage()); - } - - void OnToolAbort(WidgetIndex widgetIndex) override - { - ClearProvisional(); - } - - void OnViewportRotate() override - { - DrawMiniPreview(_trackDesign.get()); - } - - void OnPrepareDraw() override - { - DrawMiniPreview(_trackDesign.get()); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - auto ft = Formatter::Common(); - ft.Add(_trackDesign->name.c_str()); - WindowDrawWidgets(*this, dpi); - - // Draw mini tile preview - DrawPixelInfo clippedDpi; - if (ClipDrawPixelInfo(clippedDpi, dpi, this->windowPos + ScreenCoordsXY{ 4, 18 }, 168, 78)) - { - G1Element g1temp = {}; - g1temp.offset = _miniPreview.data(); - g1temp.width = TRACK_MINI_PREVIEW_WIDTH; - g1temp.height = TRACK_MINI_PREVIEW_HEIGHT; - GfxSetG1Element(SPR_TEMP, &g1temp); - DrawingEngineInvalidateImage(SPR_TEMP); - GfxDrawSprite(clippedDpi, ImageId(SPR_TEMP, NOT_TRANSLUCENT(this->colours[0])), { 0, 0 }); - } - - // Price - if (_placementCost != kMoney64Undefined && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) - { - ft = Formatter(); - ft.Add(_placementCost); - DrawTextBasic(dpi, this->windowPos + ScreenCoordsXY{ 88, 94 }, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); - } - } - - void OnResize() override - { - ResizeFrame(); - } - - void ClearProvisionalTemporarily() - { - if (_hasPlacementGhost) - { - auto provRide = GetRide(_placementGhostRideId); - if (provRide != nullptr) - { - TrackDesignPreviewRemoveGhosts(_trackDesign.get(), *provRide, _placementGhostLoc); } } - } - void RestoreProvisional() - { - if (_hasPlacementGhost) + void ClearMiniPreview() { - auto tdAction = TrackDesignAction({ _placementGhostLoc }, *_trackDesign); - tdAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); - auto res = GameActions::Execute(&tdAction); - if (res.Error != GameActions::Status::Ok) - { - _hasPlacementGhost = false; - } - } - } - - void Init(std::unique_ptr&& trackDesign) - { - _trackDesign = std::move(trackDesign); - } - - void DrawMiniPreview(TrackDesign* td6) - { - ClearMiniPreview(); - - // First pass is used to determine the width and height of the image so it can centre it - CoordsXY min = { 0, 0 }; - CoordsXY max = { 0, 0 }; - for (int32_t pass = 0; pass < 2; pass++) - { - CoordsXY origin = { 0, 0 }; - if (pass == 1) - { - origin.x -= ((max.x + min.x) >> 6) * COORDS_XY_STEP; - origin.y -= ((max.y + min.y) >> 6) * COORDS_XY_STEP; - } - - const auto& rtd = GetRideTypeDescriptor(td6->type); - if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) - { - DrawMiniPreviewMaze(td6, pass, origin, min, max); - } - else - { - DrawMiniPreviewTrack(td6, pass, origin, min, max); - } - } - } - - void ClearMiniPreview() - { - // Fill with transparent colour. - std::fill(_miniPreview.begin(), _miniPreview.end(), PALETTE_INDEX_0); - } - -private: - std::unique_ptr _trackDesign; - - CoordsXY _placementLoc; - RideId _placementGhostRideId; - bool _hasPlacementGhost; - money64 _placementCost; - CoordsXYZD _placementGhostLoc; - - std::vector _miniPreview; - - void ClearProvisional() - { - if (_hasPlacementGhost) - { - auto newRide = GetRide(_placementGhostRideId); - if (newRide != nullptr) - { - TrackDesignPreviewRemoveGhosts(_trackDesign.get(), *newRide, _placementGhostLoc); - _hasPlacementGhost = false; - } - } - } - - int32_t GetBaseZ(const CoordsXY& loc) - { - auto surfaceElement = MapGetSurfaceElementAt(loc); - if (surfaceElement == nullptr) - return 0; - - auto z = surfaceElement->GetBaseZ(); - - // Increase Z above slope - if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) - { - z += 16; - - // Increase Z above double slope - if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) - z += 16; + // Fill with transparent colour. + std::fill(_miniPreview.begin(), _miniPreview.end(), PALETTE_INDEX_0); } - // Increase Z above water - if (surfaceElement->GetWaterHeight() > 0) - z = std::max(z, surfaceElement->GetWaterHeight()); + private: + std::unique_ptr _trackDesign; - return z - + TrackDesignGetZPlacement( - _trackDesign.get(), RideGetTemporaryForPreview(), { loc, z, _currentTrackPieceDirection }); - } + CoordsXY _placementLoc; + RideId _placementGhostRideId; + bool _hasPlacementGhost; + money64 _placementCost; + CoordsXYZD _placementGhostLoc; - void DrawMiniPreviewEntrances( - const TrackDesign& td6, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max, Direction rotation) - { - for (const auto& entrance : td6.entrance_elements) + std::vector _miniPreview; + + void ClearProvisional() { - auto rotatedAndOffsetEntrance = origin + entrance.Location.ToCoordsXY().Rotate(rotation); - - if (pass == 0) + if (_hasPlacementGhost) { - min.x = std::min(min.x, rotatedAndOffsetEntrance.x); - max.x = std::max(max.x, rotatedAndOffsetEntrance.x); - min.y = std::min(min.y, rotatedAndOffsetEntrance.y); - max.y = std::max(max.y, rotatedAndOffsetEntrance.y); - } - else - { - auto pixelPosition = DrawMiniPreviewGetPixelPosition(rotatedAndOffsetEntrance); - if (DrawMiniPreviewIsPixelInBounds(pixelPosition)) + auto newRide = GetRide(_placementGhostRideId); + if (newRide != nullptr) { - uint8_t* pixel = DrawMiniPreviewGetPixelPtr(pixelPosition); - uint8_t colour = entrance.IsExit ? _PaletteIndexColourExit : _PaletteIndexColourEntrance; - for (int32_t i = 0; i < 4; i++) - { - pixel[338 + i] = colour; // x + 2, y + 2 - pixel[168 + i] = colour; // y + 1 - pixel[2 + i] = colour; // x + 2 - pixel[172 + i] = colour; // x + 4, y + 1 - } + TrackDesignPreviewRemoveGhosts(_trackDesign.get(), *newRide, _placementGhostLoc); + _hasPlacementGhost = false; } } } - } - void DrawMiniPreviewTrack(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max) - { - const uint8_t rotation = (_currentTrackPieceDirection + GetCurrentRotation()) & 3; - - CoordsXY curTrackStart = origin; - uint8_t curTrackRotation = rotation; - for (const auto& trackElement : td6->track_elements) + int32_t GetBaseZ(const CoordsXY& loc) { - // Follow a single track piece shape - const auto& ted = GetTrackElementDescriptor(trackElement.Type); - const PreviewTrack* trackBlock = ted.Block; - while (trackBlock->index != 255) + auto surfaceElement = MapGetSurfaceElementAt(loc); + if (surfaceElement == nullptr) + return 0; + + auto z = surfaceElement->GetBaseZ(); + + // Increase Z above slope + if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) { - auto rotatedAndOffsetTrackBlock = curTrackStart - + CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(curTrackRotation); + z += 16; + + // Increase Z above double slope + if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) + z += 16; + } + + // Increase Z above water + if (surfaceElement->GetWaterHeight() > 0) + z = std::max(z, surfaceElement->GetWaterHeight()); + + return z + + TrackDesignGetZPlacement( + _trackDesign.get(), RideGetTemporaryForPreview(), { loc, z, _currentTrackPieceDirection }); + } + + void DrawMiniPreviewEntrances( + const TrackDesign& td6, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max, Direction rotation) + { + for (const auto& entrance : td6.entrance_elements) + { + auto rotatedAndOffsetEntrance = origin + entrance.Location.ToCoordsXY().Rotate(rotation); if (pass == 0) { - min.x = std::min(min.x, rotatedAndOffsetTrackBlock.x); - max.x = std::max(max.x, rotatedAndOffsetTrackBlock.x); - min.y = std::min(min.y, rotatedAndOffsetTrackBlock.y); - max.y = std::max(max.y, rotatedAndOffsetTrackBlock.y); + min.x = std::min(min.x, rotatedAndOffsetEntrance.x); + max.x = std::max(max.x, rotatedAndOffsetEntrance.x); + min.y = std::min(min.y, rotatedAndOffsetEntrance.y); + max.y = std::max(max.y, rotatedAndOffsetEntrance.y); } else { - auto pixelPosition = DrawMiniPreviewGetPixelPosition(rotatedAndOffsetTrackBlock); + auto pixelPosition = DrawMiniPreviewGetPixelPosition(rotatedAndOffsetEntrance); + if (DrawMiniPreviewIsPixelInBounds(pixelPosition)) + { + uint8_t* pixel = DrawMiniPreviewGetPixelPtr(pixelPosition); + uint8_t colour = entrance.IsExit ? _PaletteIndexColourExit : _PaletteIndexColourEntrance; + for (int32_t i = 0; i < 4; i++) + { + pixel[338 + i] = colour; // x + 2, y + 2 + pixel[168 + i] = colour; // y + 1 + pixel[2 + i] = colour; // x + 2 + pixel[172 + i] = colour; // x + 4, y + 1 + } + } + } + } + } + + void DrawMiniPreviewTrack(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max) + { + const uint8_t rotation = (_currentTrackPieceDirection + GetCurrentRotation()) & 3; + + CoordsXY curTrackStart = origin; + uint8_t curTrackRotation = rotation; + for (const auto& trackElement : td6->track_elements) + { + // Follow a single track piece shape + const auto& ted = GetTrackElementDescriptor(trackElement.Type); + const PreviewTrack* trackBlock = ted.Block; + while (trackBlock->index != 255) + { + auto rotatedAndOffsetTrackBlock = curTrackStart + + CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(curTrackRotation); + + if (pass == 0) + { + min.x = std::min(min.x, rotatedAndOffsetTrackBlock.x); + max.x = std::max(max.x, rotatedAndOffsetTrackBlock.x); + min.y = std::min(min.y, rotatedAndOffsetTrackBlock.y); + max.y = std::max(max.y, rotatedAndOffsetTrackBlock.y); + } + else + { + auto pixelPosition = DrawMiniPreviewGetPixelPosition(rotatedAndOffsetTrackBlock); + if (DrawMiniPreviewIsPixelInBounds(pixelPosition)) + { + uint8_t* pixel = DrawMiniPreviewGetPixelPtr(pixelPosition); + + auto bits = trackBlock->var_08.Rotate(curTrackRotation & 3).GetBaseQuarterOccupied(); + + // Station track is a lighter colour + uint8_t colour = (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) + ? _PaletteIndexColourStation + : _PaletteIndexColourTrack; + + for (int32_t i = 0; i < 4; i++) + { + if (bits & 1) + pixel[338 + i] = colour; // x + 2, y + 2 + if (bits & 2) + pixel[168 + i] = colour; // y + 1 + if (bits & 4) + pixel[2 + i] = colour; // x + 2 + if (bits & 8) + pixel[172 + i] = colour; // x + 4, y + 1 + } + } + } + trackBlock++; + } + + // Change rotation and next position based on track curvature + curTrackRotation &= 3; + + const TrackCoordinates* track_coordinate = &ted.Coordinates; + + curTrackStart += CoordsXY{ track_coordinate->x, track_coordinate->y }.Rotate(curTrackRotation); + curTrackRotation += track_coordinate->rotation_end - track_coordinate->rotation_begin; + curTrackRotation &= 3; + if (track_coordinate->rotation_end & 4) + { + curTrackRotation |= 4; + } + if (!(curTrackRotation & 4)) + { + curTrackStart += CoordsDirectionDelta[curTrackRotation]; + } + } + + DrawMiniPreviewEntrances(*td6, pass, origin, min, max, rotation); + } + + void DrawMiniPreviewMaze(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max) + { + uint8_t rotation = (_currentTrackPieceDirection + GetCurrentRotation()) & 3; + for (const auto& mazeElement : td6->maze_elements) + { + auto rotatedMazeCoords = origin + TileCoordsXY{ mazeElement.x, mazeElement.y }.ToCoordsXY().Rotate(rotation); + + if (pass == 0) + { + min.x = std::min(min.x, rotatedMazeCoords.x); + max.x = std::max(max.x, rotatedMazeCoords.x); + min.y = std::min(min.y, rotatedMazeCoords.y); + max.y = std::max(max.y, rotatedMazeCoords.y); + } + else + { + auto pixelPosition = DrawMiniPreviewGetPixelPosition(rotatedMazeCoords); if (DrawMiniPreviewIsPixelInBounds(pixelPosition)) { uint8_t* pixel = DrawMiniPreviewGetPixelPtr(pixelPosition); - auto bits = trackBlock->var_08.Rotate(curTrackRotation & 3).GetBaseQuarterOccupied(); - - // Station track is a lighter colour - uint8_t colour = (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) ? _PaletteIndexColourStation - : _PaletteIndexColourTrack; - + uint8_t colour = _PaletteIndexColourTrack; for (int32_t i = 0; i < 4; i++) { - if (bits & 1) - pixel[338 + i] = colour; // x + 2, y + 2 - if (bits & 2) - pixel[168 + i] = colour; // y + 1 - if (bits & 4) - pixel[2 + i] = colour; // x + 2 - if (bits & 8) - pixel[172 + i] = colour; // x + 4, y + 1 + pixel[338 + i] = colour; // x + 2, y + 2 + pixel[168 + i] = colour; // y + 1 + pixel[2 + i] = colour; // x + 2 + pixel[172 + i] = colour; // x + 4, y + 1 } } } - trackBlock++; } - // Change rotation and next position based on track curvature - curTrackRotation &= 3; - - const TrackCoordinates* track_coordinate = &ted.Coordinates; - - curTrackStart += CoordsXY{ track_coordinate->x, track_coordinate->y }.Rotate(curTrackRotation); - curTrackRotation += track_coordinate->rotation_end - track_coordinate->rotation_begin; - curTrackRotation &= 3; - if (track_coordinate->rotation_end & 4) - { - curTrackRotation |= 4; - } - if (!(curTrackRotation & 4)) - { - curTrackStart += CoordsDirectionDelta[curTrackRotation]; - } + DrawMiniPreviewEntrances(*td6, pass, origin, min, max, rotation); } - DrawMiniPreviewEntrances(*td6, pass, origin, min, max, rotation); - } - - void DrawMiniPreviewMaze(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max) - { - uint8_t rotation = (_currentTrackPieceDirection + GetCurrentRotation()) & 3; - for (const auto& mazeElement : td6->maze_elements) + ScreenCoordsXY DrawMiniPreviewGetPixelPosition(const CoordsXY& location) { - auto rotatedMazeCoords = origin + TileCoordsXY{ mazeElement.x, mazeElement.y }.ToCoordsXY().Rotate(rotation); + auto tilePos = TileCoordsXY(location); + return { (80 + (tilePos.y - tilePos.x) * 4), (38 + (tilePos.y + tilePos.x) * 2) }; + } - if (pass == 0) + bool DrawMiniPreviewIsPixelInBounds(const ScreenCoordsXY& pixel) + { + return pixel.x >= 0 && pixel.y >= 0 && pixel.x <= 160 && pixel.y <= 75; + } + + uint8_t* DrawMiniPreviewGetPixelPtr(const ScreenCoordsXY& pixel) + { + return &_miniPreview[pixel.y * TRACK_MINI_PREVIEW_WIDTH + pixel.x]; + } + + GameActions::Result FindValidTrackDesignPlaceHeight(CoordsXYZ& loc, uint32_t newFlags) + { + GameActions::Result res; + for (int32_t i = 0; i < 7; i++, loc.z += 8) { - min.x = std::min(min.x, rotatedMazeCoords.x); - max.x = std::max(max.x, rotatedMazeCoords.x); - min.y = std::min(min.y, rotatedMazeCoords.y); - max.y = std::max(max.y, rotatedMazeCoords.y); - } - else - { - auto pixelPosition = DrawMiniPreviewGetPixelPosition(rotatedMazeCoords); - if (DrawMiniPreviewIsPixelInBounds(pixelPosition)) + auto tdAction = TrackDesignAction( + CoordsXYZD{ loc.x, loc.y, loc.z, _currentTrackPieceDirection }, *_trackDesign); + tdAction.SetFlags(newFlags); + res = GameActions::Query(&tdAction); + + // If successful don't keep trying. + // If failure due to no money then increasing height only makes problem worse + if (res.Error == GameActions::Status::Ok || res.Error == GameActions::Status::InsufficientFunds) { - uint8_t* pixel = DrawMiniPreviewGetPixelPtr(pixelPosition); - - uint8_t colour = _PaletteIndexColourTrack; - for (int32_t i = 0; i < 4; i++) - { - pixel[338 + i] = colour; // x + 2, y + 2 - pixel[168 + i] = colour; // y + 1 - pixel[2 + i] = colour; // x + 2 - pixel[172 + i] = colour; // x + 4, y + 1 - } + return res; } } + return res; } + }; - DrawMiniPreviewEntrances(*td6, pass, origin, min, max, rotation); - } - - ScreenCoordsXY DrawMiniPreviewGetPixelPosition(const CoordsXY& location) + WindowBase* TrackPlaceOpen(const TrackDesignFileRef* tdFileRef) { - auto tilePos = TileCoordsXY(location); - return { (80 + (tilePos.y - tilePos.x) * 4), (38 + (tilePos.y + tilePos.x) * 2) }; - } + std::unique_ptr openTrackDesign = TrackDesignImport(tdFileRef->path.c_str()); - bool DrawMiniPreviewIsPixelInBounds(const ScreenCoordsXY& pixel) - { - return pixel.x >= 0 && pixel.y >= 0 && pixel.x <= 160 && pixel.y <= 75; - } - - uint8_t* DrawMiniPreviewGetPixelPtr(const ScreenCoordsXY& pixel) - { - return &_miniPreview[pixel.y * TRACK_MINI_PREVIEW_WIDTH + pixel.x]; - } - - GameActions::Result FindValidTrackDesignPlaceHeight(CoordsXYZ& loc, uint32_t newFlags) - { - GameActions::Result res; - for (int32_t i = 0; i < 7; i++, loc.z += 8) + if (openTrackDesign == nullptr) { - auto tdAction = TrackDesignAction(CoordsXYZD{ loc.x, loc.y, loc.z, _currentTrackPieceDirection }, *_trackDesign); - tdAction.SetFlags(newFlags); - res = GameActions::Query(&tdAction); - - // If successful don't keep trying. - // If failure due to no money then increasing height only makes problem worse - if (res.Error == GameActions::Status::Ok || res.Error == GameActions::Status::InsufficientFunds) - { - return res; - } + return nullptr; } - return res; + + WindowCloseConstructionWindows(); + + auto* window = WindowFocusOrCreate(WindowClass::TrackDesignPlace, WW, WH, 0); + if (window != nullptr) + { + window->Init(std::move(openTrackDesign)); + } + return window; } -}; -WindowBase* WindowTrackPlaceOpen(const TrackDesignFileRef* tdFileRef) -{ - std::unique_ptr openTrackDesign = TrackDesignImport(tdFileRef->path.c_str()); - - if (openTrackDesign == nullptr) + void TrackPlaceClearProvisionalTemporarily() { - return nullptr; + auto* trackPlaceWnd = static_cast(WindowFindByClass(WindowClass::TrackDesignPlace)); + if (trackPlaceWnd != nullptr) + { + trackPlaceWnd->ClearProvisionalTemporarily(); + } } - WindowCloseConstructionWindows(); - - auto* window = WindowFocusOrCreate(WindowClass::TrackDesignPlace, WW, WH, 0); - if (window != nullptr) + void TrackPlaceRestoreProvisional() { - window->Init(std::move(openTrackDesign)); + auto* trackPlaceWnd = static_cast(WindowFindByClass(WindowClass::TrackDesignPlace)); + if (trackPlaceWnd != nullptr) + { + trackPlaceWnd->RestoreProvisional(); + } } - return window; -} - -void TrackPlaceClearProvisionalTemporarily() -{ - auto* trackPlaceWnd = static_cast(WindowFindByClass(WindowClass::TrackDesignPlace)); - if (trackPlaceWnd != nullptr) - { - trackPlaceWnd->ClearProvisionalTemporarily(); - } -} - -void TrackPlaceRestoreProvisional() -{ - auto* trackPlaceWnd = static_cast(WindowFindByClass(WindowClass::TrackDesignPlace)); - if (trackPlaceWnd != nullptr) - { - trackPlaceWnd->RestoreProvisional(); - } -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 4ccc770762..6c360c2b29 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -28,14 +28,16 @@ #include #include -static constexpr StringId WINDOW_TITLE = STR_SELECT_DESIGN; -static constexpr int32_t WH = 441; -static constexpr int32_t WW = 600; -static constexpr int32_t DEBUG_PATH_HEIGHT = 12; -static constexpr int32_t ROTATE_AND_SCENERY_BUTTON_SIZE = 24; -static constexpr int32_t WINDOW_PADDING = 5; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_SELECT_DESIGN; + static constexpr int32_t WH = 441; + static constexpr int32_t WW = 600; + static constexpr int32_t DEBUG_PATH_HEIGHT = 12; + static constexpr int32_t ROTATE_AND_SCENERY_BUTTON_SIZE = 24; + static constexpr int32_t WINDOW_PADDING = 5; -// clang-format off + // clang-format off enum { WIDX_BACKGROUND, WIDX_TITLE, @@ -60,661 +62,637 @@ static Widget _trackListWidgets[] = { MakeWidget({224, 18}, {372, 219}, WindowWidgetType::FlatBtn, WindowColour::Primary ), MakeWidget({572, 405}, { ROTATE_AND_SCENERY_BUTTON_SIZE, ROTATE_AND_SCENERY_BUTTON_SIZE}, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_ROTATE_ARROW), STR_ROTATE_90_TIP ), MakeWidget({572, 381}, { ROTATE_AND_SCENERY_BUTTON_SIZE, ROTATE_AND_SCENERY_BUTTON_SIZE}, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_SCENERY), STR_TOGGLE_SCENERY_TIP ), - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -constexpr uint16_t TRACK_DESIGN_INDEX_UNLOADED = UINT16_MAX; + constexpr uint16_t TRACK_DESIGN_INDEX_UNLOADED = UINT16_MAX; -RideSelection _window_track_list_item; + RideSelection _window_track_list_item; -class TrackListWindow final : public Window -{ -private: - std::vector _trackDesigns; - utf8 _filterString[USER_STRING_MAX_LENGTH]{}; - std::vector _filteredTrackIds; - uint16_t _loadedTrackDesignIndex; - std::unique_ptr _loadedTrackDesign; - std::vector _trackDesignPreviewPixels; - bool _selectedItemIsBeingUpdated; - bool _reloadTrackDesigns; - - void FilterList() + class TrackListWindow final : public Window { - _filteredTrackIds.clear(); + private: + std::vector _trackDesigns; + utf8 _filterString[USER_STRING_MAX_LENGTH]{}; + std::vector _filteredTrackIds; + uint16_t _loadedTrackDesignIndex; + std::unique_ptr _loadedTrackDesign; + std::vector _trackDesignPreviewPixels; + bool _selectedItemIsBeingUpdated; + bool _reloadTrackDesigns; - // Nothing to filter, so fill the list with all indices - if (String::LengthOf(_filterString) == 0) + void FilterList() { - for (uint16_t i = 0; i < _trackDesigns.size(); i++) - _filteredTrackIds.push_back(i); + _filteredTrackIds.clear(); - return; - } - - // Convert filter to uppercase - const auto filterStringUpper = String::ToUpper(_filterString); - - // Fill the set with indices for tracks that match the filter - for (uint16_t i = 0; i < _trackDesigns.size(); i++) - { - const auto trackNameUpper = String::ToUpper(_trackDesigns[i].name); - if (trackNameUpper.find(filterStringUpper) != std::string::npos) + // Nothing to filter, so fill the list with all indices + if (String::LengthOf(_filterString) == 0) { - _filteredTrackIds.push_back(i); - } - } + for (uint16_t i = 0; i < _trackDesigns.size(); i++) + _filteredTrackIds.push_back(i); - // Ensure that the selected item is still in the list. - if (static_cast(selected_list_item) >= _filteredTrackIds.size()) - { - selected_list_item = 0; - } - } - - void SelectFromList(int32_t listIndex) - { - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, this->windowPos.x + (this->width / 2)); - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) - { - if (listIndex == 0) - { - Close(); - RideConstructNew(_window_track_list_item); return; } - listIndex--; - } - // Displays a message if the ride can't load, fix #4080 - if (_loadedTrackDesign == nullptr) - { - ContextShowError(STR_CANT_BUILD_THIS_HERE, STR_TRACK_LOAD_FAILED_ERROR, {}); - return; - } + // Convert filter to uppercase + const auto filterStringUpper = String::ToUpper(_filterString); - if (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE) - { - gTrackDesignSceneryToggle = true; - } - - uint16_t trackDesignIndex = _filteredTrackIds[listIndex]; - TrackDesignFileRef* tdRef = &_trackDesigns[trackDesignIndex]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - auto intent = Intent(WindowClass::ManageTrackDesign); - intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); - ContextOpenIntent(&intent); - } - else - { - if (_loadedTrackDesignIndex != TRACK_DESIGN_INDEX_UNLOADED - && (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE)) + // Fill the set with indices for tracks that match the filter + for (uint16_t i = 0; i < _trackDesigns.size(); i++) { - ContextShowError(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, STR_NONE, {}); - } - - auto intent = Intent(WindowClass::TrackDesignPlace); - intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); - ContextOpenIntent(&intent); - } - } - - int32_t GetListItemFromPosition(const ScreenCoordsXY& screenCoords) - { - size_t maxItems = _filteredTrackIds.size(); - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) - { - // Extra item: custom design - maxItems++; - } - - int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; - if (index < 0 || static_cast(index) >= maxItems) - { - index = -1; - } - return index; - } - - void LoadDesignsList(RideSelection item) - { - auto repo = OpenRCT2::GetContext()->GetTrackDesignRepository(); - std::string entryName; - if (item.Type < 0x80) - { - if (GetRideTypeDescriptor(item.Type).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) - { - entryName = GetRideEntryName(item.EntryIndex); - } - } - _trackDesigns = repo->GetItemsForObjectEntry(item.Type, entryName); - - FilterList(); - } - - bool LoadDesignPreview(const u8string& path) - { - _loadedTrackDesign = TrackDesignImport(path.c_str()); - if (_loadedTrackDesign != nullptr) - { - TrackDesignDrawPreview(_loadedTrackDesign.get(), _trackDesignPreviewPixels.data()); - return true; - } - return false; - } - -public: - TrackListWindow(const RideSelection item) - { - _window_track_list_item = item; - } - - void OnOpen() override - { - LoadDesignsList(_window_track_list_item); - - String::Set(_filterString, sizeof(_filterString), ""); - _trackListWidgets[WIDX_FILTER_STRING].string = _filterString; - widgets = _trackListWidgets; - - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - widgets[WIDX_BACK].type = WindowWidgetType::Empty; - } - else - { - widgets[WIDX_BACK].type = WindowWidgetType::TableHeader; - } - - WindowInitScrollWidgets(*this); - _selectedItemIsBeingUpdated = false; - _reloadTrackDesigns = false; - // Start with first track highlighted - selected_list_item = 0; - if (_trackDesigns.size() != 0 && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) - { - selected_list_item = 1; - } - gTrackDesignSceneryToggle = false; - WindowPushOthersRight(*this); - _currentTrackPieceDirection = 2; - _trackDesignPreviewPixels.resize(4 * TRACK_PREVIEW_IMAGE_SIZE); - - _loadedTrackDesign = nullptr; - _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED; - } - - void OnClose() override - { - // Dispose track design and preview - _loadedTrackDesign = nullptr; - _trackDesignPreviewPixels.clear(); - _trackDesignPreviewPixels.shrink_to_fit(); - - // Dispose track list - _trackDesigns.clear(); - - // If gScreenAge is zero, we're already in the process - // of loading the track manager, so we shouldn't try - // to do it again. Otherwise, this window will get - // another close signal from the track manager load function, - // try to load the track manager again, and an infinite loop will result. - if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && gScreenAge != 0) - { - WindowCloseByNumber(WindowClass::ManageTrackDesign, number); - WindowCloseByNumber(WindowClass::TrackDeletePrompt, number); - Editor::LoadTrackManager(); - } - } - - void OnMouseUp(const WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_ROTATE: - _currentTrackPieceDirection++; - _currentTrackPieceDirection %= 4; - Invalidate(); - break; - case WIDX_TOGGLE_SCENERY: - gTrackDesignSceneryToggle = !gTrackDesignSceneryToggle; - _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED; - Invalidate(); - break; - case WIDX_BACK: - Close(); - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + const auto trackNameUpper = String::ToUpper(_trackDesigns[i].name); + if (trackNameUpper.find(filterStringUpper) != std::string::npos) { - ContextOpenWindow(WindowClass::ConstructRide); - } - break; - case WIDX_FILTER_STRING: - WindowStartTextbox(*this, widgetIndex, STR_STRING, _filterString, sizeof(_filterString)); // TODO check this out - break; - case WIDX_FILTER_CLEAR: - // Keep the highlighted item selected - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - if (selected_list_item != -1 && _filteredTrackIds.size() > static_cast(selected_list_item)) - selected_list_item = _filteredTrackIds[selected_list_item]; - else - selected_list_item = -1; - } - else - { - if (selected_list_item != 0) - selected_list_item = _filteredTrackIds[selected_list_item - 1] + 1; + _filteredTrackIds.push_back(i); } + } - String::Set(_filterString, sizeof(_filterString), ""); - FilterList(); - Invalidate(); - break; - } - } - - ScreenSize OnScrollGetSize(const int32_t scrollIndex) override - { - size_t numItems = _filteredTrackIds.size(); - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) - { - // Extra item: custom design - numItems++; - } - int32_t scrollHeight = static_cast(numItems * SCROLLABLE_ROW_HEIGHT); - - return { width, scrollHeight }; - } - - void OnScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - if (!_selectedItemIsBeingUpdated) - { - int32_t i = GetListItemFromPosition(screenCoords); - if (i != -1) + // Ensure that the selected item is still in the list. + if (static_cast(selected_list_item) >= _filteredTrackIds.size()) { - SelectFromList(i); + selected_list_item = 0; } } - } - void OnScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override - { - if (!_selectedItemIsBeingUpdated) + void SelectFromList(int32_t listIndex) { - int32_t i = GetListItemFromPosition(screenCoords); - if (i != -1 && selected_list_item != i) + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, this->windowPos.x + (this->width / 2)); + if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { - selected_list_item = i; - Invalidate(); + if (listIndex == 0) + { + Close(); + RideConstructNew(_window_track_list_item); + return; + } + listIndex--; } - } - } - void OnTextInput(const WidgetIndex widgetIndex, std::string_view text) override - { - if (widgetIndex != WIDX_FILTER_STRING) - return; - - if (String::Equals(_filterString, std::string(text).c_str())) - return; - - String::Set(_filterString, sizeof(_filterString), std::string(text).c_str()); - - FilterList(); - - scrolls->v_top = 0; - - Invalidate(); - } - - void OnPrepareDraw() override - { - StringId stringId = STR_NONE; - const auto* entry = GetRideEntryByIndex(_window_track_list_item.EntryIndex); - - if (entry != nullptr) - { - RideNaming rideName = GetRideNaming(_window_track_list_item.Type, *entry); - stringId = rideName.Name; - } - - Formatter::Common().Add(stringId); - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - widgets[WIDX_TITLE].text = STR_TRACK_DESIGNS; - widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_RENAME_OR_DELETE_IT; - } - else - { - widgets[WIDX_TITLE].text = STR_SELECT_DESIGN; - widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_BUILD_IT_TIP; - } - - if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) || selected_list_item != 0) - { - pressed_widgets |= 1uLL << WIDX_TRACK_PREVIEW; - disabled_widgets &= ~(1uLL << WIDX_TRACK_PREVIEW); - widgets[WIDX_ROTATE].type = WindowWidgetType::FlatBtn; - widgets[WIDX_TOGGLE_SCENERY].type = WindowWidgetType::FlatBtn; - if (gTrackDesignSceneryToggle) + // Displays a message if the ride can't load, fix #4080 + if (_loadedTrackDesign == nullptr) { - pressed_widgets &= ~(1uLL << WIDX_TOGGLE_SCENERY); + ContextShowError(STR_CANT_BUILD_THIS_HERE, STR_TRACK_LOAD_FAILED_ERROR, {}); + return; + } + + if (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE) + { + gTrackDesignSceneryToggle = true; + } + + uint16_t trackDesignIndex = _filteredTrackIds[listIndex]; + TrackDesignFileRef* tdRef = &_trackDesigns[trackDesignIndex]; + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + { + auto intent = Intent(WindowClass::ManageTrackDesign); + intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); + ContextOpenIntent(&intent); } else { - pressed_widgets |= (1uLL << WIDX_TOGGLE_SCENERY); + if (_loadedTrackDesignIndex != TRACK_DESIGN_INDEX_UNLOADED + && (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE)) + { + ContextShowError(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, STR_NONE, {}); + } + + auto intent = Intent(WindowClass::TrackDesignPlace); + intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); + ContextOpenIntent(&intent); } } - else + + int32_t GetListItemFromPosition(const ScreenCoordsXY& screenCoords) { - pressed_widgets &= ~(1uLL << WIDX_TRACK_PREVIEW); - disabled_widgets |= (1uLL << WIDX_TRACK_PREVIEW); - widgets[WIDX_ROTATE].type = WindowWidgetType::Empty; - widgets[WIDX_TOGGLE_SCENERY].type = WindowWidgetType::Empty; + size_t maxItems = _filteredTrackIds.size(); + if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + { + // Extra item: custom design + maxItems++; + } + + int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; + if (index < 0 || static_cast(index) >= maxItems) + { + index = -1; + } + return index; } - // When debugging tools are on, shift everything up a bit to make room for displaying the path. - const int32_t bottomMargin = gConfigGeneral.DebuggingTools ? (WINDOW_PADDING + DEBUG_PATH_HEIGHT) : WINDOW_PADDING; - widgets[WIDX_TRACK_LIST].bottom = height - bottomMargin; - widgets[WIDX_ROTATE].bottom = height - bottomMargin; - widgets[WIDX_ROTATE].top = widgets[WIDX_ROTATE].bottom - ROTATE_AND_SCENERY_BUTTON_SIZE; - widgets[WIDX_TOGGLE_SCENERY].bottom = widgets[WIDX_ROTATE].top; - widgets[WIDX_TOGGLE_SCENERY].top = widgets[WIDX_TOGGLE_SCENERY].bottom - ROTATE_AND_SCENERY_BUTTON_SIZE; - } - - void OnUpdate() override - { - if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) + void LoadDesignsList(RideSelection item) { - WindowUpdateTextboxCaret(); - WidgetInvalidate(*this, WIDX_FILTER_STRING); // TODO Check this + auto repo = OpenRCT2::GetContext()->GetTrackDesignRepository(); + std::string entryName; + if (item.Type < 0x80) + { + if (GetRideTypeDescriptor(item.Type).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)) + { + entryName = GetRideEntryName(item.EntryIndex); + } + } + _trackDesigns = repo->GetItemsForObjectEntry(item.Type, entryName); + + FilterList(); } - if (_reloadTrackDesigns) + bool LoadDesignPreview(const u8string& path) + { + _loadedTrackDesign = TrackDesignImport(path.c_str()); + if (_loadedTrackDesign != nullptr) + { + TrackDesignDrawPreview(_loadedTrackDesign.get(), _trackDesignPreviewPixels.data()); + return true; + } + return false; + } + + public: + TrackListWindow(const RideSelection item) + { + _window_track_list_item = item; + } + + void OnOpen() override { LoadDesignsList(_window_track_list_item); - selected_list_item = 0; - Invalidate(); - _reloadTrackDesigns = false; - } - } - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); + String::Set(_filterString, sizeof(_filterString), ""); + _trackListWidgets[WIDX_FILTER_STRING].string = _filterString; + widgets = _trackListWidgets; - int32_t listItemIndex = selected_list_item; - if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) == 0) - { - // Because the first item in the list is "Build a custom design", lower the index by one - listItemIndex--; - } - - if (_filteredTrackIds.empty() || listItemIndex == -1) - return; - - int32_t trackIndex = _filteredTrackIds[listItemIndex]; - - // Track preview - auto& tdWidget = widgets[WIDX_TRACK_PREVIEW]; - int32_t colour = ColourMapA[colours[0]].darkest; - u8string path = _trackDesigns[trackIndex].path; - - // Show track file path (in debug mode) - if (gConfigGeneral.DebuggingTools) - { - const auto shortPath = ShortenPath(path, width, FontStyle::Medium); - auto ft = Formatter(); - ft.Add(shortPath.c_str()); - DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 0, height - DEBUG_PATH_HEIGHT - 3 }, STR_STRING, ft, - { colours[1] }); // TODO Check dpi - } - - auto screenPos = windowPos + ScreenCoordsXY{ tdWidget.left + 1, tdWidget.top + 1 }; - GfxFillRect(dpi, { screenPos, screenPos + ScreenCoordsXY{ 369, 216 } }, colour); // TODO Check dpi - - if (_loadedTrackDesignIndex != trackIndex) - { - if (LoadDesignPreview(path)) + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { - _loadedTrackDesignIndex = trackIndex; + widgets[WIDX_BACK].type = WindowWidgetType::Empty; } else { - _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED; + widgets[WIDX_BACK].type = WindowWidgetType::TableHeader; + } + + WindowInitScrollWidgets(*this); + _selectedItemIsBeingUpdated = false; + _reloadTrackDesigns = false; + // Start with first track highlighted + selected_list_item = 0; + if (_trackDesigns.size() != 0 && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + { + selected_list_item = 1; + } + gTrackDesignSceneryToggle = false; + WindowPushOthersRight(*this); + _currentTrackPieceDirection = 2; + _trackDesignPreviewPixels.resize(4 * kTrackPreviewImageSize); + + _loadedTrackDesign = nullptr; + _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED; + } + + void OnClose() override + { + // Dispose track design and preview + _loadedTrackDesign = nullptr; + _trackDesignPreviewPixels.clear(); + _trackDesignPreviewPixels.shrink_to_fit(); + + // Dispose track list + _trackDesigns.clear(); + + // If gScreenAge is zero, we're already in the process + // of loading the track manager, so we shouldn't try + // to do it again. Otherwise, this window will get + // another close signal from the track manager load function, + // try to load the track manager again, and an infinite loop will result. + if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && gScreenAge != 0) + { + WindowCloseByNumber(WindowClass::ManageTrackDesign, number); + WindowCloseByNumber(WindowClass::TrackDeletePrompt, number); + Editor::LoadTrackManager(); } } - if (!_loadedTrackDesign) + void OnMouseUp(const WidgetIndex widgetIndex) override { - return; - } - - auto trackPreview = screenPos; - screenPos = windowPos + ScreenCoordsXY{ tdWidget.midX(), tdWidget.midY() }; - - G1Element g1temp = {}; - g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * TRACK_PREVIEW_IMAGE_SIZE); - g1temp.width = 370; - g1temp.height = 217; - g1temp.flags = G1_FLAG_HAS_TRANSPARENCY; - GfxSetG1Element(SPR_TEMP, &g1temp); - DrawingEngineInvalidateImage(SPR_TEMP); - GfxDrawSprite(dpi, ImageId(SPR_TEMP), trackPreview); - - screenPos.y = windowPos.y + tdWidget.bottom - 12; - - // Warnings - if ((_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE) - && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) - { - // Vehicle design not available - DrawTextEllipsised(dpi, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::CENTRE }); - screenPos.y -= SCROLLABLE_ROW_HEIGHT; - } - - if (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE) - { - if (!gTrackDesignSceneryToggle) + switch (widgetIndex) { - // Scenery not available - DrawTextEllipsised( - dpi, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE }); - screenPos.y -= SCROLLABLE_ROW_HEIGHT; + case WIDX_CLOSE: + Close(); + break; + case WIDX_ROTATE: + _currentTrackPieceDirection++; + _currentTrackPieceDirection %= 4; + Invalidate(); + break; + case WIDX_TOGGLE_SCENERY: + gTrackDesignSceneryToggle = !gTrackDesignSceneryToggle; + _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED; + Invalidate(); + break; + case WIDX_BACK: + Close(); + if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + { + ContextOpenWindow(WindowClass::ConstructRide); + } + break; + case WIDX_FILTER_STRING: + WindowStartTextbox( + *this, widgetIndex, STR_STRING, _filterString, sizeof(_filterString)); // TODO check this out + break; + case WIDX_FILTER_CLEAR: + // Keep the highlighted item selected + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + { + if (selected_list_item != -1 && _filteredTrackIds.size() > static_cast(selected_list_item)) + selected_list_item = _filteredTrackIds[selected_list_item]; + else + selected_list_item = -1; + } + else + { + if (selected_list_item != 0) + selected_list_item = _filteredTrackIds[selected_list_item - 1] + 1; + } + + String::Set(_filterString, sizeof(_filterString), ""); + FilterList(); + Invalidate(); + break; } } - // Track design name - auto ft = Formatter(); - ft.Add(_trackDesigns[trackIndex].name.c_str()); - DrawTextEllipsised(dpi, screenPos, 368, STR_TRACK_PREVIEW_NAME_FORMAT, ft, { TextAlignment::CENTRE }); - - // Information - screenPos = windowPos + ScreenCoordsXY{ tdWidget.left + 1, tdWidget.bottom + 2 }; - - // Stats - ft = Formatter(); - ft.Add(_loadedTrackDesign->excitement * 10); - DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_EXCITEMENT_RATING, ft); - screenPos.y += LIST_ROW_HEIGHT; - - ft = Formatter(); - ft.Add(_loadedTrackDesign->intensity * 10); - DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_INTENSITY_RATING, ft); - screenPos.y += LIST_ROW_HEIGHT; - - ft = Formatter(); - ft.Add(_loadedTrackDesign->nausea * 10); - DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_NAUSEA_RATING, ft); - screenPos.y += LIST_ROW_HEIGHT + 4; - - // Information for tracked rides. - if (GetRideTypeDescriptor(_loadedTrackDesign->type).HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) + ScreenSize OnScrollGetSize(const int32_t scrollIndex) override { - const auto& rtd = GetRideTypeDescriptor(_loadedTrackDesign->type); - if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) + size_t numItems = _filteredTrackIds.size(); + if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { - if (_loadedTrackDesign->type == RIDE_TYPE_MINI_GOLF) + // Extra item: custom design + numItems++; + } + int32_t scrollHeight = static_cast(numItems * SCROLLABLE_ROW_HEIGHT); + + return { width, scrollHeight }; + } + + void OnScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + if (!_selectedItemIsBeingUpdated) + { + int32_t i = GetListItemFromPosition(screenCoords); + if (i != -1) { - // Holes - ft = Formatter(); - ft.Add(_loadedTrackDesign->holes & 0x1F); - DrawTextBasic(dpi, screenPos, STR_HOLES, ft); - screenPos.y += LIST_ROW_HEIGHT; + SelectFromList(i); + } + } + } + + void OnScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + if (!_selectedItemIsBeingUpdated) + { + int32_t i = GetListItemFromPosition(screenCoords); + if (i != -1 && selected_list_item != i) + { + selected_list_item = i; + Invalidate(); + } + } + } + + void OnTextInput(const WidgetIndex widgetIndex, std::string_view text) override + { + if (widgetIndex != WIDX_FILTER_STRING) + return; + + if (String::Equals(_filterString, std::string(text).c_str())) + return; + + String::Set(_filterString, sizeof(_filterString), std::string(text).c_str()); + + FilterList(); + + scrolls->v_top = 0; + + Invalidate(); + } + + void OnPrepareDraw() override + { + StringId stringId = STR_NONE; + const auto* entry = GetRideEntryByIndex(_window_track_list_item.EntryIndex); + + if (entry != nullptr) + { + RideNaming rideName = GetRideNaming(_window_track_list_item.Type, *entry); + stringId = rideName.Name; + } + + Formatter::Common().Add(stringId); + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + { + widgets[WIDX_TITLE].text = STR_TRACK_DESIGNS; + widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_RENAME_OR_DELETE_IT; + } + else + { + widgets[WIDX_TITLE].text = STR_SELECT_DESIGN; + widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_BUILD_IT_TIP; + } + + if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) || selected_list_item != 0) + { + pressed_widgets |= 1uLL << WIDX_TRACK_PREVIEW; + disabled_widgets &= ~(1uLL << WIDX_TRACK_PREVIEW); + widgets[WIDX_ROTATE].type = WindowWidgetType::FlatBtn; + widgets[WIDX_TOGGLE_SCENERY].type = WindowWidgetType::FlatBtn; + if (gTrackDesignSceneryToggle) + { + pressed_widgets &= ~(1uLL << WIDX_TOGGLE_SCENERY); } else { - // Maximum speed - ft = Formatter(); - ft.Add(((_loadedTrackDesign->max_speed << 16) * 9) >> 18); - DrawTextBasic(dpi, screenPos, STR_MAX_SPEED, ft); - screenPos.y += LIST_ROW_HEIGHT; - - // Average speed - ft = Formatter(); - ft.Add(((_loadedTrackDesign->average_speed << 16) * 9) >> 18); - DrawTextBasic(dpi, screenPos, STR_AVERAGE_SPEED, ft); - screenPos.y += LIST_ROW_HEIGHT; + pressed_widgets |= (1uLL << WIDX_TOGGLE_SCENERY); } - - // Ride length - ft = Formatter(); - ft.Add(STR_RIDE_LENGTH_ENTRY); - ft.Add(_loadedTrackDesign->ride_length); - DrawTextEllipsised(dpi, screenPos, 214, STR_TRACK_LIST_RIDE_LENGTH, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - - if (GetRideTypeDescriptor(_loadedTrackDesign->type).HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES)) - { - // Maximum positive vertical Gs - ft = Formatter(); - ft.Add(_loadedTrackDesign->max_positive_vertical_g * 32); - DrawTextBasic(dpi, screenPos, STR_MAX_POSITIVE_VERTICAL_G, ft); - screenPos.y += LIST_ROW_HEIGHT; - - // Maximum negative vertical Gs - ft = Formatter(); - ft.Add(_loadedTrackDesign->max_negative_vertical_g * 32); - DrawTextBasic(dpi, screenPos, STR_MAX_NEGATIVE_VERTICAL_G, ft); - screenPos.y += LIST_ROW_HEIGHT; - - // Maximum lateral Gs - ft = Formatter(); - ft.Add(_loadedTrackDesign->max_lateral_g * 32); - DrawTextBasic(dpi, screenPos, STR_MAX_LATERAL_G, ft); - screenPos.y += LIST_ROW_HEIGHT; - - if (_loadedTrackDesign->total_air_time != 0) - { - // Total air time - ft = Formatter(); - ft.Add(_loadedTrackDesign->total_air_time * 25); - DrawTextBasic(dpi, screenPos, STR_TOTAL_AIR_TIME, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - } - - if (GetRideTypeDescriptor(_loadedTrackDesign->type).HasFlag(RIDE_TYPE_FLAG_HAS_DROPS)) - { - // Drops - ft = Formatter(); - ft.Add(_loadedTrackDesign->drops & 0x3F); - DrawTextBasic(dpi, screenPos, STR_DROPS, ft); - screenPos.y += LIST_ROW_HEIGHT; - - // Drop height is multiplied by 0.75 - ft = Formatter(); - ft.Add((_loadedTrackDesign->highest_drop_height * 3) / 4); - DrawTextBasic(dpi, screenPos, STR_HIGHEST_DROP_HEIGHT, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - - if (_loadedTrackDesign->type != RIDE_TYPE_MINI_GOLF) - { - uint16_t inversions = _loadedTrackDesign->inversions & 0x1F; - if (inversions != 0) - { - ft = Formatter(); - ft.Add(inversions); - // Inversions - DrawTextBasic(dpi, screenPos, STR_INVERSIONS, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - } - screenPos.y += 4; - } - - if (_loadedTrackDesign->space_required_x != 0xFF) - { - // Space required - ft = Formatter(); - ft.Add(_loadedTrackDesign->space_required_x); - ft.Add(_loadedTrackDesign->space_required_y); - DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_SPACE_REQUIRED, ft); - screenPos.y += LIST_ROW_HEIGHT; - } - - if (_loadedTrackDesign->cost != 0) - { - ft = Formatter(); - ft.Add(_loadedTrackDesign->cost); - DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_COST_AROUND, ft); - } - } - - void OnScrollDraw(const int32_t scrollIndex, DrawPixelInfo& dpi) override - { - uint8_t paletteIndex = ColourMapA[colours[0]].mid_light; - GfxClear(&dpi, paletteIndex); - - auto screenCoords = ScreenCoordsXY{ 0, 0 }; - size_t listIndex = 0; - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - if (_trackDesigns.empty()) - { - // No track designs - DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, STR_NO_TRACK_DESIGNS_OF_THIS_TYPE); - return; - } - } - else - { - // Build custom track item - StringId stringId; - if (listIndex == static_cast(selected_list_item)) - { - // Highlight - GfxFilterRect( - dpi, { screenCoords, { width, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } }, - FilterPaletteID::PaletteDarken1); - stringId = STR_WINDOW_COLOUR_2_STRINGID; } else { - stringId = STR_BLACK_STRING; + pressed_widgets &= ~(1uLL << WIDX_TRACK_PREVIEW); + disabled_widgets |= (1uLL << WIDX_TRACK_PREVIEW); + widgets[WIDX_ROTATE].type = WindowWidgetType::Empty; + widgets[WIDX_TOGGLE_SCENERY].type = WindowWidgetType::Empty; } - auto ft = Formatter(); - ft.Add(STR_BUILD_CUSTOM_DESIGN); - DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, ft); - screenCoords.y += SCROLLABLE_ROW_HEIGHT; - listIndex++; + // When debugging tools are on, shift everything up a bit to make room for displaying the path. + const int32_t bottomMargin = gConfigGeneral.DebuggingTools ? (WINDOW_PADDING + DEBUG_PATH_HEIGHT) : WINDOW_PADDING; + widgets[WIDX_TRACK_LIST].bottom = height - bottomMargin; + widgets[WIDX_ROTATE].bottom = height - bottomMargin; + widgets[WIDX_ROTATE].top = widgets[WIDX_ROTATE].bottom - ROTATE_AND_SCENERY_BUTTON_SIZE; + widgets[WIDX_TOGGLE_SCENERY].bottom = widgets[WIDX_ROTATE].top; + widgets[WIDX_TOGGLE_SCENERY].top = widgets[WIDX_TOGGLE_SCENERY].bottom - ROTATE_AND_SCENERY_BUTTON_SIZE; } - for (auto i : _filteredTrackIds) + void OnUpdate() override { - if (screenCoords.y + SCROLLABLE_ROW_HEIGHT >= dpi.y && screenCoords.y < dpi.y + dpi.height) + if (gCurrentTextBox.window.classification == classification && gCurrentTextBox.window.number == number) { + WindowUpdateTextboxCaret(); + WidgetInvalidate(*this, WIDX_FILTER_STRING); // TODO Check this + } + + if (_reloadTrackDesigns) + { + LoadDesignsList(_window_track_list_item); + selected_list_item = 0; + Invalidate(); + _reloadTrackDesigns = false; + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + int32_t listItemIndex = selected_list_item; + if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) == 0) + { + // Because the first item in the list is "Build a custom design", lower the index by one + listItemIndex--; + } + + if (_filteredTrackIds.empty() || listItemIndex == -1) + return; + + int32_t trackIndex = _filteredTrackIds[listItemIndex]; + + // Track preview + auto& tdWidget = widgets[WIDX_TRACK_PREVIEW]; + int32_t colour = ColourMapA[colours[0]].darkest; + u8string path = _trackDesigns[trackIndex].path; + + // Show track file path (in debug mode) + if (gConfigGeneral.DebuggingTools) + { + const auto shortPath = ShortenPath(path, width, FontStyle::Medium); + auto ft = Formatter(); + ft.Add(shortPath.c_str()); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 0, height - DEBUG_PATH_HEIGHT - 3 }, STR_STRING, ft, + { colours[1] }); // TODO Check dpi + } + + auto screenPos = windowPos + ScreenCoordsXY{ tdWidget.left + 1, tdWidget.top + 1 }; + GfxFillRect(dpi, { screenPos, screenPos + ScreenCoordsXY{ 369, 216 } }, colour); // TODO Check dpi + + if (_loadedTrackDesignIndex != trackIndex) + { + if (LoadDesignPreview(path)) + { + _loadedTrackDesignIndex = trackIndex; + } + else + { + _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED; + } + } + + if (!_loadedTrackDesign) + { + return; + } + + auto trackPreview = screenPos; + screenPos = windowPos + ScreenCoordsXY{ tdWidget.midX(), tdWidget.midY() }; + + G1Element g1temp = {}; + g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * kTrackPreviewImageSize); + g1temp.width = 370; + g1temp.height = 217; + g1temp.flags = G1_FLAG_HAS_TRANSPARENCY; + GfxSetG1Element(SPR_TEMP, &g1temp); + DrawingEngineInvalidateImage(SPR_TEMP); + GfxDrawSprite(dpi, ImageId(SPR_TEMP), trackPreview); + + screenPos.y = windowPos.y + tdWidget.bottom - 12; + + // Warnings + if ((_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE) + && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + { + // Vehicle design not available + DrawTextEllipsised(dpi, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::CENTRE }); + screenPos.y -= SCROLLABLE_ROW_HEIGHT; + } + + if (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE) + { + if (!gTrackDesignSceneryToggle) + { + // Scenery not available + DrawTextEllipsised( + dpi, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE }); + screenPos.y -= SCROLLABLE_ROW_HEIGHT; + } + } + + // Track design name + auto ft = Formatter(); + ft.Add(_trackDesigns[trackIndex].name.c_str()); + DrawTextEllipsised(dpi, screenPos, 368, STR_TRACK_PREVIEW_NAME_FORMAT, ft, { TextAlignment::CENTRE }); + + // Information + screenPos = windowPos + ScreenCoordsXY{ tdWidget.left + 1, tdWidget.bottom + 2 }; + + // Stats + ft = Formatter(); + ft.Add(_loadedTrackDesign->excitement * 10); + DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_EXCITEMENT_RATING, ft); + screenPos.y += LIST_ROW_HEIGHT; + + ft = Formatter(); + ft.Add(_loadedTrackDesign->intensity * 10); + DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_INTENSITY_RATING, ft); + screenPos.y += LIST_ROW_HEIGHT; + + ft = Formatter(); + ft.Add(_loadedTrackDesign->nausea * 10); + DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_NAUSEA_RATING, ft); + screenPos.y += LIST_ROW_HEIGHT + 4; + + // Information for tracked rides. + if (GetRideTypeDescriptor(_loadedTrackDesign->type).HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) + { + const auto& rtd = GetRideTypeDescriptor(_loadedTrackDesign->type); + if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)) + { + if (_loadedTrackDesign->type == RIDE_TYPE_MINI_GOLF) + { + // Holes + ft = Formatter(); + ft.Add(_loadedTrackDesign->holes & 0x1F); + DrawTextBasic(dpi, screenPos, STR_HOLES, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + else + { + // Maximum speed + ft = Formatter(); + ft.Add(((_loadedTrackDesign->max_speed << 16) * 9) >> 18); + DrawTextBasic(dpi, screenPos, STR_MAX_SPEED, ft); + screenPos.y += LIST_ROW_HEIGHT; + + // Average speed + ft = Formatter(); + ft.Add(((_loadedTrackDesign->average_speed << 16) * 9) >> 18); + DrawTextBasic(dpi, screenPos, STR_AVERAGE_SPEED, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + + // Ride length + ft = Formatter(); + ft.Add(STR_RIDE_LENGTH_ENTRY); + ft.Add(_loadedTrackDesign->ride_length); + DrawTextEllipsised(dpi, screenPos, 214, STR_TRACK_LIST_RIDE_LENGTH, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + + if (GetRideTypeDescriptor(_loadedTrackDesign->type).HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES)) + { + // Maximum positive vertical Gs + ft = Formatter(); + ft.Add(_loadedTrackDesign->max_positive_vertical_g * 32); + DrawTextBasic(dpi, screenPos, STR_MAX_POSITIVE_VERTICAL_G, ft); + screenPos.y += LIST_ROW_HEIGHT; + + // Maximum negative vertical Gs + ft = Formatter(); + ft.Add(_loadedTrackDesign->max_negative_vertical_g * 32); + DrawTextBasic(dpi, screenPos, STR_MAX_NEGATIVE_VERTICAL_G, ft); + screenPos.y += LIST_ROW_HEIGHT; + + // Maximum lateral Gs + ft = Formatter(); + ft.Add(_loadedTrackDesign->max_lateral_g * 32); + DrawTextBasic(dpi, screenPos, STR_MAX_LATERAL_G, ft); + screenPos.y += LIST_ROW_HEIGHT; + + if (_loadedTrackDesign->total_air_time != 0) + { + // Total air time + ft = Formatter(); + ft.Add(_loadedTrackDesign->total_air_time * 25); + DrawTextBasic(dpi, screenPos, STR_TOTAL_AIR_TIME, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + } + + if (GetRideTypeDescriptor(_loadedTrackDesign->type).HasFlag(RIDE_TYPE_FLAG_HAS_DROPS)) + { + // Drops + ft = Formatter(); + ft.Add(_loadedTrackDesign->drops & 0x3F); + DrawTextBasic(dpi, screenPos, STR_DROPS, ft); + screenPos.y += LIST_ROW_HEIGHT; + + // Drop height is multiplied by 0.75 + ft = Formatter(); + ft.Add((_loadedTrackDesign->highest_drop_height * 3) / 4); + DrawTextBasic(dpi, screenPos, STR_HIGHEST_DROP_HEIGHT, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + + if (_loadedTrackDesign->type != RIDE_TYPE_MINI_GOLF) + { + uint16_t inversions = _loadedTrackDesign->inversions & 0x1F; + if (inversions != 0) + { + ft = Formatter(); + ft.Add(inversions); + // Inversions + DrawTextBasic(dpi, screenPos, STR_INVERSIONS, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + } + screenPos.y += 4; + } + + if (_loadedTrackDesign->space_required_x != 0xFF) + { + // Space required + ft = Formatter(); + ft.Add(_loadedTrackDesign->space_required_x); + ft.Add(_loadedTrackDesign->space_required_y); + DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_SPACE_REQUIRED, ft); + screenPos.y += LIST_ROW_HEIGHT; + } + + if (_loadedTrackDesign->cost != 0) + { + ft = Formatter(); + ft.Add(_loadedTrackDesign->cost); + DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_COST_AROUND, ft); + } + } + + void OnScrollDraw(const int32_t scrollIndex, DrawPixelInfo& dpi) override + { + uint8_t paletteIndex = ColourMapA[colours[0]].mid_light; + GfxClear(dpi, paletteIndex); + + auto screenCoords = ScreenCoordsXY{ 0, 0 }; + size_t listIndex = 0; + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + { + if (_trackDesigns.empty()) + { + // No track designs + DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, STR_NO_TRACK_DESIGNS_OF_THIS_TYPE); + return; + } + } + else + { + // Build custom track item StringId stringId; if (listIndex == static_cast(selected_list_item)) { @@ -729,65 +707,91 @@ public: stringId = STR_BLACK_STRING; } - // Draw track name auto ft = Formatter(); - ft.Add(STR_TRACK_LIST_NAME_FORMAT); - ft.Add(_trackDesigns[i].name.c_str()); + ft.Add(STR_BUILD_CUSTOM_DESIGN); DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, ft); + screenCoords.y += SCROLLABLE_ROW_HEIGHT; + listIndex++; } - screenCoords.y += SCROLLABLE_ROW_HEIGHT; - listIndex++; + for (auto i : _filteredTrackIds) + { + if (screenCoords.y + SCROLLABLE_ROW_HEIGHT >= dpi.y && screenCoords.y < dpi.y + dpi.height) + { + StringId stringId; + if (listIndex == static_cast(selected_list_item)) + { + // Highlight + GfxFilterRect( + dpi, { screenCoords, { width, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } }, + FilterPaletteID::PaletteDarken1); + stringId = STR_WINDOW_COLOUR_2_STRINGID; + } + else + { + stringId = STR_BLACK_STRING; + } + + // Draw track name + auto ft = Formatter(); + ft.Add(STR_TRACK_LIST_NAME_FORMAT); + ft.Add(_trackDesigns[i].name.c_str()); + DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, ft); + } + + screenCoords.y += SCROLLABLE_ROW_HEIGHT; + listIndex++; + } + } + + void OnResize() override + { + ResizeFrame(); + } + + void SetIsBeingUpdated(const bool beingUpdated) + { + _selectedItemIsBeingUpdated = beingUpdated; + } + + void ReloadTrackDesigns() + { + _reloadTrackDesigns = true; + } + }; + + WindowBase* TrackListOpen(const RideSelection item) + { + WindowCloseConstructionWindows(); + ScreenCoordsXY screenPos{}; + if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + { + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + screenPos = { screenWidth / 2 - 300, std::max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200) }; + } + else + { + screenPos = { 0, TOP_TOOLBAR_HEIGHT + 2 }; + } + return WindowCreate(WindowClass::TrackDesignList, WW, WH, 0, item); + } + + void WindowTrackDesignListReloadTracks() + { + auto* trackListWindow = static_cast(WindowFindByClass(WindowClass::TrackDesignList)); + if (trackListWindow != nullptr) + { + trackListWindow->ReloadTrackDesigns(); } } - void OnResize() override + void WindowTrackDesignListSetBeingUpdated(const bool beingUpdated) { - ResizeFrame(); + auto* trackListWindow = static_cast(WindowFindByClass(WindowClass::TrackDesignList)); + if (trackListWindow != nullptr) + { + trackListWindow->SetIsBeingUpdated(beingUpdated); + } } - - void SetIsBeingUpdated(const bool beingUpdated) - { - _selectedItemIsBeingUpdated = beingUpdated; - } - - void ReloadTrackDesigns() - { - _reloadTrackDesigns = true; - } -}; - -WindowBase* WindowTrackListOpen(const RideSelection item) -{ - WindowCloseConstructionWindows(); - ScreenCoordsXY screenPos{}; - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) - { - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - screenPos = { screenWidth / 2 - 300, std::max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200) }; - } - else - { - screenPos = { 0, TOP_TOOLBAR_HEIGHT + 2 }; - } - return WindowCreate(WindowClass::TrackDesignList, WW, WH, 0, item); -} - -void WindowTrackDesignListReloadTracks() -{ - auto* trackListWindow = static_cast(WindowFindByClass(WindowClass::TrackDesignList)); - if (trackListWindow != nullptr) - { - trackListWindow->ReloadTrackDesigns(); - } -} - -void WindowTrackDesignListSetBeingUpdated(const bool beingUpdated) -{ - auto* trackListWindow = static_cast(WindowFindByClass(WindowClass::TrackDesignList)); - if (trackListWindow != nullptr) - { - trackListWindow->SetIsBeingUpdated(beingUpdated); - } -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Transparency.cpp b/src/openrct2-ui/windows/Transparency.cpp index cca5bcf0a2..5d8c50fd76 100644 --- a/src/openrct2-ui/windows/Transparency.cpp +++ b/src/openrct2-ui/windows/Transparency.cpp @@ -30,9 +30,9 @@ #include #include -using namespace OpenRCT2; - -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum WINDOW_TRANSPARENCY_WIDGET_IDX { WIDX_BACKGROUND, @@ -85,178 +85,179 @@ static Widget _transparancyWidgets[] = MakeWidget({102, 42}, INVISIBLE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Tertiary, STR_NONE, STR_INVISIBLE_VEHICLES), MakeWidget({127, 42}, INVISIBLE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Tertiary, STR_NONE, STR_INVISIBLE_SUPPORTS), - { WIDGETS_END }, + { kWidgetsEnd }, }; -// clang-format on + // clang-format on -class TransparencyWindow final : public Window -{ -private: -public: - void OnOpen() override + class TransparencyWindow final : public Window { - widgets = _transparancyWidgets; - WindowPushOthersBelow(*this); - - auto* w = WindowGetMain(); - if (w != nullptr) - windowPos.x = ((w->width / 2) - (width / 2)); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + private: + public: + void OnOpen() override { - case WIDX_CLOSE: - Close(); - break; - default: - ToggleViewportFlag(widgetIndex); - break; + widgets = _transparancyWidgets; + WindowPushOthersBelow(*this); + + auto* w = WindowGetMain(); + if (w != nullptr) + windowPos.x = ((w->width / 2) - (width / 2)); } - } - void OnPrepareDraw() override - { - uint32_t wflags = 0; - WindowBase* w = WindowGetMain(); + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + default: + ToggleViewportFlag(widgetIndex); + break; + } + } - pressed_widgets = 0; - disabled_widgets = 0; + void OnPrepareDraw() override + { + uint32_t wflags = 0; + WindowBase* w = WindowGetMain(); + + pressed_widgets = 0; + disabled_widgets = 0; + + if (w != nullptr) + wflags = w->viewport->flags; + + SetWidgetPressed(WIDX_HIDE_VEGETATION, (wflags & VIEWPORT_FLAG_HIDE_VEGETATION)); + SetWidgetPressed(WIDX_HIDE_SCENERY, (wflags & VIEWPORT_FLAG_HIDE_SCENERY)); + SetWidgetPressed(WIDX_HIDE_PATHS, (wflags & VIEWPORT_FLAG_HIDE_PATHS)); + SetWidgetPressed(WIDX_HIDE_RIDES, (wflags & VIEWPORT_FLAG_HIDE_RIDES)); + SetWidgetPressed(WIDX_HIDE_VEHICLES, (wflags & VIEWPORT_FLAG_HIDE_VEHICLES)); + SetWidgetPressed(WIDX_HIDE_SUPPORTS, (wflags & VIEWPORT_FLAG_HIDE_SUPPORTS)); + SetWidgetPressed(WIDX_HIDE_GUESTS, (wflags & VIEWPORT_FLAG_HIDE_GUESTS)); + SetWidgetPressed(WIDX_HIDE_STAFF, (wflags & VIEWPORT_FLAG_HIDE_STAFF)); + SetWidgetPressed(WIDX_INVISIBLE_VEGETATION, (wflags & VIEWPORT_FLAG_INVISIBLE_VEGETATION)); + SetWidgetPressed(WIDX_INVISIBLE_SCENERY, (wflags & VIEWPORT_FLAG_INVISIBLE_SCENERY)); + SetWidgetPressed(WIDX_INVISIBLE_PATHS, (wflags & VIEWPORT_FLAG_INVISIBLE_PATHS)); + SetWidgetPressed(WIDX_INVISIBLE_RIDES, (wflags & VIEWPORT_FLAG_INVISIBLE_RIDES)); + SetWidgetPressed(WIDX_INVISIBLE_VEHICLES, (wflags & VIEWPORT_FLAG_INVISIBLE_VEHICLES)); + SetWidgetPressed(WIDX_INVISIBLE_SUPPORTS, (wflags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS)); + + for (WidgetIndex i = WIDX_INVISIBLE_VEGETATION; i <= WIDX_INVISIBLE_SUPPORTS; i++) + { + widgets[i].image = ImageId(IsWidgetPressed(i) ? SPR_G2_BUTTON_HIDE_FULL : SPR_G2_BUTTON_HIDE_PARTIAL); + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + // Locate mechanic button image + const auto& widget = widgets[WIDX_HIDE_STAFF]; + auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; + auto image = ImageId(SPR_MECHANIC, COLOUR_BLACK, GetGameState().StaffMechanicColour); + GfxDrawSprite(dpi, image, screenCoords); + } + + private: + uint32_t ToggleTransparency(uint32_t wflags, uint32_t transparencyFlag, uint32_t seeThroughFlag) + { + wflags ^= transparencyFlag; + if (wflags & transparencyFlag) + { + wflags |= seeThroughFlag; + } + SaveInConfig(wflags); + return wflags; + } + + void ToggleViewportFlag(WidgetIndex widgetIndex) + { + uint32_t wflags = 0; + WindowBase* w = WindowGetMain(); + + if (w == nullptr) + return; - if (w != nullptr) wflags = w->viewport->flags; - SetWidgetPressed(WIDX_HIDE_VEGETATION, (wflags & VIEWPORT_FLAG_HIDE_VEGETATION)); - SetWidgetPressed(WIDX_HIDE_SCENERY, (wflags & VIEWPORT_FLAG_HIDE_SCENERY)); - SetWidgetPressed(WIDX_HIDE_PATHS, (wflags & VIEWPORT_FLAG_HIDE_PATHS)); - SetWidgetPressed(WIDX_HIDE_RIDES, (wflags & VIEWPORT_FLAG_HIDE_RIDES)); - SetWidgetPressed(WIDX_HIDE_VEHICLES, (wflags & VIEWPORT_FLAG_HIDE_VEHICLES)); - SetWidgetPressed(WIDX_HIDE_SUPPORTS, (wflags & VIEWPORT_FLAG_HIDE_SUPPORTS)); - SetWidgetPressed(WIDX_HIDE_GUESTS, (wflags & VIEWPORT_FLAG_HIDE_GUESTS)); - SetWidgetPressed(WIDX_HIDE_STAFF, (wflags & VIEWPORT_FLAG_HIDE_STAFF)); - SetWidgetPressed(WIDX_INVISIBLE_VEGETATION, (wflags & VIEWPORT_FLAG_INVISIBLE_VEGETATION)); - SetWidgetPressed(WIDX_INVISIBLE_SCENERY, (wflags & VIEWPORT_FLAG_INVISIBLE_SCENERY)); - SetWidgetPressed(WIDX_INVISIBLE_PATHS, (wflags & VIEWPORT_FLAG_INVISIBLE_PATHS)); - SetWidgetPressed(WIDX_INVISIBLE_RIDES, (wflags & VIEWPORT_FLAG_INVISIBLE_RIDES)); - SetWidgetPressed(WIDX_INVISIBLE_VEHICLES, (wflags & VIEWPORT_FLAG_INVISIBLE_VEHICLES)); - SetWidgetPressed(WIDX_INVISIBLE_SUPPORTS, (wflags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS)); + switch (widgetIndex) + { + case WIDX_HIDE_RIDES: + wflags ^= VIEWPORT_FLAG_HIDE_RIDES; + break; + case WIDX_HIDE_VEHICLES: + wflags ^= VIEWPORT_FLAG_HIDE_VEHICLES; + break; + case WIDX_HIDE_SCENERY: + wflags ^= VIEWPORT_FLAG_HIDE_SCENERY; + break; + case WIDX_HIDE_VEGETATION: + wflags ^= VIEWPORT_FLAG_HIDE_VEGETATION; + break; + case WIDX_HIDE_PATHS: + wflags ^= VIEWPORT_FLAG_HIDE_PATHS; + break; + case WIDX_HIDE_SUPPORTS: + wflags ^= VIEWPORT_FLAG_HIDE_SUPPORTS; + break; + case WIDX_INVISIBLE_RIDES: + wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_RIDES, VIEWPORT_FLAG_HIDE_RIDES); + break; + case WIDX_INVISIBLE_VEHICLES: + wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_VEHICLES, VIEWPORT_FLAG_HIDE_VEHICLES); + break; + case WIDX_INVISIBLE_SCENERY: + wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_SCENERY, VIEWPORT_FLAG_HIDE_SCENERY); + break; + case WIDX_INVISIBLE_VEGETATION: + wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_VEGETATION, VIEWPORT_FLAG_HIDE_VEGETATION); + break; + case WIDX_INVISIBLE_PATHS: + wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_PATHS, VIEWPORT_FLAG_HIDE_PATHS); + break; + case WIDX_INVISIBLE_SUPPORTS: + wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_SUPPORTS, VIEWPORT_FLAG_HIDE_SUPPORTS); + break; + case WIDX_HIDE_GUESTS: + wflags ^= VIEWPORT_FLAG_HIDE_GUESTS; + break; + case WIDX_HIDE_STAFF: + wflags ^= VIEWPORT_FLAG_HIDE_STAFF; + break; + default: + return; + } - for (WidgetIndex i = WIDX_INVISIBLE_VEGETATION; i <= WIDX_INVISIBLE_SUPPORTS; i++) - { - widgets[i].image = ImageId(IsWidgetPressed(i) ? SPR_G2_BUTTON_HIDE_FULL : SPR_G2_BUTTON_HIDE_PARTIAL); - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); - // Locate mechanic button image - const auto& widget = widgets[WIDX_HIDE_STAFF]; - auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - auto image = ImageId(SPR_MECHANIC, COLOUR_BLACK, GetGameState().StaffMechanicColour); - GfxDrawSprite(dpi, image, screenCoords); - } - -private: - uint32_t ToggleTransparency(uint32_t wflags, uint32_t transparencyFlag, uint32_t seeThroughFlag) - { - wflags ^= transparencyFlag; - if (wflags & transparencyFlag) - { - wflags |= seeThroughFlag; - } - SaveInConfig(wflags); - return wflags; - } - - void ToggleViewportFlag(WidgetIndex widgetIndex) - { - uint32_t wflags = 0; - WindowBase* w = WindowGetMain(); - - if (w == nullptr) - return; - - wflags = w->viewport->flags; - - switch (widgetIndex) - { - case WIDX_HIDE_RIDES: - wflags ^= VIEWPORT_FLAG_HIDE_RIDES; - break; - case WIDX_HIDE_VEHICLES: - wflags ^= VIEWPORT_FLAG_HIDE_VEHICLES; - break; - case WIDX_HIDE_SCENERY: - wflags ^= VIEWPORT_FLAG_HIDE_SCENERY; - break; - case WIDX_HIDE_VEGETATION: - wflags ^= VIEWPORT_FLAG_HIDE_VEGETATION; - break; - case WIDX_HIDE_PATHS: - wflags ^= VIEWPORT_FLAG_HIDE_PATHS; - break; - case WIDX_HIDE_SUPPORTS: - wflags ^= VIEWPORT_FLAG_HIDE_SUPPORTS; - break; - case WIDX_INVISIBLE_RIDES: - wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_RIDES, VIEWPORT_FLAG_HIDE_RIDES); - break; - case WIDX_INVISIBLE_VEHICLES: - wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_VEHICLES, VIEWPORT_FLAG_HIDE_VEHICLES); - break; - case WIDX_INVISIBLE_SCENERY: - wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_SCENERY, VIEWPORT_FLAG_HIDE_SCENERY); - break; - case WIDX_INVISIBLE_VEGETATION: - wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_VEGETATION, VIEWPORT_FLAG_HIDE_VEGETATION); - break; - case WIDX_INVISIBLE_PATHS: - wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_PATHS, VIEWPORT_FLAG_HIDE_PATHS); - break; - case WIDX_INVISIBLE_SUPPORTS: - wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_SUPPORTS, VIEWPORT_FLAG_HIDE_SUPPORTS); - break; - case WIDX_HIDE_GUESTS: - wflags ^= VIEWPORT_FLAG_HIDE_GUESTS; - break; - case WIDX_HIDE_STAFF: - wflags ^= VIEWPORT_FLAG_HIDE_STAFF; - break; - default: + if (w->viewport->flags == wflags) return; + + w->viewport->flags = wflags; + w->Invalidate(); } - if (w->viewport->flags == wflags) - return; + void SaveInConfig(uint32_t wflags) + { + gConfigGeneral.InvisibleRides = wflags & VIEWPORT_FLAG_INVISIBLE_RIDES; + gConfigGeneral.InvisibleVehicles = wflags & VIEWPORT_FLAG_INVISIBLE_VEHICLES; + gConfigGeneral.InvisibleScenery = wflags & VIEWPORT_FLAG_INVISIBLE_SCENERY; + gConfigGeneral.InvisibleTrees = wflags & VIEWPORT_FLAG_INVISIBLE_VEGETATION; + gConfigGeneral.InvisiblePaths = wflags & VIEWPORT_FLAG_INVISIBLE_PATHS; + gConfigGeneral.InvisibleSupports = wflags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS; + ConfigSaveDefault(); + } - w->viewport->flags = wflags; - w->Invalidate(); - } + void OnResize() override + { + ResizeFrame(); + } + }; - void SaveInConfig(uint32_t wflags) + WindowBase* TransparencyOpen() { - gConfigGeneral.InvisibleRides = wflags & VIEWPORT_FLAG_INVISIBLE_RIDES; - gConfigGeneral.InvisibleVehicles = wflags & VIEWPORT_FLAG_INVISIBLE_VEHICLES; - gConfigGeneral.InvisibleScenery = wflags & VIEWPORT_FLAG_INVISIBLE_SCENERY; - gConfigGeneral.InvisibleTrees = wflags & VIEWPORT_FLAG_INVISIBLE_VEGETATION; - gConfigGeneral.InvisiblePaths = wflags & VIEWPORT_FLAG_INVISIBLE_PATHS; - gConfigGeneral.InvisibleSupports = wflags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS; - ConfigSaveDefault(); + auto* window = WindowBringToFrontByClass(WindowClass::Transparency); + if (window == nullptr) + window = WindowCreate(WindowClass::Transparency, ScreenCoordsXY(32, 32), WW, WH); + + return window; } - - void OnResize() override - { - ResizeFrame(); - } -}; - -WindowBase* WindowTransparencyOpen() -{ - auto* window = WindowBringToFrontByClass(WindowClass::Transparency); - if (window == nullptr) - window = WindowCreate(WindowClass::Transparency, ScreenCoordsXY(32, 32), WW, WH); - - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index 1823af5531..4c653da6d3 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -21,7 +21,9 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum WindowViewClippingWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -58,355 +60,356 @@ static Widget _viewClippingWidgets[] = { MakeWidget ({ 11, 105}, { 158, 17}, WindowWidgetType::Button, WindowColour::Primary, STR_VIEW_CLIPPING_SELECT_AREA ), // selector MakeWidget ({ 11, 126}, { 158, 18}, WindowWidgetType::Button, WindowColour::Primary, STR_VIEW_CLIPPING_CLEAR_SELECTION ), // clear - WIDGETS_END, + kWidgetsEnd, }; #pragma endregion -// clang-format on -class ViewClippingWindow final : public Window -{ -private: - CoordsXY _selectionStart; - CoordsXY _previousClipSelectionA; - CoordsXY _previousClipSelectionB; - bool _toolActive{ false }; - bool _dragging{ false }; - static inline DisplayType _clipHeightDisplayType; - -public: - void OnCloseButton() + // clang-format on + class ViewClippingWindow final : public Window { - OnClose(); - } + private: + CoordsXY _selectionStart; + CoordsXY _previousClipSelectionA; + CoordsXY _previousClipSelectionB; + bool _toolActive{ false }; + bool _dragging{ false }; + static inline DisplayType _clipHeightDisplayType; - void OnMouseUp(WidgetIndex widgetIndex) override - { - // mouseup appears to be used for buttons, checkboxes - switch (widgetIndex) + public: + void OnCloseButton() { - case WIDX_CLOSE: - WindowClose(*this); - break; - case WIDX_CLIP_CHECKBOX_ENABLE: + OnClose(); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + // mouseup appears to be used for buttons, checkboxes + switch (widgetIndex) { - // Toggle height clipping. + case WIDX_CLOSE: + WindowClose(*this); + break; + case WIDX_CLIP_CHECKBOX_ENABLE: + { + // Toggle height clipping. + WindowBase* mainWindow = WindowGetMain(); + if (mainWindow != nullptr) + { + mainWindow->viewport->flags ^= VIEWPORT_FLAG_CLIP_VIEW; + mainWindow->Invalidate(); + } + this->Invalidate(); + break; + } + case WIDX_CLIP_HEIGHT_VALUE: + // Toggle display of the cut height value in RAW vs UNITS + if (_clipHeightDisplayType == DisplayType::DisplayRaw) + { + _clipHeightDisplayType = DisplayType::DisplayUnits; + } + else + { + _clipHeightDisplayType = DisplayType::DisplayRaw; + } + this->Invalidate(); + break; + case WIDX_CLIP_SELECTOR: + // Activate the selection tool + ToolSet(*this, WIDX_BACKGROUND, Tool::Crosshair); + _toolActive = true; + _dragging = false; + + // Reset clip selection to show all tiles + _previousClipSelectionA = gClipSelectionA; + _previousClipSelectionB = gClipSelectionB; + gClipSelectionA = { 0, 0 }; + gClipSelectionB = { MAXIMUM_MAP_SIZE_BIG - 1, MAXIMUM_MAP_SIZE_BIG - 1 }; + GfxInvalidateScreen(); + break; + case WIDX_CLIP_CLEAR: + if (IsActive()) + { + _toolActive = false; + ToolCancel(); + } + gClipSelectionA = { 0, 0 }; + gClipSelectionB = { MAXIMUM_MAP_SIZE_BIG - 1, MAXIMUM_MAP_SIZE_BIG - 1 }; + GfxInvalidateScreen(); + break; + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + WindowBase* mainWindow; + + switch (widgetIndex) + { + case WIDX_CLIP_HEIGHT_INCREASE: + if (gClipHeight < 255) + SetClipHeight(gClipHeight + 1); + mainWindow = WindowGetMain(); + if (mainWindow != nullptr) + mainWindow->Invalidate(); + break; + case WIDX_CLIP_HEIGHT_DECREASE: + if (gClipHeight > 0) + SetClipHeight(gClipHeight - 1); + mainWindow = WindowGetMain(); + if (mainWindow != nullptr) + mainWindow->Invalidate(); + break; + } + } + + void OnUpdate() override + { + const auto& widget = widgets[WIDX_CLIP_HEIGHT_SLIDER]; + const ScrollBar* const scroll = &this->scrolls[0]; + const int16_t scroll_width = widget.width() - 1; + const uint8_t clip_height = static_cast( + (static_cast(scroll->h_left) / (scroll->h_right - scroll_width)) * 255); + if (clip_height != gClipHeight) + { + gClipHeight = clip_height; + + // Update the main window accordingly. WindowBase* mainWindow = WindowGetMain(); if (mainWindow != nullptr) { - mainWindow->viewport->flags ^= VIEWPORT_FLAG_CLIP_VIEW; mainWindow->Invalidate(); } - this->Invalidate(); - break; } - case WIDX_CLIP_HEIGHT_VALUE: - // Toggle display of the cut height value in RAW vs UNITS - if (_clipHeightDisplayType == DisplayType::DisplayRaw) - { - _clipHeightDisplayType = DisplayType::DisplayUnits; - } - else - { - _clipHeightDisplayType = DisplayType::DisplayRaw; - } - this->Invalidate(); - break; - case WIDX_CLIP_SELECTOR: - // Activate the selection tool - ToolSet(*this, WIDX_BACKGROUND, Tool::Crosshair); - _toolActive = true; - _dragging = false; - // Reset clip selection to show all tiles - _previousClipSelectionA = gClipSelectionA; - _previousClipSelectionB = gClipSelectionB; - gClipSelectionA = { 0, 0 }; - gClipSelectionB = { MAXIMUM_MAP_SIZE_BIG - 1, MAXIMUM_MAP_SIZE_BIG - 1 }; - GfxInvalidateScreen(); - break; - case WIDX_CLIP_CLEAR: - if (IsActive()) - { - _toolActive = false; - ToolCancel(); - } - gClipSelectionA = { 0, 0 }; - gClipSelectionB = { MAXIMUM_MAP_SIZE_BIG - 1, MAXIMUM_MAP_SIZE_BIG - 1 }; - GfxInvalidateScreen(); - break; + // Restore previous selection if the tool has been interrupted + if (_toolActive && !IsActive()) + { + _toolActive = false; + gClipSelectionA = _previousClipSelectionA; + gClipSelectionB = _previousClipSelectionB; + } + + WidgetInvalidate(*this, WIDX_CLIP_HEIGHT_SLIDER); } - } - void OnMouseDown(WidgetIndex widgetIndex) override - { - WindowBase* mainWindow; - - switch (widgetIndex) + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - case WIDX_CLIP_HEIGHT_INCREASE: - if (gClipHeight < 255) - SetClipHeight(gClipHeight + 1); - mainWindow = WindowGetMain(); - if (mainWindow != nullptr) - mainWindow->Invalidate(); - break; - case WIDX_CLIP_HEIGHT_DECREASE: - if (gClipHeight > 0) - SetClipHeight(gClipHeight - 1); - mainWindow = WindowGetMain(); - if (mainWindow != nullptr) - mainWindow->Invalidate(); - break; + if (_dragging) + { + return; + } + + int32_t direction; + auto mapCoords = ScreenPosToMapPos(screenCoords, &direction); + if (mapCoords.has_value()) + { + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + MapInvalidateTileFull(gMapSelectPositionA); + gMapSelectPositionA = gMapSelectPositionB = mapCoords.value(); + MapInvalidateTileFull(mapCoords.value()); + gMapSelectType = MAP_SELECT_TYPE_FULL; + } } - } - void OnUpdate() override - { - const auto& widget = widgets[WIDX_CLIP_HEIGHT_SLIDER]; - const ScrollBar* const scroll = &this->scrolls[0]; - const int16_t scroll_width = widget.width() - 1; - const uint8_t clip_height = static_cast( - (static_cast(scroll->h_left) / (scroll->h_right - scroll_width)) * 255); - if (clip_height != gClipHeight) + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - gClipHeight = clip_height; + int32_t direction; + auto mapCoords = ScreenPosToMapPos(screenCoords, &direction); + if (mapCoords.has_value()) + { + _dragging = true; + _selectionStart = mapCoords.value(); + } + } + + void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + if (!_dragging) + { + return; + } + + int32_t direction; + auto mapCoords = ScreenPosToMapPos(screenCoords, &direction); + if (mapCoords) + { + MapInvalidateSelectionRect(); + gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; + gMapSelectPositionA.x = std::min(_selectionStart.x, mapCoords->x); + gMapSelectPositionB.x = std::max(_selectionStart.x, mapCoords->x); + gMapSelectPositionA.y = std::min(_selectionStart.y, mapCoords->y); + gMapSelectPositionB.y = std::max(_selectionStart.y, mapCoords->y); + gMapSelectType = MAP_SELECT_TYPE_FULL; + MapInvalidateSelectionRect(); + } + } + + void OnToolUp(WidgetIndex, const ScreenCoordsXY&) override + { + gClipSelectionA = gMapSelectPositionA; + gClipSelectionB = gMapSelectPositionB; + _toolActive = false; + ToolCancel(); + GfxInvalidateScreen(); + } + + void OnPrepareDraw() override + { + WidgetScrollUpdateThumbs(*this, WIDX_CLIP_HEIGHT_SLIDER); - // Update the main window accordingly. WindowBase* mainWindow = WindowGetMain(); if (mainWindow != nullptr) { - mainWindow->Invalidate(); + WidgetSetCheckboxValue(*this, WIDX_CLIP_CHECKBOX_ENABLE, mainWindow->viewport->flags & VIEWPORT_FLAG_CLIP_VIEW); + } + + if (IsActive()) + { + this->pressed_widgets |= 1uLL << WIDX_CLIP_SELECTOR; + } + else + { + this->pressed_widgets &= ~(1uLL << WIDX_CLIP_SELECTOR); } } - // Restore previous selection if the tool has been interrupted - if (_toolActive && !IsActive()) + void OnDraw(DrawPixelInfo& dpi) override { - _toolActive = false; - gClipSelectionA = _previousClipSelectionA; - gClipSelectionB = _previousClipSelectionB; - } + WindowDrawWidgets(*this, dpi); - WidgetInvalidate(*this, WIDX_CLIP_HEIGHT_SLIDER); - } + // Clip height value + auto screenCoords = this->windowPos + ScreenCoordsXY{ 8, this->widgets[WIDX_CLIP_HEIGHT_VALUE].top }; + DrawTextBasic(dpi, screenCoords, STR_VIEW_CLIPPING_HEIGHT_VALUE, {}, { this->colours[0] }); - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - if (_dragging) - { - return; - } + screenCoords = this->windowPos + + ScreenCoordsXY{ this->widgets[WIDX_CLIP_HEIGHT_VALUE].left + 1, this->widgets[WIDX_CLIP_HEIGHT_VALUE].top }; - int32_t direction; - auto mapCoords = ScreenPosToMapPos(screenCoords, &direction); - if (mapCoords.has_value()) - { - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - MapInvalidateTileFull(gMapSelectPositionA); - gMapSelectPositionA = gMapSelectPositionB = mapCoords.value(); - MapInvalidateTileFull(mapCoords.value()); - gMapSelectType = MAP_SELECT_TYPE_FULL; - } - } - - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - int32_t direction; - auto mapCoords = ScreenPosToMapPos(screenCoords, &direction); - if (mapCoords.has_value()) - { - _dragging = true; - _selectionStart = mapCoords.value(); - } - } - - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override - { - if (!_dragging) - { - return; - } - - int32_t direction; - auto mapCoords = ScreenPosToMapPos(screenCoords, &direction); - if (mapCoords) - { - MapInvalidateSelectionRect(); - gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; - gMapSelectPositionA.x = std::min(_selectionStart.x, mapCoords->x); - gMapSelectPositionB.x = std::max(_selectionStart.x, mapCoords->x); - gMapSelectPositionA.y = std::min(_selectionStart.y, mapCoords->y); - gMapSelectPositionB.y = std::max(_selectionStart.y, mapCoords->y); - gMapSelectType = MAP_SELECT_TYPE_FULL; - MapInvalidateSelectionRect(); - } - } - - void OnToolUp(WidgetIndex, const ScreenCoordsXY&) override - { - gClipSelectionA = gMapSelectPositionA; - gClipSelectionB = gMapSelectPositionB; - _toolActive = false; - ToolCancel(); - GfxInvalidateScreen(); - } - - void OnPrepareDraw() override - { - WidgetScrollUpdateThumbs(*this, WIDX_CLIP_HEIGHT_SLIDER); - - WindowBase* mainWindow = WindowGetMain(); - if (mainWindow != nullptr) - { - WidgetSetCheckboxValue(*this, WIDX_CLIP_CHECKBOX_ENABLE, mainWindow->viewport->flags & VIEWPORT_FLAG_CLIP_VIEW); - } - - if (IsActive()) - { - this->pressed_widgets |= 1uLL << WIDX_CLIP_SELECTOR; - } - else - { - this->pressed_widgets &= ~(1uLL << WIDX_CLIP_SELECTOR); - } - } - - void OnDraw(DrawPixelInfo& dpi) override - { - WindowDrawWidgets(*this, dpi); - - // Clip height value - auto screenCoords = this->windowPos + ScreenCoordsXY{ 8, this->widgets[WIDX_CLIP_HEIGHT_VALUE].top }; - DrawTextBasic(dpi, screenCoords, STR_VIEW_CLIPPING_HEIGHT_VALUE, {}, { this->colours[0] }); - - screenCoords = this->windowPos - + ScreenCoordsXY{ this->widgets[WIDX_CLIP_HEIGHT_VALUE].left + 1, this->widgets[WIDX_CLIP_HEIGHT_VALUE].top }; - - switch (_clipHeightDisplayType) - { - case DisplayType::DisplayRaw: - default: + switch (_clipHeightDisplayType) { - auto ft = Formatter(); - ft.Add(static_cast(gClipHeight)); - - // Printing the raw value. - DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { this->colours[0] }); - break; - } - case DisplayType::DisplayUnits: - { - // Print the value in the configured height label type: - if (gConfigGeneral.ShowHeightAsUnits) + case DisplayType::DisplayRaw: + default: { - // Height label is Units. auto ft = Formatter(); - ft.Add(static_cast(FIXED_1DP(gClipHeight, 0) / 2 - FIXED_1DP(7, 0))); - DrawTextBasic( - dpi, screenCoords, STR_UNIT1DP_NO_SUFFIX, ft, - { this->colours[0] }); // Printing the value in Height Units. + ft.Add(static_cast(gClipHeight)); + + // Printing the raw value. + DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { this->colours[0] }); + break; } - else + case DisplayType::DisplayUnits: { - // Height label is Real Values. - // Print the value in the configured measurement units. - switch (gConfigGeneral.MeasurementFormat) + // Print the value in the configured height label type: + if (gConfigGeneral.ShowHeightAsUnits) { - case MeasurementFormat::Metric: - case MeasurementFormat::SI: + // Height label is Units. + auto ft = Formatter(); + ft.Add(static_cast(FIXED_1DP(gClipHeight, 0) / 2 - FIXED_1DP(7, 0))); + DrawTextBasic( + dpi, screenCoords, STR_UNIT1DP_NO_SUFFIX, ft, + { this->colours[0] }); // Printing the value in Height Units. + } + else + { + // Height label is Real Values. + // Print the value in the configured measurement units. + switch (gConfigGeneral.MeasurementFormat) { - auto ft = Formatter(); - ft.Add( - static_cast(FIXED_2DP(gClipHeight, 0) / 2 * 1.5f - FIXED_2DP(10, 50))); - DrawTextBasic(dpi, screenCoords, STR_UNIT2DP_SUFFIX_METRES, ft, { this->colours[0] }); - break; - } - case MeasurementFormat::Imperial: - { - auto ft = Formatter(); - ft.Add( - static_cast(FIXED_1DP(gClipHeight, 0) / 2.0f * 5 - FIXED_1DP(35, 0))); - DrawTextBasic(dpi, screenCoords, STR_UNIT1DP_SUFFIX_FEET, ft, { this->colours[0] }); - break; + case MeasurementFormat::Metric: + case MeasurementFormat::SI: + { + auto ft = Formatter(); + ft.Add( + static_cast(FIXED_2DP(gClipHeight, 0) / 2 * 1.5f - FIXED_2DP(10, 50))); + DrawTextBasic(dpi, screenCoords, STR_UNIT2DP_SUFFIX_METRES, ft, { this->colours[0] }); + break; + } + case MeasurementFormat::Imperial: + { + auto ft = Formatter(); + ft.Add( + static_cast(FIXED_1DP(gClipHeight, 0) / 2.0f * 5 - FIXED_1DP(35, 0))); + DrawTextBasic(dpi, screenCoords, STR_UNIT1DP_SUFFIX_FEET, ft, { this->colours[0] }); + break; + } } } } } } - } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override - { - return { 1000, 0 }; - } - - void OnOpen() override - { - this->widgets = _viewClippingWidgets; - this->hold_down_widgets = (1uLL << WIDX_CLIP_HEIGHT_INCREASE) | (1uL << WIDX_CLIP_HEIGHT_DECREASE); - WindowInitScrollWidgets(*this); - - _clipHeightDisplayType = DisplayType::DisplayUnits; - - // Initialise the clip height slider from the current clip height value. - this->SetClipHeight(gClipHeight); - - WindowPushOthersBelow(*this); - - // Get the main viewport to set the view clipping flag. - WindowBase* mainWindow = WindowGetMain(); - - // Turn on view clipping when the window is opened. - if (mainWindow != nullptr) + ScreenSize OnScrollGetSize(int32_t scrollIndex) override { - mainWindow->viewport->flags |= VIEWPORT_FLAG_CLIP_VIEW; - mainWindow->Invalidate(); + return { 1000, 0 }; } - } - void OnResize() override - { - ResizeFrame(); - } - -private: - void OnClose() override - { - // Turn off view clipping when the window is closed. - WindowBase* mainWindow = WindowGetMain(); - if (mainWindow != nullptr) + void OnOpen() override { - mainWindow->viewport->flags &= ~VIEWPORT_FLAG_CLIP_VIEW; - mainWindow->Invalidate(); + this->widgets = _viewClippingWidgets; + this->hold_down_widgets = (1uLL << WIDX_CLIP_HEIGHT_INCREASE) | (1uL << WIDX_CLIP_HEIGHT_DECREASE); + WindowInitScrollWidgets(*this); + + _clipHeightDisplayType = DisplayType::DisplayUnits; + + // Initialise the clip height slider from the current clip height value. + this->SetClipHeight(gClipHeight); + + WindowPushOthersBelow(*this); + + // Get the main viewport to set the view clipping flag. + WindowBase* mainWindow = WindowGetMain(); + + // Turn on view clipping when the window is opened. + if (mainWindow != nullptr) + { + mainWindow->viewport->flags |= VIEWPORT_FLAG_CLIP_VIEW; + mainWindow->Invalidate(); + } } - } - void SetClipHeight(const uint8_t clipHeight) - { - gClipHeight = clipHeight; - const auto& widget = widgets[WIDX_CLIP_HEIGHT_SLIDER]; - const float clip_height_ratio = static_cast(gClipHeight) / 255; - this->scrolls[0].h_left = static_cast( - std::ceil(clip_height_ratio * (this->scrolls[0].h_right - (widget.width() - 1)))); - } + void OnResize() override + { + ResizeFrame(); + } - bool IsActive() - { - if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) - return false; - if (gCurrentToolWidget.window_classification != WindowClass::ViewClipping) - return false; - return _toolActive; - } -}; + private: + void OnClose() override + { + // Turn off view clipping when the window is closed. + WindowBase* mainWindow = WindowGetMain(); + if (mainWindow != nullptr) + { + mainWindow->viewport->flags &= ~VIEWPORT_FLAG_CLIP_VIEW; + mainWindow->Invalidate(); + } + } -WindowBase* WindowViewClippingOpen() -{ - auto* window = WindowBringToFrontByClass(WindowClass::ViewClipping); - if (window == nullptr) + void SetClipHeight(const uint8_t clipHeight) + { + gClipHeight = clipHeight; + const auto& widget = widgets[WIDX_CLIP_HEIGHT_SLIDER]; + const float clip_height_ratio = static_cast(gClipHeight) / 255; + this->scrolls[0].h_left = static_cast( + std::ceil(clip_height_ratio * (this->scrolls[0].h_right - (widget.width() - 1)))); + } + + bool IsActive() + { + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) + return false; + if (gCurrentToolWidget.window_classification != WindowClass::ViewClipping) + return false; + return _toolActive; + } + }; + + WindowBase* ViewClippingOpen() { - window = WindowCreate(WindowClass::ViewClipping, ScreenCoordsXY(32, 32), WW, WH); + auto* window = WindowBringToFrontByClass(WindowClass::ViewClipping); + if (window == nullptr) + { + window = WindowCreate(WindowClass::ViewClipping, ScreenCoordsXY(32, 32), WW, WH); + } + return window; } - return window; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index 09a29e24ad..0653182632 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -17,7 +17,9 @@ #include #include -// clang-format off +namespace OpenRCT2::Ui::Windows +{ + // clang-format off enum WindowViewportWidgetIdx { WIDX_BACKGROUND, @@ -28,6 +30,7 @@ enum WindowViewportWidgetIdx WIDX_ZOOM_IN, WIDX_ZOOM_OUT, WIDX_LOCATE, + WIDX_ROTATE, }; #pragma region MEASUREMENTS @@ -48,176 +51,192 @@ static Widget _viewportWidgets[] = MakeWidget({WW - 25, 17}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_G2_ZOOM_IN), STR_ZOOM_IN_TIP ), // zoom in MakeWidget({WW - 25, 41}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_G2_ZOOM_OUT), STR_ZOOM_OUT_TIP ), // zoom out MakeWidget({WW - 25, 65}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP), // locate - WIDGETS_END, + MakeWidget({WW - 25, 89}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_ROTATE_ARROW),STR_LOCATE_SUBJECT_TIP), // rotate + kWidgetsEnd, }; -// clang-format on + // clang-format on -class ViewportWindow final : public Window -{ -private: - void GetFreeViewportNumber() + class ViewportWindow final : public Window { - number = 1; - WindowVisitEach([&](WindowBase* w) { - if (w != nullptr && w != this && w->classification == WindowClass::Viewport) + private: + void GetFreeViewportNumber() + { + number = 1; + WindowVisitEach([&](WindowBase* w) { + if (w != nullptr && w != this && w->classification == WindowClass::Viewport) + { + if (w->number >= number) + number = w->number + 1; + } + }); + } + + public: + void OnOpen() override + { + GetFreeViewportNumber(); + + widgets = _viewportWidgets; + + // Create viewport + ViewportCreate(this, windowPos, width, height, Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ())); + if (viewport == nullptr) { - if (w->number >= number) - number = w->number + 1; - } - }); - } - -public: - void OnOpen() override - { - GetFreeViewportNumber(); - - widgets = _viewportWidgets; - - // Create viewport - ViewportCreate(this, windowPos, width, height, Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ())); - if (viewport == nullptr) - { - Close(); - WindowErrorOpen("Unexpected Error", "Failed to create viewport window."); - return; - } - - auto* mainWindow = WindowGetMain(); - if (mainWindow != nullptr) - { - Viewport* mainViewport = mainWindow->viewport; - int32_t x = mainViewport->viewPos.x + (mainViewport->view_width / 2); - int32_t y = mainViewport->viewPos.y + (mainViewport->view_height / 2); - savedViewPos = { x - (viewport->view_width / 2), y - (viewport->view_height / 2) }; - } - - viewport->flags |= VIEWPORT_FLAG_SOUND_ON; - - min_width = WW; - min_height = WH; - max_width = WW; - max_height = WH; - } - - void OnUpdate() override - { - auto* mainWindow = WindowGetMain(); - if (mainWindow == nullptr) - return; - - if (viewport != nullptr && viewport->flags != mainWindow->viewport->flags) - { - viewport->flags = mainWindow->viewport->flags; - Invalidate(); - } - - // Not sure how to invalidate part of the viewport that has changed, this will have to do for now - // widget_invalidate(*this, WIDX_VIEWPORT); - } - - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_CLOSE: Close(); - break; - case WIDX_ZOOM_IN: - if (viewport != nullptr && viewport->zoom > ZoomLevel::min()) - { - viewport->zoom--; - Invalidate(); - } - break; - case WIDX_ZOOM_OUT: - if (viewport != nullptr && viewport->zoom < ZoomLevel::max()) - { - viewport->zoom++; - Invalidate(); - } - break; - case WIDX_LOCATE: - auto* mainWindow = WindowGetMain(); - if (mainWindow != nullptr) - { - auto info = GetMapCoordinatesFromPos( - { windowPos.x + (width / 2), windowPos.y + (height / 2) }, ViewportInteractionItemAll); - WindowScrollToLocation(*mainWindow, { info.Loc, TileElementHeight(info.Loc) }); - } - break; + ErrorOpen("Unexpected Error", "Failed to create viewport window."); + return; + } + + auto* mainWindow = WindowGetMain(); + if (mainWindow != nullptr) + { + Viewport* mainViewport = mainWindow->viewport; + int32_t x = mainViewport->viewPos.x + (mainViewport->view_width / 2); + int32_t y = mainViewport->viewPos.y + (mainViewport->view_height / 2); + savedViewPos = { x - (viewport->view_width / 2), y - (viewport->view_height / 2) }; + } + + viewport->flags |= VIEWPORT_FLAG_SOUND_ON | VIEWPORT_FLAG_INDEPEDENT_ROTATION; + + min_width = WW; + min_height = WH; + max_width = WW; + max_height = WH; } - } - void OnDraw(DrawPixelInfo& dpi) override - { - DrawWidgets(dpi); + void OnUpdate() override + { + auto* mainWindow = WindowGetMain(); + if (mainWindow == nullptr) + return; - // Draw viewport - if (viewport != nullptr) - WindowDrawViewport(dpi, *this); - } + if (viewport != nullptr && viewport->flags != mainWindow->viewport->flags) + { + viewport->flags = mainWindow->viewport->flags | VIEWPORT_FLAG_INDEPEDENT_ROTATION; + Invalidate(); + } - void OnResize() override + // Not sure how to invalidate part of the viewport that has changed, this will have to do for now + // widget_invalidate(*this, WIDX_VIEWPORT); + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_ZOOM_IN: + { + if (viewport != nullptr && viewport->zoom > ZoomLevel::min()) + { + viewport->zoom--; + Invalidate(); + } + break; + } + case WIDX_ZOOM_OUT: + { + if (viewport != nullptr && viewport->zoom < ZoomLevel::max()) + { + viewport->zoom++; + Invalidate(); + } + break; + } + case WIDX_LOCATE: + { + auto* mainWindow = WindowGetMain(); + if (mainWindow != nullptr) + { + auto info = GetMapCoordinatesFromPos( + { windowPos.x + (width / 2), windowPos.y + (height / 2) }, ViewportInteractionItemAll); + WindowScrollToLocation(*mainWindow, { info.Loc, TileElementHeight(info.Loc) }); + } + break; + } + case WIDX_ROTATE: + { + ViewportRotateSingle(this, 1); + Invalidate(); + break; + } + } + } + + void OnDraw(DrawPixelInfo& dpi) override + { + DrawWidgets(dpi); + + // Draw viewport + if (viewport != nullptr) + WindowDrawViewport(dpi, *this); + } + + void OnResize() override + { + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + + max_width = (screenWidth * 4) / 5; + max_height = (screenHeight * 4) / 5; + + min_width = WW; + min_height = WH; + + WindowSetResize(*this, min_width, min_height, max_width, max_height); + } + + void OnPrepareDraw() override + { + Widget* viewportWidget = &widgets[WIDX_VIEWPORT]; + + ResizeFrameWithPage(); + widgets[WIDX_ZOOM_IN].left = width - 27; + widgets[WIDX_ZOOM_IN].right = width - 2; + widgets[WIDX_ZOOM_OUT].left = width - 27; + widgets[WIDX_ZOOM_OUT].right = width - 2; + widgets[WIDX_LOCATE].left = width - 27; + widgets[WIDX_LOCATE].right = width - 2; + widgets[WIDX_ROTATE].left = width - 27; + widgets[WIDX_ROTATE].right = width - 2; + widgets[WIDX_VIEWPORT].right = widgets[WIDX_ZOOM_IN].left - 1; + widgets[WIDX_VIEWPORT].bottom = widgets[WIDX_BACKGROUND].bottom - 3; + + // Set title + Formatter::Common().Add(number); + + // Set disabled widgets + disabled_widgets = 0; + if (viewport != nullptr && viewport->zoom == ZoomLevel::min()) + disabled_widgets |= 1uLL << WIDX_ZOOM_IN; + if (viewport != nullptr && viewport->zoom >= ZoomLevel::max()) + disabled_widgets |= 1uLL << WIDX_ZOOM_OUT; + + if (viewport != nullptr) + { + viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }; + viewport->width = widgets[WIDX_VIEWPORT].width() - 1; + viewport->height = widgets[WIDX_VIEWPORT].height() - 1; + viewport->view_width = viewport->zoom.ApplyTo(viewport->width); + viewport->view_height = viewport->zoom.ApplyTo(viewport->height); + } + } + }; + + WindowBase* ViewportOpen() { int32_t screenWidth = ContextGetWidth(); int32_t screenHeight = ContextGetHeight(); + int32_t width = (screenWidth / 2); + int32_t height = (screenHeight / 2); - max_width = (screenWidth * 4) / 5; - max_height = (screenHeight * 4) / 5; + auto* w = WindowCreate(WindowClass::Viewport, std::max(WW, width), std::max(WH, height), WF_RESIZABLE); - min_width = WW; - min_height = WH; - - WindowSetResize(*this, min_width, min_height, max_width, max_height); + if (w != nullptr) + return w; + return nullptr; } - - void OnPrepareDraw() override - { - Widget* viewportWidget = &widgets[WIDX_VIEWPORT]; - - ResizeFrameWithPage(); - widgets[WIDX_ZOOM_IN].left = width - 27; - widgets[WIDX_ZOOM_IN].right = width - 2; - widgets[WIDX_ZOOM_OUT].left = width - 27; - widgets[WIDX_ZOOM_OUT].right = width - 2; - widgets[WIDX_LOCATE].left = width - 27; - widgets[WIDX_LOCATE].right = width - 2; - widgets[WIDX_VIEWPORT].right = widgets[WIDX_ZOOM_IN].left - 1; - widgets[WIDX_VIEWPORT].bottom = widgets[WIDX_BACKGROUND].bottom - 3; - - // Set title - Formatter::Common().Add(number); - - // Set disabled widgets - disabled_widgets = 0; - if (viewport != nullptr && viewport->zoom == ZoomLevel::min()) - disabled_widgets |= 1uLL << WIDX_ZOOM_IN; - if (viewport != nullptr && viewport->zoom >= ZoomLevel::max()) - disabled_widgets |= 1uLL << WIDX_ZOOM_OUT; - - if (viewport != nullptr) - { - viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }; - viewport->width = widgets[WIDX_VIEWPORT].width() - 1; - viewport->height = widgets[WIDX_VIEWPORT].height() - 1; - viewport->view_width = viewport->zoom.ApplyTo(viewport->width); - viewport->view_height = viewport->zoom.ApplyTo(viewport->height); - } - } -}; - -WindowBase* WindowViewportOpen() -{ - int32_t screenWidth = ContextGetWidth(); - int32_t screenHeight = ContextGetHeight(); - int32_t width = (screenWidth / 2); - int32_t height = (screenHeight / 2); - - auto* w = WindowCreate(WindowClass::Viewport, std::max(WW, width), std::max(WH, height), WF_RESIZABLE); - - if (w != nullptr) - return w; - return nullptr; -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 9eeab3ff87..838e74a087 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -18,13 +18,13 @@ #include #include -using namespace OpenRCT2; +namespace OpenRCT2::Ui::Windows +{ + static constexpr StringId WINDOW_TITLE = STR_WATER; + static constexpr int32_t WH = 77; + static constexpr int32_t WW = 76; -static constexpr StringId WINDOW_TITLE = STR_WATER; -static constexpr int32_t WH = 77; -static constexpr int32_t WW = 76; - -// clang-format off + // clang-format off enum WindowWaterWidgetIdx { WIDX_BACKGROUND, WIDX_TITLE, @@ -39,160 +39,162 @@ static Widget _waterWidgets[] = { MakeWidget ({16, 17}, {44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary , ImageId(SPR_LAND_TOOL_SIZE_0), STR_NONE), // preview box MakeRemapWidget({17, 18}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_WATER_TIP), // decrement size MakeRemapWidget({43, 32}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_WATER_TIP), // increment size - WIDGETS_END, + kWidgetsEnd, }; -// clang-format on + // clang-format on -class WaterWindow final : public Window -{ -public: - void OnOpen() override + class WaterWindow final : public Window { - widgets = _waterWidgets; - hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); - WindowInitScrollWidgets(*this); - WindowPushOthersBelow(*this); - - gLandToolSize = 1; - gWaterToolRaiseCost = kMoney64Undefined; - gWaterToolLowerCost = kMoney64Undefined; - } - - void OnClose() override - { - // If the tool wasn't changed, turn tool off - if (WaterToolIsActive()) + public: + void OnOpen() override { - ToolCancel(); + widgets = _waterWidgets; + hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); + WindowInitScrollWidgets(*this); + WindowPushOthersBelow(*this); + + gLandToolSize = 1; + gWaterToolRaiseCost = kMoney64Undefined; + gWaterToolLowerCost = kMoney64Undefined; } - } - void OnMouseUp(WidgetIndex widgetIndex) override - { - switch (widgetIndex) + void OnClose() override { - case WIDX_CLOSE: + // If the tool wasn't changed, turn tool off + if (WaterToolIsActive()) + { + ToolCancel(); + } + } + + void OnMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_PREVIEW: + InputSize(); + break; + } + } + + void OnMouseDown(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_DECREMENT: + // Decrement land tool size + gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); + + // Invalidate the window + Invalidate(); + break; + case WIDX_INCREMENT: + // Increment land tool size + gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); + + // Invalidate the window + Invalidate(); + break; + } + } + + void OnUpdate() override + { + // Close window if another tool is open + if (!WaterToolIsActive()) + { Close(); - break; - case WIDX_PREVIEW: - InputSize(); - break; - } - } - - void OnMouseDown(WidgetIndex widgetIndex) override - { - switch (widgetIndex) - { - case WIDX_DECREMENT: - // Decrement land tool size - gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); - - // Invalidate the window - Invalidate(); - break; - case WIDX_INCREMENT: - // Increment land tool size - gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); - - // Invalidate the window - Invalidate(); - break; - } - } - - void OnUpdate() override - { - // Close window if another tool is open - if (!WaterToolIsActive()) - { - Close(); - } - } - - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override - { - int32_t size; - char* end; - - if (widgetIndex != WIDX_PREVIEW) - { - return; - } - - std::string textStr = std::string(text); - size = strtol(textStr.c_str(), &end, 10); - if (*end == '\0') - { - size = std::max(kLandToolMinimumSize, size); - size = std::min(kLandToolMaximumSize, size); - gLandToolSize = size; - - Invalidate(); - } - } - - void OnPrepareDraw() override - { - // Set the preview image button to be pressed down - SetWidgetPressed(WIDX_PREVIEW, true); - - // Update the preview image - widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); - } - - void OnDraw(DrawPixelInfo& dpi) override - { - auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(), - windowPos.y + widgets[WIDX_PREVIEW].midY() }; - - DrawWidgets(dpi); - // Draw number for tool sizes bigger than 7 - if (gLandToolSize > kLandToolMaximumSizeWithSprite) - { - auto ft = Formatter(); - ft.Add(gLandToolSize); - DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); - } - - if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) - { - // Draw raise cost amount - screenCoords = { widgets[WIDX_PREVIEW].midX() + windowPos.x, widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 }; - if (gWaterToolRaiseCost != kMoney64Undefined && gWaterToolRaiseCost != 0) - { - auto ft = Formatter(); - ft.Add(gWaterToolRaiseCost); - DrawTextBasic(dpi, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::CENTRE }); - } - screenCoords.y += 10; - - // Draw lower cost amount - if (gWaterToolLowerCost != kMoney64Undefined && gWaterToolLowerCost != 0) - { - auto ft = Formatter(); - ft.Add(gWaterToolLowerCost); - DrawTextBasic(dpi, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::CENTRE }); } } - } - void OnResize() override + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + int32_t size; + char* end; + + if (widgetIndex != WIDX_PREVIEW) + { + return; + } + + std::string textStr = std::string(text); + size = strtol(textStr.c_str(), &end, 10); + if (*end == '\0') + { + size = std::max(kLandToolMinimumSize, size); + size = std::min(kLandToolMaximumSize, size); + gLandToolSize = size; + + Invalidate(); + } + } + + void OnPrepareDraw() override + { + // Set the preview image button to be pressed down + SetWidgetPressed(WIDX_PREVIEW, true); + + // Update the preview image + widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); + } + + void OnDraw(DrawPixelInfo& dpi) override + { + auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(), + windowPos.y + widgets[WIDX_PREVIEW].midY() }; + + DrawWidgets(dpi); + // Draw number for tool sizes bigger than 7 + if (gLandToolSize > kLandToolMaximumSizeWithSprite) + { + auto ft = Formatter(); + ft.Add(gLandToolSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + } + + if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) + { + // Draw raise cost amount + screenCoords = { widgets[WIDX_PREVIEW].midX() + windowPos.x, widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 }; + if (gWaterToolRaiseCost != kMoney64Undefined && gWaterToolRaiseCost != 0) + { + auto ft = Formatter(); + ft.Add(gWaterToolRaiseCost); + DrawTextBasic(dpi, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + } + screenCoords.y += 10; + + // Draw lower cost amount + if (gWaterToolLowerCost != kMoney64Undefined && gWaterToolLowerCost != 0) + { + auto ft = Formatter(); + ft.Add(gWaterToolLowerCost); + DrawTextBasic(dpi, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + } + } + } + + void OnResize() override + { + ResizeFrame(); + } + + private: + void InputSize() + { + Formatter ft; + ft.Add(kLandToolMinimumSize); + ft.Add(kLandToolMaximumSize); + WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); + } + }; + + WindowBase* WaterOpen() { - ResizeFrame(); + return WindowFocusOrCreate(WindowClass::Water, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); } - -private: - void InputSize() - { - Formatter ft; - ft.Add(kLandToolMinimumSize); - ft.Add(kLandToolMaximumSize); - WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3); - } -}; - -WindowBase* WindowWaterOpen() -{ - return WindowFocusOrCreate(WindowClass::Water, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); -} +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Window.h b/src/openrct2-ui/windows/Window.h index 87e217fd03..2219833e1f 100644 --- a/src/openrct2-ui/windows/Window.h +++ b/src/openrct2-ui/windows/Window.h @@ -16,205 +16,209 @@ #include #include -using loadsave_callback = void (*)(int32_t result, const utf8* path); -using scenarioselect_callback = void (*)(const utf8* path); struct Peep; struct TileElement; struct Vehicle; +struct TrackDesign; enum class GuestListFilterType : int32_t; enum class ScatterToolDensity : uint8_t; +using loadsave_callback = void (*)(int32_t result, const utf8* path); +using scenarioselect_callback = void (*)(const utf8* path); -extern bool gWindowSceneryScatterEnabled; -extern uint16_t gWindowSceneryScatterSize; -extern ScatterToolDensity gWindowSceneryScatterDensity; -extern uint8_t gWindowSceneryPaintEnabled; -extern uint8_t gWindowSceneryRotation; -extern colour_t gWindowSceneryPrimaryColour; -extern colour_t gWindowScenerySecondaryColour; -extern colour_t gWindowSceneryTertiaryColour; -extern bool gWindowSceneryEyedropperEnabled; +namespace OpenRCT2::Ui::Windows +{ + extern bool gWindowSceneryScatterEnabled; + extern uint16_t gWindowSceneryScatterSize; + extern ScatterToolDensity gWindowSceneryScatterDensity; + extern uint8_t gWindowSceneryPaintEnabled; + extern uint8_t gWindowSceneryRotation; + extern colour_t gWindowSceneryPrimaryColour; + extern colour_t gWindowScenerySecondaryColour; + extern colour_t gWindowSceneryTertiaryColour; + extern bool gWindowSceneryEyedropperEnabled; -WindowBase* WindowAboutOpen(); -void WindowCampaignRefreshRides(); -WindowBase* WindowChangelogOpen(int personality); -WindowBase* WindowCheatsOpen(); -WindowBase* WindowClearSceneryOpen(); -WindowBase* CustomCurrencyWindowOpen(); -WindowBase* WindowDebugPaintOpen(); -WindowBase* WindowEditorInventionsListOpen(); -WindowBase* WindowEditorMainOpen(); -WindowBase* WindowEditorObjectiveOptionsOpen(); -WindowBase* WindowEditorScenarioOptionsOpen(); -WindowBase* WindowFootpathOpen(); -void WindowFootpathResetSelectedPath(); -WindowBase* WindowGuestOpen(Peep* peep); -WindowBase* WindowLandOpen(); -WindowBase* WindowLandRightsOpen(); -WindowBase* WindowMainOpen(); -WindowBase* WindowMapgenOpen(); -WindowBase* WindowMultiplayerOpen(); -WindowBase* WindowNewsOpen(); -WindowBase* WindowNewsOptionsOpen(); -WindowBase* WindowOptionsOpen(); -WindowBase* WindowSavePromptOpen(); + WindowBase* AboutOpen(); + void WindowCampaignRefreshRides(); + WindowBase* ChangelogOpen(int personality); + WindowBase* CheatsOpen(); + WindowBase* ClearSceneryOpen(); + WindowBase* CustomCurrencyOpen(); + WindowBase* DebugPaintOpen(); + WindowBase* EditorInventionsListOpen(); + WindowBase* EditorMainOpen(); + WindowBase* EditorObjectiveOptionsOpen(); + WindowBase* EditorScenarioOptionsOpen(); + WindowBase* FootpathOpen(); + void WindowFootpathResetSelectedPath(); + WindowBase* GuestOpen(Peep* peep); + WindowBase* LandOpen(); + WindowBase* LandRightsOpen(); + WindowBase* MainOpen(); + WindowBase* MapgenOpen(); + WindowBase* MultiplayerOpen(); + WindowBase* NewsOpen(); + WindowBase* NewsOptionsOpen(); + WindowBase* OptionsOpen(); + WindowBase* SavePromptOpen(); #ifndef DISABLE_NETWORK -WindowBase* WindowServerListOpen(); -WindowBase* WindowServerStartOpen(); + WindowBase* ServerListOpen(); + WindowBase* ServerStartOpen(); #endif -WindowBase* WindowShortcutKeysOpen(); -WindowBase* WindowStaffListOpen(); -WindowBase* WindowStaffOpen(Peep* peep); -void WindowStaffListRefresh(); -WindowBase* WindowThemesOpen(); -WindowBase* WindowTitleExitOpen(); -WindowBase* WindowTitleLogoOpen(); -WindowBase* WindowTitleMenuOpen(); -WindowBase* WindowTitleOptionsOpen(); -WindowBase* WindowViewportOpen(); -WindowBase* WindowWaterOpen(); -WindowBase* WindowViewClippingOpen(); -WindowBase* WindowTransparencyOpen(); -WindowBase* WindowAssetPacksOpen(); + WindowBase* ShortcutKeysOpen(); + WindowBase* StaffListOpen(); + WindowBase* StaffOpen(Peep* peep); + void WindowStaffListRefresh(); + WindowBase* ThemesOpen(); + WindowBase* TitleExitOpen(); + WindowBase* TitleLogoOpen(); + WindowBase* TitleMenuOpen(); + WindowBase* TitleOptionsOpen(); + WindowBase* ViewportOpen(); + WindowBase* WaterOpen(); + WindowBase* ViewClippingOpen(); + WindowBase* TransparencyOpen(); + WindowBase* AssetPacksOpen(); -// WC_FINANCES -WindowBase* WindowFinancesOpen(); -WindowBase* WindowFinancesResearchOpen(); -WindowBase* WindowFinancesMarketingOpen(); + // WC_FINANCES + WindowBase* FinancesOpen(); + WindowBase* FinancesResearchOpen(); + WindowBase* FinancesMarketingOpen(); -// WC_PARK_INFORMATION -WindowBase* WindowParkAwardsOpen(); -WindowBase* WindowParkEntranceOpen(); -WindowBase* WindowParkGuestsOpen(); -WindowBase* WindowParkObjectiveOpen(); -WindowBase* WindowParkRatingOpen(); + // WC_PARK_INFORMATION + WindowBase* ParkAwardsOpen(); + WindowBase* ParkEntranceOpen(); + WindowBase* ParkGuestsOpen(); + WindowBase* ParkObjectiveOpen(); + WindowBase* ParkRatingOpen(); -WindowBase* WindowBannerOpen(rct_windownumber number); -WindowBase* WindowRideDemolishPromptOpen(const Ride& ride); -WindowBase* WindowRideRefurbishPromptOpen(const Ride& ride); -WindowBase* WindowSignOpen(rct_windownumber number); -WindowBase* WindowSignSmallOpen(rct_windownumber number); -WindowBase* WindowPlayerOpen(uint8_t id); -WindowBase* WindowNewCampaignOpen(int16_t campaignType); + WindowBase* BannerOpen(rct_windownumber number); + WindowBase* RideDemolishPromptOpen(const Ride& ride); + WindowBase* RideRefurbishPromptOpen(const Ride& ride); + WindowBase* SignOpen(rct_windownumber number); + WindowBase* SignSmallOpen(rct_windownumber number); + WindowBase* PlayerOpen(uint8_t id); + WindowBase* NewCampaignOpen(int16_t campaignType); -WindowBase* WindowInstallTrackOpen(const utf8* path); -void WindowGuestListRefreshList(); -WindowBase* WindowGuestListOpen(); -WindowBase* WindowGuestListOpenWithFilter(GuestListFilterType type, int32_t index); -WindowBase* WindowStaffFirePromptOpen(Peep* peep); -WindowBase* WindowScenarioselectOpen(scenarioselect_callback callback); -WindowBase* WindowScenarioselectOpen(std::function callback); + WindowBase* InstallTrackOpen(const utf8* path); + void WindowGuestListRefreshList(); + WindowBase* GuestListOpen(); + WindowBase* GuestListOpenWithFilter(GuestListFilterType type, int32_t index); + WindowBase* StaffFirePromptOpen(Peep* peep); + WindowBase* ScenarioselectOpen(scenarioselect_callback callback); + WindowBase* ScenarioselectOpen(std::function callback); -WindowBase* WindowErrorOpen(StringId title, StringId message, const class Formatter& formatter); -WindowBase* WindowErrorOpen(std::string_view title, std::string_view message); -struct TrackDesign; -WindowBase* WindowLoadsaveOpen( - int32_t type, std::string_view defaultPath, std::function callback, - TrackDesign* trackDesign); -WindowBase* WindowTrackPlaceOpen(const struct TrackDesignFileRef* tdFileRef); -WindowBase* WindowTrackManageOpen(struct TrackDesignFileRef* tdFileRef); + WindowBase* ErrorOpen(StringId title, StringId message, const class Formatter& formatter); + WindowBase* ErrorOpen(std::string_view title, std::string_view message); -void TrackPlaceClearProvisionalTemporarily(); -void TrackPlaceRestoreProvisional(); + WindowBase* LoadsaveOpen( + int32_t type, std::string_view defaultPath, std::function callback, + TrackDesign* trackDesign); + WindowBase* TrackPlaceOpen(const struct TrackDesignFileRef* tdFileRef); + WindowBase* TrackManageOpen(struct TrackDesignFileRef* tdFileRef); -WindowBase* WindowMapOpen(); -void WindowMapReset(); + void TrackPlaceClearProvisionalTemporarily(); + void TrackPlaceRestoreProvisional(); -WindowBase* WindowResearchOpen(); -void WindowResearchDevelopmentMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex); -void WindowResearchDevelopmentPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex); -void WindowResearchDevelopmentDraw(WindowBase* w, DrawPixelInfo& dpi, WidgetIndex baseWidgetIndex); -void WindowResearchFundingMouseDown(WindowBase* w, WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex); -void WindowResearchFundingMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex); -void WindowResearchFundingDropdown(WidgetIndex widgetIndex, int32_t selectedIndex, WidgetIndex baseWidgetIndex); -void WindowResearchFundingPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex); -void WindowResearchFundingDraw(WindowBase* w, DrawPixelInfo& dpi); + WindowBase* MapOpen(); + void WindowMapReset(); -WindowBase* WindowNewRideOpen(); -WindowBase* WindowNewRideOpenResearch(); -void WindowNewRideInitVars(); -void WindowNewRideFocus(RideSelection rideItem); + WindowBase* ResearchOpen(); + void WindowResearchDevelopmentMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex); + void WindowResearchDevelopmentPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex); + void WindowResearchDevelopmentDraw(WindowBase* w, DrawPixelInfo& dpi, WidgetIndex baseWidgetIndex); + void WindowResearchFundingMouseDown(WindowBase* w, WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex); + void WindowResearchFundingMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex); + void WindowResearchFundingDropdown(WidgetIndex widgetIndex, int32_t selectedIndex, WidgetIndex baseWidgetIndex); + void WindowResearchFundingPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex); + void WindowResearchFundingDraw(WindowBase* w, DrawPixelInfo& dpi); -WindowBase* WindowRideListOpen(); -void WindowRideListRefreshList(WindowBase* w); + WindowBase* NewRideOpen(); + WindowBase* NewRideOpenResearch(); + void WindowNewRideInitVars(); + void WindowNewRideFocus(RideSelection rideItem); -WindowBase* WindowRideMainOpen(const Ride& ride); -WindowBase* WindowRideOpenTrack(TileElement* tileElement); -WindowBase* WindowRideOpenVehicle(Vehicle* vehicle); -void WindowRideInvalidateVehicle(const Vehicle& vehicle); -void WindowRidePaintResetVehicle(RideId rideIndex); -void WindowRideMeasurementsDesignCancel(); + WindowBase* RideListOpen(); + void WindowRideListRefreshList(WindowBase* w); -// rct2: 0x00F635EE -extern RideSelection _window_track_list_item; -WindowBase* WindowTrackListOpen(RideSelection item); -void WindowTrackDesignListReloadTracks(); -void WindowTrackDesignListSetBeingUpdated(bool beingUpdated); + WindowBase* RideMainOpen(const Ride& ride); + WindowBase* RideOpenTrack(TileElement* tileElement); + WindowBase* RideOpenVehicle(Vehicle* vehicle); + void WindowRideInvalidateVehicle(const Vehicle& vehicle); + void WindowRidePaintResetVehicle(RideId rideIndex); + void WindowRideMeasurementsDesignCancel(); -void SetMapTooltip(Formatter& ft); -const Formatter& GetMapTooltip(); -void WindowMapTooltipUpdateVisibility(); + // rct2: 0x00F635EE + extern RideSelection _window_track_list_item; + WindowBase* TrackListOpen(RideSelection item); + void WindowTrackDesignListReloadTracks(); + void WindowTrackDesignListSetBeingUpdated(bool beingUpdated); -WindowBase* WindowMazeConstructionOpen(); -void WindowMazeConstructionUpdatePressedWidgets(); + void SetMapTooltip(Formatter& ft); + const Formatter& GetMapTooltip(); + void WindowMapTooltipUpdateVisibility(); -WindowBase* WindowNetworkStatusOpen(const std::string& text, close_callback onClose); -WindowBase* WindowNetworkStatusOpenPassword(); -void WindowNetworkStatusClose(); + WindowBase* MazeConstructionOpen(); + void WindowMazeConstructionUpdatePressedWidgets(); -void WindowTextInputKey(WindowBase* w, uint32_t keycode); -void WindowTextInputOpen( - WindowBase* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, - StringId existing_text, uintptr_t existing_args, int32_t maxLength); -void WindowTextInputRawOpen( - WindowBase* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, - const_utf8string existing_text, int32_t maxLength); + WindowBase* NetworkStatusOpen(const std::string& text, close_callback onClose); + WindowBase* NetworkStatusOpenPassword(); + void WindowNetworkStatusClose(); -void WindowTextInputOpen( - std::string_view title, std::string_view description, std::string_view initialValue, size_t maxLength, - std::function okCallback, std::function cancelCallback); + void WindowTextInputKey(WindowBase* w, uint32_t keycode); + void WindowTextInputOpen( + WindowBase* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, + StringId existing_text, uintptr_t existing_args, int32_t maxLength); + void WindowTextInputRawOpen( + WindowBase* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, + const_utf8string existing_text, int32_t maxLength); -WindowBase* WindowObjectLoadErrorOpen(utf8* path, size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects); + void WindowTextInputOpen( + std::string_view title, std::string_view description, std::string_view initialValue, size_t maxLength, + std::function okCallback, std::function cancelCallback); -WindowBase* WindowRideConstructionOpen(); -void WindowRideConstructionUpdateActiveElementsImpl(); -void WindowRideConstructionUpdateEnabledTrackPieces(); + WindowBase* ObjectLoadErrorOpen(utf8* path, size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects); -WindowBase* WindowTopToolbarOpen(); -bool LandToolIsActive(); -bool ClearSceneryToolIsActive(); -bool WaterToolIsActive(); + WindowBase* RideConstructionOpen(); + void WindowRideConstructionUpdateActiveElementsImpl(); + void WindowRideConstructionUpdateEnabledTrackPieces(); -WindowBase* WindowSceneryOpen(); -void WindowScenerySetSelectedItem( - const ScenerySelection& sceneryconst, std::optional primary, const std::optional secondary, - const std::optional tertiary, const std::optional rotation); -void WindowScenerySetSelectedTab(const ObjectEntryIndex sceneryGroupIndex); -void WindowScenerySetDefaultPlacementConfiguration(); -void WindowSceneryInit(); -void WindowSceneryResetSelectedSceneryItems(); -const ScenerySelection WindowSceneryGetTabSelection(); + WindowBase* TopToolbarOpen(); + bool LandToolIsActive(); + bool ClearSceneryToolIsActive(); + bool WaterToolIsActive(); -extern uint8_t gToolbarDirtyFlags; -WindowBase* WindowGameBottomToolbarOpen(); -void WindowGameBottomToolbarInvalidateNewsItem(); + WindowBase* SceneryOpen(); + void WindowScenerySetSelectedItem( + const ScenerySelection& sceneryconst, std::optional primary, const std::optional secondary, + const std::optional tertiary, const std::optional rotation); + void WindowScenerySetSelectedTab(const ObjectEntryIndex sceneryGroupIndex); + void WindowScenerySetDefaultPlacementConfiguration(); + void WindowSceneryInit(); + void WindowSceneryResetSelectedSceneryItems(); + const ScenerySelection WindowSceneryGetTabSelection(); -WindowBase* WindowEditorBottomToolbarOpen(); + extern uint8_t gToolbarDirtyFlags; + WindowBase* GameBottomToolbarOpen(); + void WindowGameBottomToolbarInvalidateNewsItem(); -WindowBase* WindowTileInspectorOpen(); -void WindowTileInspectorClearClipboard(); + WindowBase* EditorBottomToolbarOpen(); -WindowBase* WindowEditorObjectSelectionOpen(); + WindowBase* TileInspectorOpen(); + void WindowTileInspectorClearClipboard(); -void WindowTooltipReset(const ScreenCoordsXY& screenCoords); -void WindowTooltipShow(const OpenRCT2String& message, ScreenCoordsXY screenCoords); -void WindowTooltipOpen(WindowBase* widgetWindow, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowTooltipClose(); + WindowBase* EditorObjectSelectionOpen(); + bool EditorObjectSelectionWindowCheck(); -WindowBase* WindowSceneryScatterOpen(); -WindowBase* WindowPatrolAreaOpen(EntityId staffId); -EntityId WindowPatrolAreaGetCurrentStaffId(); + void WindowTooltipReset(const ScreenCoordsXY& screenCoords); + void WindowTooltipShow(const OpenRCT2String& message, ScreenCoordsXY screenCoords); + void WindowTooltipOpen(WindowBase* widgetWindow, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); + void WindowTooltipClose(); -// clang-format off + WindowBase* SceneryScatterOpen(); + WindowBase* PatrolAreaOpen(EntityId staffId); + EntityId WindowPatrolAreaGetCurrentStaffId(); + + // clang-format off #define WINDOW_SHIM_RAW(TITLE, WIDTH, HEIGHT, CLOSE_STR) \ { WindowWidgetType::Frame, 0, 0, WIDTH - 1, 0, HEIGHT - 1, 0xFFFFFFFF, STR_NONE }, \ { WindowWidgetType::Caption, 0, 1, WIDTH - 2, 1, 14, TITLE, STR_WINDOW_TITLE_TIP }, \ @@ -223,4 +227,5 @@ EntityId WindowPatrolAreaGetCurrentStaffId(); #define WINDOW_SHIM(TITLE, WIDTH, HEIGHT) WINDOW_SHIM_RAW(TITLE, WIDTH, HEIGHT, STR_CLOSE_X) #define WINDOW_SHIM_WHITE(TITLE, WIDTH, HEIGHT) WINDOW_SHIM_RAW(TITLE, WIDTH, HEIGHT, STR_CLOSE_X_WHITE) -// clang-format on + // clang-format on +} // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2/Cheats.cpp b/src/openrct2/Cheats.cpp index 58fc4be429..6c14cd65c4 100644 --- a/src/openrct2/Cheats.cpp +++ b/src/openrct2/Cheats.cpp @@ -30,61 +30,36 @@ using namespace OpenRCT2; // TODO: Refactor this. Cheat variables should contain the cheat type // and a serialisation method. -bool gCheatsSandboxMode = false; -bool gCheatsDisableClearanceChecks = false; -bool gCheatsDisableSupportLimits = false; -bool gCheatsShowAllOperatingModes = false; -bool gCheatsShowVehiclesFromOtherTrackTypes = false; -bool gCheatsUnlockOperatingLimits = false; -bool gCheatsDisableBrakesFailure = false; -bool gCheatsDisableAllBreakdowns = false; -bool gCheatsBuildInPauseMode = false; -bool gCheatsIgnoreRideIntensity = false; -bool gCheatsDisableVandalism = false; -bool gCheatsDisableLittering = false; -bool gCheatsNeverendingMarketing = false; -bool gCheatsFreezeWeather = false; -bool gCheatsDisableTrainLengthLimit = false; -bool gCheatsDisablePlantAging = false; -bool gCheatsEnableChainLiftOnAllTrack = false; -bool gCheatsAllowArbitraryRideTypeChanges = false; -bool gCheatsDisableRideValueAging = false; -bool gCheatsIgnoreResearchStatus = false; -bool gCheatsEnableAllDrawableTrackPieces = false; -bool gCheatsAllowTrackPlaceInvalidHeights = false; -bool gCheatsAllowRegularPathAsQueue = false; -bool gCheatsAllowSpecialColourSchemes = false; -bool gCheatsMakeAllDestructible = false; -StaffSpeedCheat gCheatsSelectedStaffSpeed = StaffSpeedCheat::None; void CheatsReset() { - gCheatsSandboxMode = false; - gCheatsDisableClearanceChecks = false; - gCheatsDisableSupportLimits = false; - gCheatsShowAllOperatingModes = false; - gCheatsShowVehiclesFromOtherTrackTypes = false; - gCheatsDisableTrainLengthLimit = false; - gCheatsEnableChainLiftOnAllTrack = false; - gCheatsUnlockOperatingLimits = false; - gCheatsDisableBrakesFailure = false; - gCheatsDisableAllBreakdowns = false; - gCheatsBuildInPauseMode = false; - gCheatsIgnoreRideIntensity = false; - gCheatsDisableVandalism = false; - gCheatsDisableLittering = false; - gCheatsNeverendingMarketing = false; - gCheatsFreezeWeather = false; - gCheatsDisablePlantAging = false; - gCheatsAllowArbitraryRideTypeChanges = false; - gCheatsDisableRideValueAging = false; - gCheatsIgnoreResearchStatus = false; - gCheatsEnableAllDrawableTrackPieces = false; - gCheatsAllowTrackPlaceInvalidHeights = false; - gCheatsAllowRegularPathAsQueue = false; - gCheatsAllowSpecialColourSchemes = false; - gCheatsMakeAllDestructible = false; - gCheatsSelectedStaffSpeed = StaffSpeedCheat::None; + auto& gameState = GetGameState(); + gameState.Cheats.SandboxMode = false; + gameState.Cheats.DisableClearanceChecks = false; + gameState.Cheats.DisableSupportLimits = false; + gameState.Cheats.ShowAllOperatingModes = false; + gameState.Cheats.ShowVehiclesFromOtherTrackTypes = false; + gameState.Cheats.DisableTrainLengthLimit = false; + gameState.Cheats.EnableChainLiftOnAllTrack = false; + gameState.Cheats.UnlockOperatingLimits = false; + gameState.Cheats.DisableBrakesFailure = false; + gameState.Cheats.DisableAllBreakdowns = false; + gameState.Cheats.BuildInPauseMode = false; + gameState.Cheats.IgnoreRideIntensity = false; + gameState.Cheats.DisableVandalism = false; + gameState.Cheats.DisableLittering = false; + gameState.Cheats.NeverendingMarketing = false; + gameState.Cheats.FreezeWeather = false; + gameState.Cheats.DisablePlantAging = false; + gameState.Cheats.AllowArbitraryRideTypeChanges = false; + gameState.Cheats.DisableRideValueAging = false; + gameState.Cheats.IgnoreResearchStatus = false; + gameState.Cheats.EnableAllDrawableTrackPieces = false; + gameState.Cheats.AllowTrackPlaceInvalidHeights = false; + gameState.Cheats.AllowRegularPathAsQueue = false; + gameState.Cheats.AllowSpecialColourSchemes = false; + gameState.Cheats.MakeAllDestructible = false; + gameState.Cheats.SelectedStaffSpeed = StaffSpeedCheat::None; } void CheatsSet(CheatType cheatType, int64_t param1 /* = 0*/, int64_t param2 /* = 0*/) @@ -102,6 +77,7 @@ template static void CheatEntrySerialise(DataSerialiser& ds, CheatTy void CheatsSerialise(DataSerialiser& ds) { uint16_t count = 0; + auto& gameState = GetGameState(); if (ds.IsSaving()) { @@ -111,32 +87,35 @@ void CheatsSerialise(DataSerialiser& ds) uint64_t countOffset = stream.GetPosition(); ds << count; - CheatEntrySerialise(ds, CheatType::SandboxMode, gCheatsSandboxMode, count); - CheatEntrySerialise(ds, CheatType::DisableClearanceChecks, gCheatsDisableClearanceChecks, count); - CheatEntrySerialise(ds, CheatType::DisableSupportLimits, gCheatsDisableSupportLimits, count); - CheatEntrySerialise(ds, CheatType::ShowAllOperatingModes, gCheatsShowAllOperatingModes, count); - CheatEntrySerialise(ds, CheatType::ShowVehiclesFromOtherTrackTypes, gCheatsShowVehiclesFromOtherTrackTypes, count); - CheatEntrySerialise(ds, CheatType::FastLiftHill, gCheatsUnlockOperatingLimits, count); - CheatEntrySerialise(ds, CheatType::DisableBrakesFailure, gCheatsDisableBrakesFailure, count); - CheatEntrySerialise(ds, CheatType::DisableAllBreakdowns, gCheatsDisableAllBreakdowns, count); - CheatEntrySerialise(ds, CheatType::BuildInPauseMode, gCheatsBuildInPauseMode, count); - CheatEntrySerialise(ds, CheatType::IgnoreRideIntensity, gCheatsIgnoreRideIntensity, count); - CheatEntrySerialise(ds, CheatType::DisableVandalism, gCheatsDisableVandalism, count); - CheatEntrySerialise(ds, CheatType::DisableLittering, gCheatsDisableLittering, count); - CheatEntrySerialise(ds, CheatType::NeverEndingMarketing, gCheatsNeverendingMarketing, count); - CheatEntrySerialise(ds, CheatType::FreezeWeather, gCheatsFreezeWeather, count); - CheatEntrySerialise(ds, CheatType::DisableTrainLengthLimit, gCheatsDisableTrainLengthLimit, count); - CheatEntrySerialise(ds, CheatType::DisablePlantAging, gCheatsDisablePlantAging, count); - CheatEntrySerialise(ds, CheatType::EnableChainLiftOnAllTrack, gCheatsEnableChainLiftOnAllTrack, count); - CheatEntrySerialise(ds, CheatType::AllowArbitraryRideTypeChanges, gCheatsAllowArbitraryRideTypeChanges, count); - CheatEntrySerialise(ds, CheatType::DisableRideValueAging, gCheatsDisableRideValueAging, count); - CheatEntrySerialise(ds, CheatType::IgnoreResearchStatus, gCheatsIgnoreResearchStatus, count); - CheatEntrySerialise(ds, CheatType::EnableAllDrawableTrackPieces, gCheatsEnableAllDrawableTrackPieces, count); - CheatEntrySerialise(ds, CheatType::AllowTrackPlaceInvalidHeights, gCheatsAllowTrackPlaceInvalidHeights, count); - CheatEntrySerialise(ds, CheatType::AllowRegularPathAsQueue, gCheatsAllowRegularPathAsQueue, count); - CheatEntrySerialise(ds, CheatType::AllowSpecialColourSchemes, gCheatsAllowSpecialColourSchemes, count); - CheatEntrySerialise(ds, CheatType::MakeDestructible, gCheatsMakeAllDestructible, count); - CheatEntrySerialise(ds, CheatType::SetStaffSpeed, gCheatsSelectedStaffSpeed, count); + CheatEntrySerialise(ds, CheatType::SandboxMode, gameState.Cheats.SandboxMode, count); + CheatEntrySerialise(ds, CheatType::DisableClearanceChecks, gameState.Cheats.DisableClearanceChecks, count); + CheatEntrySerialise(ds, CheatType::DisableSupportLimits, gameState.Cheats.DisableSupportLimits, count); + CheatEntrySerialise(ds, CheatType::ShowAllOperatingModes, gameState.Cheats.ShowAllOperatingModes, count); + CheatEntrySerialise( + ds, CheatType::ShowVehiclesFromOtherTrackTypes, gameState.Cheats.ShowVehiclesFromOtherTrackTypes, count); + CheatEntrySerialise(ds, CheatType::FastLiftHill, gameState.Cheats.UnlockOperatingLimits, count); + CheatEntrySerialise(ds, CheatType::DisableBrakesFailure, gameState.Cheats.DisableBrakesFailure, count); + CheatEntrySerialise(ds, CheatType::DisableAllBreakdowns, gameState.Cheats.DisableAllBreakdowns, count); + CheatEntrySerialise(ds, CheatType::BuildInPauseMode, gameState.Cheats.BuildInPauseMode, count); + CheatEntrySerialise(ds, CheatType::IgnoreRideIntensity, gameState.Cheats.IgnoreRideIntensity, count); + CheatEntrySerialise(ds, CheatType::DisableVandalism, gameState.Cheats.DisableVandalism, count); + CheatEntrySerialise(ds, CheatType::DisableLittering, gameState.Cheats.DisableLittering, count); + CheatEntrySerialise(ds, CheatType::NeverEndingMarketing, gameState.Cheats.NeverendingMarketing, count); + CheatEntrySerialise(ds, CheatType::FreezeWeather, gameState.Cheats.FreezeWeather, count); + CheatEntrySerialise(ds, CheatType::DisableTrainLengthLimit, gameState.Cheats.DisableTrainLengthLimit, count); + CheatEntrySerialise(ds, CheatType::DisablePlantAging, gameState.Cheats.DisablePlantAging, count); + CheatEntrySerialise(ds, CheatType::EnableChainLiftOnAllTrack, gameState.Cheats.EnableChainLiftOnAllTrack, count); + CheatEntrySerialise( + ds, CheatType::AllowArbitraryRideTypeChanges, gameState.Cheats.AllowArbitraryRideTypeChanges, count); + CheatEntrySerialise(ds, CheatType::DisableRideValueAging, gameState.Cheats.DisableRideValueAging, count); + CheatEntrySerialise(ds, CheatType::IgnoreResearchStatus, gameState.Cheats.IgnoreResearchStatus, count); + CheatEntrySerialise(ds, CheatType::EnableAllDrawableTrackPieces, gameState.Cheats.EnableAllDrawableTrackPieces, count); + CheatEntrySerialise( + ds, CheatType::AllowTrackPlaceInvalidHeights, gameState.Cheats.AllowTrackPlaceInvalidHeights, count); + CheatEntrySerialise(ds, CheatType::AllowRegularPathAsQueue, gameState.Cheats.AllowRegularPathAsQueue, count); + CheatEntrySerialise(ds, CheatType::AllowSpecialColourSchemes, gameState.Cheats.AllowSpecialColourSchemes, count); + CheatEntrySerialise(ds, CheatType::MakeDestructible, gameState.Cheats.MakeAllDestructible, count); + CheatEntrySerialise(ds, CheatType::SetStaffSpeed, gameState.Cheats.SelectedStaffSpeed, count); // Remember current position and update count. uint64_t endOffset = stream.GetPosition(); @@ -161,85 +140,85 @@ void CheatsSerialise(DataSerialiser& ds) switch (static_cast(type)) { case CheatType::SandboxMode: - ds << gCheatsSandboxMode; + ds << gameState.Cheats.SandboxMode; break; case CheatType::DisableClearanceChecks: - ds << gCheatsDisableClearanceChecks; + ds << gameState.Cheats.DisableClearanceChecks; break; case CheatType::DisableSupportLimits: - ds << gCheatsDisableSupportLimits; + ds << gameState.Cheats.DisableSupportLimits; break; case CheatType::ShowAllOperatingModes: - ds << gCheatsShowAllOperatingModes; + ds << gameState.Cheats.ShowAllOperatingModes; break; case CheatType::ShowVehiclesFromOtherTrackTypes: - ds << gCheatsShowVehiclesFromOtherTrackTypes; + ds << gameState.Cheats.ShowVehiclesFromOtherTrackTypes; break; case CheatType::FastLiftHill: - ds << gCheatsUnlockOperatingLimits; + ds << gameState.Cheats.UnlockOperatingLimits; break; case CheatType::DisableBrakesFailure: - ds << gCheatsDisableBrakesFailure; + ds << gameState.Cheats.DisableBrakesFailure; break; case CheatType::DisableAllBreakdowns: - ds << gCheatsDisableAllBreakdowns; + ds << gameState.Cheats.DisableAllBreakdowns; break; case CheatType::BuildInPauseMode: - ds << gCheatsBuildInPauseMode; + ds << gameState.Cheats.BuildInPauseMode; break; case CheatType::IgnoreRideIntensity: - ds << gCheatsIgnoreRideIntensity; + ds << gameState.Cheats.IgnoreRideIntensity; break; case CheatType::DisableVandalism: - ds << gCheatsDisableVandalism; + ds << gameState.Cheats.DisableVandalism; break; case CheatType::DisableLittering: - ds << gCheatsDisableLittering; + ds << gameState.Cheats.DisableLittering; break; case CheatType::NeverEndingMarketing: - ds << gCheatsNeverendingMarketing; + ds << gameState.Cheats.NeverendingMarketing; break; case CheatType::FreezeWeather: - ds << gCheatsFreezeWeather; + ds << gameState.Cheats.FreezeWeather; break; case CheatType::DisableTrainLengthLimit: - ds << gCheatsDisableTrainLengthLimit; + ds << gameState.Cheats.DisableTrainLengthLimit; break; case CheatType::DisablePlantAging: - ds << gCheatsDisablePlantAging; + ds << gameState.Cheats.DisablePlantAging; break; case CheatType::EnableChainLiftOnAllTrack: - ds << gCheatsEnableChainLiftOnAllTrack; + ds << gameState.Cheats.EnableChainLiftOnAllTrack; break; case CheatType::AllowArbitraryRideTypeChanges: - ds << gCheatsAllowArbitraryRideTypeChanges; + ds << gameState.Cheats.AllowArbitraryRideTypeChanges; break; case CheatType::DisableRideValueAging: - ds << gCheatsDisableRideValueAging; + ds << gameState.Cheats.DisableRideValueAging; break; case CheatType::IgnoreResearchStatus: - ds << gCheatsIgnoreResearchStatus; + ds << gameState.Cheats.IgnoreResearchStatus; break; case CheatType::EnableAllDrawableTrackPieces: - ds << gCheatsEnableAllDrawableTrackPieces; + ds << gameState.Cheats.EnableAllDrawableTrackPieces; break; case CheatType::AllowTrackPlaceInvalidHeights: - ds << gCheatsAllowTrackPlaceInvalidHeights; + ds << gameState.Cheats.AllowTrackPlaceInvalidHeights; break; case CheatType::NoCapOnQueueLengthDummy: ds << dummyBool; break; case CheatType::AllowRegularPathAsQueue: - ds << gCheatsAllowRegularPathAsQueue; + ds << gameState.Cheats.AllowRegularPathAsQueue; break; case CheatType::AllowSpecialColourSchemes: - ds << gCheatsAllowSpecialColourSchemes; + ds << gameState.Cheats.AllowSpecialColourSchemes; break; case CheatType::MakeDestructible: - ds << gCheatsMakeAllDestructible; + ds << gameState.Cheats.MakeAllDestructible; break; case CheatType::SetStaffSpeed: - ds << gCheatsSelectedStaffSpeed; + ds << gameState.Cheats.SelectedStaffSpeed; break; default: break; diff --git a/src/openrct2/Cheats.h b/src/openrct2/Cheats.h index 8ce041666c..6f4680517f 100644 --- a/src/openrct2/Cheats.h +++ b/src/openrct2/Cheats.h @@ -18,32 +18,35 @@ enum class StaffSpeedCheat Fast, }; -extern bool gCheatsSandboxMode; -extern bool gCheatsDisableClearanceChecks; -extern bool gCheatsDisableSupportLimits; -extern bool gCheatsShowAllOperatingModes; -extern bool gCheatsShowVehiclesFromOtherTrackTypes; -extern bool gCheatsUnlockOperatingLimits; -extern bool gCheatsDisableBrakesFailure; -extern bool gCheatsDisableAllBreakdowns; -extern bool gCheatsBuildInPauseMode; -extern bool gCheatsIgnoreRideIntensity; -extern bool gCheatsDisableVandalism; -extern bool gCheatsDisableLittering; -extern bool gCheatsNeverendingMarketing; -extern bool gCheatsFreezeWeather; -extern bool gCheatsDisableTrainLengthLimit; -extern bool gCheatsDisablePlantAging; -extern bool gCheatsDisableRideValueAging; -extern bool gCheatsEnableChainLiftOnAllTrack; -extern bool gCheatsAllowArbitraryRideTypeChanges; -extern bool gCheatsIgnoreResearchStatus; -extern bool gCheatsEnableAllDrawableTrackPieces; -extern bool gCheatsAllowTrackPlaceInvalidHeights; -extern bool gCheatsAllowRegularPathAsQueue; -extern bool gCheatsAllowSpecialColourSchemes; -extern bool gCheatsMakeAllDestructible; -extern StaffSpeedCheat gCheatsSelectedStaffSpeed; +struct CheatsState +{ + bool SandboxMode; + bool DisableClearanceChecks; + bool DisableSupportLimits; + bool ShowAllOperatingModes; + bool ShowVehiclesFromOtherTrackTypes; + bool UnlockOperatingLimits; + bool DisableBrakesFailure; + bool DisableAllBreakdowns; + bool BuildInPauseMode; + bool IgnoreRideIntensity; + bool DisableVandalism; + bool DisableLittering; + bool NeverendingMarketing; + bool FreezeWeather; + bool DisableTrainLengthLimit; + bool DisablePlantAging; + bool DisableRideValueAging; + bool EnableChainLiftOnAllTrack; + bool AllowArbitraryRideTypeChanges; + bool IgnoreResearchStatus; + bool EnableAllDrawableTrackPieces; + bool AllowTrackPlaceInvalidHeights; + bool AllowRegularPathAsQueue; + bool AllowSpecialColourSchemes; + bool MakeAllDestructible; + StaffSpeedCheat SelectedStaffSpeed; +}; enum class CheatType : int32_t { diff --git a/src/openrct2/CommandLineSprite.cpp b/src/openrct2/CommandLineSprite.cpp index 6e7780f97f..ffe578309d 100644 --- a/src/openrct2/CommandLineSprite.cpp +++ b/src/openrct2/CommandLineSprite.cpp @@ -225,21 +225,12 @@ static bool SpriteImageExport(const G1Element& spriteElement, u8string_view outP } } -static std::optional SpriteImageImport( - const char* path, int16_t x_offset, int16_t y_offset, ImageImporter::Palette palette, bool forceBmp, - ImageImporter::ImportMode mode) +static std::optional SpriteImageImport(u8string_view path, ImageImportMeta meta) { try { auto format = IMAGE_FORMAT::PNG_32; - auto flags = ImageImporter::ImportFlags::None; - - if (!forceBmp) - { - flags = ImageImporter::ImportFlags::RLE; - } - - if (palette == ImageImporter::Palette::KeepIndices) + if (meta.palette == Palette::KeepIndices) { format = IMAGE_FORMAT::PNG; } @@ -247,7 +238,7 @@ static std::optional SpriteImageImport( ImageImporter importer; auto image = Imaging::ReadFromFile(path, format); - return importer.Import(image, x_offset, y_offset, palette, flags, mode); + return importer.Import(image, meta); } catch (const std::exception& e) { @@ -483,21 +474,21 @@ int32_t CommandLineForSprite(const char** argv, int32_t argc) const utf8* spriteFilePath = argv[1]; const utf8* imagePath = argv[2]; - int16_t x_offset = 0; - int16_t y_offset = 0; + int16_t xOffset = 0; + int16_t yOffset = 0; if (argc == 5) { char* endptr; - x_offset = strtol(argv[3], &endptr, 0); + xOffset = strtol(argv[3], &endptr, 0); if (*endptr != 0) { fprintf(stderr, "X offset must be an integer\n"); return -1; } - y_offset = strtol(argv[4], &endptr, 0); + yOffset = strtol(argv[4], &endptr, 0); if (*endptr != 0) { fprintf(stderr, "Y offset must be an integer\n"); @@ -505,8 +496,8 @@ int32_t CommandLineForSprite(const char** argv, int32_t argc) } } - auto importResult = SpriteImageImport( - imagePath, x_offset, y_offset, ImageImporter::Palette::OpenRCT2, false, gSpriteMode); + ImageImportMeta meta = { { xOffset, yOffset }, Palette::OpenRCT2, ImportFlags::RLE, gSpriteMode }; + auto importResult = SpriteImageImport(imagePath, meta); if (!importResult.has_value()) return -1; @@ -579,18 +570,12 @@ int32_t CommandLineForSprite(const char** argv, int32_t argc) } std::string strPath = Json::GetString(path); - json_t x_offset = jsonSprite["x_offset"]; - json_t y_offset = jsonSprite["y_offset"]; - - auto palette = (Json::GetString(jsonSprite["palette"]) == "keep") ? ImageImporter::Palette::KeepIndices - : ImageImporter::Palette::OpenRCT2; - bool forceBmp = !jsonSprite["palette"].is_null() && Json::GetBoolean(jsonSprite["forceBmp"]); + auto meta = createImageImportMetaFromJson(jsonSprite); + meta.importMode = gSpriteMode; auto imagePath = Path::GetAbsolute(Path::Combine(directoryPath, strPath)); - auto importResult = SpriteImageImport( - imagePath.c_str(), Json::GetNumber(x_offset), Json::GetNumber(y_offset), palette, forceBmp, - gSpriteMode); + auto importResult = SpriteImageImport(imagePath, meta); if (importResult == std::nullopt) { fprintf(stderr, "Could not import image file: %s\nCanceling\n", imagePath.c_str()); diff --git a/src/openrct2/CommandLineSprite.h b/src/openrct2/CommandLineSprite.h index ec31c9505a..726722ec10 100644 --- a/src/openrct2/CommandLineSprite.h +++ b/src/openrct2/CommandLineSprite.h @@ -13,4 +13,4 @@ #include "drawing/ImageImporter.h" int32_t CommandLineForSprite(const char** argv, int32_t argc); -extern OpenRCT2::Drawing::ImageImporter::ImportMode gSpriteMode; +extern OpenRCT2::Drawing::ImportMode gSpriteMode; diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index a3bf35234f..972fa59bd9 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -659,7 +659,7 @@ namespace OpenRCT2 MapAnimationAutoCreate(); EntityTweener::Get().Reset(); gScreenAge = 0; - gLastAutoSaveUpdate = AUTOSAVE_PAUSE; + gLastAutoSaveUpdate = kAutosavePause; #ifndef DISABLE_NETWORK bool sendMap = false; diff --git a/src/openrct2/Diagnostic.cpp b/src/openrct2/Diagnostic.cpp index 4a888613ac..c6554a0f26 100644 --- a/src/openrct2/Diagnostic.cpp +++ b/src/openrct2/Diagnostic.cpp @@ -11,6 +11,7 @@ #include "core/Console.hpp" #include "core/String.hpp" +#include "util/Util.h" #include #include @@ -20,7 +21,7 @@ #endif [[maybe_unused]] static bool _log_location_enabled = true; -bool _log_levels[static_cast(DiagnosticLevel::Count)] = { +bool _log_levels[EnumValue(DiagnosticLevel::Count)] = { true, true, true, false, true, }; @@ -38,7 +39,7 @@ static FILE* diagnostic_get_stream(DiagnosticLevel level) #ifdef __ANDROID__ -int _android_log_priority[static_cast(DiagnosticLevel::Count)] = { +int _android_log_priority[EnumValue(DiagnosticLevel::Count)] = { ANDROID_LOG_FATAL, ANDROID_LOG_ERROR, ANDROID_LOG_WARN, ANDROID_LOG_VERBOSE, ANDROID_LOG_INFO, }; @@ -46,11 +47,11 @@ void DiagnosticLog(DiagnosticLevel diagnosticLevel, const char* format, ...) { va_list args; - if (!_log_levels[static_cast(diagnosticLevel)]) + if (!_log_levels[EnumValue(diagnosticLevel)]) return; va_start(args, format); - __android_log_vprint(_android_log_priority[static_cast(diagnosticLevel)], "OpenRCT2", format, args); + __android_log_vprint(_android_log_priority[EnumValue(diagnosticLevel)], "OpenRCT2", format, args); va_end(args); } @@ -60,13 +61,13 @@ void DiagnosticLogWithLocation( va_list args; char buf[1024]; - if (!_log_levels[static_cast(diagnosticLevel)]) + if (!_log_levels[EnumValue(diagnosticLevel)]) return; snprintf(buf, 1024, "[%s:%d (%s)]: ", file, line, function); va_start(args, format); - __android_log_vprint(_android_log_priority[static_cast(diagnosticLevel)], file, format, args); + __android_log_vprint(_android_log_priority[EnumValue(diagnosticLevel)], file, format, args); va_end(args); } @@ -88,10 +89,10 @@ static void DiagnosticPrint(DiagnosticLevel level, const std::string& prefix, co void DiagnosticLog(DiagnosticLevel diagnosticLevel, const char* format, ...) { va_list args; - if (_log_levels[static_cast(diagnosticLevel)]) + if (_log_levels[EnumValue(diagnosticLevel)]) { // Level - auto prefix = String::StdFormat("%s: ", _level_strings[static_cast(diagnosticLevel)]); + auto prefix = String::StdFormat("%s: ", _level_strings[EnumValue(diagnosticLevel)]); // Message va_start(args, format); @@ -106,18 +107,17 @@ void DiagnosticLogWithLocation( DiagnosticLevel diagnosticLevel, const char* file, const char* function, int32_t line, const char* format, ...) { va_list args; - if (_log_levels[static_cast(diagnosticLevel)]) + if (_log_levels[EnumValue(diagnosticLevel)]) { // Level and source code information std::string prefix; if (_log_location_enabled) { - prefix = String::StdFormat( - "%s[%s:%d (%s)]: ", _level_strings[static_cast(diagnosticLevel)], file, line, function); + prefix = String::StdFormat("%s[%s:%d (%s)]: ", _level_strings[EnumValue(diagnosticLevel)], file, line, function); } else { - prefix = String::StdFormat("%s: ", _level_strings[static_cast(diagnosticLevel)]); + prefix = String::StdFormat("%s: ", _level_strings[EnumValue(diagnosticLevel)]); } // Message diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index f415059550..174f7ad753 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -321,7 +321,7 @@ namespace Editor gameState.NumGuestsInPark = 0; gameState.NumGuestsHeadingForPark = 0; gameState.NumGuestsInParkLastWeek = 0; - gGuestChangeModifier = 0; + gameState.GuestChangeModifier = 0; if (fromSave) { gameState.ParkFlags |= PARK_FLAGS_NO_MONEY; @@ -529,7 +529,7 @@ namespace Editor } } - if (gPeepSpawns.empty()) + if (gameState.PeepSpawns.empty()) { return { false, STR_PEEP_SPAWNS_NOT_SET }; } diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 5a793d0136..a54958c3a2 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -487,10 +487,10 @@ void FinishObjectSelection() SetEveryRideEntryInvented(); auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); - gLastEntranceStyle = objManager.GetLoadedObjectEntryIndex("rct2.station.plain"); - if (gLastEntranceStyle == OBJECT_ENTRY_INDEX_NULL) + gameState.LastEntranceStyle = objManager.GetLoadedObjectEntryIndex("rct2.station.plain"); + if (gameState.LastEntranceStyle == OBJECT_ENTRY_INDEX_NULL) { - gLastEntranceStyle = 0; + gameState.LastEntranceStyle = 0; } gameState.EditorStep = EditorStep::RollercoasterDesigner; diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index c7c857e031..bc2e86661b 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -450,9 +450,9 @@ static void FixInvalidSurfaces() // Fixes broken saves where a surface element could be null // and broken saves with incorrect invisible map border tiles - for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) + for (int32_t y = 0; y < kMaximumMapSizeTechnical; y++) { - for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) + for (int32_t x = 0; x < kMaximumMapSizeTechnical; x++) { auto* surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }); diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index 72c88181af..d6a11d58ed 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -358,7 +358,7 @@ void GameState::UpdateLogic() // WindowDispatchUpdateAll(); // Start autosave timer after update - if (gLastAutoSaveUpdate == AUTOSAVE_PAUSE) + if (gLastAutoSaveUpdate == kAutosavePause) { gLastAutoSaveUpdate = Platform::GetTicks(); } diff --git a/src/openrct2/GameState.h b/src/openrct2/GameState.h index 6a6eec7706..3a6538e627 100644 --- a/src/openrct2/GameState.h +++ b/src/openrct2/GameState.h @@ -9,17 +9,22 @@ #pragma once +#include "Cheats.h" #include "Date.h" #include "Editor.h" #include "Limits.h" #include "interface/ZoomLevel.h" +#include "management/Award.h" #include "management/Finance.h" #include "management/NewsItem.h" #include "ride/Ride.h" +#include "ride/RideRatings.h" #include "scenario/Scenario.h" +#include "util/Util.h" #include "world/Banner.h" #include "world/Climate.h" #include "world/Location.hpp" +#include "world/Park.h" #include #include @@ -39,23 +44,29 @@ namespace OpenRCT2 money64 ParkEntranceFee; std::vector ParkEntrances; uint32_t ParkSize; + int16_t ParkRatingCasualtyPenalty; money64 ParkValue; money64 ParkValueHistory[FINANCE_GRAPH_SIZE]; money64 CompanyValue; + // The total profit for the entire scenario that precedes the current financial table. + money64 HistoricalProfit; money64 ConstructionRightsPrice; money64 CurrentExpenditure; money64 CurrentProfit; - uint8_t ParkRatingHistory[32]; + uint8_t ParkRatingHistory[kParkRatingHistorySize]; + uint32_t GuestsInParkHistory[32]; ClimateType Climate; ClimateState ClimateCurrent; ClimateState ClimateNext; uint16_t ClimateUpdateTimer; money64 Cash; + money64 CashHistory[FINANCE_GRAPH_SIZE]; money64 InitialCash; money64 GuestInitialCash; uint8_t GuestInitialHappiness; uint8_t GuestInitialHunger; uint8_t GuestInitialThirst; + uint8_t GuestChangeModifier; uint32_t NextGuestNumber; uint32_t NumGuestsInPark; uint32_t NumGuestsHeadingForPark; @@ -73,8 +84,10 @@ namespace OpenRCT2 money64 BankLoan; uint8_t BankLoanInterestRate; money64 MaxBankLoan; + money64 ExpenditureTable[EXPENDITURE_TABLE_MONTH_COUNT][EnumValue(ExpenditureType::Count)]; random_engine_t ScenarioRand; TileCoordsXY MapSize; + money64 LandPrice; ::EditorStep EditorStep; @@ -84,17 +97,26 @@ namespace OpenRCT2 std::string ScenarioCompletedBy; std::vector Banners; + Entity_t Entities[MAX_ENTITIES]{}; // Ride storage for all the rides in the park, rides with RideId::Null are considered free. std::array Rides{}; + ::RideRatingUpdateStates RideRatingUpdateStates; std::vector TileElements; std::vector RestrictedScenery; + std::vector PeepSpawns; + uint8_t PeepWarningThrottle[16]; + News::ItemQueues NewsItems; + uint16_t GrassSceneryTileLoopPosition; + CoordsXY WidePathTileLoopPosition; + colour_t StaffHandymanColour; colour_t StaffMechanicColour; colour_t StaffSecurityColour; + uint64_t SamePriceThroughoutPark{}; uint8_t ResearchFundingLevel; uint8_t ResearchPriorities; @@ -113,6 +135,10 @@ namespace OpenRCT2 uint8_t SavedViewRotation; ZoomLevel SavedViewZoom; + ObjectEntryIndex LastEntranceStyle; + + std::vector CurrentAwards; + /** * Probability out of 65535, of gaining a new guest per game tick. * new guests per second = 40 * (probability / 65535) @@ -124,6 +150,8 @@ namespace OpenRCT2 * In a difficult guest generation scenario, no guests will be generated if over this value. */ uint32_t SuggestedGuestMaximum; + + CheatsState Cheats; }; GameState_t& GetGameState(); diff --git a/src/openrct2/Intro.cpp b/src/openrct2/Intro.cpp index 8c9f024f4e..3fb9106a88 100644 --- a/src/openrct2/Intro.cpp +++ b/src/openrct2/Intro.cpp @@ -178,10 +178,10 @@ void IntroDraw(DrawPixelInfo& dpi) case IntroState::Disclaimer2: break; case IntroState::PublisherBegin: - GfxClear(&dpi, kBackgroundColourDark); + GfxClear(dpi, kBackgroundColourDark); break; case IntroState::PublisherScroll: - GfxClear(&dpi, kBackgroundColourDark); + GfxClear(dpi, kBackgroundColourDark); // Draw a white rectangle for the logo background (gives a bit of white margin) GfxFillRect( @@ -197,11 +197,11 @@ void IntroDraw(DrawPixelInfo& dpi) GfxDrawSprite(dpi, ImageId(SPR_INTRO_INFOGRAMES_11), { (screenWidth / 2) - 320 + 319, _introStateCounter + 319 }); break; case IntroState::DeveloperBegin: - GfxClear(&dpi, kBackgroundColourDark); + GfxClear(dpi, kBackgroundColourDark); GfxTransposePalette(PALETTE_G1_IDX_DEVELOPER, 255); break; case IntroState::DeveloperScroll: - GfxClear(&dpi, kBackgroundColourDark); + GfxClear(dpi, kBackgroundColourDark); // Draw Chris Sawyer logo GfxDrawSprite(dpi, ImageId(SPR_INTRO_CHRIS_SAWYER_00), { (screenWidth / 2) - 320 + 70, _introStateCounter }); @@ -233,7 +233,7 @@ void IntroDraw(DrawPixelInfo& dpi) ScreenIntroDrawLogo(dpi); break; case IntroState::Clear: - GfxClear(&dpi, kBackgroundColourDark); + GfxClear(dpi, kBackgroundColourDark); break; default: break; @@ -293,7 +293,7 @@ static void ScreenIntroDrawLogo(DrawPixelInfo& dpi) DrawingEngineInvalidateImage(SPR_INTRO_LOGO_11); DrawingEngineInvalidateImage(SPR_INTRO_LOGO_21); - GfxClear(&dpi, kBackgroundColourLogo); + GfxClear(dpi, kBackgroundColourLogo); GfxDrawSprite(dpi, ImageId(SPR_INTRO_LOGO_00), { imageX + 0, 0 }); GfxDrawSprite(dpi, ImageId(SPR_INTRO_LOGO_10), { imageX + 220, 0 }); GfxDrawSprite(dpi, ImageId(SPR_INTRO_LOGO_20), { imageX + 440, 0 }); diff --git a/src/openrct2/PlatformEnvironment.cpp b/src/openrct2/PlatformEnvironment.cpp index 44b8f1ade9..025695715a 100644 --- a/src/openrct2/PlatformEnvironment.cpp +++ b/src/openrct2/PlatformEnvironment.cpp @@ -94,7 +94,7 @@ public: u8string GetDirectoryPath(DIRBASE base) const override { - return _basePath[static_cast(base)]; + return _basePath[EnumValue(base)]; } u8string GetDirectoryPath(DIRBASE base, DIRID did) const override @@ -105,15 +105,15 @@ public: { default: case DIRBASE::RCT1: - directoryName = DirectoryNamesRCT2[static_cast(did)]; + directoryName = DirectoryNamesRCT2[EnumValue(did)]; break; case DIRBASE::RCT2: - directoryName = _usingRCTClassic ? "Assets" : DirectoryNamesRCT2[static_cast(did)]; + directoryName = _usingRCTClassic ? "Assets" : DirectoryNamesRCT2[EnumValue(did)]; break; case DIRBASE::OPENRCT2: case DIRBASE::USER: case DIRBASE::CONFIG: - directoryName = DirectoryNamesOpenRCT2[static_cast(did)]; + directoryName = DirectoryNamesOpenRCT2[EnumValue(did)]; break; } @@ -124,7 +124,7 @@ public: { auto dirbase = GetDefaultBaseDirectory(pathid); auto basePath = GetDirectoryPath(dirbase); - auto fileName = FileNames[static_cast(pathid)]; + auto fileName = FileNames[EnumValue(pathid)]; return Path::Combine(basePath, fileName); } @@ -161,7 +161,7 @@ public: void SetBasePath(DIRBASE base, u8string_view path) override { - _basePath[static_cast(base)] = path; + _basePath[EnumValue(base)] = path; if (base == DIRBASE::RCT2) { @@ -223,38 +223,35 @@ std::unique_ptr OpenRCT2::CreatePlatformEnvironment() // Set default paths std::string basePaths[DIRBASE_COUNT]; - basePaths[static_cast(DIRBASE::OPENRCT2)] = Platform::GetInstallPath(); - basePaths[static_cast(DIRBASE::USER)] = Path::Combine( - Platform::GetFolderPath(SPECIAL_FOLDER::USER_DATA), subDirectory); - basePaths[static_cast(DIRBASE::CONFIG)] = Path::Combine( - Platform::GetFolderPath(SPECIAL_FOLDER::USER_CONFIG), subDirectory); - basePaths[static_cast(DIRBASE::CACHE)] = Path::Combine( - Platform::GetFolderPath(SPECIAL_FOLDER::USER_CACHE), subDirectory); - basePaths[static_cast(DIRBASE::DOCUMENTATION)] = Platform::GetDocsPath(); + basePaths[EnumValue(DIRBASE::OPENRCT2)] = Platform::GetInstallPath(); + basePaths[EnumValue(DIRBASE::USER)] = Path::Combine(Platform::GetFolderPath(SPECIAL_FOLDER::USER_DATA), subDirectory); + basePaths[EnumValue(DIRBASE::CONFIG)] = Path::Combine(Platform::GetFolderPath(SPECIAL_FOLDER::USER_CONFIG), subDirectory); + basePaths[EnumValue(DIRBASE::CACHE)] = Path::Combine(Platform::GetFolderPath(SPECIAL_FOLDER::USER_CACHE), subDirectory); + basePaths[EnumValue(DIRBASE::DOCUMENTATION)] = Platform::GetDocsPath(); // Override paths that have been specified via the command line if (!gCustomRCT1DataPath.empty()) { - basePaths[static_cast(DIRBASE::RCT1)] = gCustomRCT1DataPath; + basePaths[EnumValue(DIRBASE::RCT1)] = gCustomRCT1DataPath; } if (!gCustomRCT2DataPath.empty()) { - basePaths[static_cast(DIRBASE::RCT2)] = gCustomRCT2DataPath; + basePaths[EnumValue(DIRBASE::RCT2)] = gCustomRCT2DataPath; } if (!gCustomOpenRCT2DataPath.empty()) { - basePaths[static_cast(DIRBASE::OPENRCT2)] = gCustomOpenRCT2DataPath; + basePaths[EnumValue(DIRBASE::OPENRCT2)] = gCustomOpenRCT2DataPath; } if (!gCustomUserDataPath.empty()) { - basePaths[static_cast(DIRBASE::USER)] = gCustomUserDataPath; - basePaths[static_cast(DIRBASE::CONFIG)] = gCustomUserDataPath; - basePaths[static_cast(DIRBASE::CACHE)] = gCustomUserDataPath; + basePaths[EnumValue(DIRBASE::USER)] = gCustomUserDataPath; + basePaths[EnumValue(DIRBASE::CONFIG)] = gCustomUserDataPath; + basePaths[EnumValue(DIRBASE::CACHE)] = gCustomUserDataPath; } - if (basePaths[static_cast(DIRBASE::DOCUMENTATION)].empty()) + if (basePaths[EnumValue(DIRBASE::DOCUMENTATION)].empty()) { - basePaths[static_cast(DIRBASE::DOCUMENTATION)] = basePaths[static_cast(DIRBASE::OPENRCT2)]; + basePaths[EnumValue(DIRBASE::DOCUMENTATION)] = basePaths[EnumValue(DIRBASE::OPENRCT2)]; } auto env = OpenRCT2::CreatePlatformEnvironment(basePaths); diff --git a/src/openrct2/actions/BalloonPressAction.cpp b/src/openrct2/actions/BalloonPressAction.cpp index f8e4fdc052..a59db7fe23 100644 --- a/src/openrct2/actions/BalloonPressAction.cpp +++ b/src/openrct2/actions/BalloonPressAction.cpp @@ -39,7 +39,7 @@ GameActions::Result BalloonPressAction::Query() const auto balloon = TryGetEntity(_spriteIndex); if (balloon == nullptr) { - LOG_ERROR("Tried getting invalid sprite for balloon: %u", _spriteIndex); + LOG_ERROR("Balloon not found for spriteIndex %u", _spriteIndex); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_BALLOON_NOT_FOUND); } @@ -51,7 +51,7 @@ GameActions::Result BalloonPressAction::Execute() const auto balloon = TryGetEntity(_spriteIndex); if (balloon == nullptr) { - LOG_ERROR("Tried getting invalid sprite for balloon: %u", _spriteIndex); + LOG_ERROR("Balloon not found for spriteIndex %u", _spriteIndex); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_BALLOON_NOT_FOUND); } diff --git a/src/openrct2/actions/BannerPlaceAction.cpp b/src/openrct2/actions/BannerPlaceAction.cpp index cb498d19e0..19830294b6 100644 --- a/src/openrct2/actions/BannerPlaceAction.cpp +++ b/src/openrct2/actions/BannerPlaceAction.cpp @@ -98,9 +98,9 @@ GameActions::Result BannerPlaceAction::Query() const auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(_bannerType); if (bannerEntry == nullptr) { - LOG_ERROR("Invalid banner object type. bannerType = ", _bannerType); + LOG_ERROR("Banner entry not found for bannerType %u", _bannerType); return GameActions::Result( - GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE); + GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_BANNER_ELEMENT_NOT_FOUND); } res.Cost = bannerEntry->price; @@ -126,9 +126,9 @@ GameActions::Result BannerPlaceAction::Execute() const auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry(_bannerType); if (bannerEntry == nullptr) { - LOG_ERROR("Invalid banner object type. bannerType = ", _bannerType); + LOG_ERROR("Banner entry not found for bannerType %u", _bannerType); return GameActions::Result( - GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE); + GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_BANNER_ELEMENT_NOT_FOUND); } auto banner = CreateBanner(); diff --git a/src/openrct2/actions/BannerRemoveAction.cpp b/src/openrct2/actions/BannerRemoveAction.cpp index c0321349be..993baf955b 100644 --- a/src/openrct2/actions/BannerRemoveAction.cpp +++ b/src/openrct2/actions/BannerRemoveAction.cpp @@ -70,14 +70,14 @@ GameActions::Result BannerRemoveAction::Query() const auto bannerIndex = bannerElement->GetIndex(); if (bannerIndex == BannerIndex::GetNull()) { - LOG_ERROR("Invalid banner index. index = ", bannerIndex); + LOG_ERROR("Invalid banner index %u", bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } auto banner = bannerElement->GetBanner(); if (banner == nullptr) { - LOG_ERROR("Invalid banner index. index = ", bannerIndex); + LOG_ERROR("Invalid banner index %u", bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } @@ -109,14 +109,14 @@ GameActions::Result BannerRemoveAction::Execute() const auto bannerIndex = bannerElement->GetIndex(); if (bannerIndex == BannerIndex::GetNull()) { - LOG_ERROR("Invalid banner index. index = ", bannerIndex); + LOG_ERROR("Invalid banner index %u", bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } auto banner = bannerElement->GetBanner(); if (banner == nullptr) { - LOG_ERROR("Invalid banner index. index = ", bannerIndex); + LOG_ERROR("Invalid banner index %u", bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } diff --git a/src/openrct2/actions/BannerSetColourAction.cpp b/src/openrct2/actions/BannerSetColourAction.cpp index bcaae63230..f2b210ce65 100644 --- a/src/openrct2/actions/BannerSetColourAction.cpp +++ b/src/openrct2/actions/BannerSetColourAction.cpp @@ -66,8 +66,8 @@ GameActions::Result BannerSetColourAction::QueryExecute(bool isExecuting) const if (_primaryColour > 31) { - LOG_ERROR("Invalid primary colour: colour = %u", _primaryColour); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Invalid primary colour %u", _primaryColour); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR); } if (!MapCanBuildAt({ _loc.x, _loc.y, _loc.z - 16 })) @@ -79,15 +79,15 @@ GameActions::Result BannerSetColourAction::QueryExecute(bool isExecuting) const if (bannerElement == nullptr) { - LOG_ERROR("Could not find banner at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction); - return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("No banner at x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction); + return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND); } auto index = bannerElement->GetIndex(); auto banner = GetBanner(index); if (banner == nullptr) { - LOG_ERROR("Invalid banner index: index = %u", index); + LOG_ERROR("Invalid banner index %u", index); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } diff --git a/src/openrct2/actions/BannerSetNameAction.cpp b/src/openrct2/actions/BannerSetNameAction.cpp index b50523e7d8..a9c52faafa 100644 --- a/src/openrct2/actions/BannerSetNameAction.cpp +++ b/src/openrct2/actions/BannerSetNameAction.cpp @@ -47,8 +47,9 @@ GameActions::Result BannerSetNameAction::Query() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - LOG_WARNING("Invalid banner id, banner id = %d", _bannerIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_BANNER, STR_NONE); + LOG_ERROR("Banner not found for bannerIndex %d", _bannerIndex); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_RENAME_BANNER, STR_ERR_BANNER_ELEMENT_NOT_FOUND); } return GameActions::Result(); } @@ -58,8 +59,9 @@ GameActions::Result BannerSetNameAction::Execute() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - LOG_WARNING("Invalid banner id, banner id = %d", _bannerIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_BANNER, STR_NONE); + LOG_ERROR("Banner not found for bannerIndex %d", _bannerIndex); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_RENAME_BANNER, STR_ERR_BANNER_ELEMENT_NOT_FOUND); } banner->text = _name; diff --git a/src/openrct2/actions/BannerSetStyleAction.cpp b/src/openrct2/actions/BannerSetStyleAction.cpp index 73ef718e83..e86478f3ed 100644 --- a/src/openrct2/actions/BannerSetStyleAction.cpp +++ b/src/openrct2/actions/BannerSetStyleAction.cpp @@ -49,8 +49,9 @@ GameActions::Result BannerSetStyleAction::Query() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - LOG_ERROR("Invalid banner index: index = %u", _bannerIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Banner not found for bannerIndex %d", _bannerIndex); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND); } res.Expenditure = ExpenditureType::Landscaping; @@ -61,8 +62,9 @@ GameActions::Result BannerSetStyleAction::Query() const if (tileElement == nullptr) { - LOG_ERROR("Could not find banner index = %u", _bannerIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Banner tile element not found for bannerIndex %d", _bannerIndex); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND); } switch (_type) @@ -70,16 +72,18 @@ GameActions::Result BannerSetStyleAction::Query() const case BannerSetStyleType::PrimaryColour: if (_parameter > COLOUR_COUNT) { - LOG_ERROR("Invalid primary colour: colour = %u", _parameter); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Invalid primary colour %u", _parameter); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR); } break; case BannerSetStyleType::TextColour: if (_parameter > 13) { - LOG_ERROR("Invalid text colour: colour = %u", _parameter); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Invalid text colour %u", _parameter); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR); } break; case BannerSetStyleType::NoEntry: @@ -90,8 +94,9 @@ GameActions::Result BannerSetStyleAction::Query() const } break; default: - LOG_ERROR("Invalid type: %u", _type); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Invalid banner style type %u", _type); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_VALUE_OUT_OF_RANGE); } return res; } @@ -103,8 +108,9 @@ GameActions::Result BannerSetStyleAction::Execute() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - LOG_ERROR("Invalid banner index: index = %u", _bannerIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Banner not found for bannerIndex %d", _bannerIndex); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND); } res.Expenditure = ExpenditureType::Landscaping; @@ -115,7 +121,7 @@ GameActions::Result BannerSetStyleAction::Execute() const if (tileElement == nullptr) { - LOG_ERROR("Could not find banner index = %u", _bannerIndex); + LOG_ERROR("Banner tile element not found for bannerIndex &u", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -133,7 +139,8 @@ GameActions::Result BannerSetStyleAction::Execute() const if (bannerElement == nullptr) { LOG_ERROR("Tile element was not a banner."); - return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); + return GameActions::Result( + GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_ERR_BANNER_ELEMENT_NOT_FOUND); } banner->flags &= ~BANNER_FLAG_NO_ENTRY; @@ -147,13 +154,17 @@ GameActions::Result BannerSetStyleAction::Execute() const break; } default: - LOG_ERROR("Invalid type: %u", _type); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Invalid banner style type %u", _type); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_VALUE_OUT_OF_RANGE); } auto intent = Intent(INTENT_ACTION_UPDATE_BANNER); intent.PutExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex); ContextBroadcastIntent(&intent); + ScrollingTextInvalidate(); + GfxInvalidateScreen(); + return res; } diff --git a/src/openrct2/actions/CheatSetAction.cpp b/src/openrct2/actions/CheatSetAction.cpp index 3b1e98362f..30d2c73b4f 100644 --- a/src/openrct2/actions/CheatSetAction.cpp +++ b/src/openrct2/actions/CheatSetAction.cpp @@ -72,6 +72,7 @@ GameActions::Result CheatSetAction::Query() const { if (static_cast(_cheatType) >= static_cast(CheatType::Count)) { + LOG_ERROR("Invalid cheat type %u", _cheatType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -80,11 +81,17 @@ GameActions::Result CheatSetAction::Query() const if (_param1 < validRange.first.first || _param1 > validRange.first.second) { + LOG_ERROR( + "The first cheat parameter is out of range. Value = %d, min = %d, max = %d", _param1, validRange.first.first, + validRange.first.second); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } if (_param2 < validRange.second.first || _param2 > validRange.second.second) { + LOG_ERROR( + "The second cheat parameter is out of range. Value = %d, min = %d, max = %d", _param2, validRange.second.first, + validRange.second.second); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -98,50 +105,50 @@ GameActions::Result CheatSetAction::Execute() const switch (static_cast(_cheatType.id)) { case CheatType::SandboxMode: - gCheatsSandboxMode = _param1 != 0; + GetGameState().Cheats.SandboxMode = _param1 != 0; WindowInvalidateByClass(WindowClass::Map); WindowInvalidateByClass(WindowClass::Footpath); break; case CheatType::DisableClearanceChecks: - gCheatsDisableClearanceChecks = _param1 != 0; + GetGameState().Cheats.DisableClearanceChecks = _param1 != 0; // Required to update the clearance checks overlay on the Cheats button. WindowInvalidateByClass(WindowClass::TopToolbar); break; case CheatType::DisableSupportLimits: - gCheatsDisableSupportLimits = _param1 != 0; + GetGameState().Cheats.DisableSupportLimits = _param1 != 0; break; case CheatType::ShowAllOperatingModes: - gCheatsShowAllOperatingModes = _param1 != 0; + GetGameState().Cheats.ShowAllOperatingModes = _param1 != 0; break; case CheatType::ShowVehiclesFromOtherTrackTypes: - gCheatsShowVehiclesFromOtherTrackTypes = _param1 != 0; + GetGameState().Cheats.ShowVehiclesFromOtherTrackTypes = _param1 != 0; break; case CheatType::FastLiftHill: - gCheatsUnlockOperatingLimits = _param1 != 0; + GetGameState().Cheats.UnlockOperatingLimits = _param1 != 0; break; case CheatType::DisableBrakesFailure: - gCheatsDisableBrakesFailure = _param1 != 0; + GetGameState().Cheats.DisableBrakesFailure = _param1 != 0; break; case CheatType::DisableAllBreakdowns: - gCheatsDisableAllBreakdowns = _param1 != 0; + GetGameState().Cheats.DisableAllBreakdowns = _param1 != 0; break; case CheatType::DisableTrainLengthLimit: - gCheatsDisableTrainLengthLimit = _param1 != 0; + GetGameState().Cheats.DisableTrainLengthLimit = _param1 != 0; break; case CheatType::EnableChainLiftOnAllTrack: - gCheatsEnableChainLiftOnAllTrack = _param1 != 0; + GetGameState().Cheats.EnableChainLiftOnAllTrack = _param1 != 0; break; case CheatType::BuildInPauseMode: - gCheatsBuildInPauseMode = _param1 != 0; + GetGameState().Cheats.BuildInPauseMode = _param1 != 0; break; case CheatType::IgnoreRideIntensity: - gCheatsIgnoreRideIntensity = _param1 != 0; + GetGameState().Cheats.IgnoreRideIntensity = _param1 != 0; break; case CheatType::DisableVandalism: - gCheatsDisableVandalism = _param1 != 0; + GetGameState().Cheats.DisableVandalism = _param1 != 0; break; case CheatType::DisableLittering: - gCheatsDisableLittering = _param1 != 0; + GetGameState().Cheats.DisableLittering = _param1 != 0; break; case CheatType::NoMoney: SetScenarioNoMoney(_param1 != 0); @@ -180,7 +187,7 @@ GameActions::Result CheatSetAction::Execute() const RemoveLitter(); break; case CheatType::DisablePlantAging: - gCheatsDisablePlantAging = _param1 != 0; + GetGameState().Cheats.DisablePlantAging = _param1 != 0; break; case CheatType::SetStaffSpeed: SetStaffSpeed(_param1); @@ -189,7 +196,7 @@ GameActions::Result CheatSetAction::Execute() const RenewRides(); break; case CheatType::MakeDestructible: - gCheatsMakeAllDestructible = _param1 != 0; + GetGameState().Cheats.MakeAllDestructible = _param1 != 0; WindowInvalidateByClass(WindowClass::Ride); break; case CheatType::FixRides: @@ -209,10 +216,10 @@ GameActions::Result CheatSetAction::Execute() const ClimateForceWeather(WeatherType{ static_cast(_param1) }); break; case CheatType::FreezeWeather: - gCheatsFreezeWeather = _param1 != 0; + GetGameState().Cheats.FreezeWeather = _param1 != 0; break; case CheatType::NeverEndingMarketing: - gCheatsNeverendingMarketing = _param1 != 0; + GetGameState().Cheats.NeverendingMarketing = _param1 != 0; break; case CheatType::OpenClosePark: ParkSetOpen(!ParkIsOpen()); @@ -224,20 +231,20 @@ GameActions::Result CheatSetAction::Execute() const ParkSetForcedRating(_param1); break; case CheatType::AllowArbitraryRideTypeChanges: - gCheatsAllowArbitraryRideTypeChanges = _param1 != 0; + GetGameState().Cheats.AllowArbitraryRideTypeChanges = _param1 != 0; WindowInvalidateByClass(WindowClass::Ride); break; case CheatType::OwnAllLand: OwnAllLand(); break; case CheatType::DisableRideValueAging: - gCheatsDisableRideValueAging = _param1 != 0; + GetGameState().Cheats.DisableRideValueAging = _param1 != 0; break; case CheatType::IgnoreResearchStatus: - gCheatsIgnoreResearchStatus = _param1 != 0; + GetGameState().Cheats.IgnoreResearchStatus = _param1 != 0; break; case CheatType::EnableAllDrawableTrackPieces: - gCheatsEnableAllDrawableTrackPieces = _param1 != 0; + GetGameState().Cheats.EnableAllDrawableTrackPieces = _param1 != 0; break; case CheatType::CreateDucks: CreateDucks(_param1); @@ -246,20 +253,20 @@ GameActions::Result CheatSetAction::Execute() const Duck::RemoveAll(); break; case CheatType::AllowTrackPlaceInvalidHeights: - gCheatsAllowTrackPlaceInvalidHeights = _param1 != 0; + GetGameState().Cheats.AllowTrackPlaceInvalidHeights = _param1 != 0; break; case CheatType::AllowRegularPathAsQueue: - gCheatsAllowRegularPathAsQueue = _param1 != 0; + GetGameState().Cheats.AllowRegularPathAsQueue = _param1 != 0; break; case CheatType::AllowSpecialColourSchemes: - gCheatsAllowSpecialColourSchemes = static_cast(_param1); + GetGameState().Cheats.AllowSpecialColourSchemes = static_cast(_param1); break; case CheatType::RemoveParkFences: RemoveParkFences(); break; default: { - LOG_ERROR("Unabled cheat: %d", _cheatType.id); + LOG_ERROR("Invalid cheat type %d", _cheatType.id); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -767,7 +774,7 @@ void CheatSetAction::OwnAllLand() const } // Completely unown peep spawn points - for (const auto& spawn : gPeepSpawns) + for (const auto& spawn : GetGameState().PeepSpawns) { auto* surfaceElement = MapGetSurfaceElementAt(spawn); if (surfaceElement != nullptr) diff --git a/src/openrct2/actions/ClearAction.cpp b/src/openrct2/actions/ClearAction.cpp index f1507526af..366d1661da 100644 --- a/src/openrct2/actions/ClearAction.cpp +++ b/src/openrct2/actions/ClearAction.cpp @@ -239,5 +239,6 @@ void ClearAction::ResetClearLargeSceneryFlag() bool ClearAction::MapCanClearAt(const CoordsXY& location) { - return (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode || MapIsLocationOwnedOrHasRights(location); + return (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.SandboxMode + || MapIsLocationOwnedOrHasRights(location); } diff --git a/src/openrct2/actions/ClimateSetAction.cpp b/src/openrct2/actions/ClimateSetAction.cpp index 6b3b3f99a0..09ec9a08a7 100644 --- a/src/openrct2/actions/ClimateSetAction.cpp +++ b/src/openrct2/actions/ClimateSetAction.cpp @@ -37,7 +37,8 @@ GameActions::Result ClimateSetAction::Query() const { if (_climate >= ClimateType::Count) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_INVALID_CLIMATE_ID, STR_NONE); + LOG_ERROR("Invalid climate type %u", _climate); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_INVALID_CLIMATE_ID, STR_ERR_VALUE_OUT_OF_RANGE); } return GameActions::Result(); diff --git a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp index 1e37025d2b..e49cdd8849 100644 --- a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp +++ b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp @@ -10,6 +10,7 @@ #include "FootpathAdditionPlaceAction.h" #include "../Cheats.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../core/MemoryStream.h" #include "../interface/Window.h" @@ -57,7 +58,8 @@ GameActions::Result FootpathAdditionPlaceAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !MapIsLocationOwned(_loc)) + if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || OpenRCT2::GetGameState().Cheats.SandboxMode) + && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } @@ -75,8 +77,9 @@ GameActions::Result FootpathAdditionPlaceAction::Query() const auto tileElement = MapGetFootpathElement(_loc); if (tileElement == nullptr) { - LOG_ERROR("Could not find path element."); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); + LOG_ERROR("No path element at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_PATH_ELEMENT_NOT_FOUND); } auto pathElement = tileElement->AsPath(); @@ -97,6 +100,7 @@ GameActions::Result FootpathAdditionPlaceAction::Query() const auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry(_entryIndex); if (pathAdditionEntry == nullptr) { + LOG_ERROR("Unknown footpath addition entry for entryIndex %d", _entryIndex); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE); } @@ -151,8 +155,9 @@ GameActions::Result FootpathAdditionPlaceAction::Execute() const if (pathElement == nullptr) { - LOG_ERROR("Could not find path element."); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); + LOG_ERROR("No path element at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_PATH_ELEMENT_NOT_FOUND); } // No change @@ -165,6 +170,7 @@ GameActions::Result FootpathAdditionPlaceAction::Execute() const auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry(_entryIndex); if (pathAdditionEntry == nullptr) { + LOG_ERROR("Unknown footpath addition entry for entryIndex %d", _entryIndex); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE); } diff --git a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp index d09bcdb148..2bff554683 100644 --- a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp +++ b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp @@ -10,6 +10,7 @@ #include "FootpathAdditionRemoveAction.h" #include "../Cheats.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../core/MemoryStream.h" #include "../interface/Window.h" @@ -49,7 +50,8 @@ GameActions::Result FootpathAdditionRemoveAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !MapIsLocationOwned(_loc)) + if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || OpenRCT2::GetGameState().Cheats.SandboxMode) + && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); } @@ -67,15 +69,17 @@ GameActions::Result FootpathAdditionRemoveAction::Query() const auto tileElement = MapGetFootpathElement(_loc); if (tileElement == nullptr) { - LOG_WARNING("Could not find path element."); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); + LOG_ERROR("No path element at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_ERR_PATH_ELEMENT_NOT_FOUND); } auto pathElement = tileElement->AsPath(); if (pathElement == nullptr) { - LOG_WARNING("Could not find path element."); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); + LOG_ERROR("No path element at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_ERR_PATH_ELEMENT_NOT_FOUND); } if (!pathElement->AdditionIsGhost() && (GetFlags() & GAME_COMMAND_FLAG_GHOST)) @@ -99,8 +103,9 @@ GameActions::Result FootpathAdditionRemoveAction::Execute() const if (pathElement == nullptr) { - LOG_ERROR("Could not find path element."); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); + LOG_ERROR("No path element at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_ERR_PATH_ELEMENT_NOT_FOUND); } pathElement->SetAddition(0); diff --git a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp index 37e4b351db..c24cfaac2e 100644 --- a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp +++ b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp @@ -10,6 +10,7 @@ #include "FootpathLayoutPlaceAction.h" #include "../Cheats.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../core/MemoryStream.h" #include "../interface/Window.h" @@ -23,6 +24,8 @@ #include "../world/Surface.h" #include "../world/Wall.h" +using namespace OpenRCT2; + FootpathLayoutPlaceAction::FootpathLayoutPlaceAction( const CoordsXYZ& loc, uint8_t slope, ObjectEntryIndex type, ObjectEntryIndex railingsType, uint8_t edges, PathConstructFlags constructFlags) @@ -73,7 +76,7 @@ GameActions::Result FootpathLayoutPlaceAction::Query() const GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !MapIsLocationOwned(_loc)) + if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.SandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -132,7 +135,7 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertQuery(GameActions::R auto zHigh = zLow + PATH_CLEARANCE; if (_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) { - quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & TILE_ELEMENT_DIRECTION_MASK); + quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & kTileElementDirectionMask); zHigh += PATH_HEIGHT_STEP; } @@ -164,7 +167,7 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertQuery(GameActions::R const auto clearanceData = canBuild.GetData(); gFootpathGroundFlags = clearanceData.GroundFlags; - if (!gCheatsDisableClearanceChecks && (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)) + if (!GetGameState().Cheats.DisableClearanceChecks && (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER); @@ -174,7 +177,8 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertQuery(GameActions::R if (surfaceElement == nullptr) { return GameActions::Result( - GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, + STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } int32_t supportHeight = zLow - surfaceElement->GetBaseZ(); res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / PATH_HEIGHT_STEP) * 5.00_GBP; @@ -202,7 +206,7 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertExecute(GameActions: auto zHigh = zLow + PATH_CLEARANCE; if (_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) { - quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & TILE_ELEMENT_DIRECTION_MASK); + quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & kTileElementDirectionMask); zHigh += PATH_HEIGHT_STEP; } @@ -238,7 +242,8 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertExecute(GameActions: if (surfaceElement == nullptr) { return GameActions::Result( - GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, + STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } int32_t supportHeight = zLow - surfaceElement->GetBaseZ(); res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / PATH_HEIGHT_STEP) * 5.00_GBP; diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index e0fcb85b42..c8eab3d63a 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -78,7 +78,7 @@ GameActions::Result FootpathPlaceAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !MapIsLocationOwned(_loc)) + if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.SandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_NOT_OWNED_BY_PARK); } @@ -101,7 +101,8 @@ GameActions::Result FootpathPlaceAction::Query() const if (_direction != INVALID_DIRECTION && !DirectionValid(_direction)) { LOG_ERROR("Direction invalid. direction = %u", _direction); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_VALUE_OUT_OF_RANGE); } FootpathProvisionalRemove(); @@ -132,13 +133,13 @@ GameActions::Result FootpathPlaceAction::Execute() const if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - if (_direction != INVALID_DIRECTION && !gCheatsDisableClearanceChecks) + if (_direction != INVALID_DIRECTION && !GetGameState().Cheats.DisableClearanceChecks) { // It is possible, let's remove walls between the old and new piece of path auto zLow = _loc.z; auto zHigh = zLow + PATH_CLEARANCE; WallRemoveIntersectingWalls( - { _loc, zLow, zHigh + ((_slope & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK) ? 16 : 0) }, + { _loc, zLow, zHigh + ((_slope & kTileElementSurfaceRaisedCornersMask) ? 16 : 0) }, DirectionReverse(_direction)); WallRemoveIntersectingWalls( { _loc.x - CoordsDirectionDelta[_direction].x, _loc.y - CoordsDirectionDelta[_direction].y, zLow, zHigh }, @@ -282,7 +283,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertQuery(GameActions::Result auto zHigh = zLow + PATH_CLEARANCE; if (_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) { - quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & TILE_ELEMENT_DIRECTION_MASK); + quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & kTileElementDirectionMask); zHigh += PATH_HEIGHT_STEP; } @@ -314,7 +315,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertQuery(GameActions::Result const auto clearanceData = canBuild.GetData(); gFootpathGroundFlags = clearanceData.GroundFlags; - if (!gCheatsDisableClearanceChecks && (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)) + if (!GetGameState().Cheats.DisableClearanceChecks && (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_CANT_BUILD_THIS_UNDERWATER); @@ -323,7 +324,8 @@ GameActions::Result FootpathPlaceAction::ElementInsertQuery(GameActions::Result auto surfaceElement = MapGetSurfaceElementAt(_loc); if (surfaceElement == nullptr) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } int32_t supportHeight = zLow - surfaceElement->GetBaseZ(); res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / PATH_HEIGHT_STEP) * 5.00_GBP; @@ -351,7 +353,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertExecute(GameActions::Resul auto zHigh = zLow + PATH_CLEARANCE; if (_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) { - quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & TILE_ELEMENT_DIRECTION_MASK); + quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & kTileElementDirectionMask); zHigh += PATH_HEIGHT_STEP; } @@ -386,7 +388,8 @@ GameActions::Result FootpathPlaceAction::ElementInsertExecute(GameActions::Resul auto surfaceElement = MapGetSurfaceElementAt(_loc); if (surfaceElement == nullptr) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } int32_t supportHeight = zLow - surfaceElement->GetBaseZ(); res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / PATH_HEIGHT_STEP) * 5.00_GBP; @@ -474,11 +477,12 @@ void FootpathPlaceAction::AutomaticallySetPeepSpawn() const } } - if (gPeepSpawns.empty()) + auto& gameState = GetGameState(); + if (gameState.PeepSpawns.empty()) { - gPeepSpawns.emplace_back(); + gameState.PeepSpawns.emplace_back(); } - PeepSpawn* peepSpawn = &gPeepSpawns[0]; + PeepSpawn* peepSpawn = &gameState.PeepSpawns[0]; peepSpawn->x = _loc.x + (DirectionOffsets[direction].x * 15) + 16; peepSpawn->y = _loc.y + (DirectionOffsets[direction].y * 15) + 16; peepSpawn->direction = direction; diff --git a/src/openrct2/actions/FootpathRemoveAction.cpp b/src/openrct2/actions/FootpathRemoveAction.cpp index 5f4c14aba8..44b35a5ad9 100644 --- a/src/openrct2/actions/FootpathRemoveAction.cpp +++ b/src/openrct2/actions/FootpathRemoveAction.cpp @@ -10,6 +10,7 @@ #include "FootpathRemoveAction.h" #include "../Cheats.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../core/MemoryStream.h" #include "../interface/Window.h" @@ -21,6 +22,8 @@ #include "../world/Wall.h" #include "BannerRemoveAction.h" +using namespace OpenRCT2; + FootpathRemoveAction::FootpathRemoveAction(const CoordsXYZ& location) : _loc(location) { @@ -56,7 +59,7 @@ GameActions::Result FootpathRemoveAction::Query() const GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !MapIsLocationOwned(_loc)) + if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.SandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result( GameActions::Status::NotOwned, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -65,7 +68,8 @@ GameActions::Result FootpathRemoveAction::Query() const TileElement* footpathElement = GetFootpathElement(); if (footpathElement == nullptr) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_ERR_PATH_ELEMENT_NOT_FOUND); } res.Cost = GetRefundPrice(footpathElement); @@ -100,16 +104,17 @@ GameActions::Result FootpathRemoveAction::Execute() const TileElementRemove(footpathElement); FootpathUpdateQueueChains(); + auto& gameState = GetGameState(); // Remove the spawn point (if there is one in the current tile) - gPeepSpawns.erase( + gameState.PeepSpawns.erase( std::remove_if( - gPeepSpawns.begin(), gPeepSpawns.end(), + gameState.PeepSpawns.begin(), gameState.PeepSpawns.end(), [this](const CoordsXYZ& spawn) { { return spawn.ToTileStart() == _loc.ToTileStart(); } }), - gPeepSpawns.end()); + gameState.PeepSpawns.end()); } else { diff --git a/src/openrct2/actions/GameAction.cpp b/src/openrct2/actions/GameAction.cpp index 468d124e4e..2db04d6d86 100644 --- a/src/openrct2/actions/GameAction.cpp +++ b/src/openrct2/actions/GameAction.cpp @@ -184,7 +184,7 @@ namespace GameActions { if (gGamePaused == 0) return true; - if (gCheatsBuildInPauseMode) + if (GetGameState().Cheats.BuildInPauseMode) return true; if (actionFlags & GameActions::Flags::AllowWhilePaused) return true; @@ -422,7 +422,7 @@ namespace GameActions } // Allow autosave to commence - if (gLastAutoSaveUpdate == AUTOSAVE_PAUSE) + if (gLastAutoSaveUpdate == kAutosavePause) { gLastAutoSaveUpdate = Platform::GetTicks(); } diff --git a/src/openrct2/actions/GameActionResult.cpp b/src/openrct2/actions/GameActionResult.cpp index 4de6f06b55..1d1d92fc4c 100644 --- a/src/openrct2/actions/GameActionResult.cpp +++ b/src/openrct2/actions/GameActionResult.cpp @@ -25,7 +25,7 @@ namespace GameActions } std::string operator()(const StringId strId) const { - return FormatStringID(strId, ErrorMessageArgs); + return FormatStringIDLegacy(strId, ErrorMessageArgs); } }; diff --git a/src/openrct2/actions/GameSetSpeedAction.cpp b/src/openrct2/actions/GameSetSpeedAction.cpp index 6e30aed3a0..258ba06df6 100644 --- a/src/openrct2/actions/GameSetSpeedAction.cpp +++ b/src/openrct2/actions/GameSetSpeedAction.cpp @@ -39,7 +39,7 @@ GameActions::Result GameSetSpeedAction::Query() const if (!IsValidSpeed(_speed)) { - LOG_WARNING("Invalid game command for speed %u", _speed); + LOG_ERROR("Invalid speed %u", _speed); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -53,7 +53,7 @@ GameActions::Result GameSetSpeedAction::Execute() const if (!IsValidSpeed(_speed)) { - LOG_WARNING("Invalid game command for speed %u", _speed); + LOG_ERROR("Invalid speed %u", _speed); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } diff --git a/src/openrct2/actions/GuestSetFlagsAction.cpp b/src/openrct2/actions/GuestSetFlagsAction.cpp index 9a5f67ceef..eb70337657 100644 --- a/src/openrct2/actions/GuestSetFlagsAction.cpp +++ b/src/openrct2/actions/GuestSetFlagsAction.cpp @@ -42,7 +42,7 @@ GameActions::Result GuestSetFlagsAction::Query() const auto* peep = TryGetEntity(_peepId); if (peep == nullptr) { - LOG_ERROR("Used invalid sprite index for peep: %u", _peepId.ToUnderlying()); + LOG_ERROR("Guest entity not found for peepID %u", _peepId.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS, STR_NONE); } return GameActions::Result(); @@ -53,7 +53,7 @@ GameActions::Result GuestSetFlagsAction::Execute() const auto* peep = TryGetEntity(_peepId); if (peep == nullptr) { - LOG_ERROR("Used invalid sprite index for peep: %u", _peepId.ToUnderlying()); + LOG_ERROR("Guest entity not found for peepID %u", _peepId.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS, STR_NONE); } diff --git a/src/openrct2/actions/GuestSetNameAction.cpp b/src/openrct2/actions/GuestSetNameAction.cpp index 0f82e1bc46..8532362fee 100644 --- a/src/openrct2/actions/GuestSetNameAction.cpp +++ b/src/openrct2/actions/GuestSetNameAction.cpp @@ -58,13 +58,13 @@ GameActions::Result GuestSetNameAction::Query() const { if (_spriteIndex.ToUnderlying() >= MAX_ENTITIES || _spriteIndex.IsNull()) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_ERR_VALUE_OUT_OF_RANGE); } auto guest = TryGetEntity(_spriteIndex); if (guest == nullptr) { - LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); + LOG_ERROR("Guest entity not found for spriteIndex %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_NONE); } @@ -76,7 +76,7 @@ GameActions::Result GuestSetNameAction::Execute() const auto guest = TryGetEntity(_spriteIndex); if (guest == nullptr) { - LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); + LOG_ERROR("Guest entity not found for spriteIndex %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_NONE); } diff --git a/src/openrct2/actions/LandBuyRightsAction.cpp b/src/openrct2/actions/LandBuyRightsAction.cpp index 74a025e6a5..4f486ecfd2 100644 --- a/src/openrct2/actions/LandBuyRightsAction.cpp +++ b/src/openrct2/actions/LandBuyRightsAction.cpp @@ -113,15 +113,16 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY& { if (_setting >= LandBuyRightSetting::Count) { - LOG_WARNING("Tried calling buy land rights with an incorrect setting. setting = %u", _setting); - return GameActions::Result(GameActions::Status::InvalidParameters, _ErrorTitles[0], STR_NONE); + LOG_ERROR("Invalid land buying setting %u", _setting); + return GameActions::Result(GameActions::Status::InvalidParameters, _ErrorTitles[0], STR_ERR_VALUE_OUT_OF_RANGE); } SurfaceElement* surfaceElement = MapGetSurfaceElementAt(loc); if (surfaceElement == nullptr) { - LOG_ERROR("Could not find surface. x = %d, y = %d", loc.x, loc.y); - return GameActions::Result(GameActions::Status::InvalidParameters, _ErrorTitles[EnumValue(_setting)], STR_NONE); + LOG_ERROR("No surface at x = %d, y = %d", loc.x, loc.y); + return GameActions::Result( + GameActions::Status::InvalidParameters, _ErrorTitles[EnumValue(_setting)], STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } auto res = GameActions::Result(); @@ -144,7 +145,7 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY& surfaceElement->SetOwnership(OWNERSHIP_OWNED); ParkUpdateFencesAroundTile(loc); } - res.Cost = gLandPrice; + res.Cost = GetGameState().LandPrice; return res; case LandBuyRightSetting::BuyConstructionRights: // 2 @@ -170,7 +171,7 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY& return res; default: - LOG_WARNING("Tried calling buy land rights with an incorrect setting. setting = %u", _setting); - return GameActions::Result(GameActions::Status::InvalidParameters, _ErrorTitles[0], STR_NONE); + LOG_ERROR("Invalid land buying setting %u", _setting); + return GameActions::Result(GameActions::Status::InvalidParameters, _ErrorTitles[0], STR_ERR_VALUE_OUT_OF_RANGE); } } diff --git a/src/openrct2/actions/LandLowerAction.cpp b/src/openrct2/actions/LandLowerAction.cpp index 026ab3e239..4e363d09bb 100644 --- a/src/openrct2/actions/LandLowerAction.cpp +++ b/src/openrct2/actions/LandLowerAction.cpp @@ -10,6 +10,7 @@ #include "LandLowerAction.h" #include "../Context.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../actions/LandSetHeightAction.h" #include "../audio/audio.h" @@ -93,7 +94,7 @@ GameActions::Result LandLowerAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !OpenRCT2::GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { @@ -103,9 +104,9 @@ GameActions::Result LandLowerAction::QueryExecute(bool isExecuting) const withinOwnership = true; uint8_t height = surfaceElement->BaseHeight; - if (surfaceElement->GetSlope() & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK) + if (surfaceElement->GetSlope() & kTileElementSurfaceRaisedCornersMask) height += 2; - if (surfaceElement->GetSlope() & TILE_ELEMENT_SURFACE_DIAGONAL_FLAG) + if (surfaceElement->GetSlope() & kTileElementSurfaceDiagonalFlag) height += 2; if (height < maxHeight) @@ -117,7 +118,7 @@ GameActions::Result LandLowerAction::QueryExecute(bool isExecuting) const if (newSlope & SURFACE_STYLE_FLAG_RAISE_OR_LOWER_BASE_HEIGHT) height -= 2; - newSlope &= TILE_ELEMENT_SURFACE_SLOPE_MASK; + newSlope &= kTileElementSurfaceSlopeMask; auto landSetHeightAction = LandSetHeightAction({ x, y }, height, newSlope); landSetHeightAction.SetFlags(GetFlags()); diff --git a/src/openrct2/actions/LandRaiseAction.cpp b/src/openrct2/actions/LandRaiseAction.cpp index 8707766891..3e0ccbdcb2 100644 --- a/src/openrct2/actions/LandRaiseAction.cpp +++ b/src/openrct2/actions/LandRaiseAction.cpp @@ -11,6 +11,7 @@ #include "LandRaiseAction.h" #include "../Context.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../actions/LandSetHeightAction.h" #include "../audio/audio.h" @@ -94,7 +95,7 @@ GameActions::Result LandRaiseAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !OpenRCT2::GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { @@ -121,7 +122,7 @@ GameActions::Result LandRaiseAction::QueryExecute(bool isExecuting) const height += 2; } } - newSlope &= TILE_ELEMENT_SURFACE_SLOPE_MASK; + newSlope &= kTileElementSurfaceSlopeMask; auto landSetHeightAction = LandSetHeightAction({ x, y }, height, newSlope); landSetHeightAction.SetFlags(GetFlags()); diff --git a/src/openrct2/actions/LandSetHeightAction.cpp b/src/openrct2/actions/LandSetHeightAction.cpp index b81da2d3e9..11ae1abaa2 100644 --- a/src/openrct2/actions/LandSetHeightAction.cpp +++ b/src/openrct2/actions/LandSetHeightAction.cpp @@ -67,7 +67,7 @@ GameActions::Result LandSetHeightAction::Query() const return GameActions::Result(GameActions::Status::Disallowed, STR_NONE, errorMessage); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(_coords)) { @@ -76,7 +76,7 @@ GameActions::Result LandSetHeightAction::Query() const } money64 sceneryRemovalCost = 0; - if (!gCheatsDisableClearanceChecks) + if (!GetGameState().Cheats.DisableClearanceChecks) { if (gameState.ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) { @@ -93,7 +93,7 @@ GameActions::Result LandSetHeightAction::Query() const } // Check for ride support limits - if (!gCheatsDisableSupportLimits) + if (!GetGameState().Cheats.DisableSupportLimits) { errorMessage = CheckRideSupports(); if (errorMessage != STR_NONE) @@ -124,13 +124,13 @@ GameActions::Result LandSetHeightAction::Query() const return res; } - if (!gCheatsDisableClearanceChecks) + if (!GetGameState().Cheats.DisableClearanceChecks) { uint8_t zCorner = _height; - if (_style & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK) + if (_style & kTileElementSurfaceRaisedCornersMask) { zCorner += 2; - if (_style & TILE_ELEMENT_SURFACE_DIAGONAL_FLAG) + if (_style & kTileElementSurfaceDiagonalFlag) { zCorner += 2; } @@ -157,7 +157,7 @@ GameActions::Result LandSetHeightAction::Execute() const auto surfaceHeight = TileElementHeight(_coords); FootpathRemoveLitter({ _coords, surfaceHeight }); - if (!gCheatsDisableClearanceChecks) + if (!GetGameState().Cheats.DisableClearanceChecks) { WallRemoveAt({ _coords, _height * 8 - 16, _height * 8 + 32 }); cost += GetSmallSceneryRemovalCost(); @@ -197,12 +197,12 @@ StringId LandSetHeightAction::CheckParameters() const return STR_TOO_HIGH; } - if (_height > kMaximumLandHeight - 2 && (_style & TILE_ELEMENT_SURFACE_SLOPE_MASK) != 0) + if (_height > kMaximumLandHeight - 2 && (_style & kTileElementSurfaceSlopeMask) != 0) { return STR_TOO_HIGH; } - if (_height == kMaximumLandHeight - 2 && (_style & TILE_ELEMENT_SURFACE_DIAGONAL_FLAG)) + if (_height == kMaximumLandHeight - 2 && (_style & kTileElementSurfaceDiagonalFlag)) { return STR_TOO_HIGH; } @@ -302,10 +302,10 @@ TileElement* LandSetHeightAction::CheckFloatingStructures(TileElement* surfaceEl uint32_t waterHeight = surfaceElement->AsSurface()->GetWaterHeight(); if (waterHeight != 0) { - if (_style & TILE_ELEMENT_SURFACE_SLOPE_MASK) + if (_style & kTileElementSurfaceSlopeMask) { zCorner += 2; - if (_style & TILE_ELEMENT_SURFACE_DIAGONAL_FLAG) + if (_style & kTileElementSurfaceDiagonalFlag) { zCorner += 2; } @@ -325,7 +325,7 @@ money64 LandSetHeightAction::GetSurfaceHeightChangeCost(SurfaceElement* surfaceE for (Direction i : ALL_DIRECTIONS) { int32_t cornerHeight = TileElementGetCornerHeight(surfaceElement, i); - cornerHeight -= MapGetCornerHeight(_height, _style & TILE_ELEMENT_SURFACE_SLOPE_MASK, i); + cornerHeight -= MapGetCornerHeight(_height, _style & kTileElementSurfaceSlopeMask, i); cost += 2.50_GBP * abs(cornerHeight); } return cost; diff --git a/src/openrct2/actions/LandSetRightsAction.cpp b/src/openrct2/actions/LandSetRightsAction.cpp index 1ed0cc10b9..4c46710c6f 100644 --- a/src/openrct2/actions/LandSetRightsAction.cpp +++ b/src/openrct2/actions/LandSetRightsAction.cpp @@ -10,6 +10,7 @@ #include "LandSetRightsAction.h" #include "../Context.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../actions/LandSetHeightAction.h" #include "../audio/audio.h" @@ -82,7 +83,7 @@ GameActions::Result LandSetRightsAction::QueryExecute(bool isExecuting) const res.Position = centre; res.Expenditure = ExpenditureType::LandPurchase; - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !GetGameState().Cheats.SandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, STR_NONE, STR_LAND_NOT_FOR_SALE); } @@ -115,7 +116,7 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY& SurfaceElement* surfaceElement = MapGetSurfaceElementAt(loc); if (surfaceElement == nullptr) { - LOG_ERROR("Could not find surface. x = %d, y = %d", loc.x, loc.y); + LOG_ERROR("No surface at x = %d, y = %d", loc.x, loc.y); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } @@ -183,18 +184,19 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY& } } - res.Cost = gLandPrice; + auto& gameState = GetGameState(); + res.Cost = gameState.LandPrice; if (isExecuting) { if (_ownership != OWNERSHIP_UNOWNED) { - gPeepSpawns.erase( + gameState.PeepSpawns.erase( std::remove_if( - gPeepSpawns.begin(), gPeepSpawns.end(), + gameState.PeepSpawns.begin(), gameState.PeepSpawns.end(), [x = loc.x, y = loc.y](const auto& spawn) { return Floor2(spawn.x, 32) == x && Floor2(spawn.y, 32) == y; }), - gPeepSpawns.end()); + gameState.PeepSpawns.end()); } surfaceElement->SetOwnership(_ownership); ParkUpdateFencesAroundTile(loc); @@ -203,7 +205,7 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY& return res; } default: - LOG_WARNING("Tried calling set land rights with an incorrect setting. setting = %u", _setting); + LOG_ERROR("Invalid setting %u to set land rights", _setting); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } diff --git a/src/openrct2/actions/LandSmoothAction.cpp b/src/openrct2/actions/LandSmoothAction.cpp index bd311172d4..581eac460a 100644 --- a/src/openrct2/actions/LandSmoothAction.cpp +++ b/src/openrct2/actions/LandSmoothAction.cpp @@ -607,8 +607,9 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const break; } default: - LOG_ERROR("Invalid map selection %u", _selectionType); - return GameActions::Result(GameActions::Status::InvalidParameters, std::get(res.ErrorTitle), STR_NONE); + LOG_ERROR("Invalid map selection type %u", _selectionType); + return GameActions::Result( + GameActions::Status::InvalidParameters, std::get(res.ErrorTitle), STR_ERR_VALUE_OUT_OF_RANGE); } // switch selectionType // Raise / lower the land tool selection area diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.cpp b/src/openrct2/actions/LargeSceneryPlaceAction.cpp index 684e022313..832afdd52e 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.cpp +++ b/src/openrct2/actions/LargeSceneryPlaceAction.cpp @@ -9,6 +9,7 @@ #include "LargeSceneryPlaceAction.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../management/Finance.h" #include "../object/LargeSceneryEntry.h" @@ -21,6 +22,8 @@ #include "../world/MapAnimation.h" #include "../world/Surface.h" +using namespace OpenRCT2; + LargeSceneryPlaceAction::LargeSceneryPlaceAction( const CoordsXYZD& loc, ObjectEntryIndex sceneryType, uint8_t primaryColour, uint8_t secondaryColour, uint8_t tertiaryColour) : _loc(loc) @@ -67,24 +70,32 @@ GameActions::Result LargeSceneryPlaceAction::Query() const money64 supportsCost = 0; - if (_primaryColour >= COLOUR_COUNT || _secondaryColour >= COLOUR_COUNT || _tertiaryColour >= COLOUR_COUNT) + if (_primaryColour >= COLOUR_COUNT) { - LOG_ERROR( - "Invalid game command for scenery placement, primaryColour = %u, secondaryColour = %u", _primaryColour, - _secondaryColour); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); + LOG_ERROR("Invalid primary colour %u", _primaryColour); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR); + } + else if (_secondaryColour >= COLOUR_COUNT) + { + LOG_ERROR("Invalid secondary colour %u", _secondaryColour); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR); + } + else if (_tertiaryColour >= COLOUR_COUNT) + { + LOG_ERROR("Invalid tertiary colour %u", _tertiaryColour); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR); + } + else if (_sceneryType >= MAX_LARGE_SCENERY_OBJECTS) + { + LOG_ERROR("Invalid sceneryType %u", _sceneryType); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_VALUE_OUT_OF_RANGE); } - if (_sceneryType >= MAX_LARGE_SCENERY_OBJECTS) - { - LOG_ERROR("Invalid game command for scenery placement, sceneryType = %u", _sceneryType); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); - } - - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryType); + auto* sceneryEntry = ObjectManager::GetObjectEntry(_sceneryType); if (sceneryEntry == nullptr) { - LOG_ERROR("Invalid game command for scenery placement, sceneryType = %u", _sceneryType); + LOG_ERROR("Large scenery entry not found for sceneryType %u", _sceneryType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE); } @@ -134,7 +145,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const const auto clearanceData = canBuild.GetData(); int32_t tempSceneryGroundFlags = clearanceData.GroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND); - if (!gCheatsDisableClearanceChecks) + if (!GetGameState().Cheats.DisableClearanceChecks) { if ((clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER) || (clearanceData.GroundFlags & ELEMENT_IS_UNDERGROUND)) { @@ -156,7 +167,8 @@ GameActions::Result LargeSceneryPlaceAction::Query() const return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !MapIsLocationOwned({ curTile, zLow }) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !MapIsLocationOwned({ curTile, zLow }) + && !GetGameState().Cheats.SandboxMode) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -194,10 +206,10 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const money64 supportsCost = 0; - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryType); + auto* sceneryEntry = ObjectManager::GetObjectEntry(_sceneryType); if (sceneryEntry == nullptr) { - LOG_ERROR("Invalid game command for scenery placement, sceneryType = %u", _sceneryType); + LOG_ERROR("Large scenery entry not found for sceneryType = %u", _sceneryType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE); } @@ -279,7 +291,7 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { FootpathRemoveLitter({ curTile, zLow }); - if (!gCheatsDisableClearanceChecks) + if (!GetGameState().Cheats.DisableClearanceChecks) { WallRemoveAt({ curTile, zLow, zHigh }); } diff --git a/src/openrct2/actions/LargeSceneryRemoveAction.cpp b/src/openrct2/actions/LargeSceneryRemoveAction.cpp index 04df54135e..ff8bb62ee1 100644 --- a/src/openrct2/actions/LargeSceneryRemoveAction.cpp +++ b/src/openrct2/actions/LargeSceneryRemoveAction.cpp @@ -65,7 +65,7 @@ GameActions::Result LargeSceneryRemoveAction::Query() const TileElement* tileElement = FindLargeSceneryElement(_loc, _tileIndex); if (tileElement == nullptr) { - LOG_WARNING("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y); + LOG_ERROR("No large scenery element to remove at x = %d, y = %d", _loc.x, _loc.y); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } @@ -73,7 +73,10 @@ GameActions::Result LargeSceneryRemoveAction::Query() const auto* sceneryEntry = tileElement->AsLargeScenery()->GetEntry(); // If we have a bugged scenery entry, do not touch the tile element. if (sceneryEntry == nullptr) + { + LOG_WARNING("Scenery entry at x = %d, y = %d not removed because it is an unknown object type", _loc.x, _loc.y); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REMOVE_THIS, STR_UNKNOWN_OBJECT_TYPE); + } auto rotatedOffsets = CoordsXYZ{ CoordsXY{ sceneryEntry->tiles[_tileIndex].x_offset, sceneryEntry->tiles[_tileIndex].y_offset }.Rotate(_loc.direction), @@ -92,7 +95,7 @@ GameActions::Result LargeSceneryRemoveAction::Query() const auto currentTile = CoordsXYZ{ firstTile.x, firstTile.y, firstTile.z } + currentTileRotatedOffset; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (GetGameState().ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) { @@ -147,7 +150,7 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const TileElement* tileElement = FindLargeSceneryElement(_loc, _tileIndex); if (tileElement == nullptr) { - LOG_WARNING("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y); + LOG_ERROR("No large scenery element to remove at %d, y = %d", _loc.x, _loc.y); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } @@ -155,7 +158,10 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const auto* sceneryEntry = tileElement->AsLargeScenery()->GetEntry(); // If we have a bugged scenery entry, do not touch the tile element. if (sceneryEntry == nullptr) + { + LOG_WARNING("Scenery entry at x = %d, y = %d not removed because it is an unknown object type", _loc.x, _loc.y); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REMOVE_THIS, STR_NONE); + } tileElement->RemoveBannerEntry(); @@ -175,7 +181,7 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const auto currentTile = CoordsXYZ{ firstTile.x, firstTile.y, firstTile.z } + rotatedCurrentTile; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (!MapIsLocationOwned({ currentTile.x, currentTile.y, currentTile.z })) { @@ -184,14 +190,14 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const } auto* sceneryElement = FindLargeSceneryElement(currentTile, i); - if (sceneryElement != nullptr) + if (sceneryElement == nullptr) { - MapInvalidateTileFull(currentTile); - TileElementRemove(sceneryElement); + LOG_ERROR("Tile not found when trying to remove element!"); } else { - LOG_ERROR("Tile not found when trying to remove element!"); + MapInvalidateTileFull(currentTile); + TileElementRemove(sceneryElement); } } diff --git a/src/openrct2/actions/LargeScenerySetColourAction.cpp b/src/openrct2/actions/LargeScenerySetColourAction.cpp index 4f550d55ec..687a016b75 100644 --- a/src/openrct2/actions/LargeScenerySetColourAction.cpp +++ b/src/openrct2/actions/LargeScenerySetColourAction.cpp @@ -9,6 +9,7 @@ #include "LargeScenerySetColourAction.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../management/Finance.h" #include "../object/LargeSceneryEntry.h" @@ -69,25 +70,23 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) if (_loc.x < 0 || _loc.y < 0 || _loc.x > mapSizeMax.x || _loc.y > mapSizeMax.y) { LOG_ERROR("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_VALUE_OUT_OF_RANGE); } if (_primaryColour >= COLOUR_COUNT) { - LOG_ERROR("Invalid primary colour: colour = %u", _primaryColour); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Invalid primary colour %u", _primaryColour); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR); } - - if (_secondaryColour >= COLOUR_COUNT) + else if (_secondaryColour >= COLOUR_COUNT) { - LOG_ERROR("Invalid secondary colour: colour = %u", _secondaryColour); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Invalid secondary colour %u", _secondaryColour); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR); } - - if (_tertiaryColour >= COLOUR_COUNT) + else if (_tertiaryColour >= COLOUR_COUNT) { - LOG_ERROR("Invalid tertiary colour: colour = %u", _tertiaryColour); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + LOG_ERROR("Invalid tertiary colour %u", _tertiaryColour); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR); } auto largeElement = MapGetLargeScenerySegment(_loc, _tileIndex); @@ -109,7 +108,7 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) if (sceneryEntry == nullptr) { - LOG_ERROR("Could not find scenery object. type = %u", largeElement->GetEntryIndex()); + LOG_ERROR("Scenery element doesn't have scenery entry"); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); } // Work out the base tile coordinates (Tile with index 0) @@ -127,7 +126,7 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) auto rotatedTileCoords = CoordsXYZ{ CoordsXY{ tile->x_offset, tile->y_offset }.Rotate(_loc.direction), tile->z_offset }; auto currentTile = CoordsXYZ{ baseTile.x, baseTile.y, baseTile.z } + rotatedTileCoords; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !OpenRCT2::GetGameState().Cheats.SandboxMode) { if (!MapIsLocationOwned(currentTile)) { diff --git a/src/openrct2/actions/MapChangeSizeAction.cpp b/src/openrct2/actions/MapChangeSizeAction.cpp index 9ceeb8711e..031627beeb 100644 --- a/src/openrct2/actions/MapChangeSizeAction.cpp +++ b/src/openrct2/actions/MapChangeSizeAction.cpp @@ -35,13 +35,15 @@ void MapChangeSizeAction::Serialise(DataSerialiser& stream) GameActions::Result MapChangeSizeAction::Query() const { - if (_targetSize.x > MAXIMUM_MAP_SIZE_TECHNICAL || _targetSize.y > MAXIMUM_MAP_SIZE_TECHNICAL) + if (_targetSize.x > kMaximumMapSizeTechnical || _targetSize.y > kMaximumMapSizeTechnical) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_INCREASE_MAP_SIZE_ANY_FURTHER, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_INCREASE_MAP_SIZE_ANY_FURTHER, STR_ERR_VALUE_OUT_OF_RANGE); } - if (_targetSize.x < MINIMUM_MAP_SIZE_TECHNICAL || _targetSize.y < MINIMUM_MAP_SIZE_TECHNICAL) + if (_targetSize.x < kMinimumMapSizeTechnical || _targetSize.y < kMinimumMapSizeTechnical) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DECREASE_MAP_SIZE_ANY_FURTHER, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_DECREASE_MAP_SIZE_ANY_FURTHER, STR_ERR_VALUE_OUT_OF_RANGE); } return GameActions::Result(); } diff --git a/src/openrct2/actions/MazePlaceTrackAction.cpp b/src/openrct2/actions/MazePlaceTrackAction.cpp index bd3dfa1874..f0f4019c22 100644 --- a/src/openrct2/actions/MazePlaceTrackAction.cpp +++ b/src/openrct2/actions/MazePlaceTrackAction.cpp @@ -8,6 +8,7 @@ *****************************************************************************/ #include "MazePlaceTrackAction.h" +#include "../GameState.h" #include "../management/Finance.h" #include "../ride/RideData.h" #include "../ride/TrackData.h" @@ -56,7 +57,7 @@ GameActions::Result MazePlaceTrackAction::Query() const res.ErrorMessage = STR_OFF_EDGE_OF_MAP; return res; } - if (!MapIsLocationOwned(_loc) && !gCheatsSandboxMode) + if (!MapIsLocationOwned(_loc) && !OpenRCT2::GetGameState().Cheats.SandboxMode) { res.Error = GameActions::Status::NotOwned; res.ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK; @@ -81,7 +82,7 @@ GameActions::Result MazePlaceTrackAction::Query() const auto clearanceHeight = _loc.z + MAZE_CLEARANCE_HEIGHT; auto heightDifference = baseHeight - surfaceElement->GetBaseZ(); - if (heightDifference >= 0 && !gCheatsDisableSupportLimits) + if (heightDifference >= 0 && !OpenRCT2::GetGameState().Cheats.DisableSupportLimits) { heightDifference /= COORDS_Z_PER_TINY_Z; @@ -121,8 +122,9 @@ GameActions::Result MazePlaceTrackAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr || ride->type == RIDE_TYPE_NULL) { + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex); res.Error = GameActions::Status::InvalidParameters; - res.ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS; + res.ErrorMessage = STR_ERR_RIDE_NOT_FOUND; return res; } @@ -142,8 +144,9 @@ GameActions::Result MazePlaceTrackAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex); res.Error = GameActions::Status::InvalidParameters; - res.ErrorMessage = STR_NONE; + res.ErrorMessage = STR_ERR_RIDE_NOT_FOUND; return res; } diff --git a/src/openrct2/actions/MazeSetTrackAction.cpp b/src/openrct2/actions/MazeSetTrackAction.cpp index ee322bfb43..a28b73aa81 100644 --- a/src/openrct2/actions/MazeSetTrackAction.cpp +++ b/src/openrct2/actions/MazeSetTrackAction.cpp @@ -10,6 +10,7 @@ #include "MazeSetTrackAction.h" #include "../Cheats.h" +#include "../GameState.h" #include "../core/MemoryStream.h" #include "../interface/Window.h" #include "../localisation/Localisation.h" @@ -94,7 +95,7 @@ GameActions::Result MazeSetTrackAction::Query() const res.ErrorMessage = STR_OFF_EDGE_OF_MAP; return res; } - if (!MapIsLocationOwned(_loc) && !gCheatsSandboxMode) + if (!MapIsLocationOwned(_loc) && !OpenRCT2::GetGameState().Cheats.SandboxMode) { res.Error = GameActions::Status::NotOwned; res.ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK; @@ -119,7 +120,7 @@ GameActions::Result MazeSetTrackAction::Query() const auto clearanceHeight = _loc.z + 32; auto heightDifference = baseHeight - surfaceElement->GetBaseZ(); - if (heightDifference >= 0 && !gCheatsDisableSupportLimits) + if (heightDifference >= 0 && !OpenRCT2::GetGameState().Cheats.DisableSupportLimits) { heightDifference /= COORDS_Z_PER_TINY_Z; @@ -167,8 +168,9 @@ GameActions::Result MazeSetTrackAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr || ride->type == RIDE_CRASH_TYPE_NONE) { + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex); res.Error = GameActions::Status::NoClearance; - res.ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS; + res.ErrorMessage = STR_ERR_RIDE_NOT_FOUND; return res; } @@ -191,8 +193,9 @@ GameActions::Result MazeSetTrackAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex); res.Error = GameActions::Status::InvalidParameters; - res.ErrorMessage = STR_NONE; + res.ErrorMessage = STR_ERR_RIDE_NOT_FOUND; return res; } @@ -285,7 +288,7 @@ GameActions::Result MazeSetTrackAction::Execute() const { LOG_ERROR("No surface found"); res.Error = GameActions::Status::Unknown; - res.ErrorMessage = STR_NONE; + res.ErrorMessage = STR_ERR_SURFACE_ELEMENT_NOT_FOUND; return res; } diff --git a/src/openrct2/actions/ParkEntrancePlaceAction.cpp b/src/openrct2/actions/ParkEntrancePlaceAction.cpp index e5c73e0dd8..50e3b7619f 100644 --- a/src/openrct2/actions/ParkEntrancePlaceAction.cpp +++ b/src/openrct2/actions/ParkEntrancePlaceAction.cpp @@ -51,7 +51,7 @@ void ParkEntrancePlaceAction::Serialise(DataSerialiser& stream) GameActions::Result ParkEntrancePlaceAction::Query() const { - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !GetGameState().Cheats.SandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, STR_CANT_BUILD_THIS_HERE, STR_NONE); } diff --git a/src/openrct2/actions/ParkEntranceRemoveAction.cpp b/src/openrct2/actions/ParkEntranceRemoveAction.cpp index cc9ee8b019..8aeaa39793 100644 --- a/src/openrct2/actions/ParkEntranceRemoveAction.cpp +++ b/src/openrct2/actions/ParkEntranceRemoveAction.cpp @@ -41,7 +41,7 @@ void ParkEntranceRemoveAction::Serialise(DataSerialiser& stream) GameActions::Result ParkEntranceRemoveAction::Query() const { - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !GetGameState().Cheats.SandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, STR_CANT_REMOVE_THIS, STR_NONE); } @@ -57,7 +57,7 @@ GameActions::Result ParkEntranceRemoveAction::Query() const } if (ParkEntranceGetIndex(_loc) == -1) { - LOG_ERROR("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); + LOG_ERROR("No park entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } return res; @@ -73,7 +73,7 @@ GameActions::Result ParkEntranceRemoveAction::Execute() const auto entranceIndex = ParkEntranceGetIndex(_loc); if (entranceIndex == -1) { - LOG_ERROR("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); + LOG_ERROR("No park entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } diff --git a/src/openrct2/actions/ParkMarketingAction.cpp b/src/openrct2/actions/ParkMarketingAction.cpp index 63d181d37b..1912dd663d 100644 --- a/src/openrct2/actions/ParkMarketingAction.cpp +++ b/src/openrct2/actions/ParkMarketingAction.cpp @@ -53,7 +53,8 @@ GameActions::Result ParkMarketingAction::Query() const { if (static_cast(_type) >= std::size(AdvertisingCampaignPricePerWeek) || _numWeeks >= 256) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_START_MARKETING_CAMPAIGN, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_START_MARKETING_CAMPAIGN, STR_ERR_VALUE_OUT_OF_RANGE); } if (GetGameState().ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) { diff --git a/src/openrct2/actions/ParkSetDateAction.cpp b/src/openrct2/actions/ParkSetDateAction.cpp index c3cffccb5e..fdd0ab99ef 100644 --- a/src/openrct2/actions/ParkSetDateAction.cpp +++ b/src/openrct2/actions/ParkSetDateAction.cpp @@ -45,8 +45,21 @@ void ParkSetDateAction::Serialise(DataSerialiser& stream) GameActions::Result ParkSetDateAction::Query() const { - if (_year < 0 || _year >= kMaxYear || _month < 0 || _month >= MONTH_COUNT || _day < 0 || _day >= 31) + if (_year < 0 || _year >= kMaxYear) { + LOG_ERROR("Invalid park date year %d", _year); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); + } + else if (_month < 0 || _month >= MONTH_COUNT) + { + LOG_ERROR("Invalid park date month %d", _year); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); + } + else if (_day < 0 || _day >= 31) + { + LOG_ERROR("Invalid park date day %d", _year); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } diff --git a/src/openrct2/actions/ParkSetEntranceFeeAction.cpp b/src/openrct2/actions/ParkSetEntranceFeeAction.cpp index 773f607717..89c235745c 100644 --- a/src/openrct2/actions/ParkSetEntranceFeeAction.cpp +++ b/src/openrct2/actions/ParkSetEntranceFeeAction.cpp @@ -42,17 +42,23 @@ void ParkSetEntranceFeeAction::Serialise(DataSerialiser& stream) GameActions::Result ParkSetEntranceFeeAction::Query() const { - bool noMoney = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) != 0; - bool forceFreeEntry = !ParkEntranceFeeUnlocked(); - if (noMoney || forceFreeEntry) + if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) != 0) { + LOG_ERROR("Can't set park entrance fee because the park has no money"); return GameActions::Result(GameActions::Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, STR_NONE); } - if (_fee < 0.00_GBP || _fee > MAX_ENTRANCE_FEE) + else if (!ParkEntranceFeeUnlocked()) { + LOG_ERROR("Park entrance fee is locked"); + return GameActions::Result(GameActions::Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, STR_NONE); + } + else if (_fee < 0.00_GBP || _fee > MAX_ENTRANCE_FEE) + { + LOG_ERROR("Invalid park entrance fee %d", _fee); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } + return GameActions::Result(); } diff --git a/src/openrct2/actions/ParkSetNameAction.cpp b/src/openrct2/actions/ParkSetNameAction.cpp index 2969319f15..549d99a1bf 100644 --- a/src/openrct2/actions/ParkSetNameAction.cpp +++ b/src/openrct2/actions/ParkSetNameAction.cpp @@ -47,6 +47,7 @@ GameActions::Result ParkSetNameAction::Query() const { if (_name.empty()) { + LOG_ERROR("Can't set park name to empty string"); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_PARK, STR_INVALID_NAME_FOR_PARK); } return GameActions::Result(); diff --git a/src/openrct2/actions/ParkSetParameterAction.cpp b/src/openrct2/actions/ParkSetParameterAction.cpp index af35815c34..83d4ad1030 100644 --- a/src/openrct2/actions/ParkSetParameterAction.cpp +++ b/src/openrct2/actions/ParkSetParameterAction.cpp @@ -44,6 +44,7 @@ GameActions::Result ParkSetParameterAction::Query() const { if (_parameter >= ParkParameter::Count) { + LOG_ERROR("Invalid park parameter %d", _parameter); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -73,10 +74,11 @@ GameActions::Result ParkSetParameterAction::Execute() const } break; case ParkParameter::SamePriceInPark: - gSamePriceThroughoutPark = _value; + gameState.SamePriceThroughoutPark = _value; WindowInvalidateByClass(WindowClass::Ride); break; default: + LOG_ERROR("Invalid park parameter %d", _parameter); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } diff --git a/src/openrct2/actions/ParkSetResearchFundingAction.cpp b/src/openrct2/actions/ParkSetResearchFundingAction.cpp index 23867fadc3..ccb0f955eb 100644 --- a/src/openrct2/actions/ParkSetResearchFundingAction.cpp +++ b/src/openrct2/actions/ParkSetResearchFundingAction.cpp @@ -47,6 +47,7 @@ GameActions::Result ParkSetResearchFundingAction::Query() const { if (_fundingAmount >= RESEARCH_FUNDING_COUNT) { + LOG_ERROR("Invalid research funding amount %d", _fundingAmount); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } diff --git a/src/openrct2/actions/PeepPickupAction.cpp b/src/openrct2/actions/PeepPickupAction.cpp index 6cee870058..3978d3ddee 100644 --- a/src/openrct2/actions/PeepPickupAction.cpp +++ b/src/openrct2/actions/PeepPickupAction.cpp @@ -106,7 +106,7 @@ GameActions::Result PeepPickupAction::Query() const } break; default: - LOG_ERROR("Invalid pickup type: %u", _type); + LOG_ERROR("Invalid peep pickup type %u", _type); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE); } return res; @@ -175,7 +175,7 @@ GameActions::Result PeepPickupAction::Execute() const CancelConcurrentPickups(peep); break; default: - LOG_ERROR("Invalid pickup type: %u", _type); + LOG_ERROR("Invalid peep pickup type %u", _type); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE); } return res; diff --git a/src/openrct2/actions/PeepSpawnPlaceAction.cpp b/src/openrct2/actions/PeepSpawnPlaceAction.cpp index 6e38794033..25a3732626 100644 --- a/src/openrct2/actions/PeepSpawnPlaceAction.cpp +++ b/src/openrct2/actions/PeepSpawnPlaceAction.cpp @@ -19,6 +19,8 @@ #include "../world/Park.h" #include "../world/Surface.h" +using namespace OpenRCT2; + PeepSpawnPlaceAction::PeepSpawnPlaceAction(const CoordsXYZD& location) : _location(location) { @@ -43,7 +45,7 @@ void PeepSpawnPlaceAction::Serialise(DataSerialiser& stream) GameActions::Result PeepSpawnPlaceAction::Query() const { - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !GetGameState().Cheats.SandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE); } @@ -72,7 +74,8 @@ GameActions::Result PeepSpawnPlaceAction::Query() const auto surfaceMapElement = MapGetSurfaceElementAt(_location); if (surfaceMapElement == nullptr) { - return GameActions::Result(GameActions::Status::Unknown, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::Unknown, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } if (surfaceMapElement->GetOwnership() != OWNERSHIP_UNOWNED) { @@ -100,35 +103,37 @@ GameActions::Result PeepSpawnPlaceAction::Execute() const spawn.z = _location.z; spawn.direction = _location.direction; + auto& gameState = GetGameState(); // When attempting to place a peep spawn on a tile that already contains it, // remove that peep spawn instead. - if (!gPeepSpawns.empty()) + if (!gameState.PeepSpawns.empty()) { // When searching for existing spawns, ignore the direction. - auto foundSpawn = std::find_if(gPeepSpawns.begin(), gPeepSpawns.end(), [spawn](const CoordsXYZ& existingSpawn) { - { - return existingSpawn.ToTileStart() == spawn.ToTileStart(); - } - }); + auto foundSpawn = std::find_if( + gameState.PeepSpawns.begin(), gameState.PeepSpawns.end(), [spawn](const CoordsXYZ& existingSpawn) { + { + return existingSpawn.ToTileStart() == spawn.ToTileStart(); + } + }); - if (foundSpawn != std::end(gPeepSpawns)) + if (foundSpawn != std::end(gameState.PeepSpawns)) { - gPeepSpawns.erase(foundSpawn); + gameState.PeepSpawns.erase(foundSpawn); MapInvalidateTileFull(spawn); return res; } } // If we have reached our max peep spawns, remove the oldest spawns - while (gPeepSpawns.size() >= OpenRCT2::Limits::MaxPeepSpawns) + while (gameState.PeepSpawns.size() >= Limits::MaxPeepSpawns) { - PeepSpawn oldestSpawn = *gPeepSpawns.begin(); - gPeepSpawns.erase(gPeepSpawns.begin()); + PeepSpawn oldestSpawn = *gameState.PeepSpawns.begin(); + gameState.PeepSpawns.erase(gameState.PeepSpawns.begin()); MapInvalidateTileFull(oldestSpawn); } // Set peep spawn - gPeepSpawns.push_back(spawn); + gameState.PeepSpawns.push_back(spawn); // Invalidate tile MapInvalidateTileFull(_location); diff --git a/src/openrct2/actions/RideCreateAction.cpp b/src/openrct2/actions/RideCreateAction.cpp index 42894b6a4d..7512bc69a8 100644 --- a/src/openrct2/actions/RideCreateAction.cpp +++ b/src/openrct2/actions/RideCreateAction.cpp @@ -83,6 +83,7 @@ GameActions::Result RideCreateAction::Query() const if (_rideType >= RIDE_TYPE_COUNT) { + LOG_ERROR("Invalid ride type %d", _rideType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_INVALID_RIDE_TYPE); } @@ -90,6 +91,7 @@ GameActions::Result RideCreateAction::Query() const int32_t rideEntryIndex = RideGetEntryIndex(_rideType, _subType); if (rideEntryIndex >= MAX_RIDE_OBJECTS) { + LOG_ERROR("Ride entry not found for rideType %d, subType %d", _rideType, _subType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_INVALID_RIDE_TYPE); } @@ -97,12 +99,15 @@ GameActions::Result RideCreateAction::Query() const const auto& colourPresets = GetRideTypeDescriptor(_rideType).ColourPresets; if (_colour1 >= colourPresets.count) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_NONE); + LOG_ERROR("Can't create ride, invalid colour preset %d", _colour1); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_ERR_INVALID_COLOUR); } const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex); if (rideEntry == nullptr) { + LOG_ERROR("Ride entry not found for rideEntryIndex %d", rideEntryIndex); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_UNKNOWN_OBJECT_TYPE); } @@ -130,11 +135,12 @@ GameActions::Result RideCreateAction::Execute() const const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex); if (rideEntry == nullptr) { - LOG_WARNING("Invalid request for ride %u", rideIndex); + LOG_ERROR( + "Ride entry not found for index rideEntryIndex %u (from rideType %u, subType %u)", rideEntryIndex, _rideType, + _subType); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_UNKNOWN_OBJECT_TYPE); } - ride->id = rideIndex; ride->type = _rideType; ride->subtype = rideEntryIndex; ride->SetColourPreset(_colour1); @@ -146,7 +152,7 @@ GameActions::Result RideCreateAction::Execute() const station.Start.SetNull(); station.Entrance.SetNull(); station.Exit.SetNull(); - station.TrainAtStation = RideStation::NO_TRAIN; + station.TrainAtStation = RideStation::kNoTrain; station.QueueTime = 0; station.SegmentLength = 0; station.QueueLength = 0; @@ -154,14 +160,9 @@ GameActions::Result RideCreateAction::Execute() const station.Height = 0; } - std::fill(std::begin(ride->vehicles), std::end(ride->vehicles), EntityId::GetNull()); - ride->status = RideStatus::Closed; - ride->lifecycle_flags = 0; - ride->vehicle_change_timeout = 0; - ride->num_stations = 0; ride->NumTrains = 1; - if (gCheatsDisableTrainLengthLimit) + if (GetGameState().Cheats.DisableTrainLengthLimit) { // Reduce amount of proposed trains to prevent 32 trains from always spawning when limits are disabled if (rideEntry->cars_per_flat_ride == NoFlatRideCars) @@ -203,16 +204,7 @@ GameActions::Result RideCreateAction::Execute() const ride->lift_hill_speed = rtd.LiftData.minimum_speed; - ride->measurement = {}; - ride->excitement = RIDE_RATING_UNDEFINED; - ride->cur_num_customers = 0; - ride->num_customers_timeout = 0; - ride->chairlift_bullwheel_rotation = 0; - - for (auto& price : ride->price) - { - price = 0; - } + ride->excitement = kRideRatingUndefined; auto& gameState = GetGameState(); if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) @@ -281,38 +273,20 @@ GameActions::Result RideCreateAction::Execute() const } } - std::fill(std::begin(ride->num_customers), std::end(ride->num_customers), 0); ride->value = RIDE_VALUE_UNDEFINED; ride->satisfaction = 255; - ride->satisfaction_time_out = 0; - ride->satisfaction_next = 0; ride->popularity = 255; - ride->popularity_time_out = 0; - ride->popularity_next = 0; - ride->window_invalidate_flags = 0; - ride->total_customers = 0; - ride->total_profit = 0; - ride->num_riders = 0; - ride->slide_in_use = 0; - ride->maze_tiles = 0; ride->build_date = GetDate().GetMonthsElapsed(); ride->music_tune_id = TUNE_ID_NULL; ride->breakdown_reason = 255; ride->upkeep_cost = kMoney64Undefined; - ride->reliability = RIDE_INITIAL_RELIABILITY; + ride->reliability = kRideInitialReliability; ride->unreliability_factor = 1; ride->inspection_interval = RIDE_INSPECTION_EVERY_30_MINUTES; - ride->last_inspection = 0; - ride->downtime = 0; - std::fill_n(ride->downtime_history, sizeof(ride->downtime_history), 0x00); - ride->no_primary_items_sold = 0; - ride->no_secondary_items_sold = 0; ride->last_crash_type = RIDE_CRASH_TYPE_NONE; ride->income_per_hour = kMoney64Undefined; ride->profit = kMoney64Undefined; - ride->connected_message_throttle = 0; - ride->drops = 0; ride->entrance_style = OBJECT_ENTRY_INDEX_NULL; if (rtd.HasFlag(RIDE_TYPE_FLAG_HAS_ENTRANCE_EXIT)) @@ -320,9 +294,6 @@ GameActions::Result RideCreateAction::Execute() const ride->entrance_style = _entranceObjectIndex; } - ride->num_block_brakes = 0; - ride->guests_favourite = 0; - ride->num_circuits = 1; ride->mode = ride->GetDefaultMode(); ride->MinCarsPerTrain = rideEntry->min_cars_in_train; diff --git a/src/openrct2/actions/RideDemolishAction.cpp b/src/openrct2/actions/RideDemolishAction.cpp index 0b25f45a39..113c4fd675 100644 --- a/src/openrct2/actions/RideDemolishAction.cpp +++ b/src/openrct2/actions/RideDemolishAction.cpp @@ -60,13 +60,13 @@ GameActions::Result RideDemolishAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_ERR_RIDE_NOT_FOUND); } if ((ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) && _modifyType == RIDE_MODIFY_DEMOLISH) - && !gCheatsMakeAllDestructible) + && !GetGameState().Cheats.MakeAllDestructible) { return GameActions::Result( GameActions::Status::NoClearance, STR_CANT_DEMOLISH_RIDE, @@ -105,8 +105,8 @@ GameActions::Result RideDemolishAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_ERR_RIDE_NOT_FOUND); } switch (_modifyType) @@ -115,9 +115,10 @@ GameActions::Result RideDemolishAction::Execute() const return DemolishRide(*ride); case RIDE_MODIFY_RENEW: return RefurbishRide(*ride); + default: + LOG_ERROR("Unknown ride demolish type %d", _modifyType); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DO_THIS, STR_ERR_VALUE_OUT_OF_RANGE); } - - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DO_THIS, STR_NONE); } GameActions::Result RideDemolishAction::DemolishRide(Ride& ride) const diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp index 7fa7ced451..25c83501d6 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp @@ -9,6 +9,7 @@ #include "RideEntranceExitPlaceAction.h" +#include "../GameState.h" #include "../actions/RideEntranceExitRemoveAction.h" #include "../management/Finance.h" #include "../ride/Ride.h" @@ -16,6 +17,8 @@ #include "../world/ConstructionClearance.h" #include "../world/MapAnimation.h" +using namespace OpenRCT2; + RideEntranceExitPlaceAction::RideEntranceExitPlaceAction( const CoordsXY& loc, Direction direction, RideId rideIndex, StationIndex stationNum, bool isExit) : _loc(loc) @@ -55,14 +58,14 @@ GameActions::Result RideEntranceExitPlaceAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); + return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_ERR_RIDE_NOT_FOUND); } - if (_stationNum.ToUnderlying() >= OpenRCT2::Limits::MaxStationsPerRide) + if (_stationNum.ToUnderlying() >= Limits::MaxStationsPerRide) { - LOG_WARNING("Invalid station number for ride. stationNum: %u", _stationNum.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_NONE); + LOG_ERROR("Invalid station number for ride. stationNum: %u", _stationNum.ToUnderlying()); + return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_ERR_VALUE_OUT_OF_RANGE); } if (ride->status != RideStatus::Closed && ride->status != RideStatus::Simulating) @@ -96,7 +99,7 @@ GameActions::Result RideEntranceExitPlaceAction::Query() const { return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_OFF_EDGE_OF_MAP); } - if (!gCheatsSandboxMode && !MapIsLocationOwned({ _loc, z })) + if (!GetGameState().Cheats.SandboxMode && !MapIsLocationOwned({ _loc, z })) { return GameActions::Result(GameActions::Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK); } @@ -140,8 +143,8 @@ GameActions::Result RideEntranceExitPlaceAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); + return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_ERR_RIDE_NOT_FOUND); } if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) @@ -167,7 +170,7 @@ GameActions::Result RideEntranceExitPlaceAction::Execute() const auto z = station.GetBaseZ(); if (!(GetFlags() & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST) - && !gCheatsDisableClearanceChecks) + && !GetGameState().Cheats.DisableClearanceChecks) { FootpathRemoveLitter({ _loc, z }); WallRemoveAtZ({ _loc, z }); @@ -230,7 +233,7 @@ GameActions::Result RideEntranceExitPlaceAction::TrackPlaceQuery(const CoordsXYZ const auto errorTitle = isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION : STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION; - if (!gCheatsSandboxMode && !MapIsLocationOwned(loc)) + if (!GetGameState().Cheats.SandboxMode && !MapIsLocationOwned(loc)) { return GameActions::Result(GameActions::Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp index 29e6b60d44..232f8ccad9 100644 --- a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp +++ b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp @@ -69,7 +69,7 @@ GameActions::Result RideEntranceExitRemoveAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid ride id %u for entrance/exit removal", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } @@ -99,9 +99,9 @@ GameActions::Result RideEntranceExitRemoveAction::Query() const } else if (entranceElement == nullptr) { - LOG_WARNING( - "Entrance element not found. x = %d, y = %d, ride = %u, station = %u", _loc.x, _loc.y, _rideIndex.ToUnderlying(), - _stationNum.ToUnderlying()); + LOG_ERROR( + "Entrance/exit element not found. x = %d, y = %d, ride = %u, station = %u", _loc.x, _loc.y, + _rideIndex.ToUnderlying(), _stationNum.ToUnderlying()); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_ENTRANCE_ELEMENT_NOT_FOUND); } @@ -114,7 +114,7 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid ride id %u for entrance/exit removal", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } @@ -137,9 +137,9 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const } else if (entranceElement == nullptr) { - LOG_WARNING( - "Entrance element not found. x = %d, y = %d, ride = %u, station = %d", _loc.x, _loc.y, _rideIndex.ToUnderlying(), - _stationNum); + LOG_ERROR( + "Entrance/exit element not found. x = %d, y = %d, ride = %u, station = %d", _loc.x, _loc.y, + _rideIndex.ToUnderlying(), _stationNum); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_ENTRANCE_ELEMENT_NOT_FOUND); } diff --git a/src/openrct2/actions/RideFreezeRatingAction.cpp b/src/openrct2/actions/RideFreezeRatingAction.cpp index 0784279540..8d21ac88e4 100644 --- a/src/openrct2/actions/RideFreezeRatingAction.cpp +++ b/src/openrct2/actions/RideFreezeRatingAction.cpp @@ -34,13 +34,13 @@ GameActions::Result RideFreezeRatingAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } if (_value <= 0) { - LOG_WARNING("Rating value must be positive", _rideIndex.ToUnderlying()); + LOG_ERROR("Rating value must be positive: %u", _rideIndex.ToUnderlying()); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } diff --git a/src/openrct2/actions/RideSetAppearanceAction.cpp b/src/openrct2/actions/RideSetAppearanceAction.cpp index a1405ed462..3d6582103c 100644 --- a/src/openrct2/actions/RideSetAppearanceAction.cpp +++ b/src/openrct2/actions/RideSetAppearanceAction.cpp @@ -53,7 +53,7 @@ GameActions::Result RideSetAppearanceAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } @@ -64,19 +64,19 @@ GameActions::Result RideSetAppearanceAction::Query() const case RideSetAppearanceType::TrackColourSupports: if (_index >= std::size(ride->track_colour)) { - LOG_WARNING("Invalid game command, index %d out of bounds", _index); + LOG_ERROR("Invalid track colour %u", _index); return GameActions::Result( - GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); + GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_INVALID_COLOUR); } break; case RideSetAppearanceType::VehicleColourBody: case RideSetAppearanceType::VehicleColourTrim: - case RideSetAppearanceType::VehicleColourTernary: + case RideSetAppearanceType::VehicleColourTertiary: if (_index >= std::size(ride->vehicle_colours)) { - LOG_WARNING("Invalid game command, index %d out of bounds", _index); + LOG_ERROR("Invalid vehicle colour %u", _index); return GameActions::Result( - GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); + GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_INVALID_COLOUR); } break; case RideSetAppearanceType::VehicleColourScheme: @@ -84,7 +84,7 @@ GameActions::Result RideSetAppearanceAction::Query() const case RideSetAppearanceType::SellingItemColourIsRandom: break; default: - LOG_WARNING("Invalid game command, type %d not recognised", _type); + LOG_ERROR("Invalid ride appearance type %u", _type); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -97,7 +97,7 @@ GameActions::Result RideSetAppearanceAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } @@ -123,7 +123,7 @@ GameActions::Result RideSetAppearanceAction::Execute() const ride->vehicle_colours[_index].Trim = _value; RideUpdateVehicleColours(*ride); break; - case RideSetAppearanceType::VehicleColourTernary: + case RideSetAppearanceType::VehicleColourTertiary: ride->vehicle_colours[_index].Tertiary = _value; RideUpdateVehicleColours(*ride); break; diff --git a/src/openrct2/actions/RideSetAppearanceAction.h b/src/openrct2/actions/RideSetAppearanceAction.h index 6b0cb594ce..0b9fcbcef7 100644 --- a/src/openrct2/actions/RideSetAppearanceAction.h +++ b/src/openrct2/actions/RideSetAppearanceAction.h @@ -19,7 +19,7 @@ enum class RideSetAppearanceType : uint8_t MazeStyle = TrackColourSupports, VehicleColourBody, VehicleColourTrim, - VehicleColourTernary, + VehicleColourTertiary, VehicleColourScheme, EntranceStyle, SellingItemColourIsRandom diff --git a/src/openrct2/actions/RideSetNameAction.cpp b/src/openrct2/actions/RideSetNameAction.cpp index 9a1498c6c5..50117ba058 100644 --- a/src/openrct2/actions/RideSetNameAction.cpp +++ b/src/openrct2/actions/RideSetNameAction.cpp @@ -50,8 +50,9 @@ GameActions::Result RideSetNameAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_RENAME_RIDE_ATTRACTION, STR_ERR_RIDE_NOT_FOUND); } if (!_name.empty() && Ride::NameExists(_name, ride->id)) @@ -68,8 +69,9 @@ GameActions::Result RideSetNameAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_RENAME_RIDE_ATTRACTION, STR_ERR_RIDE_NOT_FOUND); } if (_name.empty()) diff --git a/src/openrct2/actions/RideSetPriceAction.cpp b/src/openrct2/actions/RideSetPriceAction.cpp index b418b07f6d..18c2361f3c 100644 --- a/src/openrct2/actions/RideSetPriceAction.cpp +++ b/src/openrct2/actions/RideSetPriceAction.cpp @@ -54,14 +54,14 @@ GameActions::Result RideSetPriceAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } const auto* rideEntry = GetRideEntryByIndex(ride->subtype); if (rideEntry == nullptr) { - LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride entry not found for ride subtype %u", ride->subtype); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_OBJECT_ENTRY_NOT_FOUND); } @@ -77,14 +77,14 @@ GameActions::Result RideSetPriceAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } const auto* rideEntry = GetRideEntryByIndex(ride->subtype); if (rideEntry == nullptr) { - LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride entry not found for ride subtype %u", ride->subtype); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_OBJECT_ENTRY_NOT_FOUND); } diff --git a/src/openrct2/actions/RideSetSettingAction.cpp b/src/openrct2/actions/RideSetSettingAction.cpp index 56ecdc5775..8a8a8a12c8 100644 --- a/src/openrct2/actions/RideSetSettingAction.cpp +++ b/src/openrct2/actions/RideSetSettingAction.cpp @@ -10,10 +10,13 @@ #include "RideSetSettingAction.h" #include "../Context.h" +#include "../GameState.h" #include "../object/ObjectManager.h" #include "../ride/Ride.h" #include "../ride/RideData.h" +using namespace OpenRCT2; + RideSetSettingAction::RideSetSettingAction(RideId rideIndex, RideSetSetting setting, uint8_t value) : _rideIndex(rideIndex) , _setting(setting) @@ -45,8 +48,9 @@ GameActions::Result RideSetSettingAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid ride: #%u.", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %u.", _rideIndex.ToUnderlying()); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_RIDE_NOT_FOUND); } switch (_setting) @@ -64,10 +68,11 @@ GameActions::Result RideSetSettingAction::Query() const GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE, STR_MUST_BE_CLOSED_FIRST); } - if (!RideIsModeValid(*ride) && !gCheatsShowAllOperatingModes) + if (!RideIsModeValid(*ride) && !GetGameState().Cheats.ShowAllOperatingModes) { - LOG_WARNING("Invalid ride mode: %u", _value); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); + LOG_ERROR("Invalid ride mode: %u", _value); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_VALUE_OUT_OF_RANGE); } break; case RideSetSetting::Departure: @@ -75,21 +80,23 @@ GameActions::Result RideSetSettingAction::Query() const case RideSetSetting::MinWaitingTime: if (_value > 250) { - LOG_WARNING("Invalid minimum waiting time: %u", _value); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); + LOG_ERROR("Invalid minimum waiting time: %u", _value); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_VALUE_OUT_OF_RANGE); } break; case RideSetSetting::MaxWaitingTime: if (_value > 250) { - LOG_WARNING("Invalid maximum waiting time: %u", _value); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); + LOG_ERROR("Invalid maximum waiting time: %u", _value); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_VALUE_OUT_OF_RANGE); } break; case RideSetSetting::Operation: if (!RideIsValidOperationOption(*ride)) { - LOG_WARNING("Invalid operation option value: %u", _value); + LOG_ERROR("Invalid operation option value: %u", _value); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, GetOperationErrorMessage(*ride)); } @@ -97,28 +104,31 @@ GameActions::Result RideSetSettingAction::Query() const case RideSetSetting::InspectionInterval: if (_value > RIDE_INSPECTION_NEVER) { - LOG_WARNING("Invalid inspection interval: %u", _value); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); + LOG_ERROR("Invalid inspection interval: %u", _value); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_VALUE_OUT_OF_RANGE); } break; case RideSetSetting::Music: break; case RideSetSetting::MusicType: { - auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + auto& objManager = GetContext()->GetObjectManager(); auto musicObj = objManager.GetLoadedObject(ObjectType::Music, _value); if (musicObj == nullptr) { - LOG_WARNING("Invalid music style: %u", _value); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); + LOG_ERROR("Invalid music style: %u", _value); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_VALUE_OUT_OF_RANGE); } break; } case RideSetSetting::LiftHillSpeed: if (!RideIsValidLiftHillSpeed(*ride)) { - LOG_WARNING("Invalid lift hill speed: %u", _value); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); + LOG_ERROR("Invalid lift hill speed: %u", _value); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_VALUE_OUT_OF_RANGE); } break; case RideSetSetting::NumCircuits: @@ -131,20 +141,22 @@ GameActions::Result RideSetSettingAction::Query() const if (!RideIsValidNumCircuits()) { - LOG_WARNING("Invalid number of circuits: %u", _value); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); + LOG_ERROR("Invalid number of circuits: %u", _value); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_VALUE_OUT_OF_RANGE); } break; case RideSetSetting::RideType: - if (!gCheatsAllowArbitraryRideTypeChanges) + if (!GetGameState().Cheats.AllowArbitraryRideTypeChanges) { - LOG_WARNING("Arbitrary ride type changes not allowed."); + LOG_ERROR("Arbitrary ride type changes not allowed."); return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } break; default: - LOG_WARNING("Invalid RideSetSetting: %u", static_cast(_setting)); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); + LOG_ERROR("Invalid ride setting %u", static_cast(_setting)); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_VALUE_OUT_OF_RANGE); } return GameActions::Result(); @@ -155,8 +167,9 @@ GameActions::Result RideSetSettingAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid ride: #%u.", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_ERR_RIDE_NOT_FOUND); } switch (_setting) @@ -247,15 +260,15 @@ bool RideSetSettingAction::RideIsModeValid(const Ride& ride) const bool RideSetSettingAction::RideIsValidLiftHillSpeed(const Ride& ride) const { - int32_t minSpeed = gCheatsUnlockOperatingLimits ? 0 : ride.GetRideTypeDescriptor().LiftData.minimum_speed; - int32_t maxSpeed = gCheatsUnlockOperatingLimits ? 255 : ride.GetRideTypeDescriptor().LiftData.maximum_speed; + int32_t minSpeed = GetGameState().Cheats.UnlockOperatingLimits ? 0 : ride.GetRideTypeDescriptor().LiftData.minimum_speed; + int32_t maxSpeed = GetGameState().Cheats.UnlockOperatingLimits ? 255 : ride.GetRideTypeDescriptor().LiftData.maximum_speed; return _value >= minSpeed && _value <= maxSpeed; } bool RideSetSettingAction::RideIsValidNumCircuits() const { int32_t minNumCircuits = 1; - int32_t maxNumCircuits = gCheatsUnlockOperatingLimits ? 255 : OpenRCT2::Limits::MaxCircuitsPerRide; + int32_t maxNumCircuits = GetGameState().Cheats.UnlockOperatingLimits ? 255 : Limits::MaxCircuitsPerRide; return _value >= minNumCircuits && _value <= maxNumCircuits; } @@ -264,7 +277,7 @@ bool RideSetSettingAction::RideIsValidOperationOption(const Ride& ride) const const auto& operatingSettings = ride.GetRideTypeDescriptor().OperatingSettings; uint8_t minValue = operatingSettings.MinValue; uint8_t maxValue = operatingSettings.MaxValue; - if (gCheatsUnlockOperatingLimits) + if (GetGameState().Cheats.UnlockOperatingLimits) { minValue = 0; maxValue = 255; diff --git a/src/openrct2/actions/RideSetStatusAction.cpp b/src/openrct2/actions/RideSetStatusAction.cpp index 1f34bc5206..f39cefb0c2 100644 --- a/src/openrct2/actions/RideSetStatusAction.cpp +++ b/src/openrct2/actions/RideSetStatusAction.cpp @@ -60,16 +60,16 @@ GameActions::Result RideSetStatusAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); res.Error = GameActions::Status::InvalidParameters; res.ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN; - res.ErrorMessage = STR_NONE; + res.ErrorMessage = STR_ERR_RIDE_NOT_FOUND; return res; } if (_status >= RideStatus::Count) { - LOG_WARNING("Invalid ride status %u for ride %u", EnumValue(_status), _rideIndex.ToUnderlying()); + LOG_ERROR("Invalid ride status %u for ride %u", EnumValue(_status), _rideIndex.ToUnderlying()); res.Error = GameActions::Status::InvalidParameters; res.ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN; res.ErrorMessage = STR_NONE; @@ -124,14 +124,14 @@ GameActions::Result RideSetStatusAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); res.Error = GameActions::Status::InvalidParameters; res.ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN; - res.ErrorMessage = STR_NONE; + res.ErrorMessage = STR_ERR_RIDE_NOT_FOUND; return res; } - res.ErrorTitle = _StatusErrorTitles[static_cast(_status)]; + res.ErrorTitle = _StatusErrorTitles[EnumValue(_status)]; Formatter ft(res.ErrorMessageArgs.data()); ft.Increment(6); @@ -238,7 +238,7 @@ GameActions::Result RideSetStatusAction::Execute() const break; } default: - Guard::Assert(false, "Invalid status passed: %u", _status); + Guard::Assert(false, "Invalid ride status %u", _status); break; } auto windowManager = OpenRCT2::GetContext()->GetUiContext()->GetWindowManager(); diff --git a/src/openrct2/actions/RideSetVehicleAction.cpp b/src/openrct2/actions/RideSetVehicleAction.cpp index 7a59a12737..337f0979f3 100644 --- a/src/openrct2/actions/RideSetVehicleAction.cpp +++ b/src/openrct2/actions/RideSetVehicleAction.cpp @@ -11,6 +11,7 @@ #include "../Cheats.h" #include "../Context.h" +#include "../GameState.h" #include "../core/MemoryStream.h" #include "../drawing/Drawing.h" #include "../interface/Window.h" @@ -25,6 +26,8 @@ #include "../util/Util.h" #include "../world/Park.h" +using namespace OpenRCT2; + constexpr static StringId SetVehicleTypeErrorTitle[] = { STR_RIDE_SET_VEHICLE_SET_NUM_TRAINS_FAIL, STR_RIDE_SET_VEHICLE_SET_NUM_CARS_PER_TRAIN_FAIL, @@ -63,15 +66,15 @@ GameActions::Result RideSetVehicleAction::Query() const { if (_type >= RideSetVehicleType::Count) { - LOG_WARNING("Invalid type. type = %d", _type); + LOG_ERROR("Invalid ride vehicle type %d", _type); } auto errTitle = SetVehicleTypeErrorTitle[EnumValue(_type)]; auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); + return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_ERR_RIDE_NOT_FOUND); } if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) @@ -94,13 +97,13 @@ GameActions::Result RideSetVehicleAction::Query() const { if (!RideIsVehicleTypeValid(*ride)) { - LOG_ERROR("Invalid vehicle type. type = %d", _value); - return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); + LOG_ERROR("Invalid vehicle type %d", _value); + return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_ERR_VALUE_OUT_OF_RANGE); } auto rideEntry = GetRideEntryByIndex(_value); if (rideEntry == nullptr) { - LOG_WARNING("Invalid ride entry, ride->subtype = %d", ride->subtype); + LOG_ERROR("Ride entry not found for _value %d", _value); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } @@ -109,14 +112,14 @@ GameActions::Result RideSetVehicleAction::Query() const if (_colour >= presetList->count && _colour != 255 && _colour != 0) { LOG_ERROR("Unknown vehicle colour preset. colour = %d", _colour); - return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_ERR_INVALID_COLOUR); } break; } default: - LOG_ERROR("Unknown vehicle command. type = %d", _type); - return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); + LOG_ERROR("Invalid ride vehicle setting %d", _type); + return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_ERR_VALUE_OUT_OF_RANGE); } return GameActions::Result(); @@ -128,8 +131,8 @@ GameActions::Result RideSetVehicleAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %u", _rideIndex.ToUnderlying()); + return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_ERR_RIDE_NOT_FOUND); } switch (_type) @@ -151,12 +154,12 @@ GameActions::Result RideSetVehicleAction::Execute() const auto rideEntry = GetRideEntryByIndex(ride->subtype); if (rideEntry == nullptr) { - LOG_WARNING("Invalid ride entry, ride->subtype = %d", ride->subtype); + LOG_ERROR("Ride entry not found for index %d", ride->subtype); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } uint8_t clampValue = _value; static_assert(sizeof(clampValue) == sizeof(ride->proposed_num_cars_per_train)); - if (!gCheatsDisableTrainLengthLimit) + if (!GetGameState().Cheats.DisableTrainLengthLimit) { clampValue = std::clamp(clampValue, rideEntry->min_cars_in_train, rideEntry->max_cars_in_train); } @@ -174,12 +177,12 @@ GameActions::Result RideSetVehicleAction::Execute() const auto rideEntry = GetRideEntryByIndex(ride->subtype); if (rideEntry == nullptr) { - LOG_WARNING("Invalid ride entry, ride->subtype = %d", ride->subtype); + LOG_ERROR("Ride entry not found for index %d", ride->subtype); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } RideSetVehicleColoursToRandomPreset(*ride, _colour); - if (!gCheatsDisableTrainLengthLimit) + if (!GetGameState().Cheats.DisableTrainLengthLimit) { ride->proposed_num_cars_per_train = std::clamp( ride->proposed_num_cars_per_train, rideEntry->min_cars_in_train, rideEntry->max_cars_in_train); @@ -197,7 +200,7 @@ GameActions::Result RideSetVehicleAction::Execute() const } default: - LOG_ERROR("Unknown vehicle command. type = %d", _type); + LOG_ERROR("Invalid ride vehicle setting %d", _type); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } @@ -226,7 +229,7 @@ bool RideSetVehicleAction::RideIsVehicleTypeValid(const Ride& ride) const { const auto& rtd = ride.GetRideTypeDescriptor(); - if (gCheatsShowVehiclesFromOtherTrackTypes + if (GetGameState().Cheats.ShowVehiclesFromOtherTrackTypes && !( ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE) || ride.type == RIDE_TYPE_MINI_GOLF)) @@ -255,13 +258,13 @@ bool RideSetVehicleAction::RideIsVehicleTypeValid(const Ride& ride) const continue; } - auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + auto& objManager = GetContext()->GetObjectManager(); auto& rideEntries = objManager.GetAllRideEntries(rideTypeIterator); for (auto rideEntryIndex : rideEntries) { if (rideEntryIndex == _value) { - if (!RideEntryIsInvented(rideEntryIndex) && !gCheatsIgnoreResearchStatus) + if (!RideEntryIsInvented(rideEntryIndex) && !GetGameState().Cheats.IgnoreResearchStatus) { return false; } diff --git a/src/openrct2/actions/ScenarioSetSettingAction.cpp b/src/openrct2/actions/ScenarioSetSettingAction.cpp index 60a2fb773f..87043377e8 100644 --- a/src/openrct2/actions/ScenarioSetSettingAction.cpp +++ b/src/openrct2/actions/ScenarioSetSettingAction.cpp @@ -39,7 +39,7 @@ GameActions::Result ScenarioSetSettingAction::Query() const { if (_setting >= ScenarioSetSetting::Count) { - LOG_ERROR("Invalid setting: %u", _setting); + LOG_ERROR("Invalid scenario setting: %u", _setting); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -146,7 +146,7 @@ GameActions::Result ScenarioSetSettingAction::Execute() const } break; case ScenarioSetSetting::CostToBuyLand: - gLandPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); + gameState.LandPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); break; case ScenarioSetSetting::CostToBuyConstructionRights: gameState.ConstructionRightsPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); @@ -264,7 +264,7 @@ GameActions::Result ScenarioSetSettingAction::Execute() const break; } default: - LOG_ERROR("Invalid setting: %u", _setting); + LOG_ERROR("Invalid scenario setting %u", _setting); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } diff --git a/src/openrct2/actions/SignSetNameAction.cpp b/src/openrct2/actions/SignSetNameAction.cpp index a57bf50393..0761bd6a06 100644 --- a/src/openrct2/actions/SignSetNameAction.cpp +++ b/src/openrct2/actions/SignSetNameAction.cpp @@ -48,7 +48,7 @@ GameActions::Result SignSetNameAction::Query() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - LOG_WARNING("Invalid game command for setting sign name, banner id = %d", _bannerIndex); + LOG_ERROR("Banner not found for bannerIndex %d", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_SIGN, STR_NONE); } return GameActions::Result(); @@ -59,7 +59,7 @@ GameActions::Result SignSetNameAction::Execute() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - LOG_WARNING("Invalid game command for setting sign name, banner id = %d", _bannerIndex); + LOG_ERROR("Banner not found for bannerIndex %d", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_SIGN, STR_NONE); } diff --git a/src/openrct2/actions/SignSetStyleAction.cpp b/src/openrct2/actions/SignSetStyleAction.cpp index 35d65a9e8a..025e3f5742 100644 --- a/src/openrct2/actions/SignSetStyleAction.cpp +++ b/src/openrct2/actions/SignSetStyleAction.cpp @@ -50,7 +50,7 @@ GameActions::Result SignSetStyleAction::Query() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - LOG_ERROR("Invalid banner id. id = ", _bannerIndex); + LOG_ERROR("Banner not found for bannerIndex %u", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -59,12 +59,13 @@ GameActions::Result SignSetStyleAction::Query() const TileElement* tileElement = BannerGetTileElement(_bannerIndex); if (tileElement == nullptr) { - LOG_WARNING("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex); + LOG_ERROR("Banner tile element not found for bannerIndex %u", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } if (tileElement->GetType() != TileElementType::LargeScenery) { - LOG_WARNING("Invalid game command for setting sign style, banner id '%d' is not large", _bannerIndex); + LOG_ERROR( + "Tile element has type %u, expected %d (LargeScenery)", tileElement->GetType(), TileElementType::LargeScenery); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } } @@ -74,7 +75,7 @@ GameActions::Result SignSetStyleAction::Query() const if (wallElement == nullptr) { - LOG_WARNING("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex); + LOG_ERROR("Wall element not found for bannerIndex", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } } @@ -87,7 +88,7 @@ GameActions::Result SignSetStyleAction::Execute() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - LOG_ERROR("Invalid banner id. id = ", _bannerIndex); + LOG_ERROR("Invalid banner id %u", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } diff --git a/src/openrct2/actions/SmallSceneryPlaceAction.cpp b/src/openrct2/actions/SmallSceneryPlaceAction.cpp index 628d8bc357..4237b5b20a 100644 --- a/src/openrct2/actions/SmallSceneryPlaceAction.cpp +++ b/src/openrct2/actions/SmallSceneryPlaceAction.cpp @@ -10,6 +10,7 @@ #include "SmallSceneryPlaceAction.h" #include "../Cheats.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../common.h" #include "../core/MemoryStream.h" @@ -30,6 +31,8 @@ #include "GameAction.h" #include "SmallSceneryRemoveAction.h" +using namespace OpenRCT2; + SmallSceneryPlaceAction::SmallSceneryPlaceAction( const CoordsXYZD& loc, uint8_t quadrant, ObjectEntryIndex sceneryType, uint8_t primaryColour, uint8_t secondaryColour, uint8_t tertiaryColour) @@ -112,12 +115,14 @@ GameActions::Result SmallSceneryPlaceAction::Query() const auto maxSizeMax = GetMapSizeMaxXY(); if (!_trackDesignDrawingPreview && (_loc.x > maxSizeMax.x || _loc.y > maxSizeMax.y)) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_VALUE_OUT_OF_RANGE); } - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryType); + auto* sceneryEntry = ObjectManager::GetObjectEntry(_sceneryType); if (sceneryEntry == nullptr) { + LOG_ERROR("Small scenery object entry not found for sceneryType %u", _sceneryType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE); } @@ -163,7 +168,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const targetHeight = surfaceHeight; } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode && !MapIsLocationOwned({ _loc.x, _loc.y, targetHeight })) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -171,7 +176,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const auto* surfaceElement = MapGetSurfaceElementAt(_loc); - if (surfaceElement != nullptr && !gCheatsDisableClearanceChecks && surfaceElement->GetWaterHeight() > 0) + if (surfaceElement != nullptr && !GetGameState().Cheats.DisableClearanceChecks && surfaceElement->GetWaterHeight() > 0) { int32_t water_height = surfaceElement->GetWaterHeight() - 1; if (water_height > targetHeight) @@ -181,7 +186,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const } } - if (!gCheatsDisableClearanceChecks && !(sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_STACKABLE))) + if (!GetGameState().Cheats.DisableClearanceChecks && !(sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_STACKABLE))) { if (isOnWater) { @@ -199,13 +204,15 @@ GameActions::Result SmallSceneryPlaceAction::Query() const } } - if (!gCheatsDisableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE)) && !supportsRequired - && !isOnWater && surfaceElement != nullptr && (surfaceElement->GetSlope() != TILE_ELEMENT_SLOPE_FLAT)) + if (!GetGameState().Cheats.DisableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE)) + && !supportsRequired && !isOnWater && surfaceElement != nullptr + && (surfaceElement->GetSlope() != TILE_ELEMENT_SLOPE_FLAT)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LEVEL_LAND_REQUIRED); } - if (!gCheatsDisableSupportLimits && !(sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_STACKABLE)) && supportsRequired) + if (!GetGameState().Cheats.DisableSupportLimits && !(sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_STACKABLE)) + && supportsRequired) { if (!isOnWater) { @@ -308,9 +315,10 @@ GameActions::Result SmallSceneryPlaceAction::Execute() const res.Position.z = surfaceHeight; } - auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryType); + auto* sceneryEntry = ObjectManager::GetObjectEntry(_sceneryType); if (sceneryEntry == nullptr) { + LOG_ERROR("Small scenery object entry not found for sceneryType %u", _sceneryType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE); } @@ -357,7 +365,7 @@ GameActions::Result SmallSceneryPlaceAction::Execute() const if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { FootpathRemoveLitter({ _loc, targetHeight }); - if (!gCheatsDisableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_NO_WALLS))) + if (!GetGameState().Cheats.DisableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_NO_WALLS))) { WallRemoveAt({ _loc, targetHeight, targetHeight + sceneryEntry->height }); } diff --git a/src/openrct2/actions/SmallSceneryRemoveAction.cpp b/src/openrct2/actions/SmallSceneryRemoveAction.cpp index f9c8a2436d..b52f741923 100644 --- a/src/openrct2/actions/SmallSceneryRemoveAction.cpp +++ b/src/openrct2/actions/SmallSceneryRemoveAction.cpp @@ -66,6 +66,7 @@ GameActions::Result SmallSceneryRemoveAction::Query() const auto* entry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryType); if (entry == nullptr) { + LOG_ERROR("Invalid small scenery type %u", _sceneryType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } @@ -74,7 +75,8 @@ GameActions::Result SmallSceneryRemoveAction::Query() const res.Expenditure = ExpenditureType::Landscaping; res.Position = _loc; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST) + && !GetGameState().Cheats.SandboxMode) { // Check if allowed to remove item if (GetGameState().ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) @@ -101,6 +103,7 @@ GameActions::Result SmallSceneryRemoveAction::Query() const TileElement* tileElement = FindSceneryElement(); if (tileElement == nullptr) { + LOG_ERROR("Small scenery of type %u not found at x = %d, y = %d, z = &d", _sceneryType, _loc.x, _loc.y, _loc.z); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } @@ -115,6 +118,7 @@ GameActions::Result SmallSceneryRemoveAction::Execute() const auto* entry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryType); if (entry == nullptr) { + LOG_ERROR("Invalid small scenery type %u", _sceneryType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } diff --git a/src/openrct2/actions/SmallScenerySetColourAction.cpp b/src/openrct2/actions/SmallScenerySetColourAction.cpp index f5e647142c..3832657eab 100644 --- a/src/openrct2/actions/SmallScenerySetColourAction.cpp +++ b/src/openrct2/actions/SmallScenerySetColourAction.cpp @@ -10,6 +10,7 @@ #include "SmallScenerySetColourAction.h" #include "../Cheats.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../common.h" #include "../core/MemoryStream.h" @@ -24,6 +25,8 @@ #include "../world/Surface.h" #include "../world/TileElement.h" +using namespace OpenRCT2; + SmallScenerySetColourAction::SmallScenerySetColourAction( const CoordsXYZ& loc, uint8_t quadrant, ObjectEntryIndex sceneryType, uint8_t primaryColour, uint8_t secondaryColour, uint8_t tertiaryColour) @@ -83,7 +86,7 @@ GameActions::Result SmallScenerySetColourAction::QueryExecute(bool isExecuting) return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (!MapIsLocationOwned(_loc)) { diff --git a/src/openrct2/actions/StaffFireAction.cpp b/src/openrct2/actions/StaffFireAction.cpp index 9bf45c6a93..9cfc0dc218 100644 --- a/src/openrct2/actions/StaffFireAction.cpp +++ b/src/openrct2/actions/StaffFireAction.cpp @@ -38,7 +38,7 @@ GameActions::Result StaffFireAction::Query() const { if (_spriteId.ToUnderlying() >= MAX_ENTITIES || _spriteId.IsNull()) { - LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); + LOG_ERROR("Invalid spriteId %u", _spriteId); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -46,7 +46,7 @@ GameActions::Result StaffFireAction::Query() const auto staff = TryGetEntity(_spriteId); if (staff == nullptr) { - LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); + LOG_ERROR("Staff entity not found for spriteId %u", _spriteId); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } @@ -67,7 +67,7 @@ GameActions::Result StaffFireAction::Execute() const auto staff = TryGetEntity(_spriteId); if (staff == nullptr) { - LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); + LOG_ERROR("Staff entity not found for spriteId %u", _spriteId); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } WindowCloseByClass(WindowClass::FirePrompt); diff --git a/src/openrct2/actions/StaffHireNewAction.cpp b/src/openrct2/actions/StaffHireNewAction.cpp index 410b547bbd..27708f73b2 100644 --- a/src/openrct2/actions/StaffHireNewAction.cpp +++ b/src/openrct2/actions/StaffHireNewAction.cpp @@ -85,10 +85,8 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const if (_staffType >= static_cast(StaffType::Count)) { - // Invalid staff type. - LOG_ERROR("Tried to use invalid staff type: %u", static_cast(_staffType)); - - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_HIRE_NEW_STAFF, STR_NONE); + LOG_ERROR("Invalid staff type %u", static_cast(_staffType)); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_HIRE_NEW_STAFF, STR_ERR_VALUE_OUT_OF_RANGE); } if (GetNumFreeEntities() < 400) @@ -100,19 +98,17 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const { if (static_cast(_entertainerType) >= static_cast(EntertainerCostume::Count)) { - // Invalid entertainer costume - LOG_ERROR("Tried to use invalid entertainer type: %u", static_cast(_entertainerType)); - - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_HIRE_NEW_STAFF, STR_NONE); + LOG_ERROR("Invalid entertainer type %u", static_cast(_entertainerType)); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_HIRE_NEW_STAFF, STR_ERR_VALUE_OUT_OF_RANGE); } uint32_t availableCostumes = StaffGetAvailableEntertainerCostumes(); if (!(availableCostumes & (1 << static_cast(_entertainerType)))) { - // Entertainer costume unavailable - LOG_ERROR("Tried to use unavailable entertainer type: %u", static_cast(_entertainerType)); - - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_HIRE_NEW_STAFF, STR_NONE); + LOG_ERROR("Unavailable entertainer costume %u", static_cast(_entertainerType)); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_HIRE_NEW_STAFF, STR_ERR_VALUE_OUT_OF_RANGE); } } @@ -204,7 +200,7 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const newPeep->TrousersColour = colour; // Staff energy determines their walking speed - switch (gCheatsSelectedStaffSpeed) + switch (GetGameState().Cheats.SelectedStaffSpeed) { case StaffSpeedCheat::None: newPeep->Energy = kCheatsStaffNormalSpeed; diff --git a/src/openrct2/actions/StaffSetColourAction.cpp b/src/openrct2/actions/StaffSetColourAction.cpp index 515ca77f4a..e88b14559b 100644 --- a/src/openrct2/actions/StaffSetColourAction.cpp +++ b/src/openrct2/actions/StaffSetColourAction.cpp @@ -47,6 +47,7 @@ GameActions::Result StaffSetColourAction::Query() const auto staffType = static_cast(_staffType); if (staffType != StaffType::Handyman && staffType != StaffType::Mechanic && staffType != StaffType::Security) { + LOG_ERROR("Staff color can't be changed for staff type %d", _staffType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_ACTION_INVALID_FOR_THAT_STAFF_TYPE); } diff --git a/src/openrct2/actions/StaffSetCostumeAction.cpp b/src/openrct2/actions/StaffSetCostumeAction.cpp index 099462e2d4..72e822a6ce 100644 --- a/src/openrct2/actions/StaffSetCostumeAction.cpp +++ b/src/openrct2/actions/StaffSetCostumeAction.cpp @@ -64,6 +64,7 @@ GameActions::Result StaffSetCostumeAction::Query() const { if (_spriteIndex.ToUnderlying() >= MAX_ENTITIES || _spriteIndex.IsNull()) { + LOG_ERROR("Invalid sprite index %u", _spriteIndex); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -71,14 +72,14 @@ GameActions::Result StaffSetCostumeAction::Query() const auto* staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { - LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); + LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } auto spriteType = EntertainerCostumeToSprite(_costume); if (EnumValue(spriteType) > std::size(peep_slow_walking_types)) { - LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); + LOG_ERROR("Invalid entertainer costume %u", _costume); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -90,7 +91,7 @@ GameActions::Result StaffSetCostumeAction::Execute() const auto* staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { - LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); + LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } diff --git a/src/openrct2/actions/StaffSetNameAction.cpp b/src/openrct2/actions/StaffSetNameAction.cpp index d9a4302200..9844f50a7b 100644 --- a/src/openrct2/actions/StaffSetNameAction.cpp +++ b/src/openrct2/actions/StaffSetNameAction.cpp @@ -49,14 +49,17 @@ GameActions::Result StaffSetNameAction::Query() const { if (_spriteIndex.ToUnderlying() >= MAX_ENTITIES || _spriteIndex.IsNull()) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE); + LOG_ERROR("Invalid sprite index %u", _spriteIndex); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_ERR_VALUE_OUT_OF_RANGE); } auto staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { - LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE); + LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_ERR_STAFF_NOT_FOUND); } return GameActions::Result(); @@ -67,8 +70,9 @@ GameActions::Result StaffSetNameAction::Execute() const auto staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { - LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE); + LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_ERR_STAFF_NOT_FOUND); } auto curName = staff->GetName(); diff --git a/src/openrct2/actions/StaffSetOrdersAction.cpp b/src/openrct2/actions/StaffSetOrdersAction.cpp index 995fe6513b..8ecac4c61d 100644 --- a/src/openrct2/actions/StaffSetOrdersAction.cpp +++ b/src/openrct2/actions/StaffSetOrdersAction.cpp @@ -45,6 +45,7 @@ GameActions::Result StaffSetOrdersAction::Query() const { if (_spriteIndex.ToUnderlying() >= MAX_ENTITIES || _spriteIndex.IsNull()) { + LOG_ERROR("Invalid sprite index %u", _spriteIndex); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } @@ -53,7 +54,7 @@ GameActions::Result StaffSetOrdersAction::Query() const if (staff == nullptr || (staff->AssignedStaffType != StaffType::Handyman && staff->AssignedStaffType != StaffType::Mechanic)) { - LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); + LOG_ERROR("Staff orders can't be changed for staff of type %u", _spriteIndex); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_ACTION_INVALID_FOR_THAT_STAFF_TYPE); } @@ -66,7 +67,7 @@ GameActions::Result StaffSetOrdersAction::Execute() const auto* staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { - LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); + LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } staff->StaffOrders = _ordersId; diff --git a/src/openrct2/actions/StaffSetPatrolAreaAction.cpp b/src/openrct2/actions/StaffSetPatrolAreaAction.cpp index 7317222be8..a2f235a972 100644 --- a/src/openrct2/actions/StaffSetPatrolAreaAction.cpp +++ b/src/openrct2/actions/StaffSetPatrolAreaAction.cpp @@ -60,7 +60,7 @@ GameActions::Result StaffSetPatrolAreaAction::QueryExecute(bool executing) const auto staff = TryGetEntity(_spriteId); if (staff == nullptr) { - LOG_ERROR("Invalid entity ID: %u", _spriteId.ToUnderlying()); + LOG_ERROR("Staff entity not found for spriteID %u", _spriteId.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } diff --git a/src/openrct2/actions/SurfaceSetStyleAction.cpp b/src/openrct2/actions/SurfaceSetStyleAction.cpp index 2d61bc97b1..658f38f2ea 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.cpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.cpp @@ -58,7 +58,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const if (surfaceObj == nullptr) { - LOG_ERROR("Invalid surface style."); + LOG_ERROR("Invalid surface style %u", _surfaceStyle); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_UNKNOWN_OBJECT_TYPE); } @@ -70,7 +70,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const if (edgeObj == nullptr) { - LOG_ERROR("Invalid edge style."); + LOG_ERROR("Invalid edge style %u", _edgeStyle); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_UNKNOWN_OBJECT_TYPE); } @@ -85,7 +85,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const res.Position.z = heightMid; // Do nothing if not in editor, sandbox mode or landscaping is forbidden - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode && (GetGameState().ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)) { return GameActions::Result( @@ -102,7 +102,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const if (!LocationValid(coords)) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(coords)) continue; @@ -170,7 +170,7 @@ GameActions::Result SurfaceSetStyleAction::Execute() const if (!LocationValid(coords)) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(coords)) continue; diff --git a/src/openrct2/actions/TileModifyAction.cpp b/src/openrct2/actions/TileModifyAction.cpp index 44da0b27d4..67fcd5677a 100644 --- a/src/openrct2/actions/TileModifyAction.cpp +++ b/src/openrct2/actions/TileModifyAction.cpp @@ -230,7 +230,7 @@ GameActions::Result TileModifyAction::QueryExecute(bool isExecuting) const break; } default: - LOG_ERROR("invalid instruction"); + LOG_ERROR("Invalid tile modification type %u", _setting); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE); } diff --git a/src/openrct2/actions/TrackDesignAction.cpp b/src/openrct2/actions/TrackDesignAction.cpp index 4198d3f992..989294fac2 100644 --- a/src/openrct2/actions/TrackDesignAction.cpp +++ b/src/openrct2/actions/TrackDesignAction.cpp @@ -10,6 +10,7 @@ #include "TrackDesignAction.h" #include "../Context.h" +#include "../GameState.h" #include "../management/Finance.h" #include "../management/Research.h" #include "../object/ObjectManager.h" @@ -22,6 +23,8 @@ #include "RideSetSettingAction.h" #include "RideSetVehicleAction.h" +using namespace OpenRCT2; + TrackDesignAction::TrackDesignAction(const CoordsXYZD& location, const TrackDesign& td) : _loc(location) , _td(td) @@ -61,20 +64,21 @@ GameActions::Result TrackDesignAction::Query() const GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + auto& gameState = GetGameState(); + auto& objManager = GetContext()->GetObjectManager(); auto entryIndex = objManager.GetLoadedObjectEntryIndex(_td.vehicle_object); if (entryIndex == OBJECT_ENTRY_INDEX_NULL) { // Force a fallback if the entry is not invented yet a td6 of it is selected, // which can happen in select-by-track-type mode - if (!RideEntryIsInvented(entryIndex) && !gCheatsIgnoreResearchStatus) + if (!RideEntryIsInvented(entryIndex) && !gameState.Cheats.IgnoreResearchStatus) { entryIndex = OBJECT_ENTRY_INDEX_NULL; } } // Colours do not matter as will be overwritten - auto rideCreateAction = RideCreateAction(_td.type, entryIndex, 0, 0, gLastEntranceStyle); + auto rideCreateAction = RideCreateAction(_td.type, entryIndex, 0, 0, gameState.LastEntranceStyle); rideCreateAction.SetFlags(GetFlags()); auto r = GameActions::ExecuteNested(&rideCreateAction); if (r.Error != GameActions::Status::Ok) @@ -86,8 +90,9 @@ GameActions::Result TrackDesignAction::Query() const auto ride = GetRide(rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command for track placement, ride id = %d", rideIndex); - return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %d", rideIndex); + return GameActions::Result( + GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_RIDE_NOT_FOUND); } bool placeScenery = true; @@ -133,20 +138,21 @@ GameActions::Result TrackDesignAction::Execute() const res.Position.z = _loc.z; res.Expenditure = ExpenditureType::RideConstruction; - auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + auto& gameState = GetGameState(); + auto& objManager = GetContext()->GetObjectManager(); auto entryIndex = objManager.GetLoadedObjectEntryIndex(_td.vehicle_object); if (entryIndex != OBJECT_ENTRY_INDEX_NULL) { // Force a fallback if the entry is not invented yet a track design using it is selected. // This can happen on rides with multiple vehicles where some have been invented and some haven’t. - if (!RideEntryIsInvented(entryIndex) && !gCheatsIgnoreResearchStatus) + if (!RideEntryIsInvented(entryIndex) && !gameState.Cheats.IgnoreResearchStatus) { entryIndex = OBJECT_ENTRY_INDEX_NULL; } } // Colours do not matter as will be overwritten - auto rideCreateAction = RideCreateAction(_td.type, entryIndex, 0, 0, gLastEntranceStyle); + auto rideCreateAction = RideCreateAction(_td.type, entryIndex, 0, 0, gameState.LastEntranceStyle); rideCreateAction.SetFlags(GetFlags()); auto r = GameActions::ExecuteNested(&rideCreateAction); if (r.Error != GameActions::Status::Ok) @@ -158,8 +164,9 @@ GameActions::Result TrackDesignAction::Execute() const auto ride = GetRide(rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid game command for track placement, ride id = %d", rideIndex); - return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %d", rideIndex); + return GameActions::Result( + GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_RIDE_NOT_FOUND); } // Query first, this is required again to determine if scenery is available. @@ -244,17 +251,17 @@ GameActions::Result TrackDesignAction::Execute() const ride->entrance_style = objManager.GetLoadedObjectEntryIndex(_td.StationObjectIdentifier); if (ride->entrance_style == OBJECT_ENTRY_INDEX_NULL) { - ride->entrance_style = gLastEntranceStyle; + ride->entrance_style = gameState.LastEntranceStyle; } - for (int32_t i = 0; i < OpenRCT2::Limits::NumColourSchemes; i++) + for (int32_t i = 0; i < Limits::NumColourSchemes; i++) { ride->track_colour[i].main = _td.track_spine_colour[i]; ride->track_colour[i].additional = _td.track_rail_colour[i]; ride->track_colour[i].supports = _td.track_support_colour[i]; } - for (size_t i = 0; i < OpenRCT2::Limits::MaxVehicleColours; i++) + for (size_t i = 0; i < Limits::MaxVehicleColours; i++) { ride->vehicle_colours[i] = _td.vehicle_colours[i]; } diff --git a/src/openrct2/actions/TrackPlaceAction.cpp b/src/openrct2/actions/TrackPlaceAction.cpp index 0575e89b7e..c20f2c1ae7 100644 --- a/src/openrct2/actions/TrackPlaceAction.cpp +++ b/src/openrct2/actions/TrackPlaceAction.cpp @@ -9,6 +9,7 @@ #include "TrackPlaceAction.h" +#include "../GameState.h" #include "../core/Numerics.hpp" #include "../management/Finance.h" #include "../ride/RideData.h" @@ -21,6 +22,7 @@ #include "../world/Surface.h" #include "RideSetSettingAction.h" +using namespace OpenRCT2; using namespace OpenRCT2::TrackMetaData; TrackPlaceAction::TrackPlaceAction( @@ -70,26 +72,26 @@ GameActions::Result TrackPlaceAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid ride for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); + LOG_ERROR("Ride not found for rideIndex %d", _rideIndex.ToUnderlying()); return GameActions::Result( - GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_RIDE_NOT_FOUND); } const auto* rideEntry = GetRideEntryByIndex(ride->subtype); if (rideEntry == nullptr) { - LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); + LOG_ERROR("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE); } if (!DirectionValid(_origin.direction)) { - LOG_WARNING("Invalid direction for track placement, direction = %d", _origin.direction); + LOG_ERROR("Invalid direction for track placement, direction = %d", _origin.direction); return GameActions::Result( - GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_VALUE_OUT_OF_RANGE); } - if (_rideType != ride->type && !gCheatsAllowArbitraryRideTypeChanges) + if (_rideType != ride->type && !GetGameState().Cheats.AllowArbitraryRideTypeChanges) { return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); @@ -97,9 +99,9 @@ GameActions::Result TrackPlaceAction::Query() const if (_rideType > RIDE_TYPE_COUNT) { - LOG_WARNING("Invalid ride type for track placement, rideType = %d", _rideType); + LOG_ERROR("Invalid ride type for track placement, rideType = %d", _rideType); return GameActions::Result( - GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_VALUE_OUT_OF_RANGE); } auto res = GameActions::Result(); @@ -120,7 +122,7 @@ GameActions::Result TrackPlaceAction::Query() const if (!(GetActionFlags() & GameActions::Flags::AllowWhilePaused)) { - if (GameIsPaused() && !gCheatsBuildInPauseMode) + if (GameIsPaused() && !GetGameState().Cheats.BuildInPauseMode) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, @@ -150,7 +152,8 @@ GameActions::Result TrackPlaceAction::Query() const } // Backwards steep lift hills are allowed, even on roller coasters that do not support forwards steep lift hills. if ((_trackPlaceFlags & CONSTRUCTION_LIFT_HILL_SELECTED) - && !ride->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_LIFT_HILL_STEEP) && !gCheatsEnableChainLiftOnAllTrack) + && !ride->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_LIFT_HILL_STEEP) + && !GetGameState().Cheats.EnableChainLiftOnAllTrack) { const auto& ted = GetTrackElementDescriptor(_trackType); if (ted.Flags & TRACK_ELEM_FLAG_IS_STEEP_UP) @@ -176,7 +179,7 @@ GameActions::Result TrackPlaceAction::Query() const return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!MapIsLocationOwned(tileCoords) && !gCheatsSandboxMode) + if (!MapIsLocationOwned(tileCoords) && !GetGameState().Cheats.SandboxMode) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -186,13 +189,13 @@ GameActions::Result TrackPlaceAction::Query() const if (!CheckMapCapacity(numElements)) { - LOG_WARNING("Not enough free map elements to place track."); + LOG_ERROR("Not enough free map elements to place track."); return GameActions::Result( GameActions::Status::NoFreeElements, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED); } - if (!gCheatsAllowTrackPlaceInvalidHeights) + if (!GetGameState().Cheats.AllowTrackPlaceInvalidHeights) { if (ted.Flags & TRACK_ELEM_FLAG_STARTS_AT_HALF_HEIGHT) { @@ -296,7 +299,7 @@ GameActions::Result TrackPlaceAction::Query() const } } - if (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER && !gCheatsDisableClearanceChecks) + if (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER && !GetGameState().Cheats.DisableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, @@ -309,7 +312,8 @@ GameActions::Result TrackPlaceAction::Query() const if (surfaceElement == nullptr) { return GameActions::Result( - GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, + STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } auto waterHeight = surfaceElement->GetWaterHeight(); @@ -356,10 +360,12 @@ GameActions::Result TrackPlaceAction::Query() const auto surfaceElement = MapGetSurfaceElementAt(mapLoc); if (surfaceElement == nullptr) { - return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, + STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } - if (!gCheatsDisableSupportLimits) + if (!GetGameState().Cheats.DisableSupportLimits) { int32_t ride_height = clearanceZ - surfaceElement->GetBaseZ(); if (ride_height >= 0) @@ -410,15 +416,15 @@ GameActions::Result TrackPlaceAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - LOG_WARNING("Invalid ride for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); + LOG_ERROR("Invalid ride for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); return GameActions::Result( - GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_RIDE_NOT_FOUND); } const auto* rideEntry = GetRideEntryByIndex(ride->subtype); if (rideEntry == nullptr) { - LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); + LOG_ERROR("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE); } @@ -486,7 +492,7 @@ GameActions::Result TrackPlaceAction::Execute() const } } - if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gCheatsDisableClearanceChecks) + if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !GetGameState().Cheats.DisableClearanceChecks) { FootpathRemoveLitter(mapLoc); if (rideTypeFlags & RIDE_TYPE_FLAG_TRACK_NO_WALLS) @@ -527,7 +533,9 @@ GameActions::Result TrackPlaceAction::Execute() const auto surfaceElement = MapGetSurfaceElementAt(mapLoc); if (surfaceElement == nullptr) { - return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, + STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } int32_t supportHeight = baseZ - surfaceElement->GetBaseZ(); @@ -555,7 +563,7 @@ GameActions::Result TrackPlaceAction::Execute() const auto* trackElement = TileElementInsert(mapLoc, quarterTile.GetBaseQuarterOccupied()); if (trackElement == nullptr) { - LOG_WARNING("Cannot create track element for ride = %d", _rideIndex.ToUnderlying()); + LOG_ERROR("Cannot create track element for ride = %d", _rideIndex.ToUnderlying()); return GameActions::Result( GameActions::Status::NoFreeElements, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED); @@ -616,7 +624,7 @@ GameActions::Result TrackPlaceAction::Execute() const uint8_t availableDirections = entranceDirections & 0x0F; if (availableDirections != 0) { - if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gCheatsDisableClearanceChecks) + if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !GetGameState().Cheats.DisableClearanceChecks) { for (int32_t chosenDirection = UtilBitScanForward(availableDirections); chosenDirection != -1; chosenDirection = UtilBitScanForward(availableDirections)) @@ -658,7 +666,7 @@ GameActions::Result TrackPlaceAction::Execute() const } } - if (!gCheatsDisableClearanceChecks || !(GetFlags() & GAME_COMMAND_FLAG_GHOST)) + if (!GetGameState().Cheats.DisableClearanceChecks || !(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { FootpathConnectEdges(mapLoc, tileElement, GetFlags()); } @@ -689,7 +697,7 @@ GameActions::Result TrackPlaceAction::Execute() const if (ride->mode == RideMode::PoweredLaunch) { if (ride->GetRideTypeDescriptor().SupportsRideMode(RideMode::PoweredLaunchBlockSectioned) - || gCheatsShowAllOperatingModes) + || GetGameState().Cheats.ShowAllOperatingModes) newMode = RideMode::PoweredLaunchBlockSectioned; else newMode = RideMode::PoweredLaunch; diff --git a/src/openrct2/actions/TrackRemoveAction.cpp b/src/openrct2/actions/TrackRemoveAction.cpp index 18c59eee93..b02824a06c 100644 --- a/src/openrct2/actions/TrackRemoveAction.cpp +++ b/src/openrct2/actions/TrackRemoveAction.cpp @@ -9,6 +9,7 @@ #include "TrackRemoveAction.h" +#include "../GameState.h" #include "../management/Finance.h" #include "../ride/RideData.h" #include "../ride/Track.h" @@ -19,6 +20,7 @@ #include "../world/Surface.h" #include "RideSetSettingAction.h" +using namespace OpenRCT2; using namespace OpenRCT2::TrackMetaData; TrackRemoveAction::TrackRemoveAction(track_type_t trackType, int32_t sequence, const CoordsXYZD& origin) @@ -108,10 +110,11 @@ GameActions::Result TrackRemoveAction::Query() const if (!found) { - LOG_WARNING( + LOG_ERROR( "Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", _origin.x, _origin.y, _origin.z, _origin.direction, _sequence); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_TRACK_ELEMENT_NOT_FOUND); } if (tileElement->AsTrack()->IsIndestructible()) @@ -127,22 +130,25 @@ GameActions::Result TrackRemoveAction::Query() const auto ride = GetRide(rideIndex); if (ride == nullptr) { - LOG_WARNING("Ride not found. ride index = %d.", rideIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + LOG_ERROR("Ride not found for rideIndex %d.", rideIndex); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_RIDE_NOT_FOUND); } if (ride->type >= RIDE_TYPE_COUNT) { - LOG_WARNING("Ride type not found. ride type = %d.", ride->type); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + LOG_ERROR("Ride type not found. ride type = %d.", ride->type); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_VALUE_OUT_OF_RANGE); } const auto& ted = GetTrackElementDescriptor(trackType); auto sequenceIndex = tileElement->AsTrack()->GetSequenceIndex(); const PreviewTrack* trackBlock = ted.GetBlockForSequence(sequenceIndex); if (trackBlock == nullptr) { - LOG_WARNING("Track block %d not found for track type %d.", sequenceIndex, trackType); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + LOG_ERROR("Track block %d not found for track type %d.", sequenceIndex, trackType); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_TRACK_BLOCK_NOT_FOUND); } auto startLoc = _origin; @@ -202,10 +208,11 @@ GameActions::Result TrackRemoveAction::Query() const if (!found) { - LOG_WARNING( + LOG_ERROR( "Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", mapLoc.x, mapLoc.y, mapLoc.z, _origin.direction, trackBlock->index); - return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + return GameActions::Result( + GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_TRACK_ELEMENT_NOT_FOUND); } int32_t entranceDirections = std::get<0>(ted.SequenceProperties); @@ -222,8 +229,9 @@ GameActions::Result TrackRemoveAction::Query() const auto* surfaceElement = MapGetSurfaceElementAt(mapLoc); if (surfaceElement == nullptr) { - LOG_WARNING("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y); - return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + LOG_ERROR("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y); + return GameActions::Result( + GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } int8_t _support_height = tileElement->BaseHeight - surfaceElement->BaseHeight; @@ -309,10 +317,11 @@ GameActions::Result TrackRemoveAction::Execute() const if (!found) { - LOG_WARNING( + LOG_ERROR( "Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", _origin.x, _origin.y, _origin.z, _origin.direction, _sequence); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_TRACK_ELEMENT_NOT_FOUND); } RideId rideIndex = tileElement->AsTrack()->GetRideIndex(); @@ -322,16 +331,18 @@ GameActions::Result TrackRemoveAction::Execute() const auto ride = GetRide(rideIndex); if (ride == nullptr) { - LOG_WARNING("Ride not found. ride index = %d.", rideIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + LOG_ERROR("Ride not found. ride index = %d.", rideIndex); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_RIDE_NOT_FOUND); } const auto& ted = GetTrackElementDescriptor(trackType); auto sequenceIndex = tileElement->AsTrack()->GetSequenceIndex(); const PreviewTrack* trackBlock = ted.GetBlockForSequence(sequenceIndex); if (trackBlock == nullptr) { - LOG_WARNING("Track block %d not found for track type %d.", sequenceIndex, trackType); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + LOG_ERROR("Track block %d not found for track type %d.", sequenceIndex, trackType); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_TRACK_BLOCK_NOT_FOUND); } auto startLoc = _origin; @@ -386,10 +397,11 @@ GameActions::Result TrackRemoveAction::Execute() const if (!found) { - LOG_WARNING( + LOG_ERROR( "Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", mapLoc.x, mapLoc.y, mapLoc.z, _origin.direction, trackBlock->index); - return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + return GameActions::Result( + GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_TRACK_ELEMENT_NOT_FOUND); } int32_t entranceDirections = std::get<0>(ted.SequenceProperties); @@ -406,8 +418,9 @@ GameActions::Result TrackRemoveAction::Execute() const auto* surfaceElement = MapGetSurfaceElementAt(mapLoc); if (surfaceElement == nullptr) { - LOG_WARNING("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y); - return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); + LOG_ERROR("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y); + return GameActions::Result( + GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } int8_t _support_height = tileElement->BaseHeight - surfaceElement->BaseHeight; @@ -440,7 +453,7 @@ GameActions::Result TrackRemoveAction::Execute() const InvalidateTestResults(*ride); FootpathQueueChainReset(); - if (!gCheatsDisableClearanceChecks || !(tileElement->IsGhost())) + if (!GetGameState().Cheats.DisableClearanceChecks || !(tileElement->IsGhost())) { FootpathRemoveEdgesAt(mapLoc, tileElement); } diff --git a/src/openrct2/actions/TrackSetBrakeSpeedAction.cpp b/src/openrct2/actions/TrackSetBrakeSpeedAction.cpp index 8513f03a57..9a96d6dcd9 100644 --- a/src/openrct2/actions/TrackSetBrakeSpeedAction.cpp +++ b/src/openrct2/actions/TrackSetBrakeSpeedAction.cpp @@ -63,7 +63,7 @@ GameActions::Result TrackSetBrakeSpeedAction::QueryExecute(bool isExecuting) con TileElement* tileElement = MapGetTrackElementAtOfType(_loc, _trackType); if (tileElement == nullptr) { - LOG_WARNING("Invalid game command for setting brakes speed. x = %d, y = %d", _loc.x, _loc.y); + LOG_ERROR("Track element of type %u not found at x = %d, y = %d, z = %d", _trackType, _loc.x, _loc.y, _loc.z); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_TILE_ELEMENT_NOT_FOUND); } diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index 2666f3db7c..319a8dfbbe 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -9,6 +9,7 @@ #include "WallPlaceAction.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../management/Finance.h" #include "../object/LargeSceneryEntry.h" @@ -23,6 +24,7 @@ #include "../world/Surface.h" #include "../world/Wall.h" +using namespace OpenRCT2; using namespace OpenRCT2::TrackMetaData; WallPlaceAction::WallPlaceAction( @@ -80,8 +82,10 @@ GameActions::Result WallPlaceAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_OFF_EDGE_OF_MAP); } + auto& gameState = GetGameState(); auto mapSizeMax = GetMapSizeMaxXY(); - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) + && !gameState.Cheats.SandboxMode) { if (_loc.z == 0) { @@ -114,7 +118,8 @@ GameActions::Result WallPlaceAction::Query() const if (surfaceElement == nullptr) { LOG_ERROR("Surface element not found at %d, %d.", _loc.x, _loc.y); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } targetHeight = surfaceElement->GetBaseZ(); @@ -131,21 +136,22 @@ GameActions::Result WallPlaceAction::Query() const if (surfaceElement == nullptr) { LOG_ERROR("Surface element not found at %d, %d.", _loc.x, _loc.y); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } if (surfaceElement->GetWaterHeight() > 0) { uint16_t waterHeight = surfaceElement->GetWaterHeight(); - if (targetHeight < waterHeight && !gCheatsDisableClearanceChecks) + if (targetHeight < waterHeight && !gameState.Cheats.DisableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER); } } - if (targetHeight < surfaceElement->GetBaseZ() && !gCheatsDisableClearanceChecks) + if (targetHeight < surfaceElement->GetBaseZ() && !gameState.Cheats.DisableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND); @@ -158,7 +164,7 @@ GameActions::Result WallPlaceAction::Query() const newBaseHeight += 2; if (surfaceElement->GetSlope() & (1 << newEdge)) { - if (targetHeight / 8 < newBaseHeight) + if (targetHeight / 8 < newBaseHeight && !gameState.Cheats.DisableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND); @@ -174,7 +180,7 @@ GameActions::Result WallPlaceAction::Query() const if (surfaceElement->GetSlope() & (1 << newEdge)) { newBaseHeight += 2; - if (targetHeight / 8 < newBaseHeight) + if (targetHeight / 8 < newBaseHeight && !gameState.Cheats.DisableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, @@ -189,7 +195,7 @@ GameActions::Result WallPlaceAction::Query() const newEdge = (_edge + 3) & 3; if (surfaceElement->GetSlope() & (1 << newEdge)) { - if (targetHeight / 8 < newBaseHeight) + if (targetHeight / 8 < newBaseHeight && !gameState.Cheats.DisableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND); @@ -205,7 +211,7 @@ GameActions::Result WallPlaceAction::Query() const if (surfaceElement->GetSlope() & (1 << newEdge)) { newBaseHeight += 2; - if (targetHeight / 8 < newBaseHeight) + if (targetHeight / 8 < newBaseHeight && !gameState.Cheats.DisableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, @@ -217,7 +223,7 @@ GameActions::Result WallPlaceAction::Query() const } } - auto* wallEntry = OpenRCT2::ObjectManager::GetObjectEntry(_wallType); + auto* wallEntry = ObjectManager::GetObjectEntry(_wallType); if (wallEntry == nullptr) { @@ -248,7 +254,7 @@ GameActions::Result WallPlaceAction::Query() const clearanceHeight += wallEntry->height; bool wallAcrossTrack = false; - if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) && !gCheatsDisableClearanceChecks) + if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) && !gameState.Cheats.DisableClearanceChecks) { auto result = WallCheckObstruction(wallEntry, targetHeight / 8, clearanceHeight, &wallAcrossTrack); if (result.Error != GameActions::Status::Ok) @@ -273,6 +279,8 @@ GameActions::Result WallPlaceAction::Query() const GameActions::Result WallPlaceAction::Execute() const { auto res = GameActions::Result(); + auto& gameState = GetGameState(); + res.ErrorTitle = STR_CANT_BUILD_THIS_HERE; res.Position = _loc; @@ -293,7 +301,8 @@ GameActions::Result WallPlaceAction::Execute() const if (surfaceElement == nullptr) { LOG_ERROR("Surface element not found at %d, %d.", _loc.x, _loc.y); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } targetHeight = surfaceElement->GetBaseZ(); @@ -307,7 +316,7 @@ GameActions::Result WallPlaceAction::Execute() const } auto targetLoc = CoordsXYZ(_loc, targetHeight); - auto* wallEntry = OpenRCT2::ObjectManager::GetObjectEntry(_wallType); + auto* wallEntry = ObjectManager::GetObjectEntry(_wallType); if (wallEntry == nullptr) { @@ -323,7 +332,7 @@ GameActions::Result WallPlaceAction::Execute() const clearanceHeight += wallEntry->height; bool wallAcrossTrack = false; - if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) && !gCheatsDisableClearanceChecks) + if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) && !gameState.Cheats.DisableClearanceChecks) { auto result = WallCheckObstruction(wallEntry, targetHeight / COORDS_Z_STEP, clearanceHeight, &wallAcrossTrack); if (result.Error != GameActions::Status::Ok) @@ -406,7 +415,7 @@ bool WallPlaceAction::WallCheckObstructionWithTrack( using namespace OpenRCT2::TrackMetaData; const auto& ted = GetTrackElementDescriptor(trackType); int32_t sequence = trackElement->GetSequenceIndex(); - int32_t direction = (_edge - trackElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK; + int32_t direction = (_edge - trackElement->GetDirection()) & kTileElementDirectionMask; auto ride = GetRide(trackElement->GetRideIndex()); if (ride == nullptr) { @@ -478,7 +487,7 @@ bool WallPlaceAction::WallCheckObstructionWithTrack( return false; } - direction = (trackElement->GetDirection() + ted.Coordinates.rotation_end) & TILE_ELEMENT_DIRECTION_MASK; + direction = (trackElement->GetDirection() + ted.Coordinates.rotation_end) & kTileElementDirectionMask; if (direction != _edge) { return false; @@ -555,7 +564,7 @@ GameActions::Result WallPlaceAction::WallCheckObstruction( auto sequence = largeSceneryElement->GetSequenceIndex(); const LargeSceneryTile& tile = sceneryEntry->tiles[sequence]; - int32_t direction = ((_edge - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK) + 8; + int32_t direction = ((_edge - tileElement->GetDirection()) & kTileElementDirectionMask) + 8; if (!(tile.flags & (1 << direction))) { MapGetObstructionErrorText(tileElement, res); diff --git a/src/openrct2/actions/WallRemoveAction.cpp b/src/openrct2/actions/WallRemoveAction.cpp index 8cfbb34a16..45276c784c 100644 --- a/src/openrct2/actions/WallRemoveAction.cpp +++ b/src/openrct2/actions/WallRemoveAction.cpp @@ -10,6 +10,7 @@ #include "WallRemoveAction.h" #include "../Cheats.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../core/MemoryStream.h" #include "../interface/Window.h" @@ -50,7 +51,8 @@ GameActions::Result WallRemoveAction::Query() const } const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST; - if (!isGhost && !(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && !MapIsLocationOwned(_loc)) + if (!isGhost && !(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode + && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/WallSetColourAction.cpp b/src/openrct2/actions/WallSetColourAction.cpp index 46375cbb6b..6754f37b0c 100644 --- a/src/openrct2/actions/WallSetColourAction.cpp +++ b/src/openrct2/actions/WallSetColourAction.cpp @@ -9,6 +9,7 @@ #include "WallSetColourAction.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../management/Finance.h" #include "../object/WallSceneryEntry.h" @@ -19,6 +20,8 @@ #include "../world/Scenery.h" #include "../world/Surface.h" +using namespace OpenRCT2; + WallSetColourAction::WallSetColourAction( const CoordsXYZD& loc, int32_t primaryColour, int32_t secondaryColour, int32_t tertiaryColour) : _loc(loc) @@ -63,7 +66,7 @@ GameActions::Result WallSetColourAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !MapIsLocationInPark(_loc) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !MapIsLocationInPark(_loc) && !GetGameState().Cheats.SandboxMode) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK); } @@ -73,7 +76,8 @@ GameActions::Result WallSetColourAction::Query() const { LOG_ERROR( "Could not find wall element at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_WALL_ELEMENT_NOT_FOUND); } if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(wallElement->IsGhost())) @@ -84,23 +88,23 @@ GameActions::Result WallSetColourAction::Query() const auto* wallEntry = wallElement->GetEntry(); if (wallEntry == nullptr) { - LOG_ERROR("Could not find wall object"); + LOG_ERROR( + "Wall element does not have wall entry at x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, + _loc.direction); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); } if (_primaryColour >= COLOUR_COUNT) { LOG_ERROR("Primary colour invalid: colour = %d", _primaryColour); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR); } - - if (_secondaryColour >= COLOUR_COUNT) + else if (_secondaryColour >= COLOUR_COUNT) { LOG_ERROR("Secondary colour invalid: colour = %d", _secondaryColour); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR); } - - if (wallEntry->flags & WALL_SCENERY_HAS_TERTIARY_COLOUR) + else if (wallEntry->flags & WALL_SCENERY_HAS_TERTIARY_COLOUR) { if (_tertiaryColour >= COLOUR_COUNT) { @@ -136,7 +140,9 @@ GameActions::Result WallSetColourAction::Execute() const auto* wallEntry = wallElement->GetEntry(); if (wallEntry == nullptr) { - LOG_ERROR("Could not find wall object"); + LOG_ERROR( + "Wall element does not have wall entry at x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, + _loc.direction); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); } diff --git a/src/openrct2/actions/WaterLowerAction.cpp b/src/openrct2/actions/WaterLowerAction.cpp index 1726000df2..7d76cace73 100644 --- a/src/openrct2/actions/WaterLowerAction.cpp +++ b/src/openrct2/actions/WaterLowerAction.cpp @@ -9,11 +9,14 @@ #include "WaterLowerAction.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../audio/audio.h" #include "../ride/RideConstruction.h" #include "WaterSetHeightAction.h" +using namespace OpenRCT2; + WaterLowerAction::WaterLowerAction(MapRange range) : _range(range) { @@ -76,7 +79,7 @@ GameActions::Result WaterLowerAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { @@ -119,7 +122,7 @@ GameActions::Result WaterLowerAction::QueryExecute(bool isExecuting) const if (isExecuting && hasChanged) { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::LayingOutWater, res.Position); + Audio::Play3D(Audio::SoundId::LayingOutWater, res.Position); } // Force ride construction to recheck area _currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_RECHECK; @@ -135,7 +138,7 @@ uint8_t WaterLowerAction::GetLowestHeight(const MapRange& validRange) const { for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += COORDS_XY_STEP) { - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { diff --git a/src/openrct2/actions/WaterRaiseAction.cpp b/src/openrct2/actions/WaterRaiseAction.cpp index ebfad2b152..5f75573326 100644 --- a/src/openrct2/actions/WaterRaiseAction.cpp +++ b/src/openrct2/actions/WaterRaiseAction.cpp @@ -9,6 +9,7 @@ #include "WaterRaiseAction.h" +#include "../GameState.h" #include "../OpenRCT2.h" #include "../audio/audio.h" #include "../ride/RideConstruction.h" @@ -76,7 +77,7 @@ GameActions::Result WaterRaiseAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !OpenRCT2::GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { @@ -148,7 +149,7 @@ uint16_t WaterRaiseAction::GetHighestHeight(const MapRange& validRange) const { for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += COORDS_XY_STEP) { - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !OpenRCT2::GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { diff --git a/src/openrct2/actions/WaterSetHeightAction.cpp b/src/openrct2/actions/WaterSetHeightAction.cpp index 5eb0303eca..ab472abb02 100644 --- a/src/openrct2/actions/WaterSetHeightAction.cpp +++ b/src/openrct2/actions/WaterSetHeightAction.cpp @@ -48,7 +48,7 @@ GameActions::Result WaterSetHeightAction::Query() const res.Expenditure = ExpenditureType::Landscaping; res.Position = { _coords, _height * COORDS_Z_STEP }; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode && GetGameState().ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) { return GameActions::Result(GameActions::Status::Disallowed, STR_NONE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY); @@ -65,7 +65,7 @@ GameActions::Result WaterSetHeightAction::Query() const return GameActions::Result(GameActions::Status::NotOwned, STR_NONE, STR_LAND_NOT_OWNED_BY_PARK); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(_coords)) { @@ -76,7 +76,7 @@ GameActions::Result WaterSetHeightAction::Query() const SurfaceElement* surfaceElement = MapGetSurfaceElementAt(_coords); if (surfaceElement == nullptr) { - LOG_ERROR("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); + LOG_ERROR("No surface element at: x %u, y %u", _coords.x, _coords.y); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } @@ -117,13 +117,13 @@ GameActions::Result WaterSetHeightAction::Execute() const int32_t surfaceHeight = TileElementHeight(_coords); FootpathRemoveLitter({ _coords, surfaceHeight }); - if (!gCheatsDisableClearanceChecks) + if (!GetGameState().Cheats.DisableClearanceChecks) WallRemoveAtZ({ _coords, surfaceHeight }); SurfaceElement* surfaceElement = MapGetSurfaceElementAt(_coords); if (surfaceElement == nullptr) { - LOG_ERROR("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); + LOG_ERROR("No surface element at: x %u, y %u", _coords.x, _coords.y); return GameActions::Result( GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } diff --git a/src/openrct2/audio/Audio.cpp b/src/openrct2/audio/Audio.cpp index d2173ecba9..e9a6e221e3 100644 --- a/src/openrct2/audio/Audio.cpp +++ b/src/openrct2/audio/Audio.cpp @@ -101,27 +101,10 @@ namespace OpenRCT2::Audio { auto& objManager = GetContext()->GetObjectManager(); - Object* baseAudio{}; - - // We have a different audio object for RCT Classic - auto env = GetContext()->GetPlatformEnvironment(); - if (env->IsUsingClassic()) + Object* baseAudio = objManager.LoadObject(AudioObjectIdentifiers::RCT2); + if (baseAudio != nullptr) { - baseAudio = objManager.LoadObject(AudioObjectIdentifiers::RCTCBase); - if (baseAudio != nullptr) - { - _soundsAudioObjectEntryIndex = objManager.GetLoadedObjectEntryIndex(baseAudio); - } - } - - if (baseAudio == nullptr) - { - // Fallback to vanilla RCT2 audio object - baseAudio = objManager.LoadObject(AudioObjectIdentifiers::RCT2Base); - if (baseAudio != nullptr) - { - _soundsAudioObjectEntryIndex = objManager.GetLoadedObjectEntryIndex(baseAudio); - } + _soundsAudioObjectEntryIndex = objManager.GetLoadedObjectEntryIndex(baseAudio); } objManager.LoadObject(AudioObjectIdentifiers::OpenRCT2Additional); diff --git a/src/openrct2/audio/audio.h b/src/openrct2/audio/audio.h index 1fe76571d6..5d34b28a26 100644 --- a/src/openrct2/audio/audio.h +++ b/src/openrct2/audio/audio.h @@ -140,7 +140,9 @@ namespace OpenRCT2::Audio namespace AudioObjectIdentifiers { constexpr std::string_view RCT1Title = "rct1.audio.title"; - constexpr std::string_view RCT2Base = "rct2.audio.base"; + // virtual name, used by either RCT2Base or RCTCBase, depending on which one is loaded. + constexpr std::string_view RCT2 = "rct2.audio.base"; + constexpr std::string_view RCT2Base = "rct2.audio.base.rct2"; constexpr std::string_view RCTCBase = "rct2.audio.base.rctc"; constexpr std::string_view RCT2Title = "rct2.audio.title"; constexpr std::string_view OpenRCT2Title = "openrct2.audio.title"; diff --git a/src/openrct2/command_line/RootCommands.cpp b/src/openrct2/command_line/RootCommands.cpp index c723022bc9..8d51345738 100644 --- a/src/openrct2/command_line/RootCommands.cpp +++ b/src/openrct2/command_line/RootCommands.cpp @@ -71,10 +71,10 @@ static constexpr CommandLineOptionDefinition StandardOptions[] { CMDLINE_TYPE_SWITCH, &_about, NAC, "about", "show information about " OPENRCT2_NAME }, { CMDLINE_TYPE_SWITCH, &_verbose, NAC, "verbose", "log verbose messages" }, { CMDLINE_TYPE_SWITCH, &_headless, NAC, "headless", "run " OPENRCT2_NAME " headless" IMPLIES_SILENT_BREAKPAD }, -#ifndef DISABLE_NETWORK +#ifndef DISABLE_NETWORK { CMDLINE_TYPE_INTEGER, &_port, NAC, "port", "port to use for hosting or joining a server" }, { CMDLINE_TYPE_STRING, &_address, NAC, "address", "address to listen on when hosting a server" }, -#endif +#endif { CMDLINE_TYPE_STRING, &_password, NAC, "password", "password needed to join the server" }, { CMDLINE_TYPE_STRING, &_userDataPath, NAC, "user-data-path", "path to the user data directory (containing config.ini)" }, { CMDLINE_TYPE_STRING, &_openrct2DataPath, NAC, "openrct2-data-path", "path to the OpenRCT2 data directory (containing languages)" }, @@ -173,7 +173,7 @@ exitcode_t CommandLine::HandleCommandDefault() { if (_verbose) { - _log_levels[static_cast(DiagnosticLevel::Verbose)] = true; + _log_levels[EnumValue(DiagnosticLevel::Verbose)] = true; PrintLaunchInformation(); } diff --git a/src/openrct2/command_line/SpriteCommands.cpp b/src/openrct2/command_line/SpriteCommands.cpp index 6bb5ca1b0c..7e13e9791f 100644 --- a/src/openrct2/command_line/SpriteCommands.cpp +++ b/src/openrct2/command_line/SpriteCommands.cpp @@ -16,7 +16,7 @@ #define SZ_CLOSEST "closest" #define SZ_DITHERING "dithering" -using ImportMode = OpenRCT2::Drawing::ImageImporter::ImportMode; +using ImportMode = OpenRCT2::Drawing::ImportMode; ImportMode gSpriteMode = ImportMode::Default; diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index a4534b5721..5153cb83cb 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -146,7 +146,7 @@ namespace Config auto model = &gConfigGeneral; model->AlwaysShowGridlines = reader->GetBoolean("always_show_gridlines", false); model->AutosaveFrequency = reader->GetInt32("autosave", AUTOSAVE_EVERY_5MINUTES); - model->AutosaveAmount = reader->GetInt32("autosave_amount", DEFAULT_NUM_AUTOSAVES_TO_KEEP); + model->AutosaveAmount = reader->GetInt32("autosave_amount", kDefaultNumAutosavesToKeep); model->ConfirmationPrompt = reader->GetBoolean("confirmation_prompt", false); model->CurrencyFormat = reader->GetEnum( "currency_format", Platform::GetLocaleCurrency(), Enum_Currency); @@ -841,7 +841,7 @@ bool ConfigFindOrBrowseInstallDirectory() auto uiContext = GetContext()->GetUiContext(); if (!uiContext->HasFilePicker()) { - uiContext->ShowMessageBox(FormatStringID(STR_NEEDS_RCT2_FILES_MANUAL, nullptr)); + uiContext->ShowMessageBox(LanguageGetString(STR_NEEDS_RCT2_FILES_MANUAL)); return false; } @@ -850,7 +850,7 @@ bool ConfigFindOrBrowseInstallDirectory() const char* g1DatPath = PATH_SEPARATOR "Data" PATH_SEPARATOR "g1.dat"; while (true) { - uiContext->ShowMessageBox(FormatStringID(STR_NEEDS_RCT2_FILES, nullptr)); + uiContext->ShowMessageBox(LanguageGetString(STR_NEEDS_RCT2_FILES)); std::string gog = LanguageGetString(STR_OWN_ON_GOG); std::string hdd = LanguageGetString(STR_INSTALLED_ON_HDD); @@ -889,7 +889,7 @@ bool ConfigFindOrBrowseInstallDirectory() std::string dummy; if (!Platform::FindApp("innoextract", &dummy)) { - uiContext->ShowMessageBox(FormatStringID(STR_INSTALL_INNOEXTRACT, nullptr)); + uiContext->ShowMessageBox(LanguageGetString(STR_INSTALL_INNOEXTRACT)); return false; } @@ -927,7 +927,7 @@ bool ConfigFindOrBrowseInstallDirectory() return true; } - uiContext->ShowMessageBox(FormatStringID(STR_COULD_NOT_FIND_AT_PATH, &g1DatPath)); + uiContext->ShowMessageBox(FormatStringIDLegacy(STR_COULD_NOT_FIND_AT_PATH, &g1DatPath)); } } catch (const std::exception& ex) diff --git a/src/openrct2/core/FileIndex.hpp b/src/openrct2/core/FileIndex.hpp index 45e118b18e..18c9256a8d 100644 --- a/src/openrct2/core/FileIndex.hpp +++ b/src/openrct2/core/FileIndex.hpp @@ -174,7 +174,7 @@ private: { const auto& filePath = scanResult.Files.at(i); - if (_log_levels[static_cast(DiagnosticLevel::Verbose)]) + if (_log_levels[EnumValue(DiagnosticLevel::Verbose)]) { std::lock_guard lock(printLock); LOG_VERBOSE("FileIndex:Indexing '%s'", filePath.c_str()); @@ -206,7 +206,7 @@ private: size_t stepSize = 100; // Handpicked, seems to work well with 4/8 cores. - std::atomic processed = ATOMIC_VAR_INIT(0); + std::atomic processed{ 0 }; auto reportProgress = [&]() { const size_t completed = processed; diff --git a/src/openrct2/core/Http.Android.cpp b/src/openrct2/core/Http.Android.cpp new file mode 100644 index 0000000000..67cb15eafc --- /dev/null +++ b/src/openrct2/core/Http.Android.cpp @@ -0,0 +1,179 @@ +/***************************************************************************** + * Copyright (c) 2014-2024 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#if !defined(DISABLE_HTTP) && defined(__ANDROID__) + +# include "Http.h" + +# include "../Version.h" +# include "../platform/Platform.h" + +# include +# include +# include + +# define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION + +namespace Http +{ + Response Do(const Request& req) + { + std::map headers = req.header; + headers["User-Agent"] = OPENRCT2_USER_AGENT; + // Lambda to convert jstring to string + auto jstringToString = [](JNIEnv* env, jstring jstr) -> std::string { + if (jstr == nullptr) + { + return ""; + } + const char* cstr = env->GetStringUTFChars(jstr, nullptr); + std::string str = cstr; + env->ReleaseStringUTFChars(jstr, cstr); + return str; + }; + + JNIEnv* env = (JNIEnv*)SDL_AndroidGetJNIEnv(); + + // Create request object + + jclass HttpAndroidClass = Platform::AndroidFindClass(env, "io/openrct2/HttpAndroid"); + jclass req_class = Platform::AndroidFindClass(env, "io/openrct2/HttpAndroid$Request"); + // New request object + jobject jniRequest = env->NewObject(req_class, env->GetMethodID(req_class, "", "()V")); + // Create request's headers map + jobject jniHeaders = env->NewObject( + env->FindClass("java/util/HashMap"), + env->GetMethodID(env->GetObjectClass(env->FindClass("java/util/HashMap")), "", "()V")); + // HashMap's put method + jmethodID putMethod = env->GetMethodID( + env->FindClass("java/util/HashMap"), "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); + for (const auto& header : headers) + { + jstring jniKey = env->NewStringUTF(header.first.c_str()); + jstring jniValue = env->NewStringUTF(header.second.c_str()); + env->CallObjectMethod(jniHeaders, putMethod, jniKey, jniValue); + } + env->SetObjectField(jniRequest, env->GetFieldID(req_class, "headers", "Ljava/util/Map;"), jniHeaders); + + jstring req_body = req.body.empty() ? nullptr : env->NewStringUTF(req.body.c_str()); + jstring url = req.url.empty() ? nullptr : env->NewStringUTF(req.url.c_str()); + env->SetObjectField(jniRequest, env->GetFieldID(req_class, "body", "Ljava/lang/String;"), req_body); + env->SetObjectField(jniRequest, env->GetFieldID(req_class, "url", "Ljava/lang/String;"), url); + if (req_body != nullptr) + { + env->ReleaseStringUTFChars(req_body, env->GetStringUTFChars(req_body, nullptr)); + } + if (url != nullptr) + { + env->ReleaseStringUTFChars(url, env->GetStringUTFChars(url, nullptr)); + } + std::string method = "GET"; + switch (req.method) + { + case Method::GET: + method = "GET"; + break; + case Method::POST: + method = "POST"; + break; + case Method::PUT: + method = "PUT"; + break; + } + env->SetObjectField( + jniRequest, env->GetFieldID(req_class, "method", "Lio/openrct2/HttpAndroid$Method;"), + env->GetStaticObjectField( + Platform::AndroidFindClass(env, "io/openrct2/HttpAndroid$Method"), + env->GetStaticFieldID( + Platform::AndroidFindClass(env, "io/openrct2/HttpAndroid$Method"), method.c_str(), + "Lio/openrct2/HttpAndroid$Method;"))); + // Call request method + jmethodID requestMethod = env->GetStaticMethodID( + HttpAndroidClass, "request", "(Lio/openrct2/HttpAndroid$Request;)Lio/openrct2/HttpAndroid$Response;"); + jobject jniResponse = env->CallStaticObjectMethod(HttpAndroidClass, requestMethod, jniRequest); + jfieldID statusField = env->GetFieldID(env->GetObjectClass(jniResponse), "status", "Lio/openrct2/HttpAndroid$Status;"); + jobject jniStatus = env->GetObjectField(jniResponse, statusField); + jclass statusClass = Platform::AndroidFindClass(env, "io/openrct2/HttpAndroid$Status"); + jmethodID getCodeMethod = env->GetMethodID(statusClass, "getCode", "()I"); + int code = env->CallIntMethod(jniStatus, getCodeMethod); + + Response response; + + // Get response's headers field + jclass responseClass = env->GetObjectClass(jniResponse); + jfieldID headersField = env->GetFieldID(responseClass, "headers", "Ljava/util/Map;"); + jobject jniHeadersMap = env->GetObjectField(jniResponse, headersField); + + jmethodID entrySetMethod = env->GetMethodID(env->GetObjectClass(jniHeadersMap), "entrySet", "()Ljava/util/Set;"); + jobject jniEntrySet = env->CallObjectMethod(jniHeadersMap, entrySetMethod); + jmethodID iteratorMethod = env->GetMethodID(env->GetObjectClass(jniEntrySet), "iterator", "()Ljava/util/Iterator;"); + jobject jniIterator = env->CallObjectMethod(jniEntrySet, iteratorMethod); + jmethodID hasNextMethod = env->GetMethodID(env->GetObjectClass(jniIterator), "hasNext", "()Z"); + jmethodID nextMethod = env->GetMethodID(env->GetObjectClass(jniIterator), "next", "()Ljava/lang/Object;"); + while (env->CallBooleanMethod(jniIterator, hasNextMethod)) + { + jobject jniNext = env->CallObjectMethod(jniIterator, nextMethod); + jmethodID getKeyMethod = env->GetMethodID(env->GetObjectClass(jniNext), "getKey", "()Ljava/lang/Object;"); + jmethodID getValueMethod = env->GetMethodID(env->GetObjectClass(jniNext), "getValue", "()Ljava/lang/Object;"); + jobject jniKey = env->CallObjectMethod(jniNext, getKeyMethod); + // The first key is always null for some reason, its value contains the status code + if (jniKey == nullptr) + { + env->DeleteLocalRef(jniKey); + env->DeleteLocalRef(jniNext); + continue; + } + jobject jniValue = env->CallObjectMethod(jniNext, getValueMethod); + // convert jniValue to string + jmethodID valueToStringMethod = env->GetMethodID(env->GetObjectClass(jniValue), "toString", "()Ljava/lang/String;"); + jstring jniValueString = (jstring)env->CallObjectMethod(jniValue, valueToStringMethod); + jstring jniKeyString = (jstring)jniKey; + const char* jniKeyChars = env->GetStringUTFChars(jniKeyString, nullptr); + const char* jniValueChars = env->GetStringUTFChars(jniValueString, nullptr); + std::string value = jniValueChars; + std::string key = jniKeyChars; + env->ReleaseStringUTFChars(jniKeyString, jniKeyChars); + env->ReleaseStringUTFChars(jniValueString, jniValueChars); + response.header[key] = value; + + // Cleanup + env->DeleteLocalRef(jniValue); + env->DeleteLocalRef(jniKey); + env->DeleteLocalRef(jniNext); + } + // Get response's body field and convert it to string + jfieldID bodyField = env->GetFieldID(responseClass, "body", "Ljava/lang/String;"); + jstring jniBody = (jstring)env->GetObjectField(jniResponse, bodyField); + // Get response's error field and convert it to string + jfieldID errorField = env->GetFieldID(responseClass, "error", "Ljava/lang/String;"); + jstring jniError = (jstring)env->GetObjectField(jniResponse, errorField); + // Get response's content type field and convert it to string + jfieldID contentTypeField = env->GetFieldID(responseClass, "contentType", "Ljava/lang/String;"); + jstring jniContentType = (jstring)env->GetObjectField(jniResponse, contentTypeField); + // Prepare response + response.error = jstringToString(env, jniError); + response.content_type = jstringToString(env, jniContentType); + response.status = static_cast(code); + response.body = jstringToString(env, jniBody); + + env->DeleteLocalRef(jniResponse); + env->DeleteLocalRef(jniStatus); + env->DeleteLocalRef(jniHeadersMap); + env->DeleteLocalRef(jniBody); + env->DeleteLocalRef(jniContentType); + env->DeleteLocalRef(jniError); + env->DeleteLocalRef(jniHeaders); + env->DeleteLocalRef(jniRequest); + + return response; + } + +} // namespace Http + +#endif diff --git a/src/openrct2/core/Http.cURL.cpp b/src/openrct2/core/Http.cURL.cpp index aef20b4127..67603998f9 100644 --- a/src/openrct2/core/Http.cURL.cpp +++ b/src/openrct2/core/Http.cURL.cpp @@ -7,7 +7,7 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ -#if !defined(DISABLE_HTTP) && !defined(_WIN32) +#if !defined(DISABLE_HTTP) && !defined(_WIN32) && !defined(__ANDROID__) # include "Http.h" diff --git a/src/openrct2/core/Imaging.cpp b/src/openrct2/core/Imaging.cpp index c43b19b030..a0b3f351e8 100644 --- a/src/openrct2/core/Imaging.cpp +++ b/src/openrct2/core/Imaging.cpp @@ -201,7 +201,7 @@ namespace Imaging } for (size_t i = 0; i < PNG_MAX_PALETTE_LENGTH; i++) { - const auto& entry = (*image.Palette)[static_cast(i)]; + const auto& entry = (*image.Palette)[i]; png_palette[i].blue = entry.Blue; png_palette[i].green = entry.Green; png_palette[i].red = entry.Red; diff --git a/src/openrct2/core/String.cpp b/src/openrct2/core/String.cpp index 8db36139a3..9800f8d0bf 100644 --- a/src/openrct2/core/String.cpp +++ b/src/openrct2/core/String.cpp @@ -15,7 +15,9 @@ #include #include #ifndef _WIN32 -# include +# ifndef __FreeBSD__ +# include +# endif # include # include # include diff --git a/src/openrct2/drawing/Drawing.String.cpp b/src/openrct2/drawing/Drawing.String.cpp index f8e44f4503..e8c484da69 100644 --- a/src/openrct2/drawing/Drawing.String.cpp +++ b/src/openrct2/drawing/Drawing.String.cpp @@ -21,7 +21,6 @@ #include "../localisation/LocalisationService.h" #include "../platform/Platform.h" #include "../sprites.h" -#include "../util/Util.h" #include "TTF.h" #include @@ -492,7 +491,7 @@ static void TTFDrawCharacterSprite(DrawPixelInfo& dpi, int32_t codepoint, TextDr } PaletteMap paletteMap(info->palette); - GfxDrawGlyph(&dpi, sprite, screenCoords, paletteMap); + GfxDrawGlyph(dpi, sprite, screenCoords, paletteMap); } info->x += characterWidth; @@ -509,7 +508,6 @@ static void TTFDrawStringRawSprite(DrawPixelInfo& dpi, std::string_view text, Te #ifndef NO_TTF -static int _ttfGlId = 0; static void TTFDrawStringRawTTF(DrawPixelInfo& dpi, std::string_view text, TextDrawInfo* info) { if (!TTFInitialise()) @@ -528,135 +526,20 @@ static void TTFDrawStringRawTTF(DrawPixelInfo& dpi, std::string_view text, TextD return; } - uint8_t colour = info->palette[1]; TTFSurface* surface = TTFSurfaceCacheGetOrAdd(fontDesc->font, text); if (surface == nullptr) return; - int32_t drawX = info->x + fontDesc->offset_x; - int32_t drawY = info->y + fontDesc->offset_y; - int32_t width = surface->w; - int32_t height = surface->h; - bool use_hinting = gConfigFonts.EnableHinting && fontDesc->hinting_threshold > 0; - - if (OpenRCT2::GetContext()->GetDrawingEngineType() == DrawingEngine::OpenGL) + auto drawingEngine = dpi.DrawingEngine; + if (drawingEngine != nullptr) { - auto baseId = uint32_t(0x7FFFF) - 1024; - auto imageId = baseId + _ttfGlId; - auto drawingEngine = dpi.DrawingEngine; - auto drawingContext = drawingEngine->GetDrawingContext(); - uint8_t hint_thresh = use_hinting ? fontDesc->hinting_threshold : 0; - drawingEngine->InvalidateImage(imageId); - drawingContext->DrawTTFBitmap( - &dpi, info, imageId, surface->pixels, surface->pitch, surface->h, drawX, drawY, hint_thresh); - - _ttfGlId++; - if (_ttfGlId >= 1023) - { - _ttfGlId = 0; - } - info->x += width; - return; - } - - int32_t overflowX = (dpi.x + dpi.width) - (drawX + width); - int32_t overflowY = (dpi.y + dpi.height) - (drawY + height); - if (overflowX < 0) - width += overflowX; - if (overflowY < 0) - height += overflowY; - int32_t skipX = drawX - dpi.x; - int32_t skipY = drawY - dpi.y; - info->x += width; - - auto src = static_cast(surface->pixels); - uint8_t* dst = dpi.bits; - - int32_t srcXStart = 0; - int32_t srcYStart = 0; - if (skipX < 0) - { - width += skipX; - src += -skipX; - srcXStart += -skipX; - skipX = 0; - } - if (skipY < 0) - { - height += skipY; - src += (-skipY * surface->pitch); - srcYStart += -skipY; - skipY = 0; - } - - dst += skipX; - dst += skipY * (dpi.width + dpi.pitch); - - int32_t srcScanSkip = surface->pitch - width; - int32_t dstScanSkip = dpi.width + dpi.pitch - width; - uint8_t* dst_orig = dst; - - // Draw shadow/outline - if (info->flags & (TEXT_DRAW_FLAG_OUTLINE | TEXT_DRAW_FLAG_INSET)) - { - for (int32_t yy = 0; yy < height; yy++) - { - for (int32_t xx = 0; xx < width; xx++) - { - if (info->flags & TEXT_DRAW_FLAG_OUTLINE) - { - if (GetPixel(*surface, xx + srcXStart + 1, yy + srcYStart) - || GetPixel(*surface, xx + srcXStart - 1, yy + srcYStart) - || GetPixel(*surface, xx + srcXStart, yy + srcYStart + 1) - || GetPixel(*surface, xx + srcXStart, yy + srcYStart - 1)) - { - *dst = info->palette[3]; - } - } - if (info->flags & TEXT_DRAW_FLAG_INSET) - { - if (GetPixel(*surface, xx + srcXStart - 1, yy + srcYStart - 1)) - { - *dst = info->palette[3]; - } - } - dst++; - } - // Skip any remaining bits - dst += dstScanSkip; - } - } - dst = dst_orig; - for (int32_t yy = 0; yy < height; yy++) - { - for (int32_t xx = 0; xx < width; xx++) - { - if (*src != 0) - { - if (*src > 180 || !use_hinting) - { - // Centre of the glyph: use full colour. - *dst = colour; - } - else if (use_hinting && *src > fontDesc->hinting_threshold) - { - // Simulate font hinting by shading the background colour instead. - if (info->flags & TEXT_DRAW_FLAG_OUTLINE) - { - *dst = BlendColours(colour, info->palette[3]); - } - else - { - *dst = BlendColours(colour, *dst); - } - } - } - src++; - dst++; - } - src += srcScanSkip; - dst += dstScanSkip; + int32_t drawX = info->x + fontDesc->offset_x; + int32_t drawY = info->y + fontDesc->offset_y; + uint8_t hintThresh = gConfigFonts.EnableHinting ? fontDesc->hinting_threshold : 0; + OpenRCT2::Drawing::IDrawingContext* dc = drawingEngine->GetDrawingContext(); + dc->DrawTTFBitmap(dpi, info, surface, drawX, drawY, hintThresh); } + info->x += surface->w; } #endif // NO_TTF diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index a52b2f4eb5..a4225bd0f0 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -44,13 +44,13 @@ struct PaletteBGRA uint8_t Alpha{}; }; -constexpr auto PALETTE_SIZE = 256; +constexpr auto PALETTE_SIZE = 256U; struct GamePalette { PaletteBGRA Colour[PALETTE_SIZE]{}; - PaletteBGRA& operator[](uint16_t idx) + PaletteBGRA& operator[](size_t idx) { assert(idx < PALETTE_SIZE); if (idx >= PALETTE_SIZE) @@ -62,7 +62,7 @@ struct GamePalette return Colour[idx]; } - const PaletteBGRA operator[](uint16_t idx) const + const PaletteBGRA operator[](size_t idx) const { assert(idx < PALETTE_SIZE); if (idx >= PALETTE_SIZE) @@ -537,7 +537,7 @@ void GfxTransposePalette(int32_t pal, uint8_t product); void LoadPalette(); // other -void GfxClear(DrawPixelInfo* dpi, uint8_t paletteIndex); +void GfxClear(DrawPixelInfo& dpi, uint8_t paletteIndex); void GfxFilterPixel(DrawPixelInfo& dpi, const ScreenCoordsXY& coords, FilterPaletteID palette); void GfxInvalidatePickedUpPeep(); void GfxDrawPickedUpPeep(DrawPixelInfo& dpi); @@ -569,10 +569,10 @@ void FASTCALL GfxSpriteToBuffer(DrawPixelInfo& dpi, const DrawSpriteArgs& args); void FASTCALL GfxBmpSpriteToBuffer(DrawPixelInfo& dpi, const DrawSpriteArgs& args); void FASTCALL GfxRleSpriteToBuffer(DrawPixelInfo& dpi, const DrawSpriteArgs& args); void FASTCALL GfxDrawSprite(DrawPixelInfo& dpi, const ImageId image_id, const ScreenCoordsXY& coords); -void FASTCALL GfxDrawGlyph(DrawPixelInfo* dpi, const ImageId image, const ScreenCoordsXY& coords, const PaletteMap& paletteMap); -void FASTCALL GfxDrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, const ScreenCoordsXY& coords, uint8_t colour); +void FASTCALL GfxDrawGlyph(DrawPixelInfo& dpi, const ImageId image, const ScreenCoordsXY& coords, const PaletteMap& paletteMap); +void FASTCALL GfxDrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, const ScreenCoordsXY& coords, uint8_t colour); void FASTCALL GfxDrawSpriteRawMasked( - DrawPixelInfo* dpi, const ScreenCoordsXY& coords, const ImageId maskImage, const ImageId colourImage); + DrawPixelInfo& dpi, const ScreenCoordsXY& coords, const ImageId maskImage, const ImageId colourImage); void FASTCALL GfxDrawSpriteSoftware(DrawPixelInfo& dpi, const ImageId imageId, const ScreenCoordsXY& spriteCoords); void FASTCALL GfxDrawSpritePaletteSetSoftware( DrawPixelInfo& dpi, const ImageId imageId, const ScreenCoordsXY& coords, const PaletteMap& paletteMap); diff --git a/src/openrct2/drawing/IDrawingContext.h b/src/openrct2/drawing/IDrawingContext.h index ed1ec471ca..6ea2938bac 100644 --- a/src/openrct2/drawing/IDrawingContext.h +++ b/src/openrct2/drawing/IDrawingContext.h @@ -11,6 +11,7 @@ #include "../common.h" #include "Drawing.h" +#include "TTF.h" namespace OpenRCT2::Drawing { @@ -20,21 +21,21 @@ namespace OpenRCT2::Drawing { virtual ~IDrawingContext() = default; - virtual void Clear(DrawPixelInfo* dpi, uint8_t paletteIndex) abstract; + virtual void Clear(DrawPixelInfo& dpi, uint8_t paletteIndex) abstract; virtual void FillRect( - DrawPixelInfo* dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom) abstract; + DrawPixelInfo& dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom) abstract; virtual void FilterRect( - DrawPixelInfo* dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) abstract; - virtual void DrawLine(DrawPixelInfo* dpi, uint32_t colour, const ScreenLine& line) abstract; - virtual void DrawSprite(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y) abstract; + DrawPixelInfo& dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) abstract; + virtual void DrawLine(DrawPixelInfo& dpi, uint32_t colour, const ScreenLine& line) abstract; + virtual void DrawSprite(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y) abstract; virtual void DrawSpriteRawMasked( - DrawPixelInfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) abstract; - virtual void DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) abstract; + DrawPixelInfo& dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) abstract; + virtual void DrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) abstract; virtual void DrawGlyph( - DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette) abstract; + DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette) abstract; virtual void DrawTTFBitmap( - DrawPixelInfo* dpi, TextDrawInfo* info, ImageIndex image, const void* pixels, int32_t width, int32_t height, - int32_t x, int32_t y, uint8_t hinting_threshold) abstract; + DrawPixelInfo& dpi, TextDrawInfo* info, TTFSurface* surface, int32_t x, int32_t y, + uint8_t hintingThreshold) abstract; }; } // namespace OpenRCT2::Drawing diff --git a/src/openrct2/drawing/ImageImporter.cpp b/src/openrct2/drawing/ImageImporter.cpp index 650211f76a..c5fc730faa 100644 --- a/src/openrct2/drawing/ImageImporter.cpp +++ b/src/openrct2/drawing/ImageImporter.cpp @@ -10,374 +10,395 @@ #include "ImageImporter.h" #include "../core/Imaging.h" +#include "../core/Json.hpp" #include #include #include -using namespace OpenRCT2::Drawing; -using ImportResult = ImageImporter::ImportResult; - -constexpr int32_t PALETTE_TRANSPARENT = -1; - -ImportResult ImageImporter::Import( - const Image& image, int32_t offsetX, int32_t offsetY, Palette palette, ImportFlags flags, ImportMode mode) const +namespace OpenRCT2::Drawing { - return Import(image, 0, 0, image.Width, image.Height, offsetX, offsetY, palette, flags, mode); -} + constexpr int32_t PALETTE_TRANSPARENT = -1; -ImportResult ImageImporter::Import( - const Image& image, int32_t srcX, int32_t srcY, int32_t width, int32_t height, int32_t offsetX, int32_t offsetY, - Palette palette, ImportFlags flags, ImportMode mode) const -{ - if (width > 256 || height > 256) + ImageImporter::ImportResult ImageImporter::Import(const Image& image, ImageImportMeta& meta) const { - throw std::invalid_argument("Only images 256x256 or less are supported."); - } + if (meta.srcSize.width == 0) + meta.srcSize.width = image.Width; - if (palette == Palette::KeepIndices && image.Depth != 8) - { - throw std::invalid_argument("Image is not paletted, it has bit depth of " + std::to_string(image.Depth)); - } + if (meta.srcSize.height == 0) + meta.srcSize.height = image.Height; - auto pixels = GetPixels(image.Pixels.data(), image.Stride, srcX, srcY, width, height, palette, flags, mode); - auto buffer = flags & ImportFlags::RLE ? EncodeRLE(pixels.data(), width, height) : EncodeRaw(pixels.data(), width, height); - - G1Element outElement; - outElement.width = width; - outElement.height = height; - outElement.flags = (flags & ImportFlags::RLE ? G1_FLAG_RLE_COMPRESSION : G1_FLAG_HAS_TRANSPARENCY); - outElement.x_offset = offsetX; - outElement.y_offset = offsetY; - outElement.zoomed_offset = 0; - - ImportResult result; - result.Element = outElement; - result.Buffer = std::move(buffer); - result.Element.offset = result.Buffer.data(); - return result; -} - -std::vector ImageImporter::GetPixels( - const uint8_t* pixels, uint32_t pitch, uint32_t srcX, uint32_t srcY, uint32_t width, uint32_t height, Palette palette, - ImportFlags flags, ImportMode mode) -{ - std::vector buffer; - buffer.reserve(width * height); - - // A larger range is needed for proper dithering - auto palettedSrc = pixels; - std::unique_ptr rgbaSrcBuffer; - if (palette != Palette::KeepIndices) - { - rgbaSrcBuffer = std::make_unique(height * width * 4); - } - - auto rgbaSrc = rgbaSrcBuffer.get(); - if (palette != Palette::KeepIndices) - { - auto src = pixels + (srcY * pitch) + (srcX * 4); - auto dst = rgbaSrc; - for (uint32_t y = 0; y < height; y++) + if (meta.srcSize.width > 256 || meta.srcSize.height > 256) { - for (uint32_t x = 0; x < width * 4; x++) - { - *dst = static_cast(*src); - src++; - dst++; - } - src += (pitch - (width * 4)); + throw std::invalid_argument("Only images 256x256 or less are supported."); } + + if (meta.palette == Palette::KeepIndices && image.Depth != 8) + { + throw std::invalid_argument("Image is not paletted, it has bit depth of " + std::to_string(image.Depth)); + } + const bool isRLE = meta.importFlags & ImportFlags::RLE; + + auto pixels = GetPixels(image, meta); + auto buffer = isRLE ? EncodeRLE(pixels.data(), meta.srcSize) : EncodeRaw(pixels.data(), meta.srcSize); + + G1Element outElement; + outElement.width = meta.srcSize.width; + outElement.height = meta.srcSize.height; + outElement.flags = isRLE ? G1_FLAG_RLE_COMPRESSION : G1_FLAG_HAS_TRANSPARENCY; + outElement.x_offset = meta.offset.x; + outElement.y_offset = meta.offset.y; + outElement.zoomed_offset = meta.zoomedOffset; + + ImageImporter::ImportResult result; + result.Element = outElement; + result.Buffer = std::move(buffer); + result.Element.offset = result.Buffer.data(); + return result; } - if (palette == Palette::KeepIndices) + std::vector ImageImporter::GetPixels(const Image& image, const ImageImportMeta& meta) { - palettedSrc += srcX + srcY * pitch; - for (uint32_t y = 0; y < height; y++) + const uint8_t* pixels = image.Pixels.data(); + std::vector buffer; + buffer.reserve(meta.srcSize.width * meta.srcSize.height); + + // A larger range is needed for proper dithering + auto palettedSrc = pixels; + std::unique_ptr rgbaSrcBuffer; + if (meta.palette != Palette::KeepIndices) { - for (uint32_t x = 0; x < width; x++) + rgbaSrcBuffer = std::make_unique(meta.srcSize.height * meta.srcSize.width * 4); + } + + auto rgbaSrc = rgbaSrcBuffer.get(); + if (meta.palette != Palette::KeepIndices) + { + auto src = pixels + (meta.srcOffset.y * image.Stride) + (meta.srcOffset.x * 4); + auto dst = rgbaSrc; + for (auto y = 0; y < meta.srcSize.height; y++) { - int32_t paletteIndex = *palettedSrc; - // The 1st index is always transparent - if (paletteIndex == 0) + for (auto x = 0; x < meta.srcSize.width * 4; x++) { - paletteIndex = PALETTE_TRANSPARENT; + *dst = static_cast(*src); + src++; + dst++; } - palettedSrc += 1; - buffer.push_back(paletteIndex); - } - palettedSrc += (pitch - width); - } - } - else - { - for (uint32_t y = 0; y < height; y++) - { - for (uint32_t x = 0; x < width; x++) - { - auto paletteIndex = CalculatePaletteIndex(mode, rgbaSrc, x, y, width, height); - rgbaSrc += 4; - buffer.push_back(paletteIndex); + src += (image.Stride - (meta.srcSize.width * 4)); } } - } - return buffer; -} - -std::vector ImageImporter::EncodeRaw(const int32_t* pixels, uint32_t width, uint32_t height) -{ - auto bufferLength = width * height; - std::vector buffer(bufferLength); - for (size_t i = 0; i < bufferLength; i++) - { - auto p = pixels[i]; - buffer[i] = (p == PALETTE_TRANSPARENT ? 0 : static_cast(p)); - } - return buffer; -} - -std::vector ImageImporter::EncodeRLE(const int32_t* pixels, uint32_t width, uint32_t height) -{ - struct RLECode - { - uint8_t NumPixels{}; - uint8_t OffsetX{}; - }; - - auto src = pixels; - std::vector buffer((height * 2) + (width * height * 16)); - - std::fill_n(buffer.data(), (height * 2) + (width * height * 16), 0x00); - auto yOffsets = reinterpret_cast(buffer.data()); - auto dst = buffer.data() + (height * 2); - for (uint32_t y = 0; y < height; y++) - { - yOffsets[y] = static_cast(dst - buffer.data()); - - auto previousCode = static_cast(nullptr); - auto currentCode = reinterpret_cast(dst); - dst += 2; - - auto startX = 0; - auto npixels = 0; - bool pushRun = false; - for (uint32_t x = 0; x < width; x++) + if (meta.palette == Palette::KeepIndices) { - int32_t paletteIndex = *src++; - if (paletteIndex == PALETTE_TRANSPARENT) + palettedSrc += meta.srcOffset.x + meta.srcOffset.y * image.Stride; + for (auto y = 0; y < meta.srcSize.height; y++) { - if (npixels != 0) + for (auto x = 0; x < meta.srcSize.width; x++) { - x--; - src--; - pushRun = true; - } - } - else - { - if (npixels == 0) - { - startX = x; - } - - npixels++; - *dst++ = static_cast(paletteIndex); - } - if (npixels == 127 || x == width - 1) - { - pushRun = true; - } - - if (pushRun) - { - if (npixels > 0) - { - previousCode = currentCode; - currentCode->NumPixels = npixels; - currentCode->OffsetX = startX; - - if (x == width - 1) + int32_t paletteIndex = *palettedSrc; + // The 1st index is always transparent + if (paletteIndex == 0) { - currentCode->NumPixels |= 0x80; + paletteIndex = PALETTE_TRANSPARENT; } + palettedSrc += 1; + buffer.push_back(paletteIndex); + } + palettedSrc += (image.Stride - meta.srcSize.width); + } + } + else + { + for (auto y = 0; y < meta.srcSize.height; y++) + { + for (auto x = 0; x < meta.srcSize.width; x++) + { + auto paletteIndex = CalculatePaletteIndex( + meta.importMode, rgbaSrc, x, y, meta.srcSize.width, meta.srcSize.height); + rgbaSrc += 4; + buffer.push_back(paletteIndex); + } + } + } - currentCode = reinterpret_cast(dst); - dst += 2; + return buffer; + } + + std::vector ImageImporter::EncodeRaw(const int32_t* pixels, ScreenSize size) + { + auto bufferLength = size.width * size.height; + std::vector buffer(bufferLength); + for (auto i = 0; i < bufferLength; i++) + { + auto p = pixels[i]; + buffer[i] = (p == PALETTE_TRANSPARENT ? 0 : static_cast(p)); + } + return buffer; + } + + std::vector ImageImporter::EncodeRLE(const int32_t* pixels, ScreenSize size) + { + struct RLECode + { + uint8_t NumPixels{}; + uint8_t OffsetX{}; + }; + + auto src = pixels; + std::vector buffer((size.height * 2) + (size.width * size.height * 16)); + + std::fill_n(buffer.data(), (size.height * 2) + (size.width * size.height * 16), 0x00); + auto yOffsets = reinterpret_cast(buffer.data()); + auto dst = buffer.data() + (size.height * 2); + for (auto y = 0; y < size.height; y++) + { + yOffsets[y] = static_cast(dst - buffer.data()); + + auto previousCode = static_cast(nullptr); + auto currentCode = reinterpret_cast(dst); + dst += 2; + + auto startX = 0; + auto npixels = 0; + bool pushRun = false; + for (auto x = 0; x < size.width; x++) + { + int32_t paletteIndex = *src++; + if (paletteIndex == PALETTE_TRANSPARENT) + { + if (npixels != 0) + { + x--; + src--; + pushRun = true; + } } else { - if (previousCode == nullptr) + if (npixels == 0) { - currentCode->NumPixels = 0x80; - currentCode->OffsetX = 0; + startX = x; + } + + npixels++; + *dst++ = static_cast(paletteIndex); + } + if (npixels == 127 || x == size.width - 1) + { + pushRun = true; + } + + if (pushRun) + { + if (npixels > 0) + { + previousCode = currentCode; + currentCode->NumPixels = npixels; + currentCode->OffsetX = startX; + + if (x == size.width - 1) + { + currentCode->NumPixels |= 0x80; + } + + currentCode = reinterpret_cast(dst); + dst += 2; } else { - previousCode->NumPixels |= 0x80; - dst -= 2; + if (previousCode == nullptr) + { + currentCode->NumPixels = 0x80; + currentCode->OffsetX = 0; + } + else + { + previousCode->NumPixels |= 0x80; + dst -= 2; + } } - } - startX = 0; - npixels = 0; - pushRun = false; + startX = 0; + npixels = 0; + pushRun = false; + } } } + + auto bufferLength = static_cast(dst - buffer.data()); + buffer.resize(bufferLength); + return buffer; } - auto bufferLength = static_cast(dst - buffer.data()); - buffer.resize(bufferLength); - return buffer; -} - -int32_t ImageImporter::CalculatePaletteIndex( - ImportMode mode, int16_t* rgbaSrc, int32_t x, int32_t y, int32_t width, int32_t height) -{ - auto& palette = StandardPalette; - auto paletteIndex = GetPaletteIndex(palette, rgbaSrc); - if ((mode == ImportMode::Closest || mode == ImportMode::Dithering) && !IsInPalette(palette, rgbaSrc)) + int32_t ImageImporter::CalculatePaletteIndex( + ImportMode mode, int16_t* rgbaSrc, int32_t x, int32_t y, int32_t width, int32_t height) { - paletteIndex = GetClosestPaletteIndex(palette, rgbaSrc); - if (mode == ImportMode::Dithering) + auto& palette = StandardPalette; + auto paletteIndex = GetPaletteIndex(palette, rgbaSrc); + if ((mode == ImportMode::Closest || mode == ImportMode::Dithering) && !IsInPalette(palette, rgbaSrc)) { - auto dr = rgbaSrc[0] - static_cast(palette[paletteIndex].Red); - auto dg = rgbaSrc[1] - static_cast(palette[paletteIndex].Green); - auto db = rgbaSrc[2] - static_cast(palette[paletteIndex].Blue); - - // We don't want to dither remappable colours with nonremappable colours, etc - PaletteIndexType thisIndexType = GetPaletteIndexType(paletteIndex); - - if (x + 1 < width) + paletteIndex = GetClosestPaletteIndex(palette, rgbaSrc); + if (mode == ImportMode::Dithering) { - if (!IsInPalette(palette, rgbaSrc + 4) - && thisIndexType == GetPaletteIndexType(GetClosestPaletteIndex(palette, rgbaSrc + 4))) - { - // Right - rgbaSrc[4] += dr * 7 / 16; - rgbaSrc[5] += dg * 7 / 16; - rgbaSrc[6] += db * 7 / 16; - } - } + auto dr = rgbaSrc[0] - static_cast(palette[paletteIndex].Red); + auto dg = rgbaSrc[1] - static_cast(palette[paletteIndex].Green); + auto db = rgbaSrc[2] - static_cast(palette[paletteIndex].Blue); - if (y + 1 < height) - { - if (x > 0) - { - if (!IsInPalette(palette, rgbaSrc + 4 * (width - 1)) - && thisIndexType == GetPaletteIndexType(GetClosestPaletteIndex(palette, rgbaSrc + 4 * (width - 1)))) - { - // Bottom left - rgbaSrc[4 * (width - 1)] += dr * 3 / 16; - rgbaSrc[4 * (width - 1) + 1] += dg * 3 / 16; - rgbaSrc[4 * (width - 1) + 2] += db * 3 / 16; - } - } - - // Bottom - if (!IsInPalette(palette, rgbaSrc + 4 * width) - && thisIndexType == GetPaletteIndexType(GetClosestPaletteIndex(palette, rgbaSrc + 4 * width))) - { - rgbaSrc[4 * width] += dr * 5 / 16; - rgbaSrc[4 * width + 1] += dg * 5 / 16; - rgbaSrc[4 * width + 2] += db * 5 / 16; - } + // We don't want to dither remappable colours with nonremappable colours, etc + PaletteIndexType thisIndexType = GetPaletteIndexType(paletteIndex); if (x + 1 < width) { - if (!IsInPalette(palette, rgbaSrc + 4 * (width + 1)) - && thisIndexType == GetPaletteIndexType(GetClosestPaletteIndex(palette, rgbaSrc + 4 * (width + 1)))) + if (!IsInPalette(palette, rgbaSrc + 4) + && thisIndexType == GetPaletteIndexType(GetClosestPaletteIndex(palette, rgbaSrc + 4))) { - // Bottom right - rgbaSrc[4 * (width + 1)] += dr * 1 / 16; - rgbaSrc[4 * (width + 1) + 1] += dg * 1 / 16; - rgbaSrc[4 * (width + 1) + 2] += db * 1 / 16; + // Right + rgbaSrc[4] += dr * 7 / 16; + rgbaSrc[5] += dg * 7 / 16; + rgbaSrc[6] += db * 7 / 16; + } + } + + if (y + 1 < height) + { + if (x > 0) + { + if (!IsInPalette(palette, rgbaSrc + 4 * (width - 1)) + && thisIndexType == GetPaletteIndexType(GetClosestPaletteIndex(palette, rgbaSrc + 4 * (width - 1)))) + { + // Bottom left + rgbaSrc[4 * (width - 1)] += dr * 3 / 16; + rgbaSrc[4 * (width - 1) + 1] += dg * 3 / 16; + rgbaSrc[4 * (width - 1) + 2] += db * 3 / 16; + } + } + + // Bottom + if (!IsInPalette(palette, rgbaSrc + 4 * width) + && thisIndexType == GetPaletteIndexType(GetClosestPaletteIndex(palette, rgbaSrc + 4 * width))) + { + rgbaSrc[4 * width] += dr * 5 / 16; + rgbaSrc[4 * width + 1] += dg * 5 / 16; + rgbaSrc[4 * width + 2] += db * 5 / 16; + } + + if (x + 1 < width) + { + if (!IsInPalette(palette, rgbaSrc + 4 * (width + 1)) + && thisIndexType == GetPaletteIndexType(GetClosestPaletteIndex(palette, rgbaSrc + 4 * (width + 1)))) + { + // Bottom right + rgbaSrc[4 * (width + 1)] += dr * 1 / 16; + rgbaSrc[4 * (width + 1) + 1] += dg * 1 / 16; + rgbaSrc[4 * (width + 1) + 2] += db * 1 / 16; + } } } } } + + return paletteIndex; } - return paletteIndex; -} - -int32_t ImageImporter::GetPaletteIndex(const GamePalette& palette, int16_t* colour) -{ - if (!IsTransparentPixel(colour)) + int32_t ImageImporter::GetPaletteIndex(const GamePalette& palette, int16_t* colour) { - for (int32_t i = 0; i < PALETTE_SIZE; i++) + if (!IsTransparentPixel(colour)) { - if (static_cast(palette[i].Red) == colour[0] && static_cast(palette[i].Green) == colour[1] - && static_cast(palette[i].Blue) == colour[2]) + for (uint32_t i = 0; i < PALETTE_SIZE; i++) { - return i; + if (static_cast(palette[i].Red) == colour[0] && static_cast(palette[i].Green) == colour[1] + && static_cast(palette[i].Blue) == colour[2]) + { + return i; + } } } + return PALETTE_TRANSPARENT; } - return PALETTE_TRANSPARENT; -} -bool ImageImporter::IsTransparentPixel(const int16_t* colour) -{ - return colour[3] < 128; -} - -/** - * @returns true if this colour is in the standard palette. - */ -bool ImageImporter::IsInPalette(const GamePalette& palette, int16_t* colour) -{ - return !(GetPaletteIndex(palette, colour) == PALETTE_TRANSPARENT && !IsTransparentPixel(colour)); -} - -/** - * @returns true if palette index is an index not used for a special purpose. - */ -bool ImageImporter::IsChangablePixel(int32_t paletteIndex) -{ - PaletteIndexType entryType = GetPaletteIndexType(paletteIndex); - return entryType != PaletteIndexType::Special && entryType != PaletteIndexType::PrimaryRemap; -} - -/** - * @returns the type of palette entry this is. - */ -ImageImporter::PaletteIndexType ImageImporter::GetPaletteIndexType(int32_t paletteIndex) -{ - if (paletteIndex <= 9) - return PaletteIndexType::Special; - if (paletteIndex >= 230 && paletteIndex <= 239) - return PaletteIndexType::Special; - if (paletteIndex == 255) - return PaletteIndexType::Special; - if (paletteIndex >= 243 && paletteIndex <= 254) - return PaletteIndexType::PrimaryRemap; - if (paletteIndex >= 202 && paletteIndex <= 213) - return PaletteIndexType::SecondaryRemap; - if (paletteIndex >= 46 && paletteIndex <= 57) - return PaletteIndexType::TertiaryRemap; - return PaletteIndexType::Normal; -} - -int32_t ImageImporter::GetClosestPaletteIndex(const GamePalette& palette, const int16_t* colour) -{ - auto smallestError = static_cast(-1); - auto bestMatch = PALETTE_TRANSPARENT; - for (int32_t x = 0; x < PALETTE_SIZE; x++) + bool ImageImporter::IsTransparentPixel(const int16_t* colour) { - if (IsChangablePixel(x)) - { - uint32_t error = (static_cast(palette[x].Red) - colour[0]) - * (static_cast(palette[x].Red) - colour[0]) - + (static_cast(palette[x].Green) - colour[1]) * (static_cast(palette[x].Green) - colour[1]) - + (static_cast(palette[x].Blue) - colour[2]) * (static_cast(palette[x].Blue) - colour[2]); + return colour[3] < 128; + } - if (smallestError == static_cast(-1) || smallestError > error) + /** + * @returns true if this colour is in the standard palette. + */ + bool ImageImporter::IsInPalette(const GamePalette& palette, int16_t* colour) + { + return !(GetPaletteIndex(palette, colour) == PALETTE_TRANSPARENT && !IsTransparentPixel(colour)); + } + + /** + * @returns true if palette index is an index not used for a special purpose. + */ + bool ImageImporter::IsChangablePixel(int32_t paletteIndex) + { + PaletteIndexType entryType = GetPaletteIndexType(paletteIndex); + return entryType != PaletteIndexType::Special && entryType != PaletteIndexType::PrimaryRemap; + } + + /** + * @returns the type of palette entry this is. + */ + ImageImporter::PaletteIndexType ImageImporter::GetPaletteIndexType(int32_t paletteIndex) + { + if (paletteIndex <= 9) + return PaletteIndexType::Special; + if (paletteIndex >= 230 && paletteIndex <= 239) + return PaletteIndexType::Special; + if (paletteIndex == 255) + return PaletteIndexType::Special; + if (paletteIndex >= 243 && paletteIndex <= 254) + return PaletteIndexType::PrimaryRemap; + if (paletteIndex >= 202 && paletteIndex <= 213) + return PaletteIndexType::SecondaryRemap; + if (paletteIndex >= 46 && paletteIndex <= 57) + return PaletteIndexType::TertiaryRemap; + return PaletteIndexType::Normal; + } + + int32_t ImageImporter::GetClosestPaletteIndex(const GamePalette& palette, const int16_t* colour) + { + auto smallestError = static_cast(-1); + auto bestMatch = PALETTE_TRANSPARENT; + for (uint32_t x = 0; x < PALETTE_SIZE; x++) + { + if (IsChangablePixel(x)) { - bestMatch = x; - smallestError = error; + uint32_t error = (static_cast(palette[x].Red) - colour[0]) + * (static_cast(palette[x].Red) - colour[0]) + + (static_cast(palette[x].Green) - colour[1]) + * (static_cast(palette[x].Green) - colour[1]) + + (static_cast(palette[x].Blue) - colour[2]) * (static_cast(palette[x].Blue) - colour[2]); + + if (smallestError == static_cast(-1) || smallestError > error) + { + bestMatch = x; + smallestError = error; + } } } + return bestMatch; } - return bestMatch; -} + + ImageImportMeta createImageImportMetaFromJson(json_t& input) + { + auto xOffset = Json::GetNumber(input["x"]); + auto yOffset = Json::GetNumber(input["y"]); + auto keepPalette = Json::GetString(input["palette"]) == "keep"; + auto palette = keepPalette ? Palette::KeepIndices : Palette::OpenRCT2; + + auto raw = Json::GetString(input["format"]) == "raw"; + auto flags = raw ? ImportFlags::None : ImportFlags::RLE; + + auto srcX = Json::GetNumber(input["srcX"]); + auto srcY = Json::GetNumber(input["srcY"]); + auto srcWidth = Json::GetNumber(input["srcWidth"]); + auto srcHeight = Json::GetNumber(input["srcHeight"]); + auto zoomedOffset = Json::GetNumber(input["zoom"]); + + return ImageImportMeta{ { xOffset, yOffset }, palette, flags, ImportMode::Default, { srcX, srcY }, + { srcWidth, srcHeight }, zoomedOffset }; + }; +} // namespace OpenRCT2::Drawing diff --git a/src/openrct2/drawing/ImageImporter.h b/src/openrct2/drawing/ImageImporter.h index 8566c4e2a3..e9ec90feb7 100644 --- a/src/openrct2/drawing/ImageImporter.h +++ b/src/openrct2/drawing/ImageImporter.h @@ -10,6 +10,7 @@ #pragma once #include "../core/Imaging.h" +#include "../core/JsonFwd.hpp" #include "Drawing.h" #include @@ -19,6 +20,36 @@ struct Image; namespace OpenRCT2::Drawing { + enum class ImportMode : uint8_t + { + Default, + Closest, + Dithering, + }; + + enum ImportFlags : uint8_t + { + None = 0, + RLE = 1 << 1, + }; + + enum class Palette : uint8_t + { + OpenRCT2, + KeepIndices, + }; + + struct ImageImportMeta + { + ScreenCoordsXY offset{}; + Palette palette = Palette::OpenRCT2; + ImportFlags importFlags = ImportFlags::RLE; + ImportMode importMode = ImportMode::Default; + ScreenCoordsXY srcOffset{}; + ScreenSize srcSize{}; + int32_t zoomedOffset{}; + }; + /** * Imports images to the internal RCT G1 format. */ @@ -31,32 +62,7 @@ namespace OpenRCT2::Drawing std::vector Buffer; }; - enum class ImportMode : uint8_t - { - Default, - Closest, - Dithering, - }; - - enum ImportFlags : uint8_t - { - None = 0, - RLE = 1 << 1, - }; - - enum class Palette : uint8_t - { - OpenRCT2, - KeepIndices, - }; - - ImportResult Import( - const Image& image, int32_t srcX, int32_t srcY, int32_t width, int32_t height, int32_t offsetX, int32_t offsetY, - Palette palette = Palette::OpenRCT2, ImportFlags flags = ImportFlags::None, - ImportMode mode = ImportMode::Default) const; - ImportResult Import( - const Image& image, int32_t offsetX = 0, int32_t offsetY = 0, Palette palette = Palette::OpenRCT2, - ImportFlags flags = ImportFlags::None, ImportMode mode = ImportMode::Default) const; + ImportResult Import(const Image& image, ImageImportMeta& meta) const; private: enum class PaletteIndexType : uint8_t @@ -68,11 +74,9 @@ namespace OpenRCT2::Drawing Special, }; - static std::vector GetPixels( - const uint8_t* pixels, uint32_t pitch, uint32_t srcX, uint32_t srcY, uint32_t width, uint32_t height, - Palette palette, ImportFlags flags, ImportMode mode); - static std::vector EncodeRaw(const int32_t* pixels, uint32_t width, uint32_t height); - static std::vector EncodeRLE(const int32_t* pixels, uint32_t width, uint32_t height); + static std::vector GetPixels(const Image& image, const ImageImportMeta& meta); + static std::vector EncodeRaw(const int32_t* pixels, ScreenSize size); + static std::vector EncodeRLE(const int32_t* pixels, ScreenSize size); static int32_t CalculatePaletteIndex( ImportMode mode, int16_t* rgbaSrc, int32_t x, int32_t y, int32_t width, int32_t height); @@ -83,6 +87,9 @@ namespace OpenRCT2::Drawing static PaletteIndexType GetPaletteIndexType(int32_t paletteIndex); static int32_t GetClosestPaletteIndex(const GamePalette& palette, const int16_t* colour); }; + + // Note: jsonSprite is deliberately left non-const: json_t behaviour changes when const. + ImageImportMeta createImageImportMetaFromJson(json_t& input); } // namespace OpenRCT2::Drawing constexpr GamePalette StandardPalette = { { diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index c1ebd2ec05..73b8b3e58a 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -305,7 +305,7 @@ void LightFXPrepareLightList() dpi.zoom_level = _current_view_zoom_front; dpi.width = 1; - PaintSession* session = PaintSessionAlloc(dpi, w->viewport->flags); + PaintSession* session = PaintSessionAlloc(dpi, w->viewport->flags, w->viewport->rotation); PaintSessionGenerate(*session); PaintSessionArrange(*session); auto info = SetInteractionInfoFromPaintSession(session, w->viewport->flags, ViewportInteractionItemAll); @@ -437,7 +437,7 @@ void LightFXUpdateViewportSettings() Viewport* viewport = WindowGetViewport(mainWindow); _current_view_x_back = viewport->viewPos.x; _current_view_y_back = viewport->viewPos.y; - _current_view_rotation_back = GetCurrentRotation(); + _current_view_rotation_back = viewport->rotation; _current_view_zoom_back = viewport->zoom; } } diff --git a/src/openrct2/drawing/NewDrawing.cpp b/src/openrct2/drawing/NewDrawing.cpp index 217f9257c5..03399e1ed1 100644 --- a/src/openrct2/drawing/NewDrawing.cpp +++ b/src/openrct2/drawing/NewDrawing.cpp @@ -160,9 +160,9 @@ void GfxSetDirtyBlocks(const ScreenRect& rect) } } -void GfxClear(DrawPixelInfo* dpi, uint8_t paletteIndex) +void GfxClear(DrawPixelInfo& dpi, uint8_t paletteIndex) { - auto drawingEngine = dpi->DrawingEngine; + auto drawingEngine = dpi.DrawingEngine; if (drawingEngine != nullptr) { IDrawingContext* dc = drawingEngine->GetDrawingContext(); @@ -176,7 +176,7 @@ void GfxFillRect(DrawPixelInfo& dpi, const ScreenRect& rect, int32_t colour) if (drawingEngine != nullptr) { IDrawingContext* dc = drawingEngine->GetDrawingContext(); - dc->FillRect(&dpi, colour, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); + dc->FillRect(dpi, colour, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); } } @@ -186,7 +186,7 @@ void GfxFilterRect(DrawPixelInfo& dpi, const ScreenRect& rect, FilterPaletteID p if (drawingEngine != nullptr) { IDrawingContext* dc = drawingEngine->GetDrawingContext(); - dc->FilterRect(&dpi, palette, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); + dc->FilterRect(dpi, palette, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); } } @@ -196,7 +196,7 @@ void GfxDrawLine(DrawPixelInfo& dpi, const ScreenLine& line, int32_t colour) if (drawingEngine != nullptr) { IDrawingContext* dc = drawingEngine->GetDrawingContext(); - dc->DrawLine(&dpi, colour, line); + dc->DrawLine(dpi, colour, line); } } @@ -228,7 +228,7 @@ void GfxDrawDashedLine( { x = screenLine.GetX1() + dxPrecise * i * 2 / precisionFactor; y = screenLine.GetY1() + dyPrecise * i * 2 / precisionFactor; - dc->DrawLine(&dpi, color, { { x, y }, { x + dxPrecise / precisionFactor, y + dyPrecise / precisionFactor } }); + dc->DrawLine(dpi, color, { { x, y }, { x + dxPrecise / precisionFactor, y + dyPrecise / precisionFactor } }); } } } @@ -239,13 +239,13 @@ void FASTCALL GfxDrawSprite(DrawPixelInfo& dpi, const ImageId imageId, const Scr if (drawingEngine != nullptr) { IDrawingContext* dc = drawingEngine->GetDrawingContext(); - dc->DrawSprite(&dpi, imageId, coords.x, coords.y); + dc->DrawSprite(dpi, imageId, coords.x, coords.y); } } -void FASTCALL GfxDrawGlyph(DrawPixelInfo* dpi, const ImageId image, const ScreenCoordsXY& coords, const PaletteMap& paletteMap) +void FASTCALL GfxDrawGlyph(DrawPixelInfo& dpi, const ImageId image, const ScreenCoordsXY& coords, const PaletteMap& paletteMap) { - auto drawingEngine = dpi->DrawingEngine; + auto drawingEngine = dpi.DrawingEngine; if (drawingEngine != nullptr) { IDrawingContext* dc = drawingEngine->GetDrawingContext(); @@ -254,9 +254,9 @@ void FASTCALL GfxDrawGlyph(DrawPixelInfo* dpi, const ImageId image, const Screen } void FASTCALL - GfxDrawSpriteRawMasked(DrawPixelInfo* dpi, const ScreenCoordsXY& coords, const ImageId maskImage, const ImageId colourImage) + GfxDrawSpriteRawMasked(DrawPixelInfo& dpi, const ScreenCoordsXY& coords, const ImageId maskImage, const ImageId colourImage) { - auto drawingEngine = dpi->DrawingEngine; + auto drawingEngine = dpi.DrawingEngine; if (drawingEngine != nullptr) { IDrawingContext* dc = drawingEngine->GetDrawingContext(); @@ -264,9 +264,9 @@ void FASTCALL } } -void FASTCALL GfxDrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, const ScreenCoordsXY& coords, uint8_t colour) +void FASTCALL GfxDrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, const ScreenCoordsXY& coords, uint8_t colour) { - auto drawingEngine = dpi->DrawingEngine; + auto drawingEngine = dpi.DrawingEngine; if (drawingEngine != nullptr) { IDrawingContext* dc = drawingEngine->GetDrawingContext(); diff --git a/src/openrct2/drawing/ScrollingText.cpp b/src/openrct2/drawing/ScrollingText.cpp index 4a1f76791b..a6d3604630 100644 --- a/src/openrct2/drawing/ScrollingText.cpp +++ b/src/openrct2/drawing/ScrollingText.cpp @@ -1577,12 +1577,11 @@ static void ScrollingTextSetBitmapForTTF( return; } - int32_t pitch = surface->pitch; int32_t width = surface->w; auto src = static_cast(surface->pixels); // Pitch offset - src += 2 * pitch; + src += 2 * width; // Line height offset int32_t min_vpos = -fontDesc->offset_y; @@ -1608,7 +1607,7 @@ static void ScrollingTextSetBitmapForTTF( for (int32_t y = min_vpos; y < max_vpos; y++) { - uint8_t src_pixel = src[y * pitch + x]; + uint8_t src_pixel = src[y * width + x]; if ((!use_hinting && src_pixel != 0) || src_pixel > 140) { // Centre of the glyph: use full colour. diff --git a/src/openrct2/drawing/TTF.cpp b/src/openrct2/drawing/TTF.cpp index 7c48db277a..ce61a0a273 100644 --- a/src/openrct2/drawing/TTF.cpp +++ b/src/openrct2/drawing/TTF.cpp @@ -9,7 +9,6 @@ #ifndef NO_TTF -# include # include # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdocumentation" @@ -21,7 +20,6 @@ # include "../config/Config.h" # include "../core/Numerics.hpp" # include "../core/String.hpp" -# include "../localisation/Localisation.h" # include "../localisation/LocalisationService.h" # include "../platform/Platform.h" # include "TTF.h" @@ -374,13 +372,6 @@ void TTFFreeSurface(TTFSurface* surface) free(surface); } -uint8_t GetPixel(const TTFSurface& surface, int32_t x, int32_t y) -{ - if (x < 0 || y < 0 || x >= surface.w || y >= surface.h) - return 0; - return static_cast(surface.pixels)[y * surface.pitch + x]; -} - #else # include "TTF.h" diff --git a/src/openrct2/drawing/TTF.h b/src/openrct2/drawing/TTF.h index 273fb48f90..8c9cdce7e1 100644 --- a/src/openrct2/drawing/TTF.h +++ b/src/openrct2/drawing/TTF.h @@ -15,6 +15,7 @@ bool TTFInitialise(); void TTFDispose(); +struct TTFSurface; #ifndef NO_TTF @@ -23,7 +24,6 @@ struct TTFSurface const void* pixels; int32_t w; int32_t h; - int32_t pitch; }; TTFFontDescriptor* TTFGetFontFromSpriteBase(FontStyle fontStyle); @@ -43,6 +43,5 @@ void TTF_CloseFont(TTF_Font* font); void TTF_SetFontHinting(TTF_Font* font, int hinting); int TTF_GetFontHinting(const TTF_Font* font); void TTF_Quit(void); -uint8_t GetPixel(const TTFSurface& surface, int32_t x, int32_t y); #endif // NO_TTF diff --git a/src/openrct2/drawing/TTFSDLPort.cpp b/src/openrct2/drawing/TTFSDLPort.cpp index f26b35b86c..1bc216c0ea 100644 --- a/src/openrct2/drawing/TTFSDLPort.cpp +++ b/src/openrct2/drawing/TTFSDLPort.cpp @@ -216,7 +216,7 @@ static void TTF_initLineMectrics(const TTF_Font* font, const TTFSurface* textbuf dst = const_cast(static_cast(textbuf->pixels)); if (row > 0) { - dst += row * textbuf->pitch; + dst += row * textbuf->w; } height = font->underline_height; @@ -236,7 +236,7 @@ outline into account. static void TTF_drawLine_Solid(const TTF_Font* font, const TTFSurface* textbuf, const int row) { int line; - uint8_t* dst_check = const_cast(static_cast(textbuf->pixels)) + textbuf->pitch * textbuf->h; + uint8_t* dst_check = const_cast(static_cast(textbuf->pixels)) + textbuf->w * textbuf->h; uint8_t* dst; int height; @@ -247,7 +247,7 @@ static void TTF_drawLine_Solid(const TTF_Font* font, const TTFSurface* textbuf, { /* 1 because 0 is the bg color */ std::fill_n(dst, textbuf->w, 0x01); - dst += textbuf->pitch; + dst += textbuf->w; } } @@ -258,7 +258,7 @@ static void TTF_drawLine_Solid(const TTF_Font* font, const TTFSurface* textbuf, static void TTF_drawLine_Shaded(const TTF_Font* font, const TTFSurface* textbuf, const int row) { int line; - uint8_t* dst_check = const_cast(static_cast(textbuf->pixels)) + textbuf->pitch * textbuf->h; + uint8_t* dst_check = const_cast(static_cast(textbuf->pixels)) + textbuf->w * textbuf->h; uint8_t* dst; int height; @@ -268,7 +268,7 @@ static void TTF_drawLine_Shaded(const TTF_Font* font, const TTFSurface* textbuf, for (line = height; line > 0 && dst < dst_check; --line) { std::fill_n(dst, textbuf->w, NUM_GRAYS - 1); - dst += textbuf->pitch; + dst += textbuf->w; } } @@ -1299,12 +1299,11 @@ TTFSurface* TTF_RenderUTF8(TTF_Font* font, const char* text, bool shaded) } textbuf->w = width; textbuf->h = height; - textbuf->pitch = width; textbuf->pixels = calloc(1, width * height); /* Adding bound checking to avoid all kinds of memory corruption errors that may occur. */ - dst_check = const_cast(static_cast(textbuf->pixels)) + textbuf->pitch * textbuf->h; + dst_check = const_cast(static_cast(textbuf->pixels)) + textbuf->w * textbuf->h; /* check kerning */ use_kerning = FT_HAS_KERNING(font->face) && font->kerning; @@ -1363,7 +1362,7 @@ TTFSurface* TTF_RenderUTF8(TTF_Font* font, const char* text, bool shaded) { continue; } - dst = const_cast(static_cast(textbuf->pixels)) + (row + glyph->yoffset) * textbuf->pitch + dst = const_cast(static_cast(textbuf->pixels)) + (row + glyph->yoffset) * textbuf->w + xstart + glyph->minx; src = current->buffer + row * current->pitch; diff --git a/src/openrct2/drawing/Text.cpp b/src/openrct2/drawing/Text.cpp index 29efa04c28..e368a498b8 100644 --- a/src/openrct2/drawing/Text.cpp +++ b/src/openrct2/drawing/Text.cpp @@ -157,7 +157,7 @@ int32_t DrawTextWrapped( { const void* args = ft.Data(); - StaticLayout layout(FormatStringID(format, args), textPaint, width); + StaticLayout layout(FormatStringIDLegacy(format, args), textPaint, width); if (textPaint.Alignment == TextAlignment::CENTRE) { diff --git a/src/openrct2/drawing/Weather.cpp b/src/openrct2/drawing/Weather.cpp index 0fcf9ee35d..ef5112e074 100644 --- a/src/openrct2/drawing/Weather.cpp +++ b/src/openrct2/drawing/Weather.cpp @@ -16,6 +16,7 @@ #include "../ride/TrackDesign.h" #include "../scenario/Scenario.h" #include "../ui/UiContext.h" +#include "../util/Util.h" #include "../world/Climate.h" #include "Drawing.h" #include "IDrawingEngine.h" @@ -66,10 +67,10 @@ void DrawWeather(DrawPixelInfo& dpi, IWeatherDrawer* weatherDrawer) auto weatherLevel = GetGameState().ClimateCurrent.Level; if (weatherLevel != WeatherLevel::None && !gTrackDesignSaveMode && !(viewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) { - auto drawFunc = DrawRainFunctions[static_cast(weatherLevel)]; + auto drawFunc = DrawRainFunctions[EnumValue(weatherLevel)]; if (ClimateIsSnowing()) { - drawFunc = DrawSnowFunctions[static_cast(weatherLevel)]; + drawFunc = DrawSnowFunctions[EnumValue(weatherLevel)]; } auto uiContext = GetContext()->GetUiContext(); uiContext->DrawWeatherAnimation(weatherDrawer, dpi, drawFunc); diff --git a/src/openrct2/drawing/X8DrawingEngine.cpp b/src/openrct2/drawing/X8DrawingEngine.cpp index a5f12264a0..5af091d8ab 100644 --- a/src/openrct2/drawing/X8DrawingEngine.cpp +++ b/src/openrct2/drawing/X8DrawingEngine.cpp @@ -10,7 +10,6 @@ #include "X8DrawingEngine.h" #include "../Context.h" -#include "../Game.h" #include "../Intro.h" #include "../config/Config.h" #include "../core/Numerics.hpp" @@ -19,7 +18,6 @@ #include "../interface/Window.h" #include "../ui/UiContext.h" #include "../util/Util.h" -#include "../world/Climate.h" #include "Drawing.h" #include "IDrawingContext.h" #include "IDrawingEngine.h" @@ -92,12 +90,12 @@ void X8WeatherDrawer::Draw( } } -void X8WeatherDrawer::Restore(DrawPixelInfo* dpi) +void X8WeatherDrawer::Restore(DrawPixelInfo& dpi) { if (_weatherPixelsCount > 0) { - uint32_t numPixels = (dpi->width + dpi->pitch) * dpi->height; - uint8_t* bits = dpi->bits; + uint32_t numPixels = (dpi.width + dpi.pitch) * dpi.height; + uint8_t* bits = dpi.bits; for (uint32_t i = 0; i < _weatherPixelsCount; i++) { WeatherPixel weatherPixel = _weatherPixels[i]; @@ -193,7 +191,7 @@ void X8DrawingEngine::BeginDraw() { Resize(_width, _height); } - _weatherDrawer.Restore(&_bitsDPI); + _weatherDrawer.Restore(_bitsDPI); } } @@ -460,16 +458,16 @@ X8DrawingContext::X8DrawingContext(X8DrawingEngine* engine) _engine = engine; } -void X8DrawingContext::Clear(DrawPixelInfo* dpi, uint8_t paletteIndex) +void X8DrawingContext::Clear(DrawPixelInfo& dpi, uint8_t paletteIndex) { - int32_t w = dpi->zoom_level.ApplyInversedTo(dpi->width); - int32_t h = dpi->zoom_level.ApplyInversedTo(dpi->height); - uint8_t* ptr = dpi->bits; + int32_t w = dpi.zoom_level.ApplyInversedTo(dpi.width); + int32_t h = dpi.zoom_level.ApplyInversedTo(dpi.height); + uint8_t* ptr = dpi.bits; for (int32_t y = 0; y < h; y++) { std::fill_n(ptr, w, paletteIndex); - ptr += w + dpi->pitch; + ptr += w + dpi.pitch; } } @@ -521,47 +519,47 @@ static constexpr const uint16_t* Patterns[] = { }; // clang-format on -void X8DrawingContext::FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom) +void X8DrawingContext::FillRect(DrawPixelInfo& dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom) { if (left > right) return; if (top > bottom) return; - if (dpi->x > right) + if (dpi.x > right) return; - if (left >= dpi->x + dpi->width) + if (left >= dpi.x + dpi.width) return; - if (bottom < dpi->y) + if (bottom < dpi.y) return; - if (top >= dpi->y + dpi->height) + if (top >= dpi.y + dpi.height) return; uint16_t crossPattern = 0; - int32_t startX = left - dpi->x; + int32_t startX = left - dpi.x; if (startX < 0) { crossPattern ^= startX; startX = 0; } - int32_t endX = right - dpi->x + 1; - if (endX > dpi->width) + int32_t endX = right - dpi.x + 1; + if (endX > dpi.width) { - endX = dpi->width; + endX = dpi.width; } - int32_t startY = top - dpi->y; + int32_t startY = top - dpi.y; if (startY < 0) { crossPattern ^= startY; startY = 0; } - int32_t endY = bottom - dpi->y + 1; - if (endY > dpi->height) + int32_t endY = bottom - dpi.y + 1; + if (endY > dpi.height) { - endY = dpi->height; + endY = dpi.height; } int32_t width = endX - startX; @@ -570,10 +568,10 @@ void X8DrawingContext::FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t lef if (colour & 0x1000000) { // Cross hatching - uint8_t* dst = (startY * (dpi->width + dpi->pitch)) + startX + dpi->bits; + uint8_t* dst = (startY * (dpi.width + dpi.pitch)) + startX + dpi.bits; for (int32_t i = 0; i < height; i++) { - uint8_t* nextdst = dst + dpi->width + dpi->pitch; + uint8_t* nextdst = dst + dpi.width + dpi.pitch; uint32_t p = Numerics::ror32(crossPattern, 1); p = (p & 0xFFFF0000) | width; @@ -597,22 +595,22 @@ void X8DrawingContext::FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t lef } else if (colour & 0x4000000) { - uint8_t* dst = startY * (dpi->width + dpi->pitch) + startX + dpi->bits; + uint8_t* dst = startY * (dpi.width + dpi.pitch) + startX + dpi.bits; // The pattern loops every 15 lines this is which // part the pattern is on. - int32_t patternY = (startY + dpi->y) % 16; + int32_t patternY = (startY + dpi.y) % 16; // The pattern loops every 15 pixels this is which // part the pattern is on. - int32_t startPatternX = (startX + dpi->x) % 16; + int32_t startPatternX = (startX + dpi.x) % 16; int32_t patternX = startPatternX; const uint16_t* patternsrc = Patterns[colour >> 28]; // or possibly uint8_t)[esi*4] ? for (int32_t numLines = height; numLines > 0; numLines--) { - uint8_t* nextdst = dst + dpi->width + dpi->pitch; + uint8_t* nextdst = dst + dpi.width + dpi.pitch; uint16_t pattern = patternsrc[patternY]; for (int32_t numPixels = width; numPixels > 0; numPixels--) @@ -631,53 +629,53 @@ void X8DrawingContext::FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t lef } else { - uint8_t* dst = startY * (dpi->width + dpi->pitch) + startX + dpi->bits; + uint8_t* dst = startY * (dpi.width + dpi.pitch) + startX + dpi.bits; for (int32_t i = 0; i < height; i++) { std::fill_n(dst, width, colour & 0xFF); - dst += dpi->width + dpi->pitch; + dst += dpi.width + dpi.pitch; } } } void X8DrawingContext::FilterRect( - DrawPixelInfo* dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) + DrawPixelInfo& dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) { if (left > right) return; if (top > bottom) return; - if (dpi->x > right) + if (dpi.x > right) return; - if (left >= dpi->x + dpi->width) + if (left >= dpi.x + dpi.width) return; - if (bottom < dpi->y) + if (bottom < dpi.y) return; - if (top >= dpi->y + dpi->height) + if (top >= dpi.y + dpi.height) return; - int32_t startX = left - dpi->x; + int32_t startX = left - dpi.x; if (startX < 0) { startX = 0; } - int32_t endX = right - dpi->x + 1; - if (endX > dpi->width) + int32_t endX = right - dpi.x + 1; + if (endX > dpi.width) { - endX = dpi->width; + endX = dpi.width; } - int32_t startY = top - dpi->y; + int32_t startY = top - dpi.y; if (startY < 0) { startY = 0; } - int32_t endY = bottom - dpi->y + 1; - if (endY > dpi->height) + int32_t endY = bottom - dpi.y + 1; + if (endY > dpi.height) { - endY = dpi->height; + endY = dpi.height; } int32_t width = endX - startX; @@ -686,21 +684,21 @@ void X8DrawingContext::FilterRect( // 0x2000000 // 00678B7E 00678C83 // Location in screen buffer? - uint8_t* dst = dpi->bits + uint8_t* dst = dpi.bits + static_cast( - dpi->zoom_level.ApplyInversedTo(startY) * (dpi->zoom_level.ApplyInversedTo(dpi->width) + dpi->pitch) - + dpi->zoom_level.ApplyInversedTo(startX)); + dpi.zoom_level.ApplyInversedTo(startY) * (dpi.zoom_level.ApplyInversedTo(dpi.width) + dpi.pitch) + + dpi.zoom_level.ApplyInversedTo(startX)); // Find colour in colour table? auto paletteMap = GetPaletteMapForColour(EnumValue(palette)); if (paletteMap.has_value()) { const auto& paletteEntries = paletteMap.value(); - const int32_t scaled_width = dpi->zoom_level.ApplyInversedTo(width); - const int32_t step = dpi->zoom_level.ApplyInversedTo(dpi->width) + dpi->pitch; + const int32_t scaled_width = dpi.zoom_level.ApplyInversedTo(width); + const int32_t step = dpi.zoom_level.ApplyInversedTo(dpi.width) + dpi.pitch; // Fill the rectangle with the colours from the colour table - auto c = dpi->zoom_level.ApplyInversedTo(height); + auto c = dpi.zoom_level.ApplyInversedTo(height); for (int32_t i = 0; i < c; i++) { uint8_t* nextdst = dst + step * i; @@ -713,33 +711,130 @@ void X8DrawingContext::FilterRect( } } -void X8DrawingContext::DrawLine(DrawPixelInfo* dpi, uint32_t colour, const ScreenLine& line) +void X8DrawingContext::DrawLine(DrawPixelInfo& dpi, uint32_t colour, const ScreenLine& line) { - GfxDrawLineSoftware(*dpi, line, colour); + GfxDrawLineSoftware(dpi, line, colour); } -void X8DrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, int32_t x, int32_t y) +void X8DrawingContext::DrawSprite(DrawPixelInfo& dpi, const ImageId imageId, int32_t x, int32_t y) { - GfxDrawSpriteSoftware(*dpi, imageId, { x, y }); + GfxDrawSpriteSoftware(dpi, imageId, { x, y }); } void X8DrawingContext::DrawSpriteRawMasked( - DrawPixelInfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) + DrawPixelInfo& dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) { - GfxDrawSpriteRawMaskedSoftware(*dpi, { x, y }, maskImage, colourImage); + GfxDrawSpriteRawMaskedSoftware(dpi, { x, y }, maskImage, colourImage); } -void X8DrawingContext::DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) +void X8DrawingContext::DrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) { uint8_t palette[256]; std::fill_n(palette, sizeof(palette), colour); palette[0] = 0; const auto spriteCoords = ScreenCoordsXY{ x, y }; - GfxDrawSpritePaletteSetSoftware(*dpi, ImageId(image.GetIndex(), 0), spriteCoords, PaletteMap(palette)); + GfxDrawSpritePaletteSetSoftware(dpi, ImageId(image.GetIndex(), 0), spriteCoords, PaletteMap(palette)); } -void X8DrawingContext::DrawGlyph(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& paletteMap) +void X8DrawingContext::DrawGlyph(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& paletteMap) { - GfxDrawSpritePaletteSetSoftware(*dpi, image, { x, y }, paletteMap); + GfxDrawSpritePaletteSetSoftware(dpi, image, { x, y }, paletteMap); } + +#ifndef NO_TTF +template +static void DrawTTFBitmapInternal( + DrawPixelInfo& dpi, uint8_t colour, TTFSurface* surface, int32_t x, int32_t y, uint8_t hintingThreshold) +{ + const int32_t surfaceWidth = surface->w; + int32_t width = surfaceWidth; + int32_t height = surface->h; + + const int32_t overflowX = (dpi.x + dpi.width) - (x + width); + const int32_t overflowY = (dpi.y + dpi.height) - (y + height); + if (overflowX < 0) + width += overflowX; + if (overflowY < 0) + height += overflowY; + int32_t skipX = x - dpi.x; + int32_t skipY = y - dpi.y; + + auto src = static_cast(surface->pixels); + uint8_t* dst = dpi.bits; + + if (skipX < 0) + { + width += skipX; + src += -skipX; + skipX = 0; + } + if (skipY < 0) + { + height += skipY; + src += (-skipY * surfaceWidth); + skipY = 0; + } + + dst += skipX; + dst += skipY * (dpi.width + dpi.pitch); + + const int32_t srcScanSkip = surfaceWidth - width; + const int32_t dstScanSkip = dpi.width + dpi.pitch - width; + for (int32_t yy = 0; yy < height; yy++) + { + for (int32_t xx = 0; xx < width; xx++) + { + if (*src != 0) + { + if constexpr (TUseHinting) + { + if (*src > 180) + { + // Centre of the glyph: use full colour. + *dst = colour; + } + else if (*src > hintingThreshold) + { + *dst = BlendColours(colour, *dst); + } + } + else + { + *dst = colour; + } + } + src++; + dst++; + } + src += srcScanSkip; + dst += dstScanSkip; + } +} +#endif // NO_TTF + +void X8DrawingContext::DrawTTFBitmap( + DrawPixelInfo& dpi, TextDrawInfo* info, TTFSurface* surface, int32_t x, int32_t y, uint8_t hintingThreshold) +{ +#ifndef NO_TTF + const uint8_t fgColor = info->palette[1]; + const uint8_t bgColor = info->palette[3]; + + if (info->flags & TEXT_DRAW_FLAG_OUTLINE) + { + DrawTTFBitmapInternal(dpi, bgColor, surface, x + 1, y, 0); + DrawTTFBitmapInternal(dpi, bgColor, surface, x - 1, y, 0); + DrawTTFBitmapInternal(dpi, bgColor, surface, x, y + 1, 0); + DrawTTFBitmapInternal(dpi, bgColor, surface, x, y - 1, 0); + } + if (info->flags & TEXT_DRAW_FLAG_INSET) + { + DrawTTFBitmapInternal(dpi, bgColor, surface, x + 1, y + 1, 0); + } + + if (hintingThreshold > 0) + DrawTTFBitmapInternal(dpi, fgColor, surface, x, y, hintingThreshold); + else + DrawTTFBitmapInternal(dpi, fgColor, surface, x, y, 0); +#endif // NO_TTF +} \ No newline at end of file diff --git a/src/openrct2/drawing/X8DrawingEngine.h b/src/openrct2/drawing/X8DrawingEngine.h index fb4eed44c5..4a3ea69ee3 100644 --- a/src/openrct2/drawing/X8DrawingEngine.h +++ b/src/openrct2/drawing/X8DrawingEngine.h @@ -9,7 +9,6 @@ #pragma once -#include "../common.h" #include "IDrawingContext.h" #include "IDrawingEngine.h" @@ -58,7 +57,7 @@ namespace OpenRCT2 void Draw( DrawPixelInfo& dpi, int32_t x, int32_t y, int32_t width, int32_t height, int32_t xStart, int32_t yStart, const uint8_t* weatherpattern) override; - void Restore(DrawPixelInfo* dpi); + void Restore(DrawPixelInfo& dpi); }; #ifdef __WARN_SUGGEST_FINAL_TYPES__ @@ -136,22 +135,20 @@ namespace OpenRCT2 public: explicit X8DrawingContext(X8DrawingEngine* engine); - void Clear(DrawPixelInfo* dpi, uint8_t paletteIndex) override; - void FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t x, int32_t y, int32_t w, int32_t h) override; + void Clear(DrawPixelInfo& dpi, uint8_t paletteIndex) override; + void FillRect(DrawPixelInfo& dpi, uint32_t colour, int32_t x, int32_t y, int32_t w, int32_t h) override; void FilterRect( - DrawPixelInfo* dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) override; - void DrawLine(DrawPixelInfo* dpi, uint32_t colour, const ScreenLine& line) override; - void DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, int32_t x, int32_t y) override; + DrawPixelInfo& dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) override; + void DrawLine(DrawPixelInfo& dpi, uint32_t colour, const ScreenLine& line) override; + void DrawSprite(DrawPixelInfo& dpi, const ImageId imageId, int32_t x, int32_t y) override; void DrawSpriteRawMasked( - DrawPixelInfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) override; - void DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) override; + DrawPixelInfo& dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) override; + void DrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) override; void DrawGlyph( - DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& paletteMap) override; + DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& paletteMap) override; void DrawTTFBitmap( - DrawPixelInfo* dpi, TextDrawInfo* info, uint32_t image, const void* pixels, int32_t width, int32_t height, - int32_t x, int32_t y, uint8_t hinting_threshold) override - { - } + DrawPixelInfo& dpi, TextDrawInfo* info, TTFSurface* surface, int32_t x, int32_t y, + uint8_t hintingThreshold) override; }; } // namespace Drawing } // namespace OpenRCT2 diff --git a/src/openrct2/entity/EntityBase.cpp b/src/openrct2/entity/EntityBase.cpp index 75e9a07bfa..ac71e56e36 100644 --- a/src/openrct2/entity/EntityBase.cpp +++ b/src/openrct2/entity/EntityBase.cpp @@ -64,7 +64,7 @@ void EntityBase::Invalidate() break; } - ViewportsInvalidate(SpriteData.SpriteRect, maxZoom); + ViewportsInvalidate(GetLocation(), SpriteData.Width, SpriteData.HeightMin, SpriteData.HeightMax, maxZoom); } void EntityBase::Serialise(DataSerialiser& stream) diff --git a/src/openrct2/entity/EntityRegistry.cpp b/src/openrct2/entity/EntityRegistry.cpp index 9737faef72..2567d24e76 100644 --- a/src/openrct2/entity/EntityRegistry.cpp +++ b/src/openrct2/entity/EntityRegistry.cpp @@ -10,6 +10,7 @@ #include "EntityRegistry.h" #include "../Game.h" +#include "../GameState.h" #include "../core/Algorithm.hpp" #include "../core/ChecksumStream.h" #include "../core/Crypt.h" @@ -36,23 +37,14 @@ #include #include -union Entity -{ - uint8_t Pad00[0x200]; - EntityBase base; - Entity() - : Pad00() - { - } -}; +using namespace OpenRCT2; -static Entity _entities[MAX_ENTITIES]{}; static std::array, EnumValue(EntityType::Count)> gEntityLists; static std::vector _freeIdList; static bool _entityFlashingList[MAX_ENTITIES]; -constexpr const uint32_t SPATIAL_INDEX_SIZE = (MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL) + 1; +constexpr const uint32_t SPATIAL_INDEX_SIZE = (kMaximumMapSizeTechnical * kMaximumMapSizeTechnical) + 1; constexpr uint32_t SPATIAL_INDEX_LOCATION_NULL = SPATIAL_INDEX_SIZE - 1; static std::array, SPATIAL_INDEX_SIZE> gEntitySpatialIndex; @@ -68,10 +60,10 @@ static constexpr size_t GetSpatialIndexOffset(const CoordsXY& loc) const auto tileX = std::abs(loc.x) / COORDS_XY_STEP; const auto tileY = std::abs(loc.y) / COORDS_XY_STEP; - if (tileX >= MAXIMUM_MAP_SIZE_TECHNICAL || tileY >= MAXIMUM_MAP_SIZE_TECHNICAL) + if (tileX >= kMaximumMapSizeTechnical || tileY >= kMaximumMapSizeTechnical) return SPATIAL_INDEX_LOCATION_NULL; - return tileX * MAXIMUM_MAP_SIZE_TECHNICAL + tileY; + return tileX * kMaximumMapSizeTechnical + tileY; } constexpr bool EntityTypeIsMiscEntity(const EntityType type) @@ -120,8 +112,9 @@ std::string EntitiesChecksum::ToString() const EntityBase* TryGetEntity(EntityId entityIndex) { + auto& gameState = GetGameState(); const auto idx = entityIndex.ToUnderlying(); - return idx >= MAX_ENTITIES ? nullptr : &_entities[idx].base; + return idx >= MAX_ENTITIES ? nullptr : &gameState.Entities[idx].base; } EntityBase* GetEntity(EntityId entityIndex) @@ -182,7 +175,8 @@ void ResetAllEntities() FreeEntity(*spr); } - std::fill(std::begin(_entities), std::end(_entities), Entity()); + auto& gameState = GetGameState(); + std::fill(std::begin(gameState.Entities), std::end(gameState.Entities), Entity_t()); OpenRCT2::RideUse::GetHistory().Clear(); OpenRCT2::RideUse::GetTypeHistory().Clear(); for (int32_t i = 0; i < MAX_ENTITIES; ++i) @@ -266,8 +260,8 @@ static void EntityReset(EntityBase* entity) auto entityIndex = entity->Id; _entityFlashingList[entityIndex.ToUnderlying()] = false; - Entity* spr = reinterpret_cast(entity); - *spr = Entity(); + Entity_t* tempEntity = reinterpret_cast(entity); + *tempEntity = Entity_t(); entity->Id = entityIndex; entity->Type = EntityType::Null; diff --git a/src/openrct2/entity/EntityRegistry.h b/src/openrct2/entity/EntityRegistry.h index af5477c334..e17c08be8f 100644 --- a/src/openrct2/entity/EntityRegistry.h +++ b/src/openrct2/entity/EntityRegistry.h @@ -14,6 +14,19 @@ #include +namespace OpenRCT2 +{ + union Entity_t + { + uint8_t Pad00[0x200]; + EntityBase base; + Entity_t() + : Pad00() + { + } + }; +} // namespace OpenRCT2 + constexpr uint16_t MAX_ENTITIES = 65535; EntityBase* GetEntity(EntityId sprite_idx); diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index f73432fdd6..0dee7da7cd 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -898,11 +898,11 @@ void Guest::Loc68FA89() } } -void Guest::Tick128UpdateGuest(int32_t index) +void Guest::Tick128UpdateGuest(uint32_t index) { const auto currentTicks = GetGameState().CurrentTicks; - if (static_cast(index & 0x1FF) == (currentTicks & 0x1FF)) + if ((index & 0x1FF) == (currentTicks & 0x1FF)) { /* Effect of masking with 0x1FF here vs mask 0x7F, * which is the condition for calling this function, is @@ -1036,7 +1036,7 @@ void Guest::Tick128UpdateGuest(int32_t index) PickRideToGoOn(); } - if (static_cast(index & 0x3FF) == (currentTicks & 0x3FF)) + if ((index & 0x3FF) == (currentTicks & 0x3FF)) { /* Effect of masking with 0x3FF here vs mask 0x1FF, * which is used in the encompassing conditional, is @@ -1433,7 +1433,7 @@ void Guest::CheckCantFindRide() if (w != nullptr) { - WindowEventOnPrepareDrawCall(w); + w->OnPrepareDraw(); } WindowInvalidateByNumber(WindowClass::Peep, Id); @@ -2048,7 +2048,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b // excitement check and will only do a basic intensity check when they arrive at the ride itself. if (ride.id == GuestHeadingToRideId) { - if (ride.intensity > RIDE_RATING(10, 00) && !gCheatsIgnoreRideIntensity) + if (ride.intensity > RIDE_RATING(10, 00) && !GetGameState().Cheats.IgnoreRideIntensity) { PeepRideIsTooIntense(this, ride, peepAtRide); return false; @@ -2074,7 +2074,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b // ride intensity check and get me on a sheltered ride! if (!ClimateIsRaining() || !ShouldRideWhileRaining(ride)) { - if (!gCheatsIgnoreRideIntensity) + if (!GetGameState().Cheats.IgnoreRideIntensity) { // Intensity calculations. Even though the max intensity can go up to 15, it's capped // at 10.0 (before happiness calculations). A full happiness bar will increase the max @@ -2140,7 +2140,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b return false; } - if (!gCheatsIgnoreRideIntensity) + if (!GetGameState().Cheats.IgnoreRideIntensity) { if (ride.max_positive_vertical_g > FIXED_2DP(5, 00) || ride.max_negative_vertical_g < FIXED_2DP(-4, 00) || ride.max_lateral_g > FIXED_2DP(4, 00)) @@ -2533,7 +2533,7 @@ void Guest::GoToRideEntrance(const Ride& ride) bool Guest::FindVehicleToEnter(const Ride& ride, std::vector& car_array) { - uint8_t chosen_train = RideStation::NO_TRAIN; + uint8_t chosen_train = RideStation::kNoTrain; if (ride.mode == RideMode::Dodgems || ride.mode == RideMode::Race) { @@ -2581,7 +2581,7 @@ bool Guest::FindVehicleToEnter(const Ride& ride, std::vector& car_array car_array.push_back(i); return true; } - num_seats &= VEHICLE_SEAT_NUM_MASK; + num_seats &= kVehicleSeatNumMask; } if (num_seats == vehicle->next_free_seat) continue; @@ -2854,7 +2854,7 @@ static bool PeepShouldGoOnRideAgain(Guest* peep, const Ride& ride) return false; if (!RideHasRatings(ride)) return false; - if (ride.intensity > RIDE_RATING(10, 00) && !gCheatsIgnoreRideIntensity) + if (ride.intensity > RIDE_RATING(10, 00) && !GetGameState().Cheats.IgnoreRideIntensity) return false; if (peep->Happiness < 180) return false; @@ -2899,7 +2899,7 @@ static bool PeepReallyLikedRide(Guest* peep, const Ride& ride) return false; if (!RideHasRatings(ride)) return false; - if (ride.intensity > RIDE_RATING(10, 00) && !gCheatsIgnoreRideIntensity) + if (ride.intensity > RIDE_RATING(10, 00) && !GetGameState().Cheats.IgnoreRideIntensity) return false; return true; } @@ -3018,7 +3018,7 @@ static PeepThoughtType PeepAssessSurroundings(int16_t centre_x, int16_t centre_y if (nearby_music == 1 && num_rubbish < 20) return PeepThoughtType::Music; - if (num_rubbish < 2 && !gCheatsDisableLittering) + if (num_rubbish < 2 && !GetGameState().Cheats.DisableLittering) // if disable littering cheat is enabled, peeps will not have the "clean and tidy park" thought return PeepThoughtType::VeryClean; @@ -3119,7 +3119,7 @@ static void PeepLeavePark(Guest* peep) WindowBase* w = WindowFindByNumber(WindowClass::Peep, peep->Id); if (w != nullptr) - WindowEventOnPrepareDrawCall(w); + w->OnPrepareDraw(); WindowInvalidateByNumber(WindowClass::Peep, peep->Id); } @@ -5025,17 +5025,20 @@ void Guest::UpdateRideLeaveExit() return; } - OnExitRide(*ride); - - if (ride != nullptr && (PeepFlags & PEEP_FLAGS_TRACKING)) + if (ride != nullptr) { - auto ft = Formatter(); - FormatNameTo(ft); - ride->FormatNameTo(ft); + OnExitRide(*ride); - if (gConfigNotifications.GuestLeftRide) + if (PeepFlags & PEEP_FLAGS_TRACKING) { - News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_LEFT_RIDE_X, Id, ft); + auto ft = Formatter(); + FormatNameTo(ft); + ride->FormatNameTo(ft); + + if (gConfigNotifications.GuestLeftRide) + { + News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_LEFT_RIDE_X, Id, ft); + } } } @@ -6188,7 +6191,7 @@ static PathElement* FindBreakableElement(const CoordsXYZ& loc) */ static void PeepUpdateWalkingBreakScenery(Guest* peep) { - if (gCheatsDisableVandalism) + if (GetGameState().Cheats.DisableVandalism) return; if (!(peep->PeepFlags & PEEP_FLAGS_ANGRY)) @@ -6276,7 +6279,7 @@ static bool PeepShouldWatchRide(TileElement* tileElement) } // This is most likely to have peeps watch new rides - if (ride->excitement == RIDE_RATING_UNDEFINED) + if (ride->excitement == kRideRatingUndefined) { return true; } @@ -6320,7 +6323,7 @@ bool Loc690FD0(Peep* peep, RideId* rideToView, uint8_t* rideSeatToView, TileElem return false; *rideToView = ride->id; - if (ride->excitement == RIDE_RATING_UNDEFINED) + if (ride->excitement == kRideRatingUndefined) { *rideSeatToView = 1; if (ride->status != RideStatus::Open) diff --git a/src/openrct2/entity/Guest.h b/src/openrct2/entity/Guest.h index 6ecee9a3a0..636dd8e66f 100644 --- a/src/openrct2/entity/Guest.h +++ b/src/openrct2/entity/Guest.h @@ -321,7 +321,7 @@ public: uint64_t ItemFlags; void UpdateGuest(); - void Tick128UpdateGuest(int32_t index); + void Tick128UpdateGuest(uint32_t index); int64_t GetFoodOrDrinkFlags() const; int64_t GetEmptyContainerFlags() const; bool HasDrink() const; @@ -460,8 +460,6 @@ enum EASTEREGG_PEEP_NAME_DAVID_ELLIS }; -extern uint8_t gGuestChangeModifier; - void PeepThoughtSetFormatArgs(const PeepThought* thought, Formatter& ft); void IncrementGuestsInPark(); diff --git a/src/openrct2/entity/Litter.cpp b/src/openrct2/entity/Litter.cpp index 3af4883f3f..7bb3acbd43 100644 --- a/src/openrct2/entity/Litter.cpp +++ b/src/openrct2/entity/Litter.cpp @@ -49,7 +49,7 @@ static bool IsLocationLitterable(const CoordsXYZ& mapPos) */ void Litter::Create(const CoordsXYZD& litterPos, Type type) { - if (gCheatsDisableLittering) + if (GetGameState().Cheats.DisableLittering) return; auto offsetLitterPos = litterPos diff --git a/src/openrct2/entity/PatrolArea.h b/src/openrct2/entity/PatrolArea.h index ded2ec1fbe..053df61c58 100644 --- a/src/openrct2/entity/PatrolArea.h +++ b/src/openrct2/entity/PatrolArea.h @@ -17,7 +17,7 @@ // The number of elements in the GameState_t.StaffPatrolAreas array per staff member. Every bit in the array represents a 4x4 // square. Right now, it's a 32-bit array like in RCT2. 32 * 128 = 4096 bits, which is also the number of 4x4 squares on a // 256x256 map. -constexpr size_t STAFF_PATROL_AREA_BLOCKS_PER_LINE = MAXIMUM_MAP_SIZE_TECHNICAL / 4; +constexpr size_t STAFF_PATROL_AREA_BLOCKS_PER_LINE = kMaximumMapSizeTechnical / 4; constexpr size_t STAFF_PATROL_AREA_SIZE = (STAFF_PATROL_AREA_BLOCKS_PER_LINE * STAFF_PATROL_AREA_BLOCKS_PER_LINE) / 32; class PatrolArea @@ -32,8 +32,8 @@ private: std::vector SortedTiles; }; - static constexpr auto CellColumns = (MAXIMUM_MAP_SIZE_TECHNICAL + (Cell::Width - 1)) / Cell::Width; - static constexpr auto CellRows = (MAXIMUM_MAP_SIZE_TECHNICAL + (Cell::Height - 1)) / Cell::Height; + static constexpr auto CellColumns = (kMaximumMapSizeTechnical + (Cell::Width - 1)) / Cell::Width; + static constexpr auto CellRows = (kMaximumMapSizeTechnical + (Cell::Height - 1)) / Cell::Height; static constexpr auto NumCells = CellColumns * CellRows; std::array Areas; diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index ec4966ed6e..9b91f94ca8 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -25,7 +25,7 @@ #include "../entity/Balloon.h" #include "../entity/EntityRegistry.h" #include "../entity/EntityTweener.h" -#include "../interface/Window.h" +#include "../interface/Window_internal.h" #include "../localisation/Formatter.h" #include "../localisation/Formatting.h" #include "../localisation/Localisation.h" @@ -66,16 +66,11 @@ using namespace OpenRCT2; using namespace OpenRCT2::Audio; -uint8_t gGuestChangeModifier; - -uint8_t gPeepWarningThrottle[16]; - static uint8_t _unk_F1AEF0; static TileElement* _peepRideEntranceExitElement; static std::shared_ptr _crowdSoundChannel = nullptr; -static void Peep128TickUpdate(Peep* peep, int32_t index); static void GuestReleaseBalloon(Guest* peep, int16_t spawn_height); static PeepActionSpriteType PeepSpecialSpriteToSpriteTypeMap[] = { @@ -203,68 +198,41 @@ void PeepUpdateAll() const auto currentTicks = OpenRCT2::GetGameState().CurrentTicks; - int32_t i = 0; + constexpr auto kTicks128Mask = 128U - 1U; + const auto currentTicksMasked = currentTicks & kTicks128Mask; + + uint32_t index = 0; // Warning this loop can delete peeps for (auto peep : EntityList()) { - if (static_cast(i & 0x7F) != (currentTicks & 0x7F)) + if ((index & kTicks128Mask) == currentTicksMasked) + { + peep->Tick128UpdateGuest(index); + } + + // 128 tick can delete so double check its not deleted + if (peep->Type == EntityType::Guest) { peep->Update(); } - else - { - Peep128TickUpdate(peep, i); - // 128 tick can delete so double check its not deleted - if (peep->Type == EntityType::Guest) - { - peep->Update(); - } - } - i++; + index++; } for (auto staff : EntityList()) { - if (static_cast(i & 0x7F) != (currentTicks & 0x7F)) - { - staff->Update(); - } - else - { - Peep128TickUpdate(staff, i); - // 128 tick can delete so double check its not deleted - if (staff->Type == EntityType::Staff) - { - staff->Update(); - } - } - - i++; - } -} - -/** - * - * rct2: 0x0068F41A - * Called every 128 ticks - */ -static void Peep128TickUpdate(Peep* peep, int32_t index) -{ - PROFILED_FUNCTION(); - - auto* guest = peep->As(); - if (guest != nullptr) - { - guest->Tick128UpdateGuest(index); - } - else - { - auto* staff = peep->As(); - if (staff != nullptr) + if ((index & kTicks128Mask) == currentTicksMasked) { staff->Tick128UpdateStaff(); } + + // 128 tick can delete so double check its not deleted + if (staff->Type == EntityType::Staff) + { + staff->Update(); + } + + index++; } } @@ -556,7 +524,7 @@ void PeepWindowStateUpdate(Peep* peep) { WindowBase* w = WindowFindByNumber(WindowClass::Peep, peep->Id.ToUnderlying()); if (w != nullptr) - WindowEventOnPrepareDrawCall(w); + w->OnPrepareDraw(); if (peep->Is()) { @@ -749,7 +717,8 @@ void Peep::UpdateFalling() News::AddItemToQueue(News::ItemType::Blank, STR_NEWS_ITEM_GUEST_DROWNED, x | (y << 16), ft); } - gParkRatingCasualtyPenalty = std::min(gParkRatingCasualtyPenalty + 25, 1000); + auto& gameState = GetGameState(); + gameState.ParkRatingCasualtyPenalty = std::min(gameState.ParkRatingCasualtyPenalty + 25, 1000); Remove(); return; } @@ -1039,10 +1008,12 @@ void Peep::Update() */ void PeepProblemWarningsUpdate() { + auto& gameState = GetGameState(); + Ride* ride; uint32_t hungerCounter = 0, lostCounter = 0, noexitCounter = 0, thirstCounter = 0, litterCounter = 0, disgustCounter = 0, toiletCounter = 0, vandalismCounter = 0; - uint8_t* warningThrottle = gPeepWarningThrottle; + uint8_t* warningThrottle = gameState.PeepWarningThrottle; int32_t inQueueCounter = 0; int32_t tooLongQueueCounter = 0; @@ -1118,7 +1089,6 @@ void PeepProblemWarningsUpdate() break; } } - auto& gameState = GetGameState(); // could maybe be packed into a loop, would lose a lot of clarity though if (warningThrottle[0]) @@ -1588,7 +1558,7 @@ std::string Peep::GetName() const { Formatter ft; FormatNameTo(ft); - return ::FormatStringID(STR_STRINGID, ft.Data()); + return FormatStringIDLegacy(STR_STRINGID, ft.Data()); } bool Peep::SetName(std::string_view value) diff --git a/src/openrct2/entity/Peep.h b/src/openrct2/entity/Peep.h index 0586d41408..794103dac7 100644 --- a/src/openrct2/entity/Peep.h +++ b/src/openrct2/entity/Peep.h @@ -459,8 +459,6 @@ enum extern const PeepAnimationEntry g_peep_animation_entries[EnumValue(PeepSpriteType::Count)]; extern const bool gSpriteTypeToSlowWalkMap[48]; -extern uint8_t gPeepWarningThrottle[16]; - int32_t PeepGetStaffCount(); void PeepUpdateAll(); void PeepProblemWarningsUpdate(); diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index af60d6e0ae..50873e7edc 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -1549,14 +1549,14 @@ bool Staff::UpdatePatrollingFindWatering() continue; } - if (tile_element->AsSmallScenery()->GetAge() < SCENERY_WITHER_AGE_THRESHOLD_2) + if (tile_element->AsSmallScenery()->GetAge() < kSceneryWitherAgeThreshold2) { if (chosen_position >= 4) { continue; } - if (tile_element->AsSmallScenery()->GetAge() < SCENERY_WITHER_AGE_THRESHOLD_1) + if (tile_element->AsSmallScenery()->GetAge() < kSceneryWitherAgeThreshold1) { continue; } diff --git a/src/openrct2/entity/Staff.h b/src/openrct2/entity/Staff.h index 13815ac954..e8cc7b4c62 100644 --- a/src/openrct2/entity/Staff.h +++ b/src/openrct2/entity/Staff.h @@ -142,7 +142,7 @@ enum class EntertainerCostume : uint8_t Count }; -extern const StringId StaffCostumeNames[static_cast(EntertainerCostume::Count)]; +extern const StringId StaffCostumeNames[EnumValue(EntertainerCostume::Count)]; colour_t StaffGetColour(StaffType staffType); GameActions::Result StaffSetColour(StaffType staffType, colour_t value); diff --git a/src/openrct2/entity/Yaw.hpp b/src/openrct2/entity/Yaw.hpp index 9fce6252a7..f1cdc90aef 100644 --- a/src/openrct2/entity/Yaw.hpp +++ b/src/openrct2/entity/Yaw.hpp @@ -9,6 +9,8 @@ #pragma once +#include "../util/Util.h" + #include namespace OpenRCT2::Entity::Yaw @@ -63,7 +65,7 @@ namespace OpenRCT2::Entity::Yaw [[nodiscard]] constexpr int32_t YawToPrecision(int32_t yaw, SpritePrecision precision) { - return yaw >> PrecisionOffset[static_cast(precision)]; + return yaw >> PrecisionOffset[EnumValue(precision)]; } [[nodiscard]] constexpr uint8_t NumSpritesPrecision(SpritePrecision precision) diff --git a/src/openrct2/interface/Colour.cpp b/src/openrct2/interface/Colour.cpp index 1514e287a0..97dec8f039 100644 --- a/src/openrct2/interface/Colour.cpp +++ b/src/openrct2/interface/Colour.cpp @@ -156,9 +156,9 @@ static uint8_t FindClosestPaletteIndex(uint8_t red, uint8_t green, uint8_t blue) static void InitBlendColourMap() { - for (int i = 0; i < PALETTE_SIZE; i++) + for (size_t i = 0; i < PALETTE_SIZE; i++) { - for (int j = i; j < PALETTE_SIZE; j++) + for (size_t j = i; j < PALETTE_SIZE; j++) { uint8_t red = (gPalette[i].Red + gPalette[j].Red) / 2; uint8_t green = (gPalette[i].Green + gPalette[j].Green) / 2; diff --git a/src/openrct2/interface/Colour.h b/src/openrct2/interface/Colour.h index 9a47f2a7cb..7b4ce7adab 100644 --- a/src/openrct2/interface/Colour.h +++ b/src/openrct2/interface/Colour.h @@ -253,4 +253,4 @@ uint8_t BlendColours(const uint8_t paletteIndex1, const uint8_t paletteIndex2); #endif typedef uint8_t BlendColourMapType[PALETTE_COUNT][PALETTE_COUNT]; -BlendColourMapType* GetBlendColourMap(); \ No newline at end of file +BlendColourMapType* GetBlendColourMap(); diff --git a/src/openrct2/interface/Fonts.cpp b/src/openrct2/interface/Fonts.cpp index c9e561e026..d32fdff674 100644 --- a/src/openrct2/interface/Fonts.cpp +++ b/src/openrct2/interface/Fonts.cpp @@ -117,10 +117,11 @@ static void LoadSpriteFont(LocalisationService& localisationService) #ifndef NO_TTF static bool LoadFont(LocalisationService& localisationService, TTFFontSetDescriptor* font) { + TTFDispose(); localisationService.UseTrueTypeFont(true); + gCurrentTTFFontSet = font; - TTFDispose(); bool fontInitialised = TTFInitialise(); return fontInitialised; } diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 4781474621..3692ce8ba4 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -211,7 +211,7 @@ static int32_t ConsoleCommandRides(InteractiveConsole& console, const arguments_ auto res = SetOperatingSetting(RideId::FromUnderlying(ride_index), RideSetSetting::RideType, type); if (res == kMoney64Undefined) { - if (!gCheatsAllowArbitraryRideTypeChanges) + if (!GetGameState().Cheats.AllowArbitraryRideTypeChanges) { console.WriteFormatLine( "That didn't work. Try enabling the 'Allow arbitrary ride type changes' cheat"); @@ -668,7 +668,7 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t& } else if (argv[0] == "land_rights_cost") { - console.WriteFormatLine("land_rights_cost %d.%d0", gLandPrice / 10, gLandPrice % 10); + console.WriteFormatLine("land_rights_cost %d.%d0", gameState.LandPrice / 10, gameState.LandPrice % 10); } else if (argv[0] == "construction_rights_cost") { @@ -679,8 +679,7 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t& else if (argv[0] == "climate") { console.WriteFormatLine( - "climate %s (%d)", ClimateNames[static_cast(gameState.Climate)], - static_cast(gameState.Climate)); + "climate %s (%d)", ClimateNames[EnumValue(gameState.Climate)], EnumValue(gameState.Climate)); } else if (argv[0] == "game_speed") { @@ -721,15 +720,15 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t& } else if (argv[0] == "cheat_sandbox_mode") { - console.WriteFormatLine("cheat_sandbox_mode %d", gCheatsSandboxMode); + console.WriteFormatLine("cheat_sandbox_mode %d", GetGameState().Cheats.SandboxMode); } else if (argv[0] == "cheat_disable_clearance_checks") { - console.WriteFormatLine("cheat_disable_clearance_checks %d", gCheatsDisableClearanceChecks); + console.WriteFormatLine("cheat_disable_clearance_checks %d", GetGameState().Cheats.DisableClearanceChecks); } else if (argv[0] == "cheat_disable_support_limits") { - console.WriteFormatLine("cheat_disable_support_limits %d", gCheatsDisableSupportLimits); + console.WriteFormatLine("cheat_disable_support_limits %d", GetGameState().Cheats.DisableSupportLimits); } else if (argv[0] == "current_rotation") { @@ -1111,7 +1110,7 @@ static int32_t ConsoleCommandSet(InteractiveConsole& console, const arguments_t& } else if (argv[0] == "cheat_sandbox_mode" && InvalidArguments(&invalidArgs, int_valid[0])) { - if (gCheatsSandboxMode != (int_val[0] != 0)) + if (GetGameState().Cheats.SandboxMode != (int_val[0] != 0)) { auto cheatSetAction = CheatSetAction(CheatType::SandboxMode, int_val[0] != 0); cheatSetAction.SetCallback([&console](const GameAction*, const GameActions::Result* res) { @@ -1129,7 +1128,7 @@ static int32_t ConsoleCommandSet(InteractiveConsole& console, const arguments_t& } else if (argv[0] == "cheat_disable_clearance_checks" && InvalidArguments(&invalidArgs, int_valid[0])) { - if (gCheatsDisableClearanceChecks != (int_val[0] != 0)) + if (GetGameState().Cheats.DisableClearanceChecks != (int_val[0] != 0)) { auto cheatSetAction = CheatSetAction(CheatType::DisableClearanceChecks, int_val[0] != 0); cheatSetAction.SetCallback([&console](const GameAction*, const GameActions::Result* res) { @@ -1147,7 +1146,7 @@ static int32_t ConsoleCommandSet(InteractiveConsole& console, const arguments_t& } else if (argv[0] == "cheat_disable_support_limits" && InvalidArguments(&invalidArgs, int_valid[0])) { - if (gCheatsDisableSupportLimits != (int_val[0] != 0)) + if (GetGameState().Cheats.DisableSupportLimits != (int_val[0] != 0)) { auto cheatSetAction = CheatSetAction(CheatType::DisableSupportLimits, int_val[0] != 0); cheatSetAction.SetCallback([&console](const GameAction*, const GameActions::Result* res) { @@ -1166,15 +1165,14 @@ static int32_t ConsoleCommandSet(InteractiveConsole& console, const arguments_t& else if (argv[0] == "current_rotation" && InvalidArguments(&invalidArgs, int_valid[0])) { uint8_t currentRotation = GetCurrentRotation(); - WindowBase* mainWindow = WindowGetMain(); int32_t newRotation = int_val[0]; if (newRotation < 0 || newRotation > 3) { console.WriteLineError("Invalid argument. Valid rotations are 0-3."); } - else if (newRotation != currentRotation && mainWindow != nullptr) + else if (newRotation != currentRotation) { - WindowRotateCamera(*mainWindow, newRotation - currentRotation); + ViewportRotateAll(newRotation - currentRotation); } console.Execute("get current_rotation"); } diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index 56e27dcc61..9c649088b3 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -325,6 +325,8 @@ static Viewport GetGiantViewport(int32_t rotation, ZoomLevel zoom) viewport.width = zoom.ApplyInversedTo(viewport.view_width); viewport.height = zoom.ApplyInversedTo(viewport.view_height); viewport.zoom = zoom; + viewport.rotation = rotation; + return viewport; } @@ -498,7 +500,6 @@ int32_t CommandLineForScreenshot(const char** argv, int32_t argc, ScreenshotOpti auto zoom = ZoomLevel{ customZoom }; auto rotation = std::atoi(argv[4]) & 3; viewport = GetGiantViewport(rotation, zoom); - gCurrentRotation = rotation; } else { @@ -554,7 +555,7 @@ int32_t CommandLineForScreenshot(const char** argv, int32_t argc, ScreenshotOpti viewport.viewPos = { coords2d.x - ((viewport.view_width << customZoom) / 2), coords2d.y - ((viewport.view_height << customZoom) / 2) }; viewport.zoom = ZoomLevel{ static_cast(customZoom) }; - gCurrentRotation = customRotation; + viewport.rotation = customRotation; } else { @@ -562,7 +563,7 @@ int32_t CommandLineForScreenshot(const char** argv, int32_t argc, ScreenshotOpti viewport.viewPos = { gameState.SavedView - ScreenCoordsXY{ (viewport.view_width / 2), (viewport.view_height / 2) } }; viewport.zoom = gameState.SavedViewZoom; - gCurrentRotation = gameState.SavedViewRotation; + viewport.rotation = gameState.SavedViewRotation; } } @@ -650,15 +651,13 @@ void CaptureImage(const CaptureOptions& options) viewport.viewPos = { coords2d.x - ((options.Zoom.ApplyTo(viewport.view_width)) / 2), coords2d.y - ((options.Zoom.ApplyTo(viewport.view_height)) / 2) }; viewport.zoom = options.Zoom; + viewport.rotation = options.Rotation; } else { viewport = GetGiantViewport(options.Rotation, options.Zoom); } - auto backupRotation = gCurrentRotation; - gCurrentRotation = options.Rotation; - if (options.Transparent) { viewport.flags |= VIEWPORT_FLAG_TRANSPARENT_BACKGROUND; @@ -669,6 +668,4 @@ void CaptureImage(const CaptureOptions& options) RenderViewport(nullptr, viewport, dpi); WriteDpiToFile(outputPath, dpi, gPalette); ReleaseDPI(dpi); - - gCurrentRotation = backupRotation; } diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index bc6701c459..36d90407f2 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -65,8 +65,6 @@ Viewport* g_music_tracking_viewport; static std::unique_ptr _paintJobs; static std::vector _paintColumns; -uint8_t gCurrentRotation; - static uint32_t _currentImageType; InteractionInfo::InteractionInfo(const PaintStruct* ps) : Loc(ps->MapPos) @@ -75,7 +73,14 @@ InteractionInfo::InteractionInfo(const PaintStruct* ps) , SpriteType(ps->InteractionItem) { } + static void ViewportPaintWeatherGloom(DrawPixelInfo& dpi); +static void ViewportPaint(const Viewport* viewport, DrawPixelInfo& dpi, const ScreenRect& screenRect); +static void ViewportUpdateFollowSprite(WindowBase* window); +static void ViewportUpdateSmartFollowEntity(WindowBase* window); +static void ViewportUpdateSmartFollowStaff(WindowBase* window, const Staff& peep); +static void ViewportUpdateSmartFollowVehicle(WindowBase* window); +static void ViewportInvalidate(const Viewport* viewport, const ScreenRect& screenRect); /** * This is not a viewport function. It is used to setup many variables for @@ -122,7 +127,7 @@ std::optional centre_2d_coordinates(const CoordsXYZ& loc, Viewpo return std::nullopt; } - auto screenCoord = Translate3DTo2DWithZ(GetCurrentRotation(), loc); + auto screenCoord = Translate3DTo2DWithZ(viewport->rotation, loc); screenCoord.x -= viewport->view_width / 2; screenCoord.y -= viewport->view_height / 2; return { screenCoord }; @@ -190,6 +195,7 @@ void ViewportCreate(WindowBase* w, const ScreenCoordsXY& screenCoords, int32_t w viewport->view_height = zoom.ApplyTo(height); viewport->zoom = zoom; viewport->flags = 0; + viewport->rotation = GetCurrentRotation(); if (gConfigGeneral.AlwaysShowGridlines) viewport->flags |= VIEWPORT_FLAG_GRIDLINES; @@ -227,6 +233,53 @@ void ViewportRemove(Viewport* viewport) _viewports.erase(it); } +static Viewport* ViewportGetMain() +{ + auto mainWindow = WindowGetMain(); + if (mainWindow == nullptr) + { + return nullptr; + } + return mainWindow->viewport; +} + +void ViewportsInvalidate(int32_t x, int32_t y, int32_t z0, int32_t z1, ZoomLevel maxZoom) +{ + for (auto& vp : _viewports) + { + if (maxZoom == ZoomLevel{ -1 } || vp.zoom <= ZoomLevel{ maxZoom }) + { + int32_t x1, y1, x2, y2; + + x += 16; + y += 16; + auto screenCoord = Translate3DTo2DWithZ(vp.rotation, CoordsXYZ{ x, y, 0 }); + + x1 = screenCoord.x - 32; + y1 = screenCoord.y - 32 - z1; + x2 = screenCoord.x + 32; + y2 = screenCoord.y + 32 - z0; + + ViewportInvalidate(&vp, ScreenRect{ { x1, y1 }, { x2, y2 } }); + } + } +} + +void ViewportsInvalidate(const CoordsXYZ& pos, int32_t width, int32_t minHeight, int32_t maxHeight, ZoomLevel maxZoom) +{ + for (auto& vp : _viewports) + { + if (maxZoom == ZoomLevel{ -1 } || vp.zoom <= ZoomLevel{ maxZoom }) + { + auto screenCoords = Translate3DTo2DWithZ(vp.rotation, pos); + auto screenPos = ScreenRect( + screenCoords - ScreenCoordsXY{ width, minHeight }, screenCoords + ScreenCoordsXY{ width, maxHeight }); + + ViewportInvalidate(&vp, screenPos); + } + } +} + void ViewportsInvalidate(const ScreenRect& screenRect, ZoomLevel maxZoom) { for (auto& vp : _viewports) @@ -244,15 +297,14 @@ void ViewportsInvalidate(const ScreenRect& screenRect, ZoomLevel maxZoom) * edx is assumed to be (and always is) the current rotation, so it is not * needed as parameter. */ -CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords) +CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords, uint8_t rotation) { int32_t height = 0; - uint32_t rotation = GetCurrentRotation(); CoordsXY pos{}; for (int32_t i = 0; i < 6; i++) { - pos = ViewportPosToMapPos(startCoords, height); + pos = ViewportPosToMapPos(startCoords, height, rotation); height = TileElementHeight(pos); // HACK: This is to prevent the x and y values being set to values outside @@ -565,7 +617,7 @@ static void ViewportSetUndergroundFlag(int32_t underground, WindowBase* window, */ void ViewportUpdatePosition(WindowBase* window) { - WindowEventResizeCall(window); + window->OnResize(); Viewport* viewport = window->viewport; if (viewport == nullptr) @@ -587,18 +639,18 @@ void ViewportUpdatePosition(WindowBase* window) auto viewportMidPoint = ScreenCoordsXY{ window->savedViewPos.x + viewport->view_width / 2, window->savedViewPos.y + viewport->view_height / 2 }; - auto mapCoord = ViewportPosToMapPos(viewportMidPoint, 0); + auto mapCoord = ViewportPosToMapPos(viewportMidPoint, 0, viewport->rotation); // Clamp to the map minimum value int32_t at_map_edge = 0; - if (mapCoord.x < MAP_MINIMUM_X_Y) + if (mapCoord.x < kMapMinimumXY) { - mapCoord.x = MAP_MINIMUM_X_Y; + mapCoord.x = kMapMinimumXY; at_map_edge = 1; } - if (mapCoord.y < MAP_MINIMUM_X_Y) + if (mapCoord.y < kMapMinimumXY) { - mapCoord.y = MAP_MINIMUM_X_Y; + mapCoord.y = kMapMinimumXY; at_map_edge = 1; } @@ -707,13 +759,25 @@ void ViewportUpdateSmartFollowEntity(WindowBase* window) break; case EntityType::Guest: - ViewportUpdateSmartFollowGuest(window, entity->As()); + { + auto* guest = entity->As(); + if (guest == nullptr) + { + return; + } + ViewportUpdateSmartFollowGuest(window, *guest); break; - + } case EntityType::Staff: - ViewportUpdateSmartFollowStaff(window, entity->As()); + { + auto* staff = entity->As(); + if (staff == nullptr) + { + return; + } + ViewportUpdateSmartFollowStaff(window, *staff); break; - + } default: // All other types don't need any "smart" following; steam particle, duck, money effect, etc. window->focus = Focus(window->viewport_smart_follow_sprite); window->viewport_target_sprite = window->viewport_smart_follow_sprite; @@ -721,12 +785,12 @@ void ViewportUpdateSmartFollowEntity(WindowBase* window) } } -void ViewportUpdateSmartFollowGuest(WindowBase* window, const Guest* peep) +void ViewportUpdateSmartFollowGuest(WindowBase* window, const Guest& peep) { - Focus focus = Focus(peep->Id); - window->viewport_target_sprite = peep->Id; + Focus focus = Focus(peep.Id); + window->viewport_target_sprite = peep.Id; - if (peep->State == PeepState::Picked) + if (peep.State == PeepState::Picked) { window->viewport_smart_follow_sprite = EntityId::GetNull(); window->viewport_target_sprite = EntityId::GetNull(); @@ -735,16 +799,16 @@ void ViewportUpdateSmartFollowGuest(WindowBase* window, const Guest* peep) } bool overallFocus = true; - if (peep->State == PeepState::OnRide || peep->State == PeepState::EnteringRide - || (peep->State == PeepState::LeavingRide && peep->x == LOCATION_NULL)) + if (peep.State == PeepState::OnRide || peep.State == PeepState::EnteringRide + || (peep.State == PeepState::LeavingRide && peep.x == LOCATION_NULL)) { - auto ride = GetRide(peep->CurrentRide); + auto ride = GetRide(peep.CurrentRide); if (ride != nullptr && (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) { - auto train = GetEntity(ride->vehicles[peep->CurrentTrain]); + auto train = GetEntity(ride->vehicles[peep.CurrentTrain]); if (train != nullptr) { - const auto car = train->GetCar(peep->CurrentCar); + const auto car = train->GetCar(peep.CurrentCar); if (car != nullptr) { focus = Focus(car->Id); @@ -755,9 +819,9 @@ void ViewportUpdateSmartFollowGuest(WindowBase* window, const Guest* peep) } } - if (peep->x == LOCATION_NULL && overallFocus) + if (peep.x == LOCATION_NULL && overallFocus) { - auto ride = GetRide(peep->CurrentRide); + auto ride = GetRide(peep.CurrentRide); if (ride != nullptr) { auto xy = ride->overall_view.ToTileCentre(); @@ -773,9 +837,9 @@ void ViewportUpdateSmartFollowGuest(WindowBase* window, const Guest* peep) window->focus = focus; } -void ViewportUpdateSmartFollowStaff(WindowBase* window, const Staff* peep) +void ViewportUpdateSmartFollowStaff(WindowBase* window, const Staff& peep) { - if (peep->State == PeepState::Picked) + if (peep.State == PeepState::Picked) { window->viewport_smart_follow_sprite = EntityId::GetNull(); window->viewport_target_sprite = EntityId::GetNull(); @@ -793,6 +857,65 @@ void ViewportUpdateSmartFollowVehicle(WindowBase* window) window->viewport_target_sprite = window->viewport_smart_follow_sprite; } +static void ViewportRotateSingleInternal(WindowBase& w, int32_t direction) +{ + auto* viewport = w.viewport; + if (viewport == nullptr) + return; + + auto windowPos = ScreenCoordsXY{ (viewport->width >> 1), (viewport->height >> 1) } + viewport->pos; + + // has something to do with checking if middle of the viewport is obstructed + Viewport* other; + auto mapXYCoords = ScreenGetMapXY(windowPos, &other); + CoordsXYZ coords{}; + + // other != viewport probably triggers on viewports in ride or guest window? + // naoXYCoords is nullopt if middle of viewport is obstructed by another window? + if (!mapXYCoords.has_value() || other != viewport) + { + auto viewPos = ScreenCoordsXY{ (viewport->view_width >> 1), (viewport->view_height >> 1) } + viewport->viewPos; + + coords = ViewportAdjustForMapHeight(viewPos, viewport->rotation); + } + else + { + coords.x = mapXYCoords->x; + coords.y = mapXYCoords->y; + coords.z = TileElementHeight(coords); + } + + viewport->rotation = (viewport->rotation + direction) & 3; + + auto centreLoc = centre_2d_coordinates(coords, viewport); + + if (centreLoc.has_value()) + { + w.savedViewPos = centreLoc.value(); + viewport->viewPos = *centreLoc; + } + + w.Invalidate(); + w.OnViewportRotate(); +} + +void ViewportRotateSingle(WindowBase* window, int32_t direction) +{ + ViewportRotateSingleInternal(*window, direction); +} + +void ViewportRotateAll(int32_t direction) +{ + WindowVisitEach([direction](WindowBase* w) { + auto* viewport = w->viewport; + if (viewport == nullptr) + return; + if (viewport->flags & VIEWPORT_FLAG_INDEPEDENT_ROTATION) + return; + ViewportRotateSingleInternal(*w, direction); + }); +} + /** * * rct2: 0x00685C02 @@ -864,7 +987,7 @@ static void ViewportPaintColumn(PaintSession& session) { colour = COLOUR_BLACK; } - GfxClear(&session.DPI, colour); + GfxClear(session.DPI, colour); } PaintDrawStructs(session); @@ -891,7 +1014,7 @@ static void ViewportPaintColumn(PaintSession& session) * edi: dpi * ebp: bottom */ -void ViewportPaint(const Viewport* viewport, DrawPixelInfo& dpi, const ScreenRect& screenRect) +static void ViewportPaint(const Viewport* viewport, DrawPixelInfo& dpi, const ScreenRect& screenRect) { PROFILED_FUNCTION(); @@ -952,7 +1075,7 @@ void ViewportPaint(const Viewport* viewport, DrawPixelInfo& dpi, const ScreenRec // Generate and sort columns. for (x = alignedX; x < rightBorder; x += 32) { - PaintSession* session = PaintSessionAlloc(dpi1, viewFlags); + PaintSession* session = PaintSessionAlloc(dpi1, viewFlags, viewport->rotation); _paintColumns.push_back(session); DrawPixelInfo& dpi2 = session->DPI; @@ -1091,11 +1214,11 @@ void Viewport::Invalidate() const ViewportInvalidate(this, { viewPos, viewPos + ScreenCoordsXY{ view_width, view_height } }); } -CoordsXY ViewportPosToMapPos(const ScreenCoordsXY& coords, int32_t z) +CoordsXY ViewportPosToMapPos(const ScreenCoordsXY& coords, int32_t z, uint8_t rotation) { // Reverse of Translate3DTo2DWithZ CoordsXY ret = { coords.y - coords.x / 2 + z, coords.y + coords.x / 2 + z }; - auto inverseRotation = DirectionFlipXAxis(GetCurrentRotation()); + auto inverseRotation = DirectionFlipXAxis(rotation); return ret.Rotate(inverseRotation); } @@ -1819,31 +1942,31 @@ InteractionInfo GetMapCoordinatesFromPosWindow(WindowBase* window, const ScreenC return info; } - Viewport* myviewport = window->viewport; + Viewport* viewport = window->viewport; auto viewLoc = screenCoords; - viewLoc -= myviewport->pos; - if (viewLoc.x >= 0 && viewLoc.x < static_cast(myviewport->width) && viewLoc.y >= 0 - && viewLoc.y < static_cast(myviewport->height)) + viewLoc -= viewport->pos; + if (viewLoc.x >= 0 && viewLoc.x < static_cast(viewport->width) && viewLoc.y >= 0 + && viewLoc.y < static_cast(viewport->height)) { - viewLoc.x = myviewport->zoom.ApplyTo(viewLoc.x); - viewLoc.y = myviewport->zoom.ApplyTo(viewLoc.y); - viewLoc += myviewport->viewPos; - if (myviewport->zoom > ZoomLevel{ 0 }) + viewLoc.x = viewport->zoom.ApplyTo(viewLoc.x); + viewLoc.y = viewport->zoom.ApplyTo(viewLoc.y); + viewLoc += viewport->viewPos; + if (viewport->zoom > ZoomLevel{ 0 }) { - viewLoc.x &= myviewport->zoom.ApplyTo(0xFFFFFFFF) & 0xFFFFFFFF; - viewLoc.y &= myviewport->zoom.ApplyTo(0xFFFFFFFF) & 0xFFFFFFFF; + viewLoc.x &= viewport->zoom.ApplyTo(0xFFFFFFFF) & 0xFFFFFFFF; + viewLoc.y &= viewport->zoom.ApplyTo(0xFFFFFFFF) & 0xFFFFFFFF; } DrawPixelInfo dpi; dpi.x = viewLoc.x; dpi.y = viewLoc.y; dpi.height = 1; - dpi.zoom_level = myviewport->zoom; + dpi.zoom_level = viewport->zoom; dpi.width = 1; - PaintSession* session = PaintSessionAlloc(dpi, myviewport->flags); + PaintSession* session = PaintSessionAlloc(dpi, viewport->flags, viewport->rotation); PaintSessionGenerate(*session); PaintSessionArrange(*session); - info = SetInteractionInfoFromPaintSession(session, myviewport->flags, flags & 0xFFFF); + info = SetInteractionInfoFromPaintSession(session, viewport->flags, flags & 0xFFFF); PaintSessionFree(session); } return info; @@ -1944,7 +2067,7 @@ std::optional ScreenGetMapXY(const ScreenCoordsXY& screenCoords, Viewp for (int32_t i = 0; i < 5; i++) { int32_t z = TileElementHeight(cursorMapPos); - cursorMapPos = ViewportPosToMapPos(start_vp_pos, z); + cursorMapPos = ViewportPosToMapPos(start_vp_pos, z, myViewport->rotation); cursorMapPos.x = std::clamp(cursorMapPos.x, info.Loc.x, info.Loc.x + 31); cursorMapPos.y = std::clamp(cursorMapPos.y, info.Loc.y, info.Loc.y + 31); } @@ -1968,7 +2091,7 @@ std::optional ScreenGetMapXYWithZ(const ScreenCoordsXY& screenCoords, } auto vpCoords = viewport->ScreenToViewportCoord(screenCoords); - auto mapPosition = ViewportPosToMapPos(vpCoords, z); + auto mapPosition = ViewportPosToMapPos(vpCoords, z, viewport->rotation); if (!MapIsLocationValid(mapPosition)) { return std::nullopt; @@ -2043,7 +2166,13 @@ std::optional ScreenGetMapXYSideWithZ(const ScreenCoordsXY& screenCoor */ uint8_t GetCurrentRotation() { - uint8_t rotation = gCurrentRotation; + auto* viewport = ViewportGetMain(); + if (viewport == nullptr) + { + LOG_VERBOSE("No viewport found! Will return 0."); + return 0; + } + uint8_t rotation = viewport->rotation; uint8_t rotation_masked = rotation & 3; #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (rotation != rotation_masked) @@ -2081,7 +2210,7 @@ void ViewportSetSavedView() gameState.SavedView = ScreenCoordsXY{ viewport->view_width / 2, viewport->view_height / 2 } + viewport->viewPos; gameState.SavedViewZoom = viewport->zoom; - gameState.SavedViewRotation = GetCurrentRotation(); + gameState.SavedViewRotation = viewport->rotation; } } diff --git a/src/openrct2/interface/Viewport.h b/src/openrct2/interface/Viewport.h index d206a672a8..5287e2bb4d 100644 --- a/src/openrct2/interface/Viewport.h +++ b/src/openrct2/interface/Viewport.h @@ -28,40 +28,44 @@ struct PaintEntry; // Flags must currenly retain their values to avoid breaking plugins. // Values can be changed when plugins move to using named constants. -enum +enum : uint32_t { - VIEWPORT_FLAG_GRIDLINES = (1 << 7), - VIEWPORT_FLAG_UNDERGROUND_INSIDE = (1 << 0), - VIEWPORT_FLAG_HIDE_BASE = (1 << 12), - VIEWPORT_FLAG_HIDE_VERTICAL = (1 << 13), + VIEWPORT_FLAG_NONE = 0U, - VIEWPORT_FLAG_SOUND_ON = (1 << 10), - VIEWPORT_FLAG_LAND_OWNERSHIP = (1 << 8), - VIEWPORT_FLAG_CONSTRUCTION_RIGHTS = (1 << 9), - VIEWPORT_FLAG_HIDE_ENTITIES = (1 << 14), - VIEWPORT_FLAG_CLIP_VIEW = (1 << 17), - VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES = (1 << 18), - VIEWPORT_FLAG_TRANSPARENT_BACKGROUND = (1 << 19), + VIEWPORT_FLAG_GRIDLINES = (1U << 7), + VIEWPORT_FLAG_UNDERGROUND_INSIDE = (1U << 0), + VIEWPORT_FLAG_HIDE_BASE = (1U << 12), + VIEWPORT_FLAG_HIDE_VERTICAL = (1U << 13), - VIEWPORT_FLAG_LAND_HEIGHTS = (1 << 4), - VIEWPORT_FLAG_TRACK_HEIGHTS = (1 << 5), - VIEWPORT_FLAG_PATH_HEIGHTS = (1 << 6), + VIEWPORT_FLAG_SOUND_ON = (1U << 10), + VIEWPORT_FLAG_LAND_OWNERSHIP = (1U << 8), + VIEWPORT_FLAG_CONSTRUCTION_RIGHTS = (1U << 9), + VIEWPORT_FLAG_HIDE_ENTITIES = (1U << 14), + VIEWPORT_FLAG_CLIP_VIEW = (1U << 17), + VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES = (1U << 18), + VIEWPORT_FLAG_TRANSPARENT_BACKGROUND = (1U << 19), - VIEWPORT_FLAG_HIDE_RIDES = (1 << 1), - VIEWPORT_FLAG_HIDE_VEHICLES = (1 << 20), - VIEWPORT_FLAG_HIDE_VEGETATION = (1 << 21), - VIEWPORT_FLAG_HIDE_SCENERY = (1 << 2), - VIEWPORT_FLAG_HIDE_PATHS = (1 << 16), - VIEWPORT_FLAG_HIDE_SUPPORTS = (1 << 3), - VIEWPORT_FLAG_HIDE_GUESTS = (1 << 11), - VIEWPORT_FLAG_HIDE_STAFF = (1 << 23), + VIEWPORT_FLAG_LAND_HEIGHTS = (1U << 4), + VIEWPORT_FLAG_TRACK_HEIGHTS = (1U << 5), + VIEWPORT_FLAG_PATH_HEIGHTS = (1U << 6), - VIEWPORT_FLAG_INVISIBLE_RIDES = (1 << 24), - VIEWPORT_FLAG_INVISIBLE_VEHICLES = (1 << 25), - VIEWPORT_FLAG_INVISIBLE_VEGETATION = (1 << 26), - VIEWPORT_FLAG_INVISIBLE_SCENERY = (1 << 27), - VIEWPORT_FLAG_INVISIBLE_PATHS = (1 << 28), - VIEWPORT_FLAG_INVISIBLE_SUPPORTS = (1 << 29), + VIEWPORT_FLAG_HIDE_RIDES = (1U << 1), + VIEWPORT_FLAG_HIDE_VEHICLES = (1U << 20), + VIEWPORT_FLAG_HIDE_VEGETATION = (1U << 21), + VIEWPORT_FLAG_HIDE_SCENERY = (1U << 2), + VIEWPORT_FLAG_HIDE_PATHS = (1U << 16), + VIEWPORT_FLAG_HIDE_SUPPORTS = (1U << 3), + VIEWPORT_FLAG_HIDE_GUESTS = (1U << 11), + VIEWPORT_FLAG_HIDE_STAFF = (1U << 23), + + VIEWPORT_FLAG_INVISIBLE_RIDES = (1U << 24), + VIEWPORT_FLAG_INVISIBLE_VEHICLES = (1U << 25), + VIEWPORT_FLAG_INVISIBLE_VEGETATION = (1U << 26), + VIEWPORT_FLAG_INVISIBLE_SCENERY = (1U << 27), + VIEWPORT_FLAG_INVISIBLE_PATHS = (1U << 28), + VIEWPORT_FLAG_INVISIBLE_SUPPORTS = (1U << 29), + + VIEWPORT_FLAG_INDEPEDENT_ROTATION = (1U << 30), }; enum class VisibilityKind @@ -123,25 +127,23 @@ extern uint8_t gShowConstructionRightsRefCount; // rct2: 0x014234BC extern Viewport* g_music_tracking_viewport; -extern uint8_t gCurrentRotation; - void ViewportInitAll(); std::optional centre_2d_coordinates(const CoordsXYZ& loc, Viewport* viewport); void ViewportCreate(WindowBase* w, const ScreenCoordsXY& screenCoords, int32_t width, int32_t height, const Focus& focus); void ViewportRemove(Viewport* viewport); + +void ViewportsInvalidate(int32_t x, int32_t y, int32_t z0, int32_t z1, ZoomLevel maxZoom); +void ViewportsInvalidate(const CoordsXYZ& pos, int32_t width, int32_t minHeight, int32_t maxHeight, ZoomLevel maxZoom); void ViewportsInvalidate(const ScreenRect& screenRect, ZoomLevel maxZoom = ZoomLevel{ -1 }); void ViewportUpdatePosition(WindowBase* window); -void ViewportUpdateFollowSprite(WindowBase* window); -void ViewportUpdateSmartFollowEntity(WindowBase* window); -void ViewportUpdateSmartFollowGuest(WindowBase* window, const Guest* peep); -void ViewportUpdateSmartFollowStaff(WindowBase* window, const Staff* peep); -void ViewportUpdateSmartFollowVehicle(WindowBase* window); +void ViewportUpdateSmartFollowGuest(WindowBase* window, const Guest& peep); +void ViewportRotateSingle(WindowBase* window, int32_t direction); +void ViewportRotateAll(int32_t direction); void ViewportRender(DrawPixelInfo& dpi, const Viewport* viewport, const ScreenRect& screenRect); -void ViewportPaint(const Viewport* viewport, DrawPixelInfo& dpi, const ScreenRect& screenRect); -CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords); +CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords, uint8_t rotation); -CoordsXY ViewportPosToMapPos(const ScreenCoordsXY& coords, int32_t z); +CoordsXY ViewportPosToMapPos(const ScreenCoordsXY& coords, int32_t z, uint8_t rotation); std::optional ScreenPosToMapPos(const ScreenCoordsXY& screenCoords, int32_t* direction); void ShowGridlines(); @@ -156,17 +158,13 @@ InteractionInfo GetMapCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int InteractionInfo GetMapCoordinatesFromPosWindow(WindowBase* window, const ScreenCoordsXY& screenCoords, int32_t flags); InteractionInfo SetInteractionInfoFromPaintSession(PaintSession* session, uint32_t viewFlags, uint16_t filter); -InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoords); bool ViewportInteractionLeftOver(const ScreenCoordsXY& screenCoords); bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords); -InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoords); bool ViewportInteractionRightOver(const ScreenCoordsXY& screenCoords); bool ViewportInteractionRightClick(const ScreenCoordsXY& screenCoords); CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoords); -void ViewportInvalidate(const Viewport* viewport, const ScreenRect& screenRect); - std::optional ScreenGetMapXY(const ScreenCoordsXY& screenCoords, Viewport** viewport); std::optional ScreenGetMapXYWithZ(const ScreenCoordsXY& screenCoords, int32_t z); std::optional ScreenGetMapXYQuadrant(const ScreenCoordsXY& screenCoords, uint8_t* quadrant); diff --git a/src/openrct2/interface/Widget.h b/src/openrct2/interface/Widget.h index 73bd1149f9..2f387ee342 100644 --- a/src/openrct2/interface/Widget.h +++ b/src/openrct2/interface/Widget.h @@ -9,8 +9,6 @@ #pragma once -#include "../drawing/Drawing.h" -#include "../localisation/StringIds.h" #include "Window.h" enum class WindowWidgetType : uint8_t @@ -41,9 +39,6 @@ enum class WindowWidgetType : uint8_t Last = 26, }; -constexpr auto WIDGETS_END = Widget{ WindowWidgetType::Last, 0, 0, 0, 0, 0, 0, 0 }; -#define BAR_BLINK (1u << 31) - enum { SCROLL_HORIZONTAL = (1 << 0), @@ -51,133 +46,4 @@ enum SCROLL_BOTH = SCROLL_HORIZONTAL | SCROLL_VERTICAL }; -enum class WindowColour : uint8_t -{ - Primary, - Secondary, - Tertiary, - Quaternary, -}; - -constexpr uint8_t SCROLLBAR_WIDTH = 10; - -constexpr ScreenSize TAB_SIZE = { 31, 27 }; - -constexpr Widget MakeWidget( - const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, - uint32_t content = 0xFFFFFFFF, StringId tooltip = STR_NONE) -{ - Widget out = {}; - out.left = origin.x; - out.right = origin.x + size.width - 1; - out.top = origin.y; - out.bottom = origin.y + size.height - 1; - out.type = type; - out.colour = static_cast(colour); - out.content = content; - out.tooltip = tooltip; - - return out; -} - -constexpr Widget MakeWidget( - const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, ImageId image, - StringId tooltip = STR_NONE) -{ - Widget out = {}; - out.left = origin.x; - out.right = origin.x + size.width - 1; - out.top = origin.y; - out.bottom = origin.y + size.height - 1; - out.type = type; - out.colour = static_cast(colour); - out.image = image; - out.tooltip = tooltip; - - return out; -} - -constexpr Widget MakeRemapWidget( - const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, ImageIndex content, - StringId tooltip = STR_NONE) -{ - return MakeWidget(origin, size, type, colour, ImageId(content, FilterPaletteID::PaletteNull), tooltip); -} - -constexpr Widget MakeTab(const ScreenCoordsXY& origin, StringId tooltip = STR_NONE) -{ - const ScreenSize size = TAB_SIZE; - const WindowWidgetType type = WindowWidgetType::Tab; - const WindowColour colour = WindowColour::Secondary; - const auto content = ImageId(ImageIndexUndefined); - - return MakeWidget(origin, size, type, colour, content, tooltip); -} - -#define MakeSpinnerWidgets(...) \ - MakeWidget(__VA_ARGS__), MakeSpinnerIncreaseWidget(__VA_ARGS__), MakeSpinnerDecreaseWidget(__VA_ARGS__) - -constexpr Widget MakeSpinnerDecreaseWidget( - const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour, - [[maybe_unused]] uint32_t content = 0xFFFFFFFF, StringId tooltip = STR_NONE) -{ - const int16_t xPos = origin.x + size.width - 26; - const int16_t yPos = origin.y + 1; - const uint16_t width = 13; - const uint16_t height = size.height - 2; - - return MakeWidget({ xPos, yPos }, { width, height }, WindowWidgetType::Button, colour, STR_NUMERIC_DOWN, tooltip); -} - -constexpr Widget MakeSpinnerIncreaseWidget( - const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour, - [[maybe_unused]] uint32_t content = 0xFFFFFFFF, StringId tooltip = STR_NONE) -{ - const int16_t xPos = origin.x + size.width - 13; - const int16_t yPos = origin.y + 1; - const uint16_t width = 12; - const uint16_t height = size.height - 2; - - return MakeWidget({ xPos, yPos }, { width, height }, WindowWidgetType::Button, colour, STR_NUMERIC_UP, tooltip); -} - -#define MakeDropdownWidgets(...) MakeDropdownBoxWidget(__VA_ARGS__), MakeDropdownButtonWidget(__VA_ARGS__) - -constexpr Widget MakeDropdownBoxWidget( - const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour, - [[maybe_unused]] uint32_t content = 0xFFFFFFFF, StringId tooltip = STR_NONE) -{ - return MakeWidget(origin, size, type, colour, content); -} - -constexpr Widget MakeDropdownButtonWidget( - const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour, - [[maybe_unused]] uint32_t content = 0xFFFFFFFF, StringId tooltip = STR_NONE) -{ - const int16_t xPos = origin.x + size.width - 11; - const int16_t yPos = origin.y + 1; - const uint16_t width = 11; - const uint16_t height = 10; - - return MakeWidget({ xPos, yPos }, { width, height }, WindowWidgetType::Button, colour, STR_DROPDOWN_GLYPH, tooltip); -} - void WidgetScrollUpdateThumbs(WindowBase& w, WidgetIndex widget_index); -void WidgetDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widgetIndex); - -bool WidgetIsDisabled(const WindowBase& w, WidgetIndex widgetIndex); -bool WidgetIsHoldable(const WindowBase& w, WidgetIndex widgetIndex); -bool WidgetIsVisible(const WindowBase& w, WidgetIndex widgetIndex); -bool WidgetIsPressed(const WindowBase& w, WidgetIndex widgetIndex); -bool WidgetIsHighlighted(const WindowBase& w, WidgetIndex widgetIndex); -bool WidgetIsActiveTool(const WindowBase& w, WidgetIndex widgetIndex); -void WidgetScrollGetPart( - WindowBase& w, const Widget* widget, const ScreenCoordsXY& screenCoords, ScreenCoordsXY& retScreenCoords, - int32_t* output_scroll_area, int32_t* scroll_id); - -void WidgetSetEnabled(WindowBase& w, WidgetIndex widgetIndex, bool enabled); -void WidgetSetDisabled(WindowBase& w, WidgetIndex widgetIndex, bool value); -void WidgetSetHoldable(WindowBase& w, WidgetIndex widgetIndex, bool value); -void WidgetSetVisible(WindowBase& w, WidgetIndex widgetIndex, bool value); -void WidgetSetPressed(WindowBase& w, WidgetIndex widgetIndex, bool value); -void WidgetSetCheckboxValue(WindowBase& w, WidgetIndex widgetIndex, bool value); diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index c6c764edab..b1f34b9fb6 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -114,7 +114,7 @@ void WindowVisitEach(std::function func) void WindowDispatchUpdateAll() { // gTooltipNotShownTicks++; - WindowVisitEach([&](WindowBase* w) { WindowEventUpdateCall(w); }); + WindowVisitEach([&](WindowBase* w) { w->OnUpdate(); }); } void WindowUpdateAllViewports() @@ -140,7 +140,7 @@ void WindowUpdateAll() { gWindowUpdateTicks = gCurrentRealTimeTicks + kGameUpdateFPS; - WindowVisitEach([](WindowBase* w) { WindowEventPeriodicUpdateCall(w); }); + WindowVisitEach([](WindowBase* w) { w->OnPeriodicUpdate(); }); } // Border flash invalidation @@ -159,6 +159,11 @@ void WindowUpdateAll() windowManager->UpdateMouseWheel(); } +void WindowNotifyLanguageChange() +{ + WindowVisitEach([&](WindowBase* w) { w->OnLanguageChange(); }); +} + static void WindowCloseSurplus(int32_t cap, WindowClass avoid_classification) { // find the amount of windows that are currently open @@ -213,7 +218,7 @@ void WindowSetWindowLimit(int32_t value) */ void WindowClose(WindowBase& w) { - WindowEventCloseCall(&w); + w.OnClose(); // Remove viewport w.RemoveViewport(); @@ -422,7 +427,7 @@ WindowBase* WindowFindFromPoint(const ScreenCoordsXY& screenCoords) WidgetIndex WindowFindWidgetFromPoint(WindowBase& w, const ScreenCoordsXY& screenCoords) { // Invalidate the window - WindowEventOnPrepareDrawCall(&w); + w.OnPrepareDraw(); // Find the widget at point x, y WidgetIndex widget_index = -1; @@ -584,9 +589,10 @@ void WindowUpdateScrollWidgets(WindowBase& w) continue; auto& scroll = w.scrolls[scrollIndex]; - width = 0; - height = 0; - WindowGetScrollSize(&w, scrollIndex, &width, &height); + ScreenSize scrollSize = w.OnScrollGetSize(scrollIndex); + width = scrollSize.width; + height = scrollSize.height; + if (height == 0) { scroll.v_top = 0; @@ -830,7 +836,7 @@ void WindowScrollToLocation(WindowBase& w, const CoordsXYZ& coords) } } - auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), coords); + auto screenCoords = Translate3DTo2DWithZ(w.viewport->rotation, coords); int32_t i = 0; if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) @@ -883,66 +889,6 @@ void WindowScrollToLocation(WindowBase& w, const CoordsXYZ& coords) } } -/** - * - * rct2: 0x00688956 - */ -static void call_event_viewport_rotate_on_all_windows() -{ - WindowVisitEach([](WindowBase* w) { WindowEventViewportRotateCall(w); }); -} - -/** - * - * rct2: 0x0068881A - * direction can be used to alter the camera rotation: - * 1: clockwise - * -1: anti-clockwise - */ -void WindowRotateCamera(WindowBase& w, int32_t direction) -{ - Viewport* viewport = w.viewport; - if (viewport == nullptr) - return; - - auto windowPos = ScreenCoordsXY{ (viewport->width >> 1), (viewport->height >> 1) } + viewport->pos; - - // has something to do with checking if middle of the viewport is obstructed - Viewport* other; - auto mapXYCoords = ScreenGetMapXY(windowPos, &other); - CoordsXYZ coords{}; - - // other != viewport probably triggers on viewports in ride or guest window? - // naoXYCoords is nullopt if middle of viewport is obstructed by another window? - if (!mapXYCoords.has_value() || other != viewport) - { - auto viewPos = ScreenCoordsXY{ (viewport->view_width >> 1), (viewport->view_height >> 1) } + viewport->viewPos; - - coords = ViewportAdjustForMapHeight(viewPos); - } - else - { - coords.x = mapXYCoords->x; - coords.y = mapXYCoords->y; - coords.z = TileElementHeight(coords); - } - - gCurrentRotation = (GetCurrentRotation() + direction) & 3; - - auto centreLoc = centre_2d_coordinates(coords, viewport); - - if (centreLoc.has_value()) - { - w.savedViewPos = centreLoc.value(); - viewport->viewPos = *centreLoc; - } - - w.Invalidate(); - - call_event_viewport_rotate_on_all_windows(); - ResetAllSpriteQuadrantPlacements(); -} - void WindowViewportGetMapCoordsByCursor( const WindowBase& w, int32_t* map_x, int32_t* map_y, int32_t* offset_x, int32_t* offset_y) { @@ -951,8 +897,8 @@ void WindowViewportGetMapCoordsByCursor( // Compute map coordinate by mouse position. auto viewportPos = w.viewport->ScreenToViewportCoord(mouseCoords); - auto coordsXYZ = ViewportAdjustForMapHeight(viewportPos); - auto mapCoords = ViewportPosToMapPos(viewportPos, coordsXYZ.z); + auto coordsXYZ = ViewportAdjustForMapHeight(viewportPos, w.viewport->rotation); + auto mapCoords = ViewportPosToMapPos(viewportPos, coordsXYZ.z, w.viewport->rotation); *map_x = mapCoords.x; *map_y = mapCoords.y; @@ -1236,7 +1182,7 @@ static void WindowDrawSingle(DrawPixelInfo& dpi, WindowBase& w, int32_t left, in // Invalidate modifies the window colours so first get the correct // colour before setting the global variables for the string painting - WindowEventOnPrepareDrawCall(&w); + w.OnPrepareDraw(); // Text colouring gCurrentWindowColours[0] = NOT_TRANSLUCENT(w.colours[0]); @@ -1244,7 +1190,7 @@ static void WindowDrawSingle(DrawPixelInfo& dpi, WindowBase& w, int32_t left, in gCurrentWindowColours[2] = NOT_TRANSLUCENT(w.colours[2]); gCurrentWindowColours[3] = NOT_TRANSLUCENT(w.colours[3]); - WindowEventOnDrawCall(&w, copy); + w.OnDraw(copy); } /** @@ -1295,8 +1241,8 @@ void WindowResize(WindowBase& w, int32_t dw, int32_t dh) w.width = std::clamp(w.width + dw, w.min_width, w.max_width); w.height = std::clamp(w.height + dh, w.min_height, w.max_height); - WindowEventResizeCall(&w); - WindowEventOnPrepareDrawCall(&w); + w.OnResize(); + w.OnPrepareDraw(); // Update scroll widgets for (auto& scroll : w.scrolls) @@ -1388,143 +1334,11 @@ void ToolCancel() // Abort tool event WindowBase* w = WindowFindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number); if (w != nullptr) - WindowEventToolAbortCall(w, gCurrentToolWidget.widget_index); + w->OnToolAbort(gCurrentToolWidget.widget_index); } } } -void WindowEventCloseCall(WindowBase* w) -{ - w->OnClose(); -} - -void WindowEventMouseUpCall(WindowBase* w, WidgetIndex widgetIndex) -{ - w->OnMouseUp(widgetIndex); -} - -void WindowEventResizeCall(WindowBase* w) -{ - w->OnResize(); -} - -void WindowEventMouseDownCall(WindowBase* w, WidgetIndex widgetIndex) -{ - w->OnMouseDown(widgetIndex); -} - -void WindowEventDropdownCall(WindowBase* w, WidgetIndex widgetIndex, int32_t dropdownIndex) -{ - w->OnDropdown(widgetIndex, dropdownIndex); -} - -void WindowEventUpdateCall(WindowBase* w) -{ - w->OnUpdate(); -} - -void WindowEventPeriodicUpdateCall(WindowBase* w) -{ - w->OnPeriodicUpdate(); -} - -void WindowEventToolUpdateCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnToolUpdate(widgetIndex, screenCoords); -} - -void WindowEventToolDownCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnToolDown(widgetIndex, screenCoords); -} - -void WindowEventToolDragCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnToolDrag(widgetIndex, screenCoords); -} - -void WindowEventToolUpCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnToolUp(widgetIndex, screenCoords); -} - -void WindowEventToolAbortCall(WindowBase* w, WidgetIndex widgetIndex) -{ - w->OnToolAbort(widgetIndex); -} - -void WindowGetScrollSize(WindowBase* w, int32_t scrollIndex, int32_t* width, int32_t* height) -{ - auto size = w->OnScrollGetSize(scrollIndex); - if (width != nullptr) - *width = size.width; - if (height != nullptr) - *height = size.height; -} - -void WindowEventScrollMousedownCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnScrollMouseDown(scrollIndex, screenCoords); -} - -void WindowEventScrollMousedragCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnScrollMouseDrag(scrollIndex, screenCoords); -} - -void WindowEventScrollMouseoverCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnScrollMouseOver(scrollIndex, screenCoords); -} - -void WindowEventTextinputCall(WindowBase* w, WidgetIndex widgetIndex, const char* text) -{ - if (text != nullptr) - { - w->OnTextInput(widgetIndex, text); - } -} - -void WindowEventViewportRotateCall(WindowBase* w) -{ - w->OnViewportRotate(); -} - -void WindowEventScrollSelectCall(WindowBase* w, int32_t scrollIndex, int32_t scrollAreaType) -{ - w->OnScrollSelect(scrollIndex, scrollAreaType); -} - -OpenRCT2String WindowEventTooltipCall(WindowBase* w, const WidgetIndex widgetIndex, const StringId fallback) -{ - return w->OnTooltip(widgetIndex, fallback); -} - -CursorID WindowEventCursorCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - return w->OnCursor(widgetIndex, screenCoords, CursorID::Arrow); -} - -void WindowEventMovedCall(WindowBase* w, const ScreenCoordsXY& screenCoords) -{ - w->OnMoved(screenCoords); -} - -void WindowEventOnPrepareDrawCall(WindowBase* w) -{ - w->OnPrepareDraw(); -} - -void WindowEventOnDrawCall(WindowBase* w, DrawPixelInfo& dpi) -{ - w->OnDraw(dpi); -} - -void WindowEventScrollDrawCall(WindowBase* w, DrawPixelInfo& dpi, int32_t scrollIndex) -{ - w->OnScrollDraw(scrollIndex, dpi); -} - /** * * rct2: 0x006ED710 @@ -1869,10 +1683,6 @@ void WindowCancelTextbox() if (gUsingWidgetTextBox) { WindowBase* w = WindowFindByNumber(gCurrentTextBox.window.classification, gCurrentTextBox.window.number); - if (w != nullptr) - { - WindowEventTextinputCall(w, gCurrentTextBox.widget_index, nullptr); - } gCurrentTextBox.window.classification = WindowClass::Null; gCurrentTextBox.window.number = 0; ContextStopTextInput(); @@ -1899,7 +1709,7 @@ void WindowUpdateTextbox() gTextBoxFrameNo = 0; WindowBase* w = WindowFindByNumber(gCurrentTextBox.window.classification, gCurrentTextBox.window.number); WidgetInvalidate(*w, gCurrentTextBox.widget_index); - WindowEventTextinputCall(w, gCurrentTextBox.widget_index, gTextBoxInput.c_str()); + w->OnTextInput(gCurrentTextBox.widget_index, gTextBoxInput); } } @@ -2031,31 +1841,6 @@ Viewport* WindowGetViewport(WindowBase* w) return w->viewport; } -WindowBase* WindowGetListening() -{ - for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++) - { - auto& w = **it; - if (w.flags & WF_DEAD) - continue; - - auto viewport = w.viewport; - if (viewport != nullptr) - { - if (viewport->flags & VIEWPORT_FLAG_SOUND_ON) - { - return &w; - } - } - } - return nullptr; -} - -WindowClass WindowGetClassification(const WindowBase& window) -{ - return window.classification; -} - /** * * rct2: 0x006EAF26 diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index aaa6ff854b..139f6fcd89 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -148,16 +148,16 @@ struct Widget */ struct Viewport { - int32_t width; - int32_t height; - ScreenCoordsXY pos; - ScreenCoordsXY viewPos; - int32_t view_width; - int32_t view_height; - uint32_t flags; - ZoomLevel zoom; - uint8_t var_11; - VisibilityCache visibility; + int32_t width{}; + int32_t height{}; + ScreenCoordsXY pos{}; + ScreenCoordsXY viewPos{}; + int32_t view_width{}; + int32_t view_height{}; + uint32_t flags{}; + ZoomLevel zoom{}; + uint8_t rotation{}; + VisibilityCache visibility{}; // Use this function on coordinates that are relative to the viewport zoom i.e. a peeps x, y position after transforming // from its x, y, z @@ -366,6 +366,7 @@ constexpr int32_t WC_STAFF__WIDX_PICKUP = 9; constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE = 13; constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_COPY = 16; constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE = 15; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_SORT = 14; constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE = 10; constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP = 11; constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN = 12; @@ -503,6 +504,7 @@ void WindowVisitEach(std::function func); void WindowDispatchUpdateAll(); void WindowUpdateAllViewports(); void WindowUpdateAll(); +void WindowNotifyLanguageChange(); void WindowSetWindowLimit(int32_t value); @@ -578,7 +580,6 @@ void WindowPushOthersBelow(WindowBase& w1); WindowBase* WindowGetMain(); void WindowScrollToLocation(WindowBase& w, const CoordsXYZ& coords); -void WindowRotateCamera(WindowBase& w, int32_t direction); void WindowViewportGetMapCoordsByCursor( const WindowBase& w, int32_t* map_x, int32_t* map_y, int32_t* offset_x, int32_t* offset_y); void WindowViewportCentreTileAroundCursor(WindowBase& w, int32_t map_x, int32_t map_y, int32_t offset_x, int32_t offset_y); @@ -611,36 +612,6 @@ Viewport* WindowGetViewport(WindowBase* window); void WindowRelocateWindows(int32_t width, int32_t height); void WindowResizeGui(int32_t width, int32_t height); void WindowResizeGuiScenarioEditor(int32_t width, int32_t height); -void RideConstructionToolupdateEntranceExit(const ScreenCoordsXY& screenCoords); -void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords); -void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords); - -void WindowEventCloseCall(WindowBase* w); -void WindowEventMouseUpCall(WindowBase* w, WidgetIndex widgetIndex); -void WindowEventResizeCall(WindowBase* w); -void WindowEventMouseDownCall(WindowBase* w, WidgetIndex widgetIndex); -void WindowEventDropdownCall(WindowBase* w, WidgetIndex widgetIndex, int32_t dropdownIndex); -void WindowEventUnknown05Call(WindowBase* w); -void WindowEventUpdateCall(WindowBase* w); -void WindowEventPeriodicUpdateCall(WindowBase* w); -void WindowEventToolUpdateCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowEventToolDownCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowEventToolDragCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowEventToolUpCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowEventToolAbortCall(WindowBase* w, WidgetIndex widgetIndex); -void WindowGetScrollSize(WindowBase* w, int32_t scrollIndex, int32_t* width, int32_t* height); -void WindowEventScrollMousedownCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords); -void WindowEventScrollMousedragCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords); -void WindowEventScrollMouseoverCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords); -void WindowEventTextinputCall(WindowBase* w, WidgetIndex widgetIndex, const char* text); -void WindowEventViewportRotateCall(WindowBase* w); -void WindowEventScrollSelectCall(WindowBase* w, int32_t scrollIndex, int32_t scrollAreaType); -OpenRCT2String WindowEventTooltipCall(WindowBase* w, const WidgetIndex widgetIndex, const StringId fallback); -CursorID WindowEventCursorCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowEventMovedCall(WindowBase* w, const ScreenCoordsXY& screenCoords); -void WindowEventOnPrepareDrawCall(WindowBase* w); -void WindowEventOnDrawCall(WindowBase* w, DrawPixelInfo& dpi); -void WindowEventScrollDrawCall(WindowBase* w, DrawPixelInfo& dpi, int32_t scrollIndex); void InvalidateAllWindowsAfterInput(); void TextinputCancel(); @@ -662,28 +633,6 @@ Viewport* WindowGetPreviousViewport(Viewport* current); void WindowResetVisibilities(); void WindowInitAll(); -void WindowRideConstructionKeyboardShortcutTurnLeft(); -void WindowRideConstructionKeyboardShortcutTurnRight(); -void WindowRideConstructionKeyboardShortcutUseTrackDefault(); -void WindowRideConstructionKeyboardShortcutSlopeDown(); -void WindowRideConstructionKeyboardShortcutSlopeUp(); -void WindowRideConstructionKeyboardShortcutChainLiftToggle(); -void WindowRideConstructionKeyboardShortcutBankLeft(); -void WindowRideConstructionKeyboardShortcutBankRight(); -void WindowRideConstructionKeyboardShortcutPreviousTrack(); -void WindowRideConstructionKeyboardShortcutNextTrack(); -void WindowRideConstructionKeyboardShortcutBuildCurrent(); -void WindowRideConstructionKeyboardShortcutDemolishCurrent(); - -void WindowFootpathKeyboardShortcutTurnLeft(); -void WindowFootpathKeyboardShortcutTurnRight(); -void WindowFootpathKeyboardShortcutSlopeDown(); -void WindowFootpathKeyboardShortcutSlopeUp(); -void WindowFootpathKeyboardShortcutBuildCurrent(); -void WindowFootpathKeyboardShortcutDemolishCurrent(); - -void WindowTileInspectorKeyboardShortcutToggleInvisibility(); - void WindowFollowSprite(WindowBase& w, EntityId spriteIndex); void WindowUnfollowSprite(WindowBase& w); @@ -695,6 +644,3 @@ money64 PlaceProvisionalTrackPiece( const CoordsXYZ& trackPos); extern RideConstructionState _rideConstructionState2; - -WindowBase* WindowGetListening(); -WindowClass WindowGetClassification(const WindowBase& window); diff --git a/src/openrct2/interface/Window_internal.h b/src/openrct2/interface/Window_internal.h index 994c587089..fd2a3b8cd0 100644 --- a/src/openrct2/interface/Window_internal.h +++ b/src/openrct2/interface/Window_internal.h @@ -80,11 +80,6 @@ struct WindowBase WindowBase& operator=(const WindowBase&) = delete; - virtual bool IsLegacy() - { - return true; - } - // Events virtual void OnOpen() { @@ -167,6 +162,9 @@ struct WindowBase { } virtual CursorID OnCursor(WidgetIndex, const ScreenCoordsXY&, CursorID); + virtual void OnLanguageChange() + { + } void ResizeFrame(); void ResizeFrameWithPage(); diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 305315edf9..5bf4284f55 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -396,6 +396,7 @@ + @@ -901,6 +902,7 @@ + diff --git a/src/openrct2/localisation/Currency.cpp b/src/openrct2/localisation/Currency.cpp index 9d3d725a55..88d0560d9b 100644 --- a/src/openrct2/localisation/Currency.cpp +++ b/src/openrct2/localisation/Currency.cpp @@ -15,24 +15,24 @@ // clang-format off CurrencyDescriptor CurrencyDescriptors[EnumValue(CurrencyType::Count)] = { - { "GBP", 10, CurrencyAffix::Prefix, "\xC2\xA3", CurrencyAffix::Suffix, "GBP", STR_POUNDS }, // British Pound - { "USD", 10, CurrencyAffix::Prefix, "$", CurrencyAffix::Prefix, "$", STR_DOLLARS }, // US Dollar - { "FRF", 10, CurrencyAffix::Suffix, "F", CurrencyAffix::Suffix, "F", STR_FRANC }, // French Franc - { "DEM", 10, CurrencyAffix::Prefix, "DM", CurrencyAffix::Prefix, "DM", STR_DEUTSCHE_MARK }, // Deutsche Mark - { "JPY", 1000, CurrencyAffix::Prefix, "\xC2\xA5", CurrencyAffix::Suffix, "YEN", STR_YEN }, // Japanese Yen - { "ESP", 10, CurrencyAffix::Suffix, "Pts", CurrencyAffix::Suffix, "Pts", STR_PESETA }, // Spanish Peseta - { "ITL", 1000, CurrencyAffix::Prefix, "L", CurrencyAffix::Prefix, "L", STR_LIRA }, // Italian Lira - { "NLG", 10, CurrencyAffix::Prefix, "\xC6\x92 ", CurrencyAffix::Prefix, "fl.", STR_GUILDERS }, // Dutch Guilder - { "SEK", 100, CurrencyAffix::Suffix, " kr", CurrencyAffix::Suffix, " kr", STR_KRONA }, // Swedish Krona - { "EUR", 10, CurrencyAffix::Prefix, "\xE2\x82\xAC", CurrencyAffix::Suffix, "EUR", STR_EUROS }, // Euro - { "KRW", 10000, CurrencyAffix::Prefix, "\xE2\x82\xA9", CurrencyAffix::Prefix, "W", STR_WON }, // South Korean Won - { "RUB", 1000, CurrencyAffix::Suffix, "\xE2\x82\xBD", CurrencyAffix::Prefix, "R ", STR_ROUBLE }, // Russian Rouble - { "CZK", 100, CurrencyAffix::Suffix, " K\xC4\x8D", CurrencyAffix::Suffix, " Kc", STR_CZECH_KORUNA }, // Czech koruna - { "HKD", 100, CurrencyAffix::Prefix, "$", CurrencyAffix::Prefix, "HKD", STR_HONG_KONG_DOLLAR}, // Hong Kong Dollar - { "TWD", 1000, CurrencyAffix::Prefix, "NT$", CurrencyAffix::Prefix, "NT$", STR_NEW_TAIWAN_DOLLAR}, // New Taiwan Dollar - { "CNY", 100, CurrencyAffix::Prefix, "CN\xC2\xA5", CurrencyAffix::Prefix, "CNY", STR_CHINESE_YUAN }, // Chinese Yuan - { "HUF", 1000, CurrencyAffix::Suffix, " Ft", CurrencyAffix::Suffix, " Ft", STR_HUNGARIAN_FORINT}, // Hungarian Forint - { "CTM", 10, CurrencyAffix::Prefix, "Ctm", CurrencyAffix::Prefix, "Ctm", STR_CUSTOM_CURRENCY }, // Customizable currency + { "GBP", 10, CurrencyAffix::Prefix, u8"£", CurrencyAffix::Suffix, "GBP", STR_POUNDS }, // British Pound + { "USD", 10, CurrencyAffix::Prefix, u8"$", CurrencyAffix::Prefix, "$", STR_DOLLARS }, // US Dollar + { "FRF", 10, CurrencyAffix::Suffix, u8"F", CurrencyAffix::Suffix, "F", STR_FRANC }, // French Franc + { "DEM", 10, CurrencyAffix::Prefix, u8"DM", CurrencyAffix::Prefix, "DM", STR_DEUTSCHE_MARK }, // Deutsche Mark + { "JPY", 1000, CurrencyAffix::Prefix, u8"¥", CurrencyAffix::Suffix, "YEN", STR_YEN }, // Japanese Yen + { "ESP", 10, CurrencyAffix::Suffix, u8"Pts", CurrencyAffix::Suffix, "Pts", STR_PESETA }, // Spanish Peseta + { "ITL", 1000, CurrencyAffix::Prefix, u8"L", CurrencyAffix::Prefix, "L", STR_LIRA }, // Italian Lira + { "NLG", 10, CurrencyAffix::Prefix, u8"ƒ ", CurrencyAffix::Prefix, "fl.", STR_GUILDERS }, // Dutch Guilder + { "SEK", 100, CurrencyAffix::Suffix, u8" kr", CurrencyAffix::Suffix, " kr", STR_KRONA }, // Swedish Krona + { "EUR", 10, CurrencyAffix::Prefix, u8"€", CurrencyAffix::Suffix, "EUR", STR_EUROS }, // Euro + { "KRW", 10000, CurrencyAffix::Prefix, u8"₩", CurrencyAffix::Prefix, "W", STR_WON }, // South Korean Won + { "RUB", 1000, CurrencyAffix::Suffix, u8"₽", CurrencyAffix::Prefix, "R ", STR_ROUBLE }, // Russian Rouble + { "CZK", 100, CurrencyAffix::Suffix, u8" Kč", CurrencyAffix::Suffix, " Kc", STR_CZECH_KORUNA }, // Czech koruna + { "HKD", 100, CurrencyAffix::Prefix, u8"$", CurrencyAffix::Prefix, "HKD", STR_HONG_KONG_DOLLAR}, // Hong Kong Dollar + { "TWD", 1000, CurrencyAffix::Prefix, u8"NT$", CurrencyAffix::Prefix, "NT$", STR_NEW_TAIWAN_DOLLAR}, // New Taiwan Dollar + { "CNY", 100, CurrencyAffix::Prefix, u8"CN¥", CurrencyAffix::Prefix, "CNY", STR_CHINESE_YUAN }, // Chinese Yuan + { "HUF", 1000, CurrencyAffix::Suffix, u8" Ft", CurrencyAffix::Suffix, " Ft", STR_HUNGARIAN_FORINT}, // Hungarian Forint + { "CTM", 10, CurrencyAffix::Prefix, u8"Ctm", CurrencyAffix::Prefix, "Ctm", STR_CUSTOM_CURRENCY }, // Customizable currency }; // clang-format on diff --git a/src/openrct2/localisation/Currency.h b/src/openrct2/localisation/Currency.h index 4fb2495a66..7ad966e0c9 100644 --- a/src/openrct2/localisation/Currency.h +++ b/src/openrct2/localisation/Currency.h @@ -11,6 +11,7 @@ #include "../common.h" #include "../core/String.hpp" +#include "../util/Util.h" // List of currencies enum class CurrencyType : uint8_t @@ -61,7 +62,7 @@ struct CurrencyDescriptor }; // List of currency formats -extern CurrencyDescriptor CurrencyDescriptors[static_cast(CurrencyType::Count)]; +extern CurrencyDescriptor CurrencyDescriptors[EnumValue(CurrencyType::Count)]; /** * Loads custom currency saved parameters into {@link CurrencyDescriptors}' diff --git a/src/openrct2/localisation/Language.cpp b/src/openrct2/localisation/Language.cpp index a47d68c901..4bf4e9ada2 100644 --- a/src/openrct2/localisation/Language.cpp +++ b/src/openrct2/localisation/Language.cpp @@ -12,6 +12,7 @@ #include "../core/String.hpp" #include "../interface/FontFamilies.h" #include "../interface/Fonts.h" +#include "../interface/Window.h" #include "../object/ObjectManager.h" #include "../platform/Platform.h" #include "LanguagePack.h" @@ -85,6 +86,7 @@ bool LanguageOpen(int32_t id) // Objects and their localised strings need to be refreshed objectManager.ResetObjects(); ScrollingTextInvalidate(); + WindowNotifyLanguageChange(); return true; } catch (const std::exception&) diff --git a/src/openrct2/localisation/Localisation.cpp b/src/openrct2/localisation/Localisation.cpp index 4e5da98eae..753d5a5271 100644 --- a/src/openrct2/localisation/Localisation.cpp +++ b/src/openrct2/localisation/Localisation.cpp @@ -265,7 +265,7 @@ const StringId PeepThoughts[] = { }; // clang-format on -std::string FormatStringID(StringId format, const void* args) +std::string FormatStringIDLegacy(StringId format, const void* args) { std::string buffer(256, 0); size_t len{}; diff --git a/src/openrct2/localisation/Localisation.h b/src/openrct2/localisation/Localisation.h index b7382de526..fe9da9f781 100644 --- a/src/openrct2/localisation/Localisation.h +++ b/src/openrct2/localisation/Localisation.h @@ -18,7 +18,7 @@ #include -std::string FormatStringID(StringId format, const void* args); +std::string FormatStringIDLegacy(StringId format, const void* args); void FormatStringToUpper(char* dest, size_t size, StringId format, const void* args); /** diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index 75dfd5ea15..3afad4e011 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -113,6 +113,7 @@ enum : uint16_t STR_RIDE_NAME_SINGLE_RAIL_ROLLER_COASTER = 94, STR_RIDE_NAME_ALPINE_COASTER = 95, STR_RIDE_NAME_CLASSIC_WOODEN_ROLLER_COASTER = 96, + STR_RIDE_NAME_CLASSIC_STAND_UP_ROLLER_COASTER = 97, STR_RIDE_DESCRIPTION_SPIRAL_ROLLER_COASTER = 512, STR_RIDE_DESCRIPTION_STAND_UP_ROLLER_COASTER = 513, @@ -206,6 +207,7 @@ enum : uint16_t STR_RIDE_DESCRIPTION_SINGLE_RAIL_ROLLER_COASTER = 604, STR_RIDE_DESCRIPTION_ALPINE_COASTER = 605, STR_RIDE_DESCRIPTION_CLASSIC_WOODEN_ROLLER_COASTER = 606, + STR_RIDE_DESCRIPTION_CLASSIC_STAND_UP_ROLLER_COASTER = 607, STR_GUEST_X = 767, STR_HANDYMAN_X = 768, @@ -2286,7 +2288,7 @@ enum : uint16_t // STR_3098 :Can't change lift hill speed... STR_SELECT_COLOUR = 3099, STR_SELECT_SECONDARY_COLOUR = 3100, - STR_SELECT_TERNARY_COLOUR = 3101, + STR_SELECT_TERTIARY_COLOUR = 3101, STR_SCENERY_PAINTBRUSH_TIP = 3102, STR_CANT_REPAINT_THIS = 3103, STR_LIST_RIDES_TIP = 3104, @@ -2478,7 +2480,7 @@ enum : uint16_t STR_WINDOW_OBJECTIVE_MONTHLY_PROFIT = 3306, STR_WINDOW_OBJECTIVE_MINIMUM_LENGTH = 3307, STR_WINDOW_OBJECTIVE_EXCITEMENT_RATING = 3308, - STR_WINDOW_COLOUR_2_COMMA16 = 3309, + STR_WINDOW_COLOUR_2_COMMA32 = 3309, STR_WINDOW_COLOUR_2_LENGTH = 3310, STR_WINDOW_COLOUR_2_COMMA2DP32 = 3311, STR_WINDOW_PRESERVATION_ORDER = 3312, @@ -4035,6 +4037,12 @@ enum : uint16_t STR_RESTRICT_SCENERY = 6621, STR_RESTRICT_SCENERY_TIP = 6622, + STR_CONSOLE_HELPER_TEXT = 6623, + + STR_SHORTCUT_SORT_ELEMENTS = 6624, + + STR_ERR_INVALID_COLOUR = 6625, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working /* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings }; diff --git a/src/openrct2/management/Award.cpp b/src/openrct2/management/Award.cpp index 47053fd241..146fe49403 100644 --- a/src/openrct2/management/Award.cpp +++ b/src/openrct2/management/Award.cpp @@ -69,13 +69,6 @@ static constexpr StringId AwardNewsStrings[] = { STR_NEWS_ITEM_BEST_GENTLE_RIDES, }; -static std::vector _currentAwards; - -std::vector& GetAwards() -{ - return _currentAwards; -} - bool AwardIsPositive(AwardType type) { return AwardPositiveMap[EnumValue(type)]; @@ -602,7 +595,7 @@ static bool AwardIsDeserved(AwardType awardType, int32_t activeAwardTypes) void AwardReset() { - _currentAwards.clear(); + GetGameState().CurrentAwards.clear(); } /** @@ -613,17 +606,18 @@ void AwardUpdateAll() { PROFILED_FUNCTION(); + auto& currentAwards = GetGameState().CurrentAwards; // Decrease award times - for (auto& award : _currentAwards) + for (auto& award : currentAwards) { --award.Time; } // Remove any 0 time awards auto res = std::remove_if( - std::begin(_currentAwards), std::end(_currentAwards), [](const Award& award) { return award.Time == 0; }); - if (res != std::end(_currentAwards)) + std::begin(currentAwards), std::end(currentAwards), [](const Award& award) { return award.Time == 0; }); + if (res != std::end(currentAwards)) { - _currentAwards.erase(res, std::end(_currentAwards)); + currentAwards.erase(res, std::end(currentAwards)); WindowInvalidateByClass(WindowClass::ParkInformation); } @@ -632,13 +626,13 @@ void AwardUpdateAll() { // Set active award types as flags int32_t activeAwardTypes = 0; - for (auto& award : _currentAwards) + for (auto& award : currentAwards) { activeAwardTypes |= (1 << EnumValue(award.Type)); } // Check if there was a free award entry - if (_currentAwards.size() < OpenRCT2::Limits::MaxAwards) + if (currentAwards.size() < OpenRCT2::Limits::MaxAwards) { // Get a random award type not already active AwardType awardType; @@ -651,7 +645,7 @@ void AwardUpdateAll() if (AwardIsDeserved(awardType, activeAwardTypes)) { // Add award - _currentAwards.push_back(Award{ 5u, awardType }); + currentAwards.push_back(Award{ 5u, awardType }); if (gConfigNotifications.ParkAward) { News::AddItemToQueue(News::ItemType::Award, AwardNewsStrings[EnumValue(awardType)], 0, {}); diff --git a/src/openrct2/management/Award.h b/src/openrct2/management/Award.h index 0700cb8804..e73e3de6d9 100644 --- a/src/openrct2/management/Award.h +++ b/src/openrct2/management/Award.h @@ -42,8 +42,6 @@ struct Award AwardType Type; }; -std::vector& GetAwards(); - bool AwardIsPositive(AwardType type); void AwardReset(); void AwardUpdateAll(); diff --git a/src/openrct2/management/Finance.cpp b/src/openrct2/management/Finance.cpp index 292fbe97e8..cd0abc8660 100644 --- a/src/openrct2/management/Finance.cpp +++ b/src/openrct2/management/Finance.cpp @@ -25,6 +25,8 @@ #include "../windows/Intent.h" #include "../world/Park.h" +#include + using namespace OpenRCT2; // Monthly research funding costs @@ -35,14 +37,10 @@ const money64 research_cost_table[RESEARCH_FUNDING_COUNT] = { 400.00_GBP, // Maximum funding }; -static constexpr int32_t dword_988E60[static_cast(ExpenditureType::Count)] = { +static constexpr int32_t dword_988E60[EnumValue(ExpenditureType::Count)] = { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, }; -money64 gHistoricalProfit; -money64 gCashHistory[FINANCE_GRAPH_SIZE]; -money64 gExpenditureTable[EXPENDITURE_TABLE_MONTH_COUNT][static_cast(ExpenditureType::Count)]; - /** * Checks the condition if the game is required to use money. * @param flags game command flags. @@ -82,8 +80,8 @@ void FinancePayment(money64 amount, ExpenditureType type) auto& gameState = GetGameState(); gameState.Cash = AddClamp_money64(gameState.Cash, -amount); - gExpenditureTable[0][static_cast(type)] -= amount; - if (dword_988E60[static_cast(type)] & 1) + gameState.ExpenditureTable[0][EnumValue(type)] -= amount; + if (dword_988E60[EnumValue(type)] & 1) { // Cumulative amount of money spent this day gameState.CurrentExpenditure -= amount; @@ -190,7 +188,7 @@ void FinanceResetHistory() auto& gameState = GetGameState(); for (int32_t i = 0; i < FINANCE_GRAPH_SIZE; i++) { - gCashHistory[i] = kMoney64Undefined; + gameState.CashHistory[i] = kMoney64Undefined; gameState.WeeklyProfitHistory[i] = kMoney64Undefined; gameState.ParkValueHistory[i] = kMoney64Undefined; } @@ -199,7 +197,7 @@ void FinanceResetHistory() { for (uint32_t j = 0; j < static_cast(ExpenditureType::Count); ++j) { - gExpenditureTable[i][j] = 0; + gameState.ExpenditureTable[i][j] = 0; } } } @@ -215,7 +213,7 @@ void FinanceInit() // It only initialises the first month for (uint32_t i = 0; i < static_cast(ExpenditureType::Count); i++) { - gExpenditureTable[0][i] = 0; + gameState.ExpenditureTable[0][i] = 0; } gameState.CurrentExpenditure = 0; @@ -230,11 +228,10 @@ void FinanceInit() gameState.BankLoan = 10000.00_GBP; gameState.MaxBankLoan = 20000.00_GBP; - gHistoricalProfit = 0; - gameState.BankLoanInterestRate = 10; gameState.ParkValue = 0; gameState.CompanyValue = 0; + gameState.HistoricalProfit = 0; gameState.ScenarioCompletedCompanyValue = kMoney64Undefined; gameState.TotalAdmissions = 0; gameState.TotalIncomeFromAdmissions = 0; @@ -320,15 +317,15 @@ money64 FinanceGetCurrentCash() */ void FinanceShiftExpenditureTable() { + auto& gameState = GetGameState(); // If EXPENDITURE_TABLE_MONTH_COUNT months have passed then is full, sum the oldest month if (GetDate().GetMonthsElapsed() >= EXPENDITURE_TABLE_MONTH_COUNT) { - money64 sum = 0; - for (uint32_t i = 0; i < static_cast(ExpenditureType::Count); i++) - { - sum += gExpenditureTable[EXPENDITURE_TABLE_MONTH_COUNT - 1][i]; - } - gHistoricalProfit += sum; + const money64 sum = std::accumulate( + std::cbegin(gameState.ExpenditureTable[EXPENDITURE_TABLE_MONTH_COUNT - 1]), + std::cend(gameState.ExpenditureTable[EXPENDITURE_TABLE_MONTH_COUNT - 1]), money64{}); + + GetGameState().HistoricalProfit += sum; } // Shift the table @@ -336,14 +333,14 @@ void FinanceShiftExpenditureTable() { for (size_t j = 0; j < static_cast(ExpenditureType::Count); j++) { - gExpenditureTable[i][j] = gExpenditureTable[i - 1][j]; + gameState.ExpenditureTable[i][j] = gameState.ExpenditureTable[i - 1][j]; } } // Zero the beginning of the table, which is the new month for (uint32_t i = 0; i < static_cast(ExpenditureType::Count); i++) { - gExpenditureTable[0][i] = 0; + gameState.ExpenditureTable[0][i] = 0; } WindowInvalidateByClass(WindowClass::Finances); @@ -367,12 +364,12 @@ money64 FinanceGetLastMonthShopProfit() money64 profit = 0; if (GetDate().GetMonthsElapsed() != 0) { - const auto* lastMonthExpenditure = gExpenditureTable[1]; + const auto* lastMonthExpenditure = GetGameState().ExpenditureTable[1]; - profit += lastMonthExpenditure[static_cast(ExpenditureType::ShopSales)]; - profit += lastMonthExpenditure[static_cast(ExpenditureType::ShopStock)]; - profit += lastMonthExpenditure[static_cast(ExpenditureType::FoodDrinkSales)]; - profit += lastMonthExpenditure[static_cast(ExpenditureType::FoodDrinkStock)]; + profit += lastMonthExpenditure[EnumValue(ExpenditureType::ShopSales)]; + profit += lastMonthExpenditure[EnumValue(ExpenditureType::ShopStock)]; + profit += lastMonthExpenditure[EnumValue(ExpenditureType::FoodDrinkSales)]; + profit += lastMonthExpenditure[EnumValue(ExpenditureType::FoodDrinkStock)]; } return profit; -} +} \ No newline at end of file diff --git a/src/openrct2/management/Finance.h b/src/openrct2/management/Finance.h index bc8b028871..33375b8966 100644 --- a/src/openrct2/management/Finance.h +++ b/src/openrct2/management/Finance.h @@ -38,15 +38,6 @@ constexpr uint8_t MaxBankLoanInterestRate = 255; extern const money64 research_cost_table[RESEARCH_FUNDING_COUNT]; -/** - * The total profit for the entire scenario that precedes - * the current financial table. - */ -extern money64 gHistoricalProfit; - -extern money64 gCashHistory[FINANCE_GRAPH_SIZE]; -extern money64 gExpenditureTable[EXPENDITURE_TABLE_MONTH_COUNT][static_cast(ExpenditureType::Count)]; - bool FinanceCheckMoneyRequired(uint32_t flags); bool FinanceCheckAffordability(money64 cost, uint32_t flags); void FinancePayment(money64 amount, ExpenditureType type); diff --git a/src/openrct2/management/Marketing.cpp b/src/openrct2/management/Marketing.cpp index 685c08ea32..8cda9cb79a 100644 --- a/src/openrct2/management/Marketing.cpp +++ b/src/openrct2/management/Marketing.cpp @@ -11,6 +11,7 @@ #include "../Cheats.h" #include "../Game.h" +#include "../GameState.h" #include "../config/Config.h" #include "../entity/Guest.h" #include "../interface/Window.h" @@ -24,6 +25,8 @@ #include "Finance.h" #include "NewsItem.h" +using namespace OpenRCT2; + const money64 AdvertisingCampaignPricePerWeek[] = { 50.00_GBP, // PARK_ENTRY_FREE 50.00_GBP, // RIDE_FREE @@ -100,7 +103,7 @@ void MarketingUpdate() { PROFILED_FUNCTION(); - if (gCheatsNeverendingMarketing) + if (GetGameState().Cheats.NeverendingMarketing) return; for (auto it = gMarketingCampaigns.begin(); it != gMarketingCampaigns.end();) diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index e3ee26bc9f..62c0d281bc 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -112,7 +112,7 @@ void News::InitQueue() assert(gameState.NewsItems.IsEmpty()); // Throttles for warning types (PEEP_*_WARNING) - for (auto& warningThrottle : gPeepWarningThrottle) + for (auto& warningThrottle : gameState.PeepWarningThrottle) { warningThrottle = 0; } diff --git a/src/openrct2/management/Research.cpp b/src/openrct2/management/Research.cpp index 99349efac9..ae3919dae1 100644 --- a/src/openrct2/management/Research.cpp +++ b/src/openrct2/management/Research.cpp @@ -627,7 +627,7 @@ bool SceneryGroupIsInvented(int32_t sgIndex) return true; } - if (gCheatsIgnoreResearchStatus) + if (GetGameState().Cheats.IgnoreResearchStatus) { return true; } diff --git a/src/openrct2/math/Trigonometry.hpp b/src/openrct2/math/Trigonometry.hpp index 0ec685dd80..f5a617af56 100644 --- a/src/openrct2/math/Trigonometry.hpp +++ b/src/openrct2/math/Trigonometry.hpp @@ -106,7 +106,7 @@ namespace OpenRCT2::Math::Trigonometry constexpr int32_t ComputeHorizontalMagnitude(int32_t length, uint8_t pitch) { - return (-PitchToDirectionVectorFromGeometry[static_cast(pitch)].y * length) / 256; + return (-PitchToDirectionVectorFromGeometry[pitch].y * length) / 256; } constexpr CoordsXY ComputeXYVector(int32_t magnitude, uint8_t yaw) diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 3302aff33c..79700af5c3 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -46,7 +46,7 @@ using namespace OpenRCT2; // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "0" +#define NETWORK_STREAM_VERSION "3" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION @@ -2758,7 +2758,7 @@ void NetworkBase::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connecti GameLoadScripts(); GameNotifyMapChanged(); _serverState.tick = GetGameState().CurrentTicks; - // WindowNetworkStatusOpen("Loaded new map from network"); + // NetworkStatusOpen("Loaded new map from network"); _serverState.state = NetworkServerStatus::Ok; _clientMapLoaded = true; gFirstTimeSaving = true; @@ -2805,7 +2805,7 @@ bool NetworkBase::LoadMap(IStream* stream) EntityTweener::Get().Reset(); MapAnimationAutoCreate(); - gLastAutoSaveUpdate = AUTOSAVE_PAUSE; + gLastAutoSaveUpdate = kAutosavePause; result = true; } catch (const std::exception& e) diff --git a/src/openrct2/network/Socket.cpp b/src/openrct2/network/Socket.cpp index 55fb2cc8fd..38e53ea275 100644 --- a/src/openrct2/network/Socket.cpp +++ b/src/openrct2/network/Socket.cpp @@ -248,7 +248,7 @@ private: class TcpSocket final : public ITcpSocket, protected Socket { private: - std::atomic _status = ATOMIC_VAR_INIT(SocketStatus::Closed); + std::atomic _status{ SocketStatus::Closed }; uint16_t _listeningPort = 0; SOCKET _socket = INVALID_SOCKET; diff --git a/src/openrct2/object/ImageTable.cpp b/src/openrct2/object/ImageTable.cpp index dcd8d788c7..3ac0b90a8c 100644 --- a/src/openrct2/object/ImageTable.cpp +++ b/src/openrct2/object/ImageTable.cpp @@ -161,9 +161,10 @@ std::vector> ImageTable::ParseImages( { auto imageData = context->GetData(s); auto image = Imaging::ReadFromBuffer(imageData); + auto meta = ImageImportMeta{}; ImageImporter importer; - auto importResult = importer.Import(image, 0, 0, ImageImporter::Palette::OpenRCT2, ImageImporter::ImportFlags::RLE); + auto importResult = importer.Import(image, meta); result.push_back(std::make_unique(importResult.Element)); } @@ -183,30 +184,11 @@ std::vector> ImageTable::ParseImages( Guard::Assert(el.is_object(), "ImageTable::ParseImages expects parameter el to be object"); auto path = Json::GetString(el["path"]); - auto x = Json::GetNumber(el["x"]); - auto y = Json::GetNumber(el["y"]); - auto srcX = Json::GetNumber(el["srcX"]); - auto srcY = Json::GetNumber(el["srcY"]); - auto srcWidth = Json::GetNumber(el["srcWidth"]); - auto srcHeight = Json::GetNumber(el["srcHeight"]); - auto raw = Json::GetString(el["format"]) == "raw"; - auto keepPalette = Json::GetString(el["palette"]) == "keep"; - auto zoomOffset = Json::GetNumber(el["zoom"]); + auto meta = createImageImportMetaFromJson(el); std::vector> result; try { - auto flags = ImageImporter::ImportFlags::None; - auto palette = ImageImporter::Palette::OpenRCT2; - if (!raw) - { - flags = static_cast(flags | ImageImporter::ImportFlags::RLE); - } - if (keepPalette) - { - palette = ImageImporter::Palette::KeepIndices; - } - auto itSource = std::find_if( imageSources.begin(), imageSources.end(), [&path](const std::pair& item) { return item.first == path; }); @@ -216,16 +198,9 @@ std::vector> ImageTable::ParseImages( } auto& image = itSource->second; - if (srcWidth == 0) - srcWidth = image.Width; - - if (srcHeight == 0) - srcHeight = image.Height; - ImageImporter importer; - auto importResult = importer.Import(image, srcX, srcY, srcWidth, srcHeight, x, y, palette, flags); + auto importResult = importer.Import(image, meta); auto g1element = importResult.Element; - g1element.zoomed_offset = zoomOffset; result.push_back(std::make_unique(g1element)); } catch (const std::exception& e) diff --git a/src/openrct2/object/ObjectEntryManager.h b/src/openrct2/object/ObjectEntryManager.h index 84b170e00d..de8a1a143d 100644 --- a/src/openrct2/object/ObjectEntryManager.h +++ b/src/openrct2/object/ObjectEntryManager.h @@ -1,3 +1,14 @@ +/***************************************************************************** + * Copyright (c) 2014-2024 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + #include "ObjectTypes.h" namespace OpenRCT2::ObjectManager diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index f10790f7b5..1942f5fae6 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -9,7 +9,9 @@ #include "ObjectFactory.h" +#include "../Context.h" #include "../OpenRCT2.h" +#include "../PlatformEnvironment.h" #include "../audio/audio.h" #include "../core/Console.hpp" #include "../core/File.h" @@ -500,6 +502,12 @@ namespace ObjectFactory } } + static bool isUsingClassic() + { + auto env = OpenRCT2::GetContext()->GetPlatformEnvironment(); + return env->IsUsingClassic(); + } + std::unique_ptr CreateObjectFromJson( IObjectRepository& objectRepository, json_t& jRoot, const IFileDataRetriever* fileRetriever, bool loadImageTable) { @@ -517,9 +525,13 @@ namespace ObjectFactory { auto id = Json::GetString(jRoot["id"]); - // HACK Disguise RCT Classic audio as RCT2 audio so asset packs override correctly - if (id == OpenRCT2::Audio::AudioObjectIdentifiers::RCTCBase) - id = OpenRCT2::Audio::AudioObjectIdentifiers::RCT2Base; + // Base audio files are renamed to a common, virtual name so asset packs can override it correctly. + const bool isRCT2BaseAudio = id == OpenRCT2::Audio::AudioObjectIdentifiers::RCT2Base && !isUsingClassic(); + const bool isRCTCBaseAudio = id == OpenRCT2::Audio::AudioObjectIdentifiers::RCTCBase && isUsingClassic(); + if (isRCT2BaseAudio || isRCTCBaseAudio) + { + id = OpenRCT2::Audio::AudioObjectIdentifiers::RCT2; + } auto version = VersionTuple(Json::GetString(jRoot["version"])); ObjectEntryDescriptor descriptor; diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index 152e3a3f55..5dd997e63a 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -714,7 +714,7 @@ CarEntry RideObject::ReadJsonCar([[maybe_unused]] IReadObjectContext* context, j car.num_seats = Json::GetNumber(jCar["numSeats"]); if (Json::GetBoolean(jCar["seatsInPairs"], true) && car.num_seats > 1) { - car.num_seats |= VEHICLE_SEAT_PAIR_FLAG; + car.num_seats |= kVehicleSeatPairFlag; } car.sprite_width = Json::GetNumber(jCar["spriteWidth"]); @@ -818,7 +818,7 @@ CarEntry RideObject::ReadJsonCar([[maybe_unused]] IReadObjectContext* context, j { "isReverserPassengerCar", CAR_ENTRY_FLAG_REVERSER_PASSENGER_CAR }, { "hasInvertedSpriteSet", CAR_ENTRY_FLAG_HAS_INVERTED_SPRITE_SET }, { "hasDodgemInUseLights", CAR_ENTRY_FLAG_DODGEM_INUSE_LIGHTS }, - { "hasAdditionalColour2", CAR_ENTRY_FLAG_ENABLE_TERNARY_COLOUR }, + { "hasAdditionalColour2", CAR_ENTRY_FLAG_ENABLE_TERTIARY_COLOUR }, { "recalculateSpriteBounds", CAR_ENTRY_FLAG_RECALCULATE_SPRITE_BOUNDS }, { "overrideNumberOfVerticalFrames", CAR_ENTRY_FLAG_OVERRIDE_NUM_VERTICAL_FRAMES }, { "spriteBoundsIncludeInvertedSet", CAR_ENTRY_FLAG_SPRITE_BOUNDS_INCLUDE_INVERTED_SET }, diff --git a/src/openrct2/paint/Paint.Entity.cpp b/src/openrct2/paint/Paint.Entity.cpp index be86e4e3a5..3e1e074dc6 100644 --- a/src/openrct2/paint/Paint.Entity.cpp +++ b/src/openrct2/paint/Paint.Entity.cpp @@ -94,10 +94,13 @@ void EntityPaintSetup(PaintSession& session, const CoordsXY& pos) } } - if (session.DPI.y + session.DPI.height <= spr->SpriteData.SpriteRect.GetTop() - || spr->SpriteData.SpriteRect.GetBottom() <= session.DPI.y - || session.DPI.x + session.DPI.width <= spr->SpriteData.SpriteRect.GetLeft() - || spr->SpriteData.SpriteRect.GetRight() <= session.DPI.x) + auto screenCoords = Translate3DTo2DWithZ(session.CurrentRotation, spr->GetLocation()); + auto spriteRect = ScreenRect( + screenCoords - ScreenCoordsXY{ spr->SpriteData.Width, spr->SpriteData.HeightMin }, + screenCoords + ScreenCoordsXY{ spr->SpriteData.Width, spr->SpriteData.HeightMax }); + + if (session.DPI.y + session.DPI.height <= spriteRect.GetTop() || spriteRect.GetBottom() <= session.DPI.y + || session.DPI.x + session.DPI.width <= spriteRect.GetLeft() || spriteRect.GetRight() <= session.DPI.x) { continue; } diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 714f203fea..53f82b608f 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -55,7 +55,7 @@ bool gPaintBoundingBoxes; bool gPaintBlockedTiles; static void PaintAttachedPS(DrawPixelInfo& dpi, PaintStruct* ps, uint32_t viewFlags); -static void PaintPSImageWithBoundingBoxes(DrawPixelInfo& dpi, PaintStruct* ps, ImageId imageId, int32_t x, int32_t y); +static void PaintPSImageWithBoundingBoxes(PaintSession& session, PaintStruct* ps, ImageId imageId, int32_t x, int32_t y); static ImageId PaintPSColourifyImage(const PaintStruct* ps, ImageId imageId, uint32_t viewFlags); static int32_t RemapPositionToQuadrant(const PaintStruct& ps, uint8_t rotation) @@ -243,7 +243,6 @@ template void PaintSessionGenerateRotate(PaintSession& sessio */ void PaintSessionGenerate(PaintSession& session) { - session.CurrentRotation = GetCurrentRotation(); switch (DirectionFlipXAxis(session.CurrentRotation)) { case 0: @@ -533,7 +532,7 @@ static void PaintDrawStruct(PaintSession& session, PaintStruct* ps) auto imageId = PaintPSColourifyImage(ps, ps->image_id, session.ViewFlags); if (gPaintBoundingBoxes && session.DPI.zoom_level == ZoomLevel{ 0 }) { - PaintPSImageWithBoundingBoxes(session.DPI, ps, imageId, screenPos.x, screenPos.y); + PaintPSImageWithBoundingBoxes(session, ps, imageId, screenPos.x, screenPos.y); } else { @@ -579,7 +578,7 @@ static void PaintAttachedPS(DrawPixelInfo& dpi, PaintStruct* ps, uint32_t viewFl auto imageId = PaintPSColourifyImage(ps, attached_ps->image_id, viewFlags); if (attached_ps->IsMasked) { - GfxDrawSpriteRawMasked(&dpi, screenCoords, imageId, attached_ps->ColourImageId); + GfxDrawSpriteRawMasked(dpi, screenCoords, imageId, attached_ps->ColourImageId); } else { @@ -588,10 +587,12 @@ static void PaintAttachedPS(DrawPixelInfo& dpi, PaintStruct* ps, uint32_t viewFl } } -static void PaintPSImageWithBoundingBoxes(DrawPixelInfo& dpi, PaintStruct* ps, ImageId imageId, int32_t x, int32_t y) +static void PaintPSImageWithBoundingBoxes(PaintSession& session, PaintStruct* ps, ImageId imageId, int32_t x, int32_t y) { + auto& dpi = session.DPI; + const uint8_t colour = BoundBoxDebugColours[EnumValue(ps->InteractionItem)]; - const uint8_t rotation = GetCurrentRotation(); + const uint8_t rotation = session.CurrentRotation; const CoordsXYZ frontTop = { ps->Bounds.x_end, @@ -688,9 +689,9 @@ static ImageId PaintPSColourifyImage(const PaintStruct* ps, ImageId imageId, uin } } -PaintSession* PaintSessionAlloc(DrawPixelInfo& dpi, uint32_t viewFlags) +PaintSession* PaintSessionAlloc(DrawPixelInfo& dpi, uint32_t viewFlags, uint8_t rotation) { - return GetContext()->GetPainter()->CreateSession(dpi, viewFlags); + return GetContext()->GetPainter()->CreateSession(dpi, viewFlags, rotation); } void PaintSessionFree(PaintSession* session) diff --git a/src/openrct2/paint/Paint.h b/src/openrct2/paint/Paint.h index 7248fe134c..b958bcc304 100644 --- a/src/openrct2/paint/Paint.h +++ b/src/openrct2/paint/Paint.h @@ -121,9 +121,9 @@ struct TunnelEntry uint8_t type; }; -// The maximum size must be MAXIMUM_MAP_SIZE_TECHNICAL multiplied by 2 because +// The maximum size must be kMaximumMapSizeTechnical multiplied by 2 because // the quadrant index is based on the x and y components combined. -static constexpr int32_t MaxPaintQuadrants = MAXIMUM_MAP_SIZE_TECHNICAL * 2; +static constexpr int32_t MaxPaintQuadrants = kMaximumMapSizeTechnical * 2; #define TUNNEL_MAX_COUNT 65 @@ -338,7 +338,7 @@ void PaintFloatingMoneyEffect( PaintSession& session, money64 amount, StringId string_id, int32_t y, int32_t z, int8_t y_offsets[], int32_t offset_x, uint32_t rotation); -PaintSession* PaintSessionAlloc(DrawPixelInfo& dpi, uint32_t viewFlags); +PaintSession* PaintSessionAlloc(DrawPixelInfo& dpi, uint32_t viewFlags, uint8_t rotation); void PaintSessionFree(PaintSession* session); void PaintSessionGenerate(PaintSession& session); void PaintSessionArrange(PaintSessionCore& session); diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 1240a9270b..d91d24d94a 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -133,7 +133,7 @@ void Painter::MeasureFPS() _lastSecond = currentTime; } -PaintSession* Painter::CreateSession(DrawPixelInfo& dpi, uint32_t viewFlags) +PaintSession* Painter::CreateSession(DrawPixelInfo& dpi, uint32_t viewFlags, uint8_t rotation) { PROFILED_FUNCTION(); @@ -160,6 +160,7 @@ PaintSession* Painter::CreateSession(DrawPixelInfo& dpi, uint32_t viewFlags) session->QuadrantFrontIndex = 0; session->PaintEntryChain = _paintStructPool.Create(); session->Flags = 0; + session->CurrentRotation = rotation; std::fill(std::begin(session->Quadrants), std::end(session->Quadrants), nullptr); session->PaintHead = nullptr; diff --git a/src/openrct2/paint/Painter.h b/src/openrct2/paint/Painter.h index 7f51f6558e..54a119fd0c 100644 --- a/src/openrct2/paint/Painter.h +++ b/src/openrct2/paint/Painter.h @@ -47,7 +47,7 @@ namespace OpenRCT2 explicit Painter(const std::shared_ptr& uiContext); void Paint(Drawing::IDrawingEngine& de); - PaintSession* CreateSession(DrawPixelInfo& dpi, uint32_t viewFlags); + PaintSession* CreateSession(DrawPixelInfo& dpi, uint32_t viewFlags, uint8_t rotation); void ReleaseSession(PaintSession* session); ~Painter(); diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index 633de8010b..aa031803f2 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -10,6 +10,7 @@ #include "VirtualFloor.h" #include "../Cheats.h" +#include "../GameState.h" #include "../Input.h" #include "../config/Config.h" #include "../interface/Viewport.h" @@ -244,7 +245,7 @@ static void VirtualFloorGetTileProperties( *tileOwned = MapIsLocationOwned({ loc, height }); - if (gCheatsSandboxMode) + if (GetGameState().Cheats.SandboxMode) *tileOwned = true; // Iterate through the map elements of the current tile to find: diff --git a/src/openrct2/paint/support/MetalSupports.cpp b/src/openrct2/paint/support/MetalSupports.cpp index b9b15ab2c6..de7e41b04d 100644 --- a/src/openrct2/paint/support/MetalSupports.cpp +++ b/src/openrct2/paint/support/MetalSupports.cpp @@ -178,6 +178,26 @@ static constexpr uint8_t metal_supports_slope_image_map[] = { }; // clang-format on +static constexpr MetalSupportPlace kMetalSupportPlacementRotated[][NumOrthogonalDirections] = { + { MetalSupportPlace::TopCorner, MetalSupportPlace::RightCorner, MetalSupportPlace::BottomCorner, + MetalSupportPlace::LeftCorner }, + { MetalSupportPlace::LeftCorner, MetalSupportPlace::TopCorner, MetalSupportPlace::RightCorner, + MetalSupportPlace::BottomCorner }, + { MetalSupportPlace::RightCorner, MetalSupportPlace::BottomCorner, MetalSupportPlace::LeftCorner, + MetalSupportPlace::TopCorner }, + { MetalSupportPlace::BottomCorner, MetalSupportPlace::LeftCorner, MetalSupportPlace::TopCorner, + MetalSupportPlace::RightCorner }, + { MetalSupportPlace::Centre, MetalSupportPlace::Centre, MetalSupportPlace::Centre, MetalSupportPlace::Centre }, + { MetalSupportPlace::TopLeftSide, MetalSupportPlace::TopRightSide, MetalSupportPlace::BottomRightSide, + MetalSupportPlace::BottomLeftSide }, + { MetalSupportPlace::TopRightSide, MetalSupportPlace::BottomRightSide, MetalSupportPlace::BottomLeftSide, + MetalSupportPlace::TopLeftSide }, + { MetalSupportPlace::BottomLeftSide, MetalSupportPlace::TopLeftSide, MetalSupportPlace::TopRightSide, + MetalSupportPlace::BottomRightSide }, + { MetalSupportPlace::BottomRightSide, MetalSupportPlace::BottomLeftSide, MetalSupportPlace::TopLeftSide, + MetalSupportPlace::TopRightSide }, +}; + /** * Metal pole supports * @param supportType (edi) @@ -267,7 +287,7 @@ bool MetalASupportsPaintSetup( int8_t yOffset = SupportBoundBoxes[segment].y; uint32_t imageIndex = _97B15C[supportType].base_id; - imageIndex += metal_supports_slope_image_map[supportSegments[segment].slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]; + imageIndex += metal_supports_slope_image_map[supportSegments[segment].slope & kTileElementSurfaceSlopeMask]; auto image_id = imageTemplate.WithIndex(imageIndex); PaintAddImageAsParent(session, image_id, { xOffset, yOffset, supportSegments[segment].height }, { 0, 0, 5 }); @@ -374,6 +394,14 @@ bool MetalASupportsPaintSetup( return true; } +bool MetalASupportsPaintSetupRotated( + PaintSession& session, MetalSupportType supportTypeMember, MetalSupportPlace placement, Direction direction, + int32_t special, int32_t height, ImageId imageTemplate) +{ + placement = kMetalSupportPlacementRotated[EnumValue(placement)][direction]; + return MetalASupportsPaintSetup(session, supportTypeMember, placement, special, height, imageTemplate); +} + /** * Metal pole supports * rct2: 0x00663584 @@ -465,7 +493,7 @@ bool MetalBSupportsPaintSetup( } else { - uint32_t imageOffset = metal_supports_slope_image_map[supportSegments[segment].slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]; + uint32_t imageOffset = metal_supports_slope_image_map[supportSegments[segment].slope & kTileElementSurfaceSlopeMask]; uint32_t imageId = _97B15C[supportType].base_id + imageOffset; PaintAddImageAsParent( @@ -559,6 +587,14 @@ bool MetalBSupportsPaintSetup( return false; // AND } +bool MetalBSupportsPaintSetupRotated( + PaintSession& session, MetalSupportType supportTypeMember, MetalSupportPlace placement, Direction direction, + int32_t special, int32_t height, ImageId imageTemplate) +{ + placement = kMetalSupportPlacementRotated[EnumValue(placement)][direction]; + return MetalBSupportsPaintSetup(session, supportTypeMember, placement, special, height, imageTemplate); +} + constexpr uint8_t MetalSupportTypeCount = 13; constexpr MetalSupportType RotatedMetalSupports[MetalSupportTypeCount][NumOrthogonalDirections] = { { MetalSupportType::Tubes, MetalSupportType::Tubes, MetalSupportType::Tubes, MetalSupportType::Tubes }, @@ -643,7 +679,7 @@ bool PathPoleSupportsPaintSetup( } else { - uint8_t imageOffset = metal_supports_slope_image_map[supportSegments[segment].slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]; + uint8_t imageOffset = metal_supports_slope_image_map[supportSegments[segment].slope & kTileElementSurfaceSlopeMask]; baseHeight = supportSegments[segment].height; PaintAddImageAsParent( diff --git a/src/openrct2/paint/support/MetalSupports.h b/src/openrct2/paint/support/MetalSupports.h index 40c74e4288..c1e3b95db1 100644 --- a/src/openrct2/paint/support/MetalSupports.h +++ b/src/openrct2/paint/support/MetalSupports.h @@ -95,9 +95,15 @@ struct PaintSession; bool MetalASupportsPaintSetup( PaintSession& session, MetalSupportType supportTypeMember, MetalSupportPlace placement, int32_t special, int32_t height, ImageId imageTemplate); +bool MetalASupportsPaintSetupRotated( + PaintSession& session, MetalSupportType supportTypeMember, MetalSupportPlace placement, Direction direction, + int32_t special, int32_t height, ImageId imageTemplate); bool MetalBSupportsPaintSetup( PaintSession& session, MetalSupportType supportTypeMember, MetalSupportPlace placement, int32_t special, int32_t height, ImageId imageTemplate); +bool MetalBSupportsPaintSetupRotated( + PaintSession& session, MetalSupportType supportTypeMember, MetalSupportPlace placement, Direction direction, + int32_t special, int32_t height, ImageId imageTemplate); void DrawSupportsSideBySide( PaintSession& session, Direction direction, uint16_t height, ImageId colour, MetalSupportType type, int32_t special = 0); bool PathPoleSupportsPaintSetup( diff --git a/src/openrct2/paint/support/WoodenSupports.cpp b/src/openrct2/paint/support/WoodenSupports.cpp index c9fb7f1176..2c14a51ffc 100644 --- a/src/openrct2/paint/support/WoodenSupports.cpp +++ b/src/openrct2/paint/support/WoodenSupports.cpp @@ -447,7 +447,7 @@ bool WoodenASupportsPaintSetup( } else { - auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]); + auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileElementSurfaceSlopeMask]); PaintAddImageAsParent(session, imageId, { 0, 0, baseHeight }, { { 0, 0, baseHeight + 2 }, { 32, 32, 11 } }); PaintAddImageAsParent( @@ -475,7 +475,7 @@ bool WoodenASupportsPaintSetup( } else { - auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]); + auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileElementSurfaceSlopeMask]); PaintAddImageAsParent(session, imageId, { 0, 0, baseHeight }, { { 0, 0, baseHeight + 2 }, { 32, 32, 11 } }); hasSupports = true; } @@ -579,7 +579,7 @@ bool WoodenBSupportsPaintSetup( } else { - auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]); + auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileElementSurfaceSlopeMask]); PaintAddImageAsParent(session, imageId, { 0, 0, baseHeight }, { { 0, 0, baseHeight + 2 }, { 32, 32, 11 } }); PaintAddImageAsParent( @@ -607,7 +607,7 @@ bool WoodenBSupportsPaintSetup( } else { - auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]); + auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileElementSurfaceSlopeMask]); PaintAddImageAsParent(session, imageId, { 0, 0, baseHeight }, { { 0, 0, baseHeight + 2 }, { 32, 32, 3 } }); hasSupports = true; } @@ -704,7 +704,7 @@ bool PathBoxSupportsPaintSetup( return false; } - uint32_t imageId = supportOrientationOffset + word_97B3C4[session.Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK] + uint32_t imageId = supportOrientationOffset + word_97B3C4[session.Support.slope & kTileElementSurfaceSlopeMask] + pathPaintInfo.BridgeImageId; PaintAddImageAsParent( @@ -725,7 +725,7 @@ bool PathBoxSupportsPaintSetup( return false; } - uint32_t ebx = supportOrientationOffset + word_97B3C4[session.Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK] + uint32_t ebx = supportOrientationOffset + word_97B3C4[session.Support.slope & kTileElementSurfaceSlopeMask] + pathPaintInfo.BridgeImageId; PaintAddImageAsParent( diff --git a/src/openrct2/paint/tile_element/Paint.Entrance.cpp b/src/openrct2/paint/tile_element/Paint.Entrance.cpp index e041b91460..c97eb3e727 100644 --- a/src/openrct2/paint/tile_element/Paint.Entrance.cpp +++ b/src/openrct2/paint/tile_element/Paint.Entrance.cpp @@ -203,7 +203,7 @@ static void PaintRideEntranceExit(PaintSession& session, uint8_t direction, int3 session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, supportsImageTemplate); height += isExit ? 40 : 56; - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height, 0x20); } @@ -331,7 +331,7 @@ static void PaintParkEntrance(PaintSession& session, uint8_t direction, int32_t WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, supportsImageTemplate); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); } diff --git a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp index 8372297e6c..67a4292d6b 100644 --- a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp @@ -78,11 +78,11 @@ static void PaintLargeScenerySupports( int32_t clearanceHeight = Ceil2(tileElement.GetClearanceZ() + 15, 16); if (tile.flags & LARGE_SCENERY_TILE_FLAG_ALLOW_SUPPORTS_ABOVE) { - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, clearanceHeight, 0x20); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, clearanceHeight, 0x20); } else { - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); } PaintUtilSetGeneralSupportHeight(session, clearanceHeight, 0x20); } diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index 9c39bf7ba9..e8872a0866 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -913,36 +913,41 @@ static void PathPaintSegmentSupportHeight( if (pathElement.IsQueue() || (pathElement.GetEdgesAndCorners() != 0xFF && hasSupports)) { - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); return; } if (pathElement.GetEdgesAndCorners() == 0xFF) { - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight( + session, + EnumsToFlags( + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + 0xFFFF, 0); return; } - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C4, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::centre), 0xFFFF, 0); if (edges & EDGE_NE) { - PaintUtilSetSegmentSupportHeight(session, SEGMENT_CC, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::topRightSide), 0xFFFF, 0); } if (edges & EDGE_SE) { - PaintUtilSetSegmentSupportHeight(session, SEGMENT_D4, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::bottomRightSide), 0xFFFF, 0); } if (edges & EDGE_SW) { - PaintUtilSetSegmentSupportHeight(session, SEGMENT_D0, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::bottomLeftSide), 0xFFFF, 0); } if (edges & EDGE_NW) { - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::topLeftSide), 0xFFFF, 0); } } diff --git a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp index daf7d59a59..5934ae8700 100644 --- a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp @@ -78,32 +78,38 @@ static void SetSupportHeights( { if (sceneryEntry.HasFlag(SMALL_SCENERY_FLAG_FULL_TILE)) { - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C4, height, 0x20); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::centre), height, 0x20); if (sceneryEntry.HasFlag(SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) { - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~SEGMENT_C4, height, 0x20); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~EnumToFlag(PaintSegment::centre), height, 0x20); } } else if (sceneryEntry.HasFlag(SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) { auto direction = (sceneryElement.GetSceneryQuadrant() + session.CurrentRotation) % 4; PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), height, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + height, 0x20); } } else if (sceneryEntry.HasFlag(SMALL_SCENERY_FLAG27 | SMALL_SCENERY_FLAG_FULL_TILE)) { - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C4, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::centre), 0xFFFF, 0); if (sceneryEntry.HasFlag(SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) { - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~SEGMENT_C4, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~EnumToFlag(PaintSegment::centre), 0xFFFF, 0); } } else if (sceneryEntry.HasFlag(SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) { auto direction = (sceneryElement.GetSceneryQuadrant() + session.CurrentRotation) % 4; PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); } } @@ -174,11 +180,11 @@ static void PaintSmallSceneryBody( ImageIndex baseImageIndex = sceneryEntry->image + direction; if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_CAN_WITHER)) { - if (sceneryElement.GetAge() >= SCENERY_WITHER_AGE_THRESHOLD_1) + if (sceneryElement.GetAge() >= kSceneryWitherAgeThreshold1) { baseImageIndex += 4; } - if (sceneryElement.GetAge() >= SCENERY_WITHER_AGE_THRESHOLD_2) + if (sceneryElement.GetAge() >= kSceneryWitherAgeThreshold2) { baseImageIndex += 4; } diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index 88d3fc6f3a..82d873806c 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -40,6 +40,8 @@ #include #include +using namespace OpenRCT2; + // Needed to make the sign appear above footpaths. static constexpr int16_t ForSaleSignZOffset = 3; @@ -924,14 +926,14 @@ static std::pair SurfaceGetHeightAboveWater( { localHeight += LAND_HEIGHT_STEP; - if (waterHeight != localHeight || !(localSurfaceShape & TILE_ELEMENT_SURFACE_DIAGONAL_FLAG)) + if (waterHeight != localHeight || !(localSurfaceShape & static_cast(kTileElementSurfaceDiagonalFlag))) { localHeight = waterHeight; localSurfaceShape = TILE_ELEMENT_SLOPE_FLAT; } else { - localSurfaceShape = Numerics::ror4(surfaceShape ^ TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK, 2); + localSurfaceShape = Numerics::ror4(surfaceShape ^ static_cast(kTileElementSurfaceRaisedCornersMask), 2); } } } @@ -1187,12 +1189,13 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con PaintPatrolArea(session, tileElement, height, surfaceShape); + auto& gameState = GetGameState(); // Draw Peep Spawns - if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) + if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gameState.Cheats.SandboxMode) && session.ViewFlags & VIEWPORT_FLAG_LAND_OWNERSHIP) { const CoordsXY& pos = session.MapPosition; - for (auto& spawn : gPeepSpawns) + for (auto& spawn : gameState.PeepSpawns) { if ((spawn.x & 0xFFE0) == pos.x && (spawn.y & 0xFFE0) == pos.y) { @@ -1461,11 +1464,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con // 00 00 00 // 00 00 // 00 - PaintUtilSetSegmentSupportHeight( - session, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 - | SEGMENT_D4, - height, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, height, 0); PaintUtilForceSetGeneralSupportHeight(session, height, 0); break; @@ -1476,10 +1475,14 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con // 01 01 01 // 1B 1B // 1B - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, height, 0); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height, 1); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_D0 | SEGMENT_D4, height + 6, 0x1B); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C0, height + 6 + 6, 0x1B); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), height, + 0); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::rightCorner), height, 1); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), height + 6, 0x1B); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::bottomCorner), height + 6 + 6, 0x1B); PaintUtilForceSetGeneralSupportHeight(session, height, 1); break; @@ -1490,10 +1493,14 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con // 17 02 00 // 17 00 // 02 - PaintUtilSetSegmentSupportHeight(session, SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, height, 0); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height, 2); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_D0, height + 6, 0x17); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8, height + 6 + 6, 0x17); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + height, 0); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::centre, PaintSegment::bottomCorner), height, 2); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), height + 6, 0x17); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::leftCorner), height + 6 + 6, 0x17); PaintUtilForceSetGeneralSupportHeight(session, height, 2); break; @@ -1504,9 +1511,15 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con // 03 03 03 // 03 03 // 03 - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC, height + 2, 3); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, height + 2 + 6, 3); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0, height + 2 + 6 + 6, 3); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner), + height + 2, 3); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + height + 2 + 6, 3); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner), + height + 2 + 6 + 6, 3); PaintUtilForceSetGeneralSupportHeight(session, height, 3); break; @@ -1517,10 +1530,14 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con // 04 04 04 // 00 00 // 00 - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C0 | SEGMENT_D0 | SEGMENT_D4, height, 0); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height, 4); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_CC, height + 6, 0x1E); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4, height + 6 + 6, 0x1E); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::bottomCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + height, 0); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::rightCorner), height, 4); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::topRightSide), height + 6, 0x1E); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::topCorner), height + 6 + 6, 0x1E); PaintUtilForceSetGeneralSupportHeight(session, height, 4); break; @@ -1531,11 +1548,14 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con // 05 05 05 ░░ ░░ ░░ // 1B 1B ▒▒ ▒▒ // 1B ▓▓ - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4, height + 6 + 6, 0x1E); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_CC, height + 6, 0x1E); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height, 5); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_D0 | SEGMENT_D4, height + 6, 0x1B); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C0, height + 6 + 6, 0x1B); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::topCorner), height + 6 + 6, 0x1E); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::topRightSide), height + 6, 0x1E); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::rightCorner), height, 5); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), height + 6, 0x1B); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::bottomCorner), height + 6 + 6, 0x1B); PaintUtilForceSetGeneralSupportHeight(session, height, 5); break; @@ -1546,9 +1566,15 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con // 06 06 06 ▓▓ ▒▒ ░░ // 06 06 ▒▒ ░░ // 06 ░░ - PaintUtilSetSegmentSupportHeight(session, SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0, height + 2, 6); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, height + 2 + 6, 6); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4, height + 2 + 6 + 6, 6); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::rightCorner, PaintSegment::bottomRightSide, PaintSegment::bottomCorner), + height + 2, 6); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + height + 2 + 6, 6); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner), + height + 2 + 6 + 6, 6); PaintUtilForceSetGeneralSupportHeight(session, height, 6); break; @@ -1559,113 +1585,169 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con // 00 07 17 ▓▓ ▓▓ ░░ // 00 17 ▓▓ ▒▒ // 07 ▓▓ - PaintUtilSetSegmentSupportHeight(session, SEGMENT_BC, height + 4, 0x17); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_CC | SEGMENT_D4, height + 4 + 6, 0x17); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 7); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_D0 | SEGMENT_B8, height + 4 + 6 + 6, 0); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::rightCorner), height + 4, 0x17); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topRightSide, PaintSegment::bottomRightSide), height + 4 + 6, 0x17); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::centre, PaintSegment::bottomCorner), + height + 4 + 6 + 6, 7); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::leftCorner), + height + 4 + 6 + 6, 0); PaintUtilForceSetGeneralSupportHeight(session, height, 7); break; case 8: // Loc6620D8 - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_C8 | SEGMENT_D0, height, 0); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height, 8); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_CC | SEGMENT_D4, height + 6, 0x1D); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_BC, height + 6 + 6, 0x1D); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + height, 0); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::centre, PaintSegment::bottomCorner), height, 8); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topRightSide, PaintSegment::bottomRightSide), height + 6, 0x1D); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::rightCorner), height + 6 + 6, 0x1D); PaintUtilForceSetGeneralSupportHeight(session, height, 8); break; case 9: // Loc66216D PaintUtilForceSetGeneralSupportHeight(session, height, 9); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8, height + 2, 9); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, height + 2 + 6, 9); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, height + 2 + 6 + 6, 9); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner), height + 2, + 9); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + height + 2 + 6, 9); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + height + 2 + 6 + 6, 9); break; case 10: // Loc662206 PaintUtilForceSetGeneralSupportHeight(session, height, 0xA); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8, height + 6 + 6, 0x17); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_D0, height + 6, 0x17); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height, 0xA); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_CC | SEGMENT_D4, height + 6, 0x1D); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_BC, height + 6 + 6, 0x1D); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::leftCorner), height + 6 + 6, 0x17); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), height + 6, 0x17); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::centre, PaintSegment::bottomCorner), height, 0xA); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topRightSide, PaintSegment::bottomRightSide), height + 6, 0x1D); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::rightCorner), height + 6 + 6, 0x1D); break; case 11: // Loc66229B PaintUtilForceSetGeneralSupportHeight(session, height, 0xB); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4, height + 4, 0x1B); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_CC, height + 4 + 6, 0x1B); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0xB); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C0, height + 4 + 6 + 6, 0); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::topCorner), height + 4, 0x1B); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::topRightSide), height + 4 + 6, 0x1B); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::rightCorner), + height + 4 + 6 + 6, 0xB); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide, PaintSegment::bottomCorner), + height + 4 + 6 + 6, 0); break; case 12: // Loc662334 PaintUtilForceSetGeneralSupportHeight(session, height, 0xC); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0, height + 2, 0xC); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, height + 2 + 6, 0xC); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC, height + 2 + 6 + 6, 0xC); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner), + height + 2, 0xC); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + height + 2 + 6, 0xC); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner), + height + 2 + 6 + 6, 0xC); break; case 13: // Loc6623CD PaintUtilForceSetGeneralSupportHeight(session, height, 0xD); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8, height + 4, 0x1D); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_D0, height + 4 + 6, 0x1D); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 0xD); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_CC | SEGMENT_D4 | SEGMENT_BC, height + 4 + 6 + 6, 0); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::leftCorner), height + 4, 0x1D); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), height + 4 + 6, 0x1D); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::centre, PaintSegment::bottomCorner), + height + 4 + 6 + 6, 0xD); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topRightSide, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + height + 4 + 6 + 6, 0); break; case 14: // Loc662466 PaintUtilForceSetGeneralSupportHeight(session, height, 0xE); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C0, height + 4, 0x1E); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_D0 | SEGMENT_D4, height + 4 + 6, 0x1E); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0xE); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_CC | SEGMENT_B4, height + 4 + 6 + 6, 0); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::bottomCorner), height + 4, 0x1E); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), height + 4 + 6, 0x1E); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::rightCorner), + height + 4 + 6 + 6, 0xE); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::topCorner), + height + 4 + 6 + 6, 0); break; case 23: // Loc6624FF PaintUtilForceSetGeneralSupportHeight(session, height, 0x17); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_BC, height + 4, 0x17); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_CC | SEGMENT_D4, height + 4 + 6, 0x17); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 0x17); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_D0, height + 4 + 6 + 6 + 6, 0x17); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8, height + 4 + 6 + 6 + 6 + 6, 0x17); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::rightCorner), height + 4, 0x17); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topRightSide, PaintSegment::bottomRightSide), height + 4 + 6, 0x17); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::centre, PaintSegment::bottomCorner), + height + 4 + 6 + 6, 0x17); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), height + 4 + 6 + 6 + 6, 0x17); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::leftCorner), height + 4 + 6 + 6 + 6 + 6, 0x17); break; case 27: // Loc6625A0 PaintUtilForceSetGeneralSupportHeight(session, height, 0x1B); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4, height + 4, 0x1B); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_CC, height + 4 + 6, 0x1B); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0x1B); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_D0 | SEGMENT_D4, height + 4 + 6 + 6 + 6, 0x1B); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C0, height + 4 + 6 + 6 + 6 + 6, 0x1B); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::topCorner), height + 4, 0x1B); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::topRightSide), height + 4 + 6, 0x1B); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::rightCorner), + height + 4 + 6 + 6, 0x1B); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), height + 4 + 6 + 6 + 6, + 0x1B); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::bottomCorner), height + 4 + 6 + 6 + 6 + 6, 0x1B); break; case 29: // Loc662641 PaintUtilForceSetGeneralSupportHeight(session, height, 0x1D); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8, height + 4, 0x1D); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_D0, height + 4 + 6, 0x1D); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 0x1D); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_CC | SEGMENT_D4, height + 4 + 6 + 6 + 6, 0x1D); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_BC, height + 4 + 6 + 6 + 6 + 6, 0x1D); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::leftCorner), height + 4, 0x1D); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), height + 4 + 6, 0x1D); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topCorner, PaintSegment::centre, PaintSegment::bottomCorner), + height + 4 + 6 + 6, 0x1D); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topRightSide, PaintSegment::bottomRightSide), height + 4 + 6 + 6 + 6, 0x1D); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::rightCorner), height + 4 + 6 + 6 + 6 + 6, 0x1D); break; case 30: // Loc6626E2 PaintUtilForceSetGeneralSupportHeight(session, height, 0x1E); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C0, height + 4, 0x1E); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_D0 | SEGMENT_D4, height + 4 + 6, 0x1E); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0x1E); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C8 | SEGMENT_CC, height + 4 + 6 + 6 + 6, 0x1E); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_B4, height + 4 + 6 + 6 + 6 + 6, 0x1E); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::bottomCorner), height + 4, 0x1E); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), height + 4 + 6, 0x1E); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::rightCorner), + height + 4 + 6 + 6, 0x1E); + PaintUtilSetSegmentSupportHeight( + session, EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::topRightSide), height + 4 + 6 + 6 + 6, 0x1E); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::topCorner), height + 4 + 6 + 6 + 6 + 6, 0x1E); break; } } diff --git a/src/openrct2/paint/tile_element/Paint.TileElement.cpp b/src/openrct2/paint/tile_element/Paint.TileElement.cpp index a65d07fbf9..0d4760f876 100644 --- a/src/openrct2/paint/tile_element/Paint.TileElement.cpp +++ b/src/openrct2/paint/tile_element/Paint.TileElement.cpp @@ -38,9 +38,6 @@ static void BlankTilesPaint(PaintSession& session, int32_t x, int32_t y); static void PaintTileElementBase(PaintSession& session, const CoordsXY& origCoords); -const int32_t SEGMENTS_ALL = SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC - | SEGMENT_D0 | SEGMENT_D4; - /** * * rct2: 0x0068B35F @@ -51,7 +48,7 @@ void TileElementPaintSetup(PaintSession& session, const CoordsXY& mapCoords, boo if (!MapIsEdge(mapCoords)) { - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilForceSetGeneralSupportHeight(session, -1, 0); session.Flags = isTrackPiecePreview ? PaintSessionFlags::IsTrackPiecePreview : 0; session.WaterHeight = 0xFFFF; @@ -378,7 +375,9 @@ void PaintUtilForceSetGeneralSupportHeight(PaintSession& session, int16_t height } const uint16_t segment_offsets[9] = { - SEGMENT_B4, SEGMENT_B8, SEGMENT_BC, SEGMENT_C0, SEGMENT_C4, SEGMENT_C8, SEGMENT_CC, SEGMENT_D0, SEGMENT_D4, + EnumToFlag(PaintSegment::topCorner), EnumToFlag(PaintSegment::leftCorner), EnumToFlag(PaintSegment::rightCorner), + EnumToFlag(PaintSegment::bottomCorner), EnumToFlag(PaintSegment::centre), EnumToFlag(PaintSegment::topLeftSide), + EnumToFlag(PaintSegment::topRightSide), EnumToFlag(PaintSegment::bottomLeftSide), EnumToFlag(PaintSegment::bottomRightSide), }; void PaintUtilSetSegmentSupportHeight(PaintSession& session, int32_t segments, uint16_t height, uint8_t slope) @@ -399,6 +398,7 @@ void PaintUtilSetSegmentSupportHeight(PaintSession& session, int32_t segments, u uint16_t PaintUtilRotateSegments(uint16_t segments, uint8_t rotation) { + // Only the value representing PaintSegment::centre falls beyond 0xFF, so this will be kept in place. uint8_t temp = segments & 0xFF; temp = Numerics::rol8(temp, rotation * 2); diff --git a/src/openrct2/paint/tile_element/Paint.TileElement.h b/src/openrct2/paint/tile_element/Paint.TileElement.h index 9df68ddace..cea6ed18a4 100644 --- a/src/openrct2/paint/tile_element/Paint.TileElement.h +++ b/src/openrct2/paint/tile_element/Paint.TileElement.h @@ -26,18 +26,24 @@ enum edge_t EDGE_TOPRIGHT = EDGE_NE }; -enum +// This controls in which segment of a tile something is drawn. +// This is from a screen perspective, e.g. topCorner will always represent the part of top of the screen. +enum class PaintSegment : uint16_t { - SEGMENT_B4 = (1 << 0), // 0 - SEGMENT_CC = (1 << 1), // 6 - SEGMENT_BC = (1 << 2), // 2 - SEGMENT_D4 = (1 << 3), // 8 - SEGMENT_C0 = (1 << 4), // 3 - SEGMENT_D0 = (1 << 5), // 7 - SEGMENT_B8 = (1 << 6), // 1 - SEGMENT_C8 = (1 << 7), // 5 - SEGMENT_C4 = (1 << 8), // 4 + topCorner = 0, + topRightSide = 1, + rightCorner = 2, + bottomRightSide = 3, + bottomCorner = 4, + bottomLeftSide = 5, + leftCorner = 6, + topLeftSide = 7, + centre = 8, }; +constexpr int32_t kSegmentsAll = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide); enum { @@ -71,7 +77,6 @@ enum TUNNEL_TYPE_COUNT }; -extern const int32_t SEGMENTS_ALL; extern const uint16_t segment_offsets[9]; extern bool gShowSupportSegmentHeights; diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 799c829b68..fe205516e6 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -528,7 +528,7 @@ namespace OpenRCT2 cs.ReadWrite(gameState.GuestInitialThirst); cs.ReadWrite(gameState.NextGuestNumber); - cs.ReadWriteVector(gPeepSpawns, [&cs](PeepSpawn& spawn) { + cs.ReadWriteVector(gameState.PeepSpawns, [&cs](PeepSpawn& spawn) { cs.ReadWrite(spawn.x); cs.ReadWrite(spawn.y); cs.ReadWrite(spawn.z); @@ -541,18 +541,18 @@ namespace OpenRCT2 money16 tempConstructionRightPrice{}; cs.ReadWrite(tempLandPrice); cs.ReadWrite(tempConstructionRightPrice); - gLandPrice = ToMoney64(tempLandPrice); + gameState.LandPrice = ToMoney64(tempLandPrice); gameState.ConstructionRightsPrice = ToMoney64(tempConstructionRightPrice); } else { - cs.ReadWrite(gLandPrice); + cs.ReadWrite(gameState.LandPrice); cs.ReadWrite(gameState.ConstructionRightsPrice); } - cs.ReadWrite(gGrassSceneryTileLoopPosition); - cs.ReadWrite(gWidePathTileLoopPosition); + cs.ReadWrite(gameState.GrassSceneryTileLoopPosition); + cs.ReadWrite(gameState.WidePathTileLoopPosition); - auto& rideRatings = RideRatingGetUpdateStates(); + auto& rideRatings = gameState.RideRatingUpdateStates; if (os.GetHeader().TargetVersion >= 21) { cs.ReadWriteArray(rideRatings, [this, &cs](RideRatingUpdateState& calcData) { @@ -617,7 +617,7 @@ namespace OpenRCT2 cs.Write(static_cast(gameState.SavedViewZoom)); } cs.ReadWrite(gameState.SavedViewRotation); - cs.ReadWrite(gLastEntranceStyle); + cs.ReadWrite(gameState.LastEntranceStyle); cs.ReadWrite(gameState.EditorStep); }); } @@ -821,7 +821,7 @@ namespace OpenRCT2 cs.ReadWrite(gameState.StaffHandymanColour); cs.ReadWrite(gameState.StaffMechanicColour); cs.ReadWrite(gameState.StaffSecurityColour); - cs.ReadWrite(gSamePriceThroughoutPark); + cs.ReadWrite(gameState.SamePriceThroughoutPark); // Finances if (cs.GetMode() == OrcaStream::Mode::READING) @@ -832,7 +832,7 @@ namespace OpenRCT2 { for (uint32_t j = 0; j < numTypes; j++) { - gExpenditureTable[i][j] = cs.Read(); + gameState.ExpenditureTable[i][j] = cs.Read(); } } } @@ -847,11 +847,11 @@ namespace OpenRCT2 { for (uint32_t j = 0; j < numTypes; j++) { - cs.Write(gExpenditureTable[i][j]); + cs.Write(gameState.ExpenditureTable[i][j]); } } } - cs.ReadWrite(gHistoricalProfit); + cs.ReadWrite(gameState.HistoricalProfit); // Marketing cs.ReadWriteVector(gMarketingCampaigns, [&cs](MarketingCampaign& campaign) { @@ -862,15 +862,16 @@ namespace OpenRCT2 }); // Awards + auto& currentAwards = gameState.CurrentAwards; if (version <= 6) { Award awards[RCT2::Limits::MaxAwards]{}; - cs.ReadWriteArray(awards, [&cs](Award& award) { + cs.ReadWriteArray(awards, [&cs, ¤tAwards](Award& award) { if (award.Time != 0) { cs.ReadWrite(award.Time); cs.ReadWrite(award.Type); - GetAwards().push_back(award); + currentAwards.push_back(award); return true; } @@ -879,7 +880,7 @@ namespace OpenRCT2 } else { - cs.ReadWriteVector(GetAwards(), [&cs](Award& award) { + cs.ReadWriteVector(currentAwards, [&cs](Award& award) { cs.ReadWrite(award.Time); cs.ReadWrite(award.Type); }); @@ -890,7 +891,7 @@ namespace OpenRCT2 cs.ReadWrite(gameState.NumGuestsInPark); cs.ReadWrite(gameState.NumGuestsHeadingForPark); cs.ReadWrite(gameState.ParkRating); - cs.ReadWrite(gParkRatingCasualtyPenalty); + cs.ReadWrite(gameState.ParkRatingCasualtyPenalty); cs.ReadWrite(gameState.CurrentExpenditure); cs.ReadWrite(gameState.CurrentProfit); cs.ReadWrite(gameState.WeeklyProfitAverageDividend); @@ -908,11 +909,11 @@ namespace OpenRCT2 cs.ReadWrite(gameState.TotalRideValueForMoney); } cs.ReadWrite(gameState.NumGuestsInParkLastWeek); - cs.ReadWrite(gGuestChangeModifier); + cs.ReadWrite(gameState.GuestChangeModifier); cs.ReadWrite(gameState.GuestGenerationProbability); cs.ReadWrite(gameState.SuggestedGuestMaximum); - cs.ReadWriteArray(gPeepWarningThrottle, [&cs](uint8_t& value) { + cs.ReadWriteArray(gameState.PeepWarningThrottle, [&cs](uint8_t& value) { cs.ReadWrite(value); return true; }); @@ -922,12 +923,12 @@ namespace OpenRCT2 return true; }); - cs.ReadWriteArray(gGuestsInParkHistory, [&cs](uint32_t& value) { + cs.ReadWriteArray(gameState.GuestsInParkHistory, [&cs](uint32_t& value) { cs.ReadWrite(value); return true; }); - cs.ReadWriteArray(gCashHistory, [&cs](money64& value) { + cs.ReadWriteArray(gameState.CashHistory, [&cs](money64& value) { cs.ReadWrite(value); return true; }); diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index bc93899351..51512b06d9 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -1589,14 +1589,14 @@ namespace OpenRCT2::PathFinding * Gets the nearest peep spawn relative to point, by using Manhattan distance. * @param x x coordinate of location * @param y y coordinate of location - * @return Index of gPeepSpawns (or 0xFF if no peep spawns exist). + * @return Index of gameState.PeepSpawns (or 0xFF if no peep spawns exist). */ static uint8_t GetNearestPeepSpawnIndex(uint16_t x, uint16_t y) { uint8_t chosenSpawn = 0xFF; uint16_t nearestDist = 0xFFFF; uint8_t i = 0; - for (const auto& spawn : gPeepSpawns) + for (const auto& spawn : GetGameState().PeepSpawns) { uint16_t dist = abs(spawn.x - x) + abs(spawn.y - y); if (dist < nearestDist) @@ -1622,7 +1622,7 @@ namespace OpenRCT2::PathFinding if (chosenSpawn == 0xFF) return GuestPathfindAimless(peep, edges); - const auto peepSpawnLoc = gPeepSpawns[chosenSpawn].ToTileStart(); + const auto peepSpawnLoc = GetGameState().PeepSpawns[chosenSpawn].ToTileStart(); Direction direction = peepSpawnLoc.direction; if (peepSpawnLoc.x == peep.NextLoc.x && peepSpawnLoc.y == peep.NextLoc.y) diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index 0c94a03a2f..1f418d0fc6 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -57,7 +57,7 @@ static const wchar_t* _wszCommitSha1Short = WSZ(""); static const wchar_t* _wszArchitecture = WSZ(OPENRCT2_ARCHITECTURE); static std::map _uploadFiles; -# define BACKTRACE_TOKEN "029f8349236e87bd851f381f518f251698f0bb6efad167c6afeac151bbf14d9e" +# define BACKTRACE_TOKEN "a647c0d5b2b416665cba6a1054397d3074eedd13d68a66efc0c0729ffce7c8bb" using namespace OpenRCT2; diff --git a/src/openrct2/rct1/RCT1.h b/src/openrct2/rct1/RCT1.h index 88a43c6fdd..7ba5978708 100644 --- a/src/openrct2/rct1/RCT1.h +++ b/src/openrct2/rct1/RCT1.h @@ -11,6 +11,7 @@ #include "../rct12/RCT12.h" #include "../ride/RideRatings.h" +#include "../world/Park.h" #include "Limits.h" namespace RCT1 @@ -772,7 +773,7 @@ namespace RCT1 uint16_t AvailableBanners; uint8_t Unk1990AA[94]; uint16_t ParkRating; - uint8_t ParkRatingHistory[32]; + uint8_t ParkRatingHistory[kParkRatingHistorySize]; uint8_t GuestsInParkHistory[32]; uint8_t ResearchPriority; uint8_t ResearchProgressStage; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index e70c732791..69ebdcaff1 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -916,7 +916,7 @@ namespace RCT1 { auto& dstStation = dst->GetStation(StationIndex::FromUnderlying(i)); dstStation.Start.SetNull(); - dstStation.TrainAtStation = RideStation::NO_TRAIN; + dstStation.TrainAtStation = RideStation::kNoTrain; dstStation.Entrance.SetNull(); dstStation.Exit.SetNull(); dstStation.LastPeepInQueue = EntityId::GetNull(); @@ -1410,14 +1410,15 @@ namespace RCT1 void ImportPeepSpawns() { - gPeepSpawns.clear(); + auto& gameState = GetGameState(); + gameState.PeepSpawns.clear(); for (size_t i = 0; i < Limits::MaxPeepSpawns; i++) { if (_s4.PeepSpawn[i].x != RCT12_PEEP_SPAWN_UNDEFINED) { PeepSpawn spawn = { _s4.PeepSpawn[i].x, _s4.PeepSpawn[i].y, _s4.PeepSpawn[i].z * 16, _s4.PeepSpawn[i].direction }; - gPeepSpawns.push_back(spawn); + gameState.PeepSpawns.push_back(spawn); } } } @@ -1425,7 +1426,7 @@ namespace RCT1 void ImportFinance(GameState_t& gameState) { gameState.ParkEntranceFee = _s4.ParkEntranceFee; - gLandPrice = ToMoney64(_s4.LandPrice); + gameState.LandPrice = ToMoney64(_s4.LandPrice); gameState.ConstructionRightsPrice = ToMoney64(_s4.ConstructionRightsPrice); gameState.Cash = ToMoney64(_s4.Cash); @@ -1441,7 +1442,7 @@ namespace RCT1 for (size_t i = 0; i < Limits::FinanceGraphSize; i++) { - gCashHistory[i] = ToMoney64(_s4.CashHistory[i]); + gameState.CashHistory[i] = ToMoney64(_s4.CashHistory[i]); gameState.ParkValueHistory[i] = CorrectRCT1ParkValue(_s4.ParkValueHistory[i]); gameState.WeeklyProfitHistory[i] = ToMoney64(_s4.WeeklyProfitHistory[i]); } @@ -1450,7 +1451,7 @@ namespace RCT1 { for (size_t j = 0; j < Limits::ExpenditureTypeCount; j++) { - gExpenditureTable[i][j] = ToMoney64(_s4.Expenditure[i][j]); + gameState.ExpenditureTable[i][j] = ToMoney64(_s4.Expenditure[i][j]); } } gameState.CurrentExpenditure = ToMoney64(_s4.TotalExpenditure); @@ -1527,9 +1528,9 @@ namespace RCT1 std::vector tileElements; const auto maxSize = _s4.MapSize == 0 ? Limits::MaxMapSize : _s4.MapSize; - for (TileCoordsXY coords = { 0, 0 }; coords.y < MAXIMUM_MAP_SIZE_TECHNICAL; coords.y++) + for (TileCoordsXY coords = { 0, 0 }; coords.y < kMaximumMapSizeTechnical; coords.y++) { - for (coords.x = 0; coords.x < MAXIMUM_MAP_SIZE_TECHNICAL; coords.x++) + for (coords.x = 0; coords.x < kMaximumMapSizeTechnical; coords.x++) { auto tileAdded = false; if (coords.x < maxSize && coords.y < maxSize) @@ -2156,27 +2157,29 @@ namespace RCT1 { if (_s4.GuestsInParkHistory[i] != RCT12ParkHistoryUndefined) { - gGuestsInParkHistory[i] = _s4.GuestsInParkHistory[i] * RCT12GuestsInParkHistoryFactor; + gameState.GuestsInParkHistory[i] = _s4.GuestsInParkHistory[i] * RCT12GuestsInParkHistoryFactor; } } // Awards - auto& awards = GetAwards(); + auto& currentAwards = gameState.CurrentAwards; for (auto& src : _s4.Awards) { if (src.Time != 0) { - awards.push_back(Award{ src.Time, static_cast(src.Type) }); + currentAwards.push_back(Award{ src.Time, static_cast(src.Type) }); } } // Number of guests history - std::fill(std::begin(gGuestsInParkHistory), std::end(gGuestsInParkHistory), std::numeric_limits::max()); + std::fill( + std::begin(gameState.GuestsInParkHistory), std::end(gameState.GuestsInParkHistory), + std::numeric_limits::max()); for (size_t i = 0; i < std::size(_s4.GuestsInParkHistory); i++) { if (_s4.GuestsInParkHistory[i] != std::numeric_limits::max()) { - gGuestsInParkHistory[i] = _s4.GuestsInParkHistory[i] * 20; + gameState.GuestsInParkHistory[i] = _s4.GuestsInParkHistory[i] * 20; } } @@ -2234,10 +2237,10 @@ namespace RCT1 gameState.ParkSize = _s4.ParkSize; gameState.TotalRideValueForMoney = _s4.TotalRideValueForMoney; - gSamePriceThroughoutPark = 0; + gameState.SamePriceThroughoutPark = 0; if (_gameVersion == FILE_VERSION_RCT1_LL) { - gSamePriceThroughoutPark = _s4.SamePriceThroughout; + gameState.SamePriceThroughoutPark = _s4.SamePriceThroughout; } } diff --git a/src/openrct2/rct1/Tables.cpp b/src/openrct2/rct1/Tables.cpp index 4a7bc17109..5b878a7495 100644 --- a/src/openrct2/rct1/Tables.cpp +++ b/src/openrct2/rct1/Tables.cpp @@ -173,7 +173,7 @@ namespace RCT1 static uint8_t map[] = { RIDE_TYPE_CLASSIC_WOODEN_ROLLER_COASTER,// RCT1_RIDE_TYPE_WOODEN_ROLLER_COASTER - RIDE_TYPE_STAND_UP_ROLLER_COASTER, // RCT1_RIDE_TYPE_STAND_UP_STEEL_ROLLER_COASTER + RIDE_TYPE_CLASSIC_STAND_UP_ROLLER_COASTER, // RCT1_RIDE_TYPE_STAND_UP_STEEL_ROLLER_COASTER RIDE_TYPE_SUSPENDED_SWINGING_COASTER, // RCT1_RIDE_TYPE_SUSPENDED_ROLLER_COASTER RIDE_TYPE_INVERTED_ROLLER_COASTER, // RCT1_RIDE_TYPE_INVERTED_ROLLER_COASTER RIDE_TYPE_CLASSIC_MINI_ROLLER_COASTER, // RCT1_RIDE_TYPE_STEEL_MINI_ROLLER_COASTER @@ -275,7 +275,7 @@ namespace RCT1 { COPY_COLOUR_1, COPY_COLOUR_2, COPY_COLOUR_2 }, // RCT1_VEHICLE_TYPE_INVERTED_COASTER_TRAIN, // Not in RCT2 { COPY_COLOUR_1, COPY_COLOUR_2, COPY_COLOUR_2 }, // RCT1_VEHICLE_TYPE_SUSPENDED_SWINGING_CARS, { COPY_COLOUR_1, COPY_COLOUR_2, COLOUR_BLACK }, // RCT1_VEHICLE_TYPE_LADYBIRD_CARS, - { COPY_COLOUR_1, COPY_COLOUR_1, COPY_COLOUR_2 }, // RCT1_VEHICLE_TYPE_STANDUP_ROLLER_COASTER_CARS, + { COPY_COLOUR_1, COPY_COLOUR_2, COPY_COLOUR_2 }, // RCT1_VEHICLE_TYPE_STANDUP_ROLLER_COASTER_CARS, { COPY_COLOUR_1, COPY_COLOUR_2, COLOUR_BLACK }, // RCT1_VEHICLE_TYPE_SPINNING_CARS, { COPY_COLOUR_1, COPY_COLOUR_2, COLOUR_BLACK }, // RCT1_VEHICLE_TYPE_SINGLE_PERSON_SWINGING_CHAIRS, { COPY_COLOUR_1, COPY_COLOUR_2, COLOUR_BLACK }, // RCT1_VEHICLE_TYPE_SWANS_PEDAL_BOATS, @@ -705,7 +705,7 @@ namespace RCT1 static constexpr const char * map[] = { "rct1.ride.wooden_rc_trains", // RCT1_RIDE_TYPE_WOODEN_ROLLER_COASTER - "rct2.ride.togst", // RCT1_RIDE_TYPE_STAND_UP_STEEL_ROLLER_COASTER + "rct1.ride.stand_up_trains", // RCT1_RIDE_TYPE_STAND_UP_STEEL_ROLLER_COASTER "rct1.ride.suspended_swinging_cars", // RCT1_RIDE_TYPE_SUSPENDED_ROLLER_COASTER "rct1ll.ride.4_across_inverted_trains", // RCT1_RIDE_TYPE_INVERTED_ROLLER_COASTER "rct1.ride.ladybird_trains", // RCT1_RIDE_TYPE_STEEL_MINI_ROLLER_COASTER @@ -807,7 +807,7 @@ namespace RCT1 "rct1.ride.inverted_trains", // VehicleType::InvertedCoasterTrain//NotinRCT2 "rct1.ride.suspended_swinging_cars", // VehicleType::SuspendedSwingingCars "rct1.ride.ladybird_trains", // VehicleType::LadybirdCars - "rct2.ride.togst", // VehicleType::StandupRollerCoasterCars + "rct1.ride.stand_up_trains", // VehicleType::StandupRollerCoasterCars "rct2.ride.wmspin", // VehicleType::SpinningCars "rct1.ride.single_person_swinging_cars", // VehicleType::SinglePersonSwingingChairs "rct2.ride.swans", // VehicleType::SwansPedalBoats diff --git a/src/openrct2/rct12/RCT12.cpp b/src/openrct2/rct12/RCT12.cpp index cbe4c1a41e..1be2bb0782 100644 --- a/src/openrct2/rct12/RCT12.cpp +++ b/src/openrct2/rct12/RCT12.cpp @@ -31,7 +31,7 @@ using namespace OpenRCT2; RCT12TileElementType RCT12TileElementBase::GetType() const { - auto elem_type = static_cast((this->Type & TILE_ELEMENT_TYPE_MASK) >> 2); + auto elem_type = static_cast((this->Type & kTileElementTypeMask) >> 2); switch (elem_type) { case RCT12TileElementType::Surface: @@ -54,12 +54,12 @@ RCT12TileElementType RCT12TileElementBase::GetType() const uint8_t RCT12TileElementBase::GetDirection() const { - return this->Type & TILE_ELEMENT_DIRECTION_MASK; + return this->Type & kTileElementDirectionMask; } uint8_t RCT12TileElementBase::GetOccupiedQuadrants() const { - return Flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK; + return Flags & kTileElementOccupiedQuadrantsMask; } bool RCT12TileElementBase::IsLastForTile() const @@ -74,7 +74,7 @@ bool RCT12TileElementBase::IsGhost() const uint8_t RCT12SurfaceElement::GetSlope() const { - return (Slope & TILE_ELEMENT_SURFACE_SLOPE_MASK); + return (Slope & kTileElementSurfaceSlopeMask); } uint32_t RCT12SurfaceElement::GetSurfaceStyle() const @@ -99,7 +99,7 @@ uint8_t RCT12SurfaceElement::GetGrassLength() const uint8_t RCT12SurfaceElement::GetOwnership() const { - return (Ownership & TILE_ELEMENT_SURFACE_OWNERSHIP_MASK); + return (Ownership & kTileElementSurfaceOwnershipMask); } uint32_t RCT12SurfaceElement::GetWaterHeight() const @@ -109,7 +109,7 @@ uint32_t RCT12SurfaceElement::GetWaterHeight() const uint8_t RCT12SurfaceElement::GetParkFences() const { - return (Ownership & TILE_ELEMENT_SURFACE_PARK_FENCE_MASK); + return (Ownership & kTileElementSurfaceParkFenceMask); } bool RCT12SurfaceElement::HasTrackThatNeedsWater() const @@ -308,7 +308,7 @@ uint8_t RCT12SmallSceneryElement::GetAge() const uint8_t RCT12SmallSceneryElement::GetSceneryQuadrant() const { - return (this->Type & TILE_ELEMENT_QUADRANT_MASK) >> 6; + return (this->Type & kTileElementQuadrantMask) >> 6; } colour_t RCT12SmallSceneryElement::GetPrimaryColour() const @@ -358,7 +358,7 @@ uint8_t RCT12WallElement::GetEntryIndex() const uint8_t RCT12WallElement::GetSlope() const { - return (Type & TILE_ELEMENT_QUADRANT_MASK) >> 6; + return (Type & kTileElementQuadrantMask) >> 6; } colour_t RCT12WallElement::GetPrimaryColour() const diff --git a/src/openrct2/rct12/SawyerChunk.cpp b/src/openrct2/rct12/SawyerChunk.cpp index 65779a1bb3..1f77f6b551 100644 --- a/src/openrct2/rct12/SawyerChunk.cpp +++ b/src/openrct2/rct12/SawyerChunk.cpp @@ -12,14 +12,9 @@ #include "../core/Memory.hpp" #include "SawyerChunkReader.h" -SawyerChunk::SawyerChunk(SAWYER_ENCODING encoding, void* data, size_t length) +SawyerChunk::SawyerChunk(SAWYER_ENCODING encoding, std::unique_ptr data, size_t length) { _encoding = encoding; - _data = data; + _data = std::move(data); _length = length; } - -SawyerChunk::~SawyerChunk() -{ - SawyerChunkReader::FreeChunk(_data); -} diff --git a/src/openrct2/rct12/SawyerChunk.h b/src/openrct2/rct12/SawyerChunk.h index 1a6a4ca5af..05e8bc2d7a 100644 --- a/src/openrct2/rct12/SawyerChunk.h +++ b/src/openrct2/rct12/SawyerChunk.h @@ -11,6 +11,8 @@ #include "../common.h" +#include + /** * The type of encoding / compression for a sawyer encoded chunk. */ @@ -28,14 +30,14 @@ enum class SAWYER_ENCODING : uint8_t class SawyerChunk final { private: - void* _data = nullptr; + std::unique_ptr _data; size_t _length = 0; SAWYER_ENCODING _encoding = SAWYER_ENCODING::NONE; public: const void* GetData() const { - return _data; + return _data.get(); } size_t GetLength() const { @@ -46,6 +48,5 @@ public: return _encoding; } - SawyerChunk(SAWYER_ENCODING encoding, void* data, size_t length); - ~SawyerChunk(); + SawyerChunk(SAWYER_ENCODING encoding, std::unique_ptr data, size_t length); }; diff --git a/src/openrct2/rct12/SawyerChunkReader.cpp b/src/openrct2/rct12/SawyerChunkReader.cpp index eaf4220583..df1e38b95f 100644 --- a/src/openrct2/rct12/SawyerChunkReader.cpp +++ b/src/openrct2/rct12/SawyerChunkReader.cpp @@ -71,22 +71,15 @@ std::shared_ptr SawyerChunkReader::ReadChunk() throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_CHUNK_SIZE); } - auto buffer = static_cast(AllocateLargeTempBuffer()); - try + auto buffer = std::make_unique(MAX_UNCOMPRESSED_CHUNK_SIZE); + size_t uncompressedLength = DecodeChunk( + buffer.get(), MAX_UNCOMPRESSED_CHUNK_SIZE, compressedData.get(), header); + if (uncompressedLength == 0) { - size_t uncompressedLength = DecodeChunk(buffer, MAX_UNCOMPRESSED_CHUNK_SIZE, compressedData.get(), header); - if (uncompressedLength == 0) - { - throw SawyerChunkException(EXCEPTION_MSG_ZERO_SIZED_CHUNK); - } - return std::make_shared( - static_cast(header.encoding), buffer, uncompressedLength); - } - catch (const std::exception&) - { - FreeLargeTempBuffer(buffer); - throw; + throw SawyerChunkException(EXCEPTION_MSG_ZERO_SIZED_CHUNK); } + return std::make_shared( + static_cast(header.encoding), std::move(buffer), uncompressedLength); } default: throw SawyerChunkException(EXCEPTION_MSG_INVALID_CHUNK_ENCODING); @@ -119,14 +112,14 @@ std::shared_ptr SawyerChunkReader::ReadChunkTrack() throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_CHUNK_SIZE); } - auto buffer = static_cast(AllocateLargeTempBuffer()); + auto buffer = std::make_unique(MAX_UNCOMPRESSED_CHUNK_SIZE); SawyerCodingChunkHeader header{ CHUNK_ENCODING_RLE, compressedDataLength }; - size_t uncompressedLength = DecodeChunk(buffer, MAX_UNCOMPRESSED_CHUNK_SIZE, compressedData.get(), header); + size_t uncompressedLength = DecodeChunk(buffer.get(), MAX_UNCOMPRESSED_CHUNK_SIZE, compressedData.get(), header); if (uncompressedLength == 0) { throw SawyerChunkException(EXCEPTION_MSG_ZERO_SIZED_CHUNK); } - return std::make_shared(SAWYER_ENCODING::RLE, buffer, uncompressedLength); + return std::make_shared(SAWYER_ENCODING::RLE, std::move(buffer), uncompressedLength); } catch (const std::exception&) { @@ -157,11 +150,6 @@ void SawyerChunkReader::ReadChunk(void* dst, size_t length) } } -void SawyerChunkReader::FreeChunk(void* data) -{ - FreeLargeTempBuffer(data); -} - size_t SawyerChunkReader::DecodeChunk(void* dst, size_t dstCapacity, const void* src, const SawyerCodingChunkHeader& header) { size_t resultLength; @@ -192,8 +180,7 @@ size_t SawyerChunkReader::DecodeChunk(void* dst, size_t dstCapacity, const void* size_t SawyerChunkReader::DecodeChunkRLERepeat(void* dst, size_t dstCapacity, const void* src, size_t srcLength) { - auto immBuffer = std::unique_ptr( - static_cast(AllocateLargeTempBuffer()), &FreeLargeTempBuffer); + auto immBuffer = std::make_unique(MAX_UNCOMPRESSED_CHUNK_SIZE); auto immLength = DecodeChunkRLE(immBuffer.get(), MAX_UNCOMPRESSED_CHUNK_SIZE, src, srcLength); auto size = DecodeChunkRepeat(dst, dstCapacity, immBuffer.get(), immLength); return size; @@ -301,26 +288,3 @@ size_t SawyerChunkReader::DecodeChunkRotate(void* dst, size_t dstCapacity, const } return srcLength; } - -void* SawyerChunkReader::AllocateLargeTempBuffer() -{ -#ifdef __USE_HEAP_ALLOC__ - auto buffer = HeapAlloc(GetProcessHeap(), 0, MAX_UNCOMPRESSED_CHUNK_SIZE); -#else - auto buffer = std::malloc(MAX_UNCOMPRESSED_CHUNK_SIZE); -#endif - if (buffer == nullptr) - { - throw std::runtime_error("Unable to allocate large temporary buffer."); - } - return buffer; -} - -void SawyerChunkReader::FreeLargeTempBuffer(void* buffer) -{ -#ifdef __USE_HEAP_ALLOC__ - HeapFree(GetProcessHeap(), 0, buffer); -#else - std::free(buffer); -#endif -} diff --git a/src/openrct2/rct12/SawyerChunkReader.h b/src/openrct2/rct12/SawyerChunkReader.h index 60c1e5c572..5bbdc3a79b 100644 --- a/src/openrct2/rct12/SawyerChunkReader.h +++ b/src/openrct2/rct12/SawyerChunkReader.h @@ -85,18 +85,10 @@ public: return result; } - /** - * Frees the chunk data, to be used when destructing SawyerChunks - */ - static void FreeChunk(void* data); - private: static size_t DecodeChunk(void* dst, size_t dstCapacity, const void* src, const SawyerCodingChunkHeader& header); static size_t DecodeChunkRLERepeat(void* dst, size_t dstCapacity, const void* src, size_t srcLength); static size_t DecodeChunkRLE(void* dst, size_t dstCapacity, const void* src, size_t srcLength); static size_t DecodeChunkRepeat(void* dst, size_t dstCapacity, const void* src, size_t srcLength); static size_t DecodeChunkRotate(void* dst, size_t dstCapacity, const void* src, size_t srcLength); - - static void* AllocateLargeTempBuffer(); - static void FreeLargeTempBuffer(void* buffer); }; diff --git a/src/openrct2/rct2/RCT2.h b/src/openrct2/rct2/RCT2.h index e52f9bd3d1..16ddbbe13d 100644 --- a/src/openrct2/rct2/RCT2.h +++ b/src/openrct2/rct2/RCT2.h @@ -13,6 +13,7 @@ #include "../core/FileSystem.hpp" #include "../rct12/RCT12.h" #include "../ride/RideRatings.h" +#include "../world/Park.h" #include "Limits.h" #include @@ -845,8 +846,8 @@ namespace RCT2 // SC6[6] uint32_t NextFreeTileElementPointerIndex; Entity Entities[Limits::MaxEntitiesRCTCExtended]; - uint16_t EntityListsHead[static_cast(EntityListId::Count)]; - uint16_t EntityListsCount[static_cast(EntityListId::Count)]; + uint16_t EntityListsHead[EnumValue(EntityListId::Count)]; + uint16_t EntityListsCount[EnumValue(EntityListId::Count)]; StringId ParkName; uint8_t Pad013573D6[2]; uint32_t ParkNameArgs; @@ -889,7 +890,7 @@ namespace RCT2 uint16_t ParkRating; // Ignored in scenario - uint8_t ParkRatingHistory[32]; + uint8_t ParkRatingHistory[kParkRatingHistorySize]; uint8_t GuestsInParkHistory[32]; // SC6[10] diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 9093aa1050..94373ba570 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -282,7 +282,7 @@ namespace RCT2 ImportPeepSpawns(); - gGuestChangeModifier = _s6.GuestCountChangeModifier; + gameState.GuestChangeModifier = _s6.GuestCountChangeModifier; gameState.ResearchFundingLevel = _s6.CurrentResearchLevel; // Pad01357400 // _s6.ResearchedTrackTypesA @@ -295,7 +295,7 @@ namespace RCT2 { for (size_t j = 0; j < Limits::ExpenditureTypeCount; j++) { - gExpenditureTable[i][j] = ToMoney64(_s6.ExpenditureTable[i][j]); + gameState.ExpenditureTable[i][j] = ToMoney64(_s6.ExpenditureTable[i][j]); } } @@ -314,7 +314,7 @@ namespace RCT2 { if (_s6.GuestsInParkHistory[i] != RCT12ParkHistoryUndefined) { - gGuestsInParkHistory[i] = _s6.GuestsInParkHistory[i] * RCT12GuestsInParkHistoryFactor; + gameState.GuestsInParkHistory[i] = _s6.GuestsInParkHistory[i] * RCT12GuestsInParkHistoryFactor; } } @@ -366,7 +366,7 @@ namespace RCT2 for (size_t i = 0; i < Limits::FinanceGraphSize; i++) { - gCashHistory[i] = ToMoney64(_s6.BalanceHistory[i]); + gameState.CashHistory[i] = ToMoney64(_s6.BalanceHistory[i]); gameState.WeeklyProfitHistory[i] = ToMoney64(_s6.WeeklyProfitHistory[i]); gameState.ParkValueHistory[i] = ToMoney64(_s6.ParkValueHistory[i]); } @@ -375,19 +375,19 @@ namespace RCT2 gameState.TotalAdmissions = _s6.TotalAdmissions; gameState.TotalIncomeFromAdmissions = ToMoney64(_s6.IncomeFromAdmissions); gameState.CompanyValue = ToMoney64(_s6.CompanyValue); - std::memcpy(gPeepWarningThrottle, _s6.PeepWarningThrottle, sizeof(_s6.PeepWarningThrottle)); + std::memcpy(gameState.PeepWarningThrottle, _s6.PeepWarningThrottle, sizeof(_s6.PeepWarningThrottle)); // Awards - auto& awards = GetAwards(); + auto& currentAwards = gameState.CurrentAwards; for (auto& src : _s6.Awards) { if (src.Time != 0) { - awards.push_back(Award{ src.Time, static_cast(src.Type) }); + currentAwards.push_back(Award{ src.Time, static_cast(src.Type) }); } } - gLandPrice = ToMoney64(_s6.LandPrice); + gameState.LandPrice = ToMoney64(_s6.LandPrice); gameState.ConstructionRightsPrice = ToMoney64(_s6.ConstructionRightsPrice); // unk_01358774 // Pad01358776 @@ -396,17 +396,18 @@ namespace RCT2 gameState.ScenarioCompanyValueRecord = _s6.CompletedCompanyValueRecord; // _s6.LoanHash; // Pad013587CA - gHistoricalProfit = ToMoney64(_s6.HistoricalProfit); + gameState.HistoricalProfit = ToMoney64(_s6.HistoricalProfit); // Pad013587D4 gameState.ScenarioCompletedBy = std::string_view(_s6.ScenarioCompletedName, sizeof(_s6.ScenarioCompletedName)); gameState.Cash = ToMoney64(DECRYPT_MONEY(_s6.Cash)); // Pad013587FC - gParkRatingCasualtyPenalty = _s6.ParkRatingCasualtyPenalty; + gameState.ParkRatingCasualtyPenalty = _s6.ParkRatingCasualtyPenalty; gameState.MapSize = { _s6.MapSize, _s6.MapSize }; - gSamePriceThroughoutPark = _s6.SamePriceThroughout | (static_cast(_s6.SamePriceThroughoutExtended) << 32); + gameState.SamePriceThroughoutPark = _s6.SamePriceThroughout + | (static_cast(_s6.SamePriceThroughoutExtended) << 32); gameState.SuggestedGuestMaximum = _s6.SuggestedMaxGuests; gameState.ScenarioParkRatingWarningDays = _s6.ParkRatingWarningDays; - gLastEntranceStyle = _s6.LastEntranceStyle; + gameState.LastEntranceStyle = _s6.LastEntranceStyle; // rct1_water_colour // Pad01358842 ImportResearchList(gameState); @@ -447,7 +448,7 @@ namespace RCT2 ImportRideRatingsCalcData(); ImportRideMeasurements(); gameState.NextGuestNumber = _s6.NextGuestIndex; - gGrassSceneryTileLoopPosition = _s6.GrassAndSceneryTilepos; + gameState.GrassSceneryTileLoopPosition = _s6.GrassAndSceneryTilepos; // unk_13CA73E // Pad13CA73F // unk_13CA740 @@ -495,8 +496,7 @@ namespace RCT2 // Pad13CE730 // rct1_scenario_flags - gWidePathTileLoopPosition.x = _s6.WidePathTileLoopX; - gWidePathTileLoopPosition.y = _s6.WidePathTileLoopY; + gameState.WidePathTileLoopPosition = { _s6.WidePathTileLoopX, _s6.WidePathTileLoopY }; // Pad13CE778 // Fix and set dynamic variables @@ -1397,7 +1397,7 @@ namespace RCT2 auto& destStation = dst->GetStation(stationIndex); destStation.Start.SetNull(); - destStation.TrainAtStation = RideStation::NO_TRAIN; + destStation.TrainAtStation = RideStation::kNoTrain; destStation.Entrance.SetNull(); destStation.Exit.SetNull(); destStation.LastPeepInQueue = EntityId::GetNull(); @@ -1612,7 +1612,7 @@ namespace RCT2 const auto& src = _s6.RideRatingsCalcData; // S6 has only one state, ensure we reset all states before reading the first one. RideRatingResetUpdateStates(); - auto& rideRatingStates = RideRatingGetUpdateStates(); + auto& rideRatingStates = GetGameState().RideRatingUpdateStates; auto& dst = rideRatingStates[0]; dst = {}; dst.Proximity = { src.ProximityX, src.ProximityY, src.ProximityZ }; @@ -1759,14 +1759,15 @@ namespace RCT2 _s6.PeepSpawns[0].z = 7; } - gPeepSpawns.clear(); + auto& gameState = GetGameState(); + gameState.PeepSpawns.clear(); for (size_t i = 0; i < Limits::MaxPeepSpawns; i++) { if (_s6.PeepSpawns[i].x != RCT12_PEEP_SPAWN_UNDEFINED) { PeepSpawn spawn = { _s6.PeepSpawns[i].x, _s6.PeepSpawns[i].y, _s6.PeepSpawns[i].z * 16, _s6.PeepSpawns[i].direction }; - gPeepSpawns.push_back(spawn); + gameState.PeepSpawns.push_back(spawn); } } } @@ -1801,9 +1802,9 @@ namespace RCT2 bool nextElementInvisible = false; bool restOfTileInvisible = false; const auto maxSize = std::min(Limits::MaxMapSize, _s6.MapSize); - for (TileCoordsXY coords = { 0, 0 }; coords.y < MAXIMUM_MAP_SIZE_TECHNICAL; coords.y++) + for (TileCoordsXY coords = { 0, 0 }; coords.y < kMaximumMapSizeTechnical; coords.y++) { - for (coords.x = 0; coords.x < MAXIMUM_MAP_SIZE_TECHNICAL; coords.x++) + for (coords.x = 0; coords.x < kMaximumMapSizeTechnical; coords.x++) { nextElementInvisible = false; restOfTileInvisible = false; diff --git a/src/openrct2/ride/CarEntry.cpp b/src/openrct2/ride/CarEntry.cpp index 71a02ec7d4..fc84d82872 100644 --- a/src/openrct2/ride/CarEntry.cpp +++ b/src/openrct2/ride/CarEntry.cpp @@ -16,22 +16,22 @@ uint32_t CarEntry::NumRotationSprites(SpriteGroupType spriteGroup) const { - return NumSpritesPrecision(SpriteGroups[static_cast(spriteGroup)].spritePrecision); + return NumSpritesPrecision(SpriteGroups[EnumValue(spriteGroup)].spritePrecision); } int32_t CarEntry::SpriteByYaw(int32_t yaw, SpriteGroupType spriteGroup) const { - return YawToPrecision(yaw, SpriteGroups[static_cast(spriteGroup)].spritePrecision); + return YawToPrecision(yaw, SpriteGroups[EnumValue(spriteGroup)].spritePrecision); } bool CarEntry::GroupEnabled(SpriteGroupType spriteGroup) const { - return SpriteGroups[static_cast(spriteGroup)].Enabled(); + return SpriteGroups[EnumValue(spriteGroup)].Enabled(); } uint32_t CarEntry::GroupImageId(SpriteGroupType spriteGroup) const { - return SpriteGroups[static_cast(spriteGroup)].imageId; + return SpriteGroups[EnumValue(spriteGroup)].imageId; } uint32_t CarEntry::SpriteOffset(SpriteGroupType spriteGroup, int32_t imageDirection, uint8_t rankIndex) const diff --git a/src/openrct2/ride/CarEntry.h b/src/openrct2/ride/CarEntry.h index c64bf966d0..c6188e4dd3 100644 --- a/src/openrct2/ride/CarEntry.h +++ b/src/openrct2/ride/CarEntry.h @@ -50,7 +50,7 @@ enum : uint32_t CAR_ENTRY_FLAG_DODGEM_INUSE_LIGHTS = 1 << 7, // When set the vehicle has an additional frame for when in use. Used only by dodgems. CAR_ENTRY_FLAG_ALLOW_DOORS_DEPRECATED = 1 << 8, // Not used any more - every vehicle will now work with doors. - CAR_ENTRY_FLAG_ENABLE_TERNARY_COLOUR = 1 << 9, + CAR_ENTRY_FLAG_ENABLE_TERTIARY_COLOUR = 1 << 9, CAR_ENTRY_FLAG_RECALCULATE_SPRITE_BOUNDS = 1 << 10, // Only used during loading of the objects. CAR_ENTRY_FLAG_USE_16_ROTATION_FRAMES = 1 << 11, // Instead of the default 32 rotation frames. Only used for boat hire and works only for non sloped sprites. diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 9b8746528b..d0300a5cf3 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -31,7 +31,7 @@ #include "../entity/EntityRegistry.h" #include "../entity/Peep.h" #include "../entity/Staff.h" -#include "../interface/Window.h" +#include "../interface/Window_internal.h" #include "../localisation/Date.h" #include "../localisation/Formatter.h" #include "../localisation/Formatting.h" @@ -176,6 +176,12 @@ Ride* RideAllocateAtIndex(RideId index) auto result = &GetGameState().Rides[idx]; assert(result->id == RideId::GetNull()); + // Initialize the ride to all the defaults. + *result = Ride{}; + + // Because it is default initialized to zero rather than the magic constant for Null, fill the array. + std::fill(std::begin(result->vehicles), std::end(result->vehicles), EntityId::GetNull()); + result->id = index; return result; } @@ -618,7 +624,7 @@ bool TrackBlockGetNext(CoordsXYE* input, CoordsXYE* output, int32_t* z, int32_t* OriginZ -= trackBlock->z; OriginZ += trackCoordinate.z_end; - uint8_t directionStart = ((trackCoordinate.rotation_end + rotation) & TILE_ELEMENT_DIRECTION_MASK) + uint8_t directionStart = ((trackCoordinate.rotation_end + rotation) & kTileElementDirectionMask) | (trackCoordinate.rotation_end & TRACK_BLOCK_2); return TrackBlockGetNextFromZero({ coords, OriginZ }, *ride, directionStart, output, z, direction, false); @@ -757,7 +763,7 @@ bool TrackBlockGetPrevious(const CoordsXYE& trackPos, TrackBeginEnd* outTrackBeg z -= trackBlock->z; z += trackCoordinate.z_begin; - rotation = ((trackCoordinate.rotation_begin + rotation) & TILE_ELEMENT_DIRECTION_MASK) + rotation = ((trackCoordinate.rotation_begin + rotation) & kTileElementDirectionMask) | (trackCoordinate.rotation_begin & TRACK_BLOCK_2); return TrackBlockGetPreviousFromZero({ coords, z }, *ride, rotation, outTrackBeginEnd); @@ -1417,7 +1423,7 @@ static void RideBreakdownUpdate(Ride& ride) if (!ride.CanBreakDown()) { - ride.reliability = RIDE_INITIAL_RELIABILITY; + ride.reliability = kRideInitialReliability; return; } @@ -1433,8 +1439,8 @@ static void RideBreakdownUpdate(Ride& ride) // a 0.8% chance, less the breakdown factor which accumulates as the game // continues. if ((ride.reliability == 0 - || static_cast(ScenarioRand() & 0x2FFFFF) <= 1 + RIDE_INITIAL_RELIABILITY - ride.reliability) - && !gCheatsDisableAllBreakdowns) + || static_cast(ScenarioRand() & 0x2FFFFF) <= 1u + kRideInitialReliability - ride.reliability) + && !GetGameState().Cheats.DisableAllBreakdowns) { int32_t breakdownReason = RideGetNewBreakdownProblem(ride); if (breakdownReason != -1) @@ -1493,7 +1499,7 @@ static int32_t RideGetNewBreakdownProblem(const Ride& ride) return -1; // If brakes failure is disabled, also take it out of the equation (see above comment why) - if (gCheatsDisableBrakesFailure) + if (GetGameState().Cheats.DisableBrakesFailure) return -1; auto monthsOld = ride.GetAge(); @@ -2138,12 +2144,12 @@ static void RideFreeOldMeasurements() numRideMeasurements++; } } - if (numRideMeasurements > MAX_RIDE_MEASUREMENTS && lruRide != nullptr) + if (numRideMeasurements > kMaxRideMeasurements && lruRide != nullptr) { lruRide->measurement = {}; numRideMeasurements--; } - } while (numRideMeasurements > MAX_RIDE_MEASUREMENTS); + } while (numRideMeasurements > kMaxRideMeasurements); } std::pair Ride::GetMeasurement() @@ -2852,7 +2858,7 @@ static bool RideCheckTrackContainsBanked(const CoordsXYE& input, CoordsXYE* outp while (TrackCircuitIteratorNext(&it)) { - auto trackType = output->element->AsTrack()->GetTrackType(); + auto trackType = it.current.element->AsTrack()->GetTrackType(); const auto& ted = GetTrackElementDescriptor(trackType); if (ted.Flags & TRACK_ELEM_FLAG_BANKED) { @@ -3631,7 +3637,7 @@ ResultWithMessage Ride::CreateVehicles(const CoordsXYE& element, bool isApplying lifecycle_flags |= RIDE_LIFECYCLE_ON_TRACK; for (int32_t i = 0; i < OpenRCT2::Limits::MaxStationsPerRide; i++) { - stations[i].Depart = (stations[i].Depart & STATION_DEPART_FLAG) | 1; + stations[i].Depart = (stations[i].Depart & kStationDepartFlag) | 1; } // @@ -3968,7 +3974,7 @@ void Ride::ConstructMissingEntranceOrExit() const w = WindowFindByClass(WindowClass::RideConstruction); if (w != nullptr) - WindowEventMouseUpCall(w, entranceOrExit); + w->OnMouseUp(entranceOrExit); } } @@ -4396,11 +4402,11 @@ void IncrementTurnCount1Element(Ride& ride, uint8_t type) default: return; } - uint16_t value = (*turn_count & TURN_MASK_1_ELEMENT) + 1; - *turn_count &= ~TURN_MASK_1_ELEMENT; + uint16_t value = (*turn_count & kTurnMask1Element) + 1; + *turn_count &= ~kTurnMask1Element; - if (value > TURN_MASK_1_ELEMENT) - value = TURN_MASK_1_ELEMENT; + if (value > kTurnMask1Element) + value = kTurnMask1Element; *turn_count |= value; } @@ -4421,11 +4427,11 @@ void IncrementTurnCount2Elements(Ride& ride, uint8_t type) default: return; } - uint16_t value = (*turn_count & TURN_MASK_2_ELEMENTS) + 0x20; - *turn_count &= ~TURN_MASK_2_ELEMENTS; + uint16_t value = (*turn_count & kTurnMask2Elements) + 0x20; + *turn_count &= ~kTurnMask2Elements; - if (value > TURN_MASK_2_ELEMENTS) - value = TURN_MASK_2_ELEMENTS; + if (value > kTurnMask2Elements) + value = kTurnMask2Elements; *turn_count |= value; } @@ -4446,11 +4452,11 @@ void IncrementTurnCount3Elements(Ride& ride, uint8_t type) default: return; } - uint16_t value = (*turn_count & TURN_MASK_3_ELEMENTS) + 0x100; - *turn_count &= ~TURN_MASK_3_ELEMENTS; + uint16_t value = (*turn_count & kTurnMask3Elements) + 0x100; + *turn_count &= ~kTurnMask3Elements; - if (value > TURN_MASK_3_ELEMENTS) - value = TURN_MASK_3_ELEMENTS; + if (value > kTurnMask3Elements) + value = kTurnMask3Elements; *turn_count |= value; } @@ -4470,11 +4476,11 @@ void IncrementTurnCount4PlusElements(Ride& ride, uint8_t type) default: return; } - uint16_t value = (*turn_count & TURN_MASK_4_PLUS_ELEMENTS) + 0x800; - *turn_count &= ~TURN_MASK_4_PLUS_ELEMENTS; + uint16_t value = (*turn_count & kTurnMask4PlusElements) + 0x800; + *turn_count &= ~kTurnMask4PlusElements; - if (value > TURN_MASK_4_PLUS_ELEMENTS) - value = TURN_MASK_4_PLUS_ELEMENTS; + if (value > kTurnMask4PlusElements) + value = kTurnMask4PlusElements; *turn_count |= value; } @@ -4496,7 +4502,7 @@ int32_t GetTurnCount1Element(const Ride& ride, uint8_t type) return 0; } - return (*turn_count) & TURN_MASK_1_ELEMENT; + return (*turn_count) & kTurnMask1Element; } int32_t GetTurnCount2Elements(const Ride& ride, uint8_t type) @@ -4517,7 +4523,7 @@ int32_t GetTurnCount2Elements(const Ride& ride, uint8_t type) return 0; } - return ((*turn_count) & TURN_MASK_2_ELEMENTS) >> 5; + return ((*turn_count) & kTurnMask2Elements) >> 5; } int32_t GetTurnCount3Elements(const Ride& ride, uint8_t type) @@ -4538,7 +4544,7 @@ int32_t GetTurnCount3Elements(const Ride& ride, uint8_t type) return 0; } - return ((*turn_count) & TURN_MASK_3_ELEMENTS) >> 8; + return ((*turn_count) & kTurnMask3Elements) >> 8; } int32_t GetTurnCount4PlusElements(const Ride& ride, uint8_t type) @@ -4556,7 +4562,7 @@ int32_t GetTurnCount4PlusElements(const Ride& ride, uint8_t type) return 0; } - return ((*turn_count) & TURN_MASK_4_PLUS_ELEMENTS) >> 11; + return ((*turn_count) & kTurnMask4PlusElements) >> 11; } bool Ride::HasSpinningTunnel() const @@ -4633,7 +4639,7 @@ bool RideHasAnyTrackElements(const Ride& ride) void InvalidateTestResults(Ride& ride) { ride.measurement = {}; - ride.excitement = RIDE_RATING_UNDEFINED; + ride.excitement = kRideRatingUndefined; ride.lifecycle_flags &= ~RIDE_LIFECYCLE_TESTED; ride.lifecycle_flags &= ~RIDE_LIFECYCLE_TEST_IN_PROGRESS; if (ride.lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK) @@ -4923,7 +4929,7 @@ OpenRCT2::BitSet RideEntryGetSupportedTrackPieces(const RideO { for (auto& group : trackPieceRequiredSprites[i]) { - auto precision = defaultVehicle->SpriteGroups[static_cast(group.VehicleSpriteGroup)].spritePrecision; + auto precision = defaultVehicle->SpriteGroups[EnumValue(group.VehicleSpriteGroup)].spritePrecision; if (precision < group.MinPrecision) supportedPieces.set(i, false); } @@ -5077,7 +5083,7 @@ void Ride::UpdateMaxVehicles() } int32_t newCarsPerTrain = std::max(proposed_num_cars_per_train, rideEntry->min_cars_in_train); maxCarsPerTrain = std::max(maxCarsPerTrain, static_cast(rideEntry->min_cars_in_train)); - if (!gCheatsDisableTrainLengthLimit) + if (!GetGameState().Cheats.DisableTrainLengthLimit) { newCarsPerTrain = std::min(maxCarsPerTrain, newCarsPerTrain); } @@ -5166,7 +5172,7 @@ void Ride::UpdateMaxVehicles() maxNumTrains = rideEntry->cars_per_flat_ride; } - if (gCheatsDisableTrainLengthLimit) + if (GetGameState().Cheats.DisableTrainLengthLimit) { maxNumTrains = OpenRCT2::Limits::MaxTrainsPerRide; } @@ -5299,7 +5305,7 @@ void Ride::Renew() { // Set build date to current date (so the ride is brand new) build_date = GetDate().GetMonthsElapsed(); - reliability = RIDE_INITIAL_RELIABILITY; + reliability = kRideInitialReliability; } RideClassification Ride::GetClassification() const @@ -5372,7 +5378,7 @@ static bool CheckForAdjacentStation(const CoordsXYZ& stationCoords, uint8_t dire bool found = false; int32_t adjX = stationCoords.x; int32_t adjY = stationCoords.y; - for (uint32_t i = 0; i <= RIDE_ADJACENCY_CHECK_DISTANCE; i++) + for (uint32_t i = 0; i <= kRideAdjacencyCheckDistance; i++) { adjX += CoordsDirectionDelta[direction].x; adjY += CoordsDirectionDelta[direction].y; @@ -5434,7 +5440,7 @@ bool RideHasStationShelter(const Ride& ride) bool RideHasRatings(const Ride& ride) { - return ride.excitement != RIDE_RATING_UNDEFINED; + return ride.excitement != kRideRatingUndefined; } int32_t GetBoosterSpeed(ride_type_t rideType, int32_t rawSpeed) @@ -5512,7 +5518,7 @@ int32_t RideGetEntryIndex(int32_t rideType, int32_t rideSubType) } // Can happen in select-by-track-type mode - if (!RideEntryIsInvented(rideEntryIndex) && !gCheatsIgnoreResearchStatus) + if (!RideEntryIsInvented(rideEntryIndex) && !GetGameState().Cheats.IgnoreResearchStatus) { continue; } @@ -5712,7 +5718,7 @@ std::string Ride::GetName() const { Formatter ft; FormatNameTo(ft); - return FormatStringID(STR_STRINGID, reinterpret_cast(ft.Data())); + return FormatStringIDLegacy(STR_STRINGID, reinterpret_cast(ft.Data())); } void Ride::FormatNameTo(Formatter& ft) const @@ -5741,7 +5747,7 @@ void Ride::FormatNameTo(Formatter& ft) const uint64_t Ride::GetAvailableModes() const { - if (gCheatsShowAllOperatingModes) + if (GetGameState().Cheats.ShowAllOperatingModes) return AllRideModesAvailable; return GetRideTypeDescriptor().RideModes; @@ -5923,7 +5929,7 @@ ResultWithMessage Ride::ChangeStatusCheckTrackValidity(const CoordsXYE& trackEle } } - if (subtype != OBJECT_ENTRY_INDEX_NULL && !gCheatsEnableAllDrawableTrackPieces) + if (subtype != OBJECT_ENTRY_INDEX_NULL && !GetGameState().Cheats.EnableAllDrawableTrackPieces) { const auto* rideEntry = GetRideEntryByIndex(subtype); if (rideEntry->flags & RIDE_ENTRY_FLAG_NO_INVERSIONS) diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index e25961e5e3..9ae087ed4b 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -40,7 +40,8 @@ struct Vehicle; struct RideObjectEntry; struct ResultWithMessage; -#define RIDE_ADJACENCY_CHECK_DISTANCE 5 +constexpr uint8_t kRideAdjacencyCheckDistance = 5; + constexpr uint8_t TUNE_ID_NULL = 0xFF; constexpr uint16_t const MAX_STATION_LOCATIONS = OpenRCT2::Limits::MaxStationsPerRide * 2; // Entrance and exit per station @@ -49,20 +50,20 @@ constexpr uint16_t const MAZE_CLEARANCE_HEIGHT = 4 * COORDS_Z_STEP; struct RideStation { + static constexpr uint8_t kNoTrain = std::numeric_limits::max(); + CoordsXY Start; - uint8_t Height; - uint8_t Length; - uint8_t Depart; - uint8_t TrainAtStation; + uint8_t Height{}; + uint8_t Length{}; + uint8_t Depart{}; + uint8_t TrainAtStation{ kNoTrain }; TileCoordsXYZD Entrance; TileCoordsXYZD Exit; - int32_t SegmentLength; // Length of track between this station and the next. - uint16_t SegmentTime; // Time for train to reach the next station from this station. - uint8_t QueueTime; - uint16_t QueueLength; - EntityId LastPeepInQueue; - - static constexpr uint8_t NO_TRAIN = std::numeric_limits::max(); + int32_t SegmentLength{}; // Length of track between this station and the next. + uint16_t SegmentTime{}; // Time for train to reach the next station from this station. + uint8_t QueueTime{}; + uint16_t QueueLength{}; + EntityId LastPeepInQueue{ EntityId::GetNull() }; int32_t GetBaseZ() const; void SetBaseZ(int32_t newZ); @@ -112,31 +113,31 @@ enum class RideStatus : uint8_t; */ struct Ride { - RideId id = RideId::GetNull(); - ride_type_t type = RIDE_TYPE_NULL; + RideId id{ RideId::GetNull() }; + ride_type_t type{ RIDE_TYPE_NULL }; // pointer to static info. for example, wild mouse type is 0x36, subtype is // 0x4c. - ObjectEntryIndex subtype; - RideMode mode; - uint8_t colour_scheme_type; - VehicleColour vehicle_colours[OpenRCT2::Limits::MaxVehicleColours]; + ObjectEntryIndex subtype{ OBJECT_ENTRY_INDEX_NULL }; + RideMode mode{}; + uint8_t colour_scheme_type{}; + VehicleColour vehicle_colours[OpenRCT2::Limits::MaxVehicleColours]{}; // 0 = closed, 1 = open, 2 = test - RideStatus status; + RideStatus status{}; std::string custom_name; - uint16_t default_name_number; + uint16_t default_name_number{}; CoordsXY overall_view; - EntityId vehicles[OpenRCT2::Limits::MaxTrainsPerRide + 1]; // Points to the first car in the train - uint8_t depart_flags; - uint8_t num_stations; - uint8_t NumTrains; - uint8_t num_cars_per_train; - uint8_t ProposedNumTrains; - uint8_t proposed_num_cars_per_train; - uint8_t max_trains; - uint8_t MinCarsPerTrain; - uint8_t MaxCarsPerTrain; - uint8_t min_waiting_time; - uint8_t max_waiting_time; + EntityId vehicles[OpenRCT2::Limits::MaxTrainsPerRide + 1]{}; // Points to the first car in the train + uint8_t depart_flags{}; + uint8_t num_stations{}; + uint8_t NumTrains{}; + uint8_t num_cars_per_train{}; + uint8_t ProposedNumTrains{}; + uint8_t proposed_num_cars_per_train{}; + uint8_t max_trains{}; + uint8_t MinCarsPerTrain{}; + uint8_t MaxCarsPerTrain{}; + uint8_t min_waiting_time{}; + uint8_t max_waiting_time{}; union { uint8_t operation_option; @@ -144,54 +145,54 @@ struct Ride uint8_t NumLaps; uint8_t launch_speed; uint8_t speed; - uint8_t rotations; + uint8_t rotations{}; }; - uint8_t boat_hire_return_direction; + uint8_t boat_hire_return_direction{}; TileCoordsXY boat_hire_return_position; // bits 0 through 4 are the number of helix sections // bit 5: spinning tunnel, water splash, or rapids // bit 6: log reverser, waterfall // bit 7: whirlpool - uint8_t special_track_elements; + uint8_t special_track_elements{}; // Divide this value by 29127 to get the human-readable max speed // (in RCT2, display_speed = (max_speed * 9) >> 18) - int32_t max_speed; - int32_t average_speed; - uint8_t current_test_segment; - uint8_t average_speed_test_timeout; - fixed16_2dp max_positive_vertical_g; - fixed16_2dp max_negative_vertical_g; - fixed16_2dp max_lateral_g; - fixed16_2dp previous_vertical_g; - fixed16_2dp previous_lateral_g; - uint32_t testing_flags; + int32_t max_speed{}; + int32_t average_speed{}; + uint8_t current_test_segment{}; + uint8_t average_speed_test_timeout{}; + fixed16_2dp max_positive_vertical_g{}; + fixed16_2dp max_negative_vertical_g{}; + fixed16_2dp max_lateral_g{}; + fixed16_2dp previous_vertical_g{}; + fixed16_2dp previous_lateral_g{}; + uint32_t testing_flags{}; // x y z map location of the current track piece during a test // this is to prevent counting special tracks multiple times TileCoordsXYZ CurTestTrackLocation; // Next 3 variables are related (XXXX XYYY ZZZa aaaa) - uint16_t turn_count_default; // X = current turn count - uint16_t turn_count_banked; - uint16_t turn_count_sloped; // X = number turns > 3 elements + uint16_t turn_count_default{}; // X = current turn count + uint16_t turn_count_banked{}; + uint16_t turn_count_sloped{}; // X = number turns > 3 elements // Y is number of powered lifts, X is drops - uint8_t drops; // (YYXX XXXX) - uint8_t start_drop_height; - uint8_t highest_drop_height; - int32_t sheltered_length; + uint8_t drops{}; // (YYXX XXXX) + uint8_t start_drop_height{}; + uint8_t highest_drop_height{}; + int32_t sheltered_length{}; // Unused always 0? Should affect nausea - uint16_t var_11C; - uint8_t num_sheltered_sections; // (?abY YYYY) + uint16_t var_11C{}; + uint8_t num_sheltered_sections{}; // (?abY YYYY) // Customer counter in the current 960 game tick (about 30 seconds) interval - uint16_t cur_num_customers; + uint16_t cur_num_customers{}; // Counts ticks to update customer intervals, resets each 960 game ticks. - uint16_t num_customers_timeout; + uint16_t num_customers_timeout{}; // Customer count in the last 10 * 960 game ticks (sliding window) - uint16_t num_customers[OpenRCT2::Limits::CustomerHistorySize]; - money64 price[RCT2::ObjectLimits::MaxShopItemsPerRideEntry]; + uint16_t num_customers[OpenRCT2::Limits::CustomerHistorySize]{}; + money64 price[RCT2::ObjectLimits::MaxShopItemsPerRideEntry]{}; TileCoordsXYZ ChairliftBullwheelLocation[2]; union { - RatingTuple ratings; + RatingTuple ratings{}; struct { ride_rating excitement; @@ -199,39 +200,39 @@ struct Ride ride_rating nausea; }; }; - money64 value; - uint16_t chairlift_bullwheel_rotation; - uint8_t satisfaction; - uint8_t satisfaction_time_out; - uint8_t satisfaction_next; + money64 value{}; + uint16_t chairlift_bullwheel_rotation{}; + uint8_t satisfaction{}; + uint8_t satisfaction_time_out{}; + uint8_t satisfaction_next{}; // Various flags stating whether a window needs to be refreshed - uint8_t window_invalidate_flags; - uint32_t total_customers; - money64 total_profit; - uint8_t popularity; - uint8_t popularity_time_out; // Updated every purchase and ?possibly by time? - uint8_t popularity_next; // When timeout reached this will be the next popularity - uint16_t num_riders; - uint8_t music_tune_id; - uint8_t slide_in_use; + uint8_t window_invalidate_flags{}; + uint32_t total_customers{}; + money64 total_profit{}; + uint8_t popularity{}; + uint8_t popularity_time_out{}; // Updated every purchase and ?possibly by time? + uint8_t popularity_next{}; // When timeout reached this will be the next popularity + uint16_t num_riders{}; + uint8_t music_tune_id{}; + uint8_t slide_in_use{}; union { EntityId slide_peep; - uint16_t maze_tiles; + uint16_t maze_tiles{}; }; - uint8_t slide_peep_t_shirt_colour; - uint8_t spiral_slide_progress; - int32_t build_date; - money64 upkeep_cost; - EntityId race_winner; - uint32_t music_position; - uint8_t breakdown_reason_pending; - uint8_t mechanic_status; - EntityId mechanic; - StationIndex inspection_station; - uint8_t broken_vehicle; - uint8_t broken_car; - uint8_t breakdown_reason; + uint8_t slide_peep_t_shirt_colour{}; + uint8_t spiral_slide_progress{}; + int32_t build_date{}; + money64 upkeep_cost{}; + EntityId race_winner{}; + uint32_t music_position{}; + uint8_t breakdown_reason_pending{}; + uint8_t mechanic_status{}; + EntityId mechanic{ EntityId::GetNull() }; + StationIndex inspection_station{ StationIndex::GetNull() }; + uint8_t broken_vehicle{}; + uint8_t broken_car{}; + uint8_t breakdown_reason{}; union { struct @@ -239,52 +240,52 @@ struct Ride uint8_t reliability_subvalue; // 0 - 255, acts like the decimals for reliability_percentage uint8_t reliability_percentage; // Starts at 100 and decreases from there. }; - uint16_t reliability; + uint16_t reliability{}; }; // Small constant used to increase the unreliability as the game continues, // making breakdowns more and more likely. - uint8_t unreliability_factor; + uint8_t unreliability_factor{}; // Range from [0, 100] - uint8_t downtime; - uint8_t inspection_interval; - uint8_t last_inspection; - uint8_t downtime_history[OpenRCT2::Limits::DowntimeHistorySize]; - uint32_t no_primary_items_sold; - uint32_t no_secondary_items_sold; - uint8_t breakdown_sound_modifier; + uint8_t downtime{}; + uint8_t inspection_interval{}; + uint8_t last_inspection{}; + uint8_t downtime_history[OpenRCT2::Limits::DowntimeHistorySize]{}; + uint32_t no_primary_items_sold{}; + uint32_t no_secondary_items_sold{}; + uint8_t breakdown_sound_modifier{}; // Used to oscillate the sound when ride breaks down. // 0 = no change, 255 = max change - uint8_t not_fixed_timeout; - uint8_t last_crash_type; - uint8_t connected_message_throttle; - money64 income_per_hour; - money64 profit; - TrackColour track_colour[OpenRCT2::Limits::NumColourSchemes]; - ObjectEntryIndex music; - ObjectEntryIndex entrance_style; - uint16_t vehicle_change_timeout; - uint8_t num_block_brakes; - uint8_t lift_hill_speed; - uint32_t guests_favourite; - uint32_t lifecycle_flags; - uint16_t total_air_time; - StationIndex current_test_station; - uint8_t num_circuits; - CoordsXYZ CableLiftLoc; - EntityId cable_lift; + uint8_t not_fixed_timeout{}; + uint8_t last_crash_type{}; + uint8_t connected_message_throttle{}; + money64 income_per_hour{}; + money64 profit{}; + TrackColour track_colour[OpenRCT2::Limits::NumColourSchemes]{}; + ObjectEntryIndex music{ OBJECT_ENTRY_INDEX_NULL }; + ObjectEntryIndex entrance_style{ OBJECT_ENTRY_INDEX_NULL }; + uint16_t vehicle_change_timeout{}; + uint8_t num_block_brakes{}; + uint8_t lift_hill_speed{}; + uint32_t guests_favourite{}; + uint32_t lifecycle_flags{}; + uint16_t total_air_time{}; + StationIndex current_test_station{ StationIndex::GetNull() }; + uint8_t num_circuits{}; + CoordsXYZ CableLiftLoc{}; + EntityId cable_lift{ EntityId::GetNull() }; // These two fields are used to warn users about issues. // Such issue can be hacked rides with incompatible options set. // They don't require export/import. - uint8_t current_issues; - uint32_t last_issue_time; + uint8_t current_issues{}; + uint32_t last_issue_time{}; // TO-DO: those friend functions are temporary, find a way to not access the private fields friend void UpdateSpiralSlide(Ride& ride); friend void UpdateChairlift(Ride& ride); private: - std::array stations; + std::array stations{}; public: RideStation& GetStation(StationIndex stationIndex = StationIndex::FromUnderlying(0)); @@ -298,9 +299,9 @@ public: StationIndex::UnderlyingType GetStationNumber(StationIndex in) const; public: - uint16_t inversions; - uint16_t holes; - uint8_t sheltered_eighths; + uint16_t inversions{}; + uint16_t holes{}; + uint8_t sheltered_eighths{}; std::unique_ptr measurement; @@ -610,6 +611,7 @@ enum RIDE_TYPE_SINGLE_RAIL_ROLLER_COASTER, RIDE_TYPE_ALPINE_COASTER, RIDE_TYPE_CLASSIC_WOODEN_ROLLER_COASTER, + RIDE_TYPE_CLASSIC_STAND_UP_ROLLER_COASTER, RIDE_TYPE_COUNT }; @@ -902,18 +904,18 @@ enum TRACK_ELEMENT_SET_BRAKE_BOOSTER_SPEED = (1 << 7) }; -#define MAX_RIDE_MEASUREMENTS 8 +constexpr uint8_t kMaxRideMeasurements = 8; constexpr money64 RIDE_VALUE_UNDEFINED = kMoney64Undefined; -#define RIDE_INITIAL_RELIABILITY ((100 << 8) | 0xFF) // Upper byte is percentage, lower byte is "decimal". +constexpr uint16_t kRideInitialReliability = ((100 << 8) | 0xFF); // Upper byte is percentage, lower byte is "decimal". -#define STATION_DEPART_FLAG (1 << 7) -#define STATION_DEPART_MASK (~STATION_DEPART_FLAG) +constexpr uint8_t kStationDepartFlag = (1 << 7); +constexpr uint8_t kStationDepartMask = static_cast(~kStationDepartFlag); -#define CURRENT_TURN_COUNT_MASK 0xF800 -#define TURN_MASK_1_ELEMENT 0x001F -#define TURN_MASK_2_ELEMENTS 0x00E0 -#define TURN_MASK_3_ELEMENTS 0x0700 -#define TURN_MASK_4_PLUS_ELEMENTS 0xF800 +constexpr uint16_t kCurrentTurnCountMask = 0xF800; +constexpr uint16_t kTurnMask1Element = 0x001F; +constexpr uint16_t kTurnMask2Elements = 0x00E0; +constexpr uint16_t kTurnMask3Elements = 0x0700; +constexpr uint16_t kTurnMask4PlusElements = 0xF800; constexpr uint32_t CONSTRUCTION_LIFT_HILL_SELECTED = 1 << 0; constexpr uint32_t CONSTRUCTION_INVERTED_TRACK_SELECTED = 1 << 1; @@ -1012,10 +1014,6 @@ void RideDelete(RideId id); const RideObjectEntry* GetRideEntryByIndex(ObjectEntryIndex index); std::string_view GetRideEntryName(ObjectEntryIndex index); -extern const StringId ColourSchemeNames[4]; - -extern ObjectEntryIndex gLastEntranceStyle; - int32_t RideGetCount(); void RideInitAll(); void ResetAllRideBuildDates(); @@ -1086,8 +1084,6 @@ enum class RideSetSetting : uint8_t; money64 SetOperatingSetting(RideId rideId, RideSetSetting setting, uint8_t value); money64 SetOperatingSettingNested(RideId rideId, RideSetSetting setting, uint8_t value, uint8_t flags); -void UpdateGhostTrackAndArrow(); - uint32_t RideCustomersPerHour(const Ride& ride); uint32_t RideCustomersInLast5Minutes(const Ride& ride); diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 64ca3022f4..4cfca9604f 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -22,7 +22,7 @@ #include "../entity/EntityList.h" #include "../entity/EntityRegistry.h" #include "../entity/Staff.h" -#include "../interface/Window.h" +#include "../interface/Window_internal.h" #include "../localisation/Date.h" #include "../localisation/Formatter.h" #include "../localisation/Localisation.h" @@ -79,8 +79,6 @@ uint8_t _currentSeatRotationAngle; CoordsXYZD _unkF440C5; -ObjectEntryIndex gLastEntranceStyle; - uint8_t gRideEntranceExitPlaceType; RideId gRideEntranceExitPlaceRideIndex; StationIndex gRideEntranceExitPlaceStationIndex; @@ -200,7 +198,7 @@ void Ride::RemoveVehicles() } for (size_t i = 0; i < OpenRCT2::Limits::MaxStationsPerRide; i++) - stations[i].TrainAtStation = RideStation::NO_TRAIN; + stations[i].TrainAtStation = RideStation::kNoTrain; // Also clean up orphaned vehicles for good measure. for (auto* vehicle : TrainManager::View()) @@ -239,7 +237,7 @@ void RideClearForConstruction(Ride& ride) auto w = WindowFindByNumber(WindowClass::Ride, ride.id.ToUnderlying()); if (w != nullptr) - WindowEventResizeCall(w); + w->OnResize(); } /** @@ -697,7 +695,8 @@ void RideConstructionSetDefaultNextPiece() _currentTrackPitchEnd = slope; _previousTrackPitchEnd = slope; _currentTrackLiftHill = tileElement->AsTrack()->HasChain() - && ((slope != TrackPitch::Down25 && slope != TrackPitch::Down60) || gCheatsEnableChainLiftOnAllTrack); + && ((slope != TrackPitch::Down25 && slope != TrackPitch::Down60) + || GetGameState().Cheats.EnableChainLiftOnAllTrack); break; } case RideConstructionState::Back: @@ -744,7 +743,7 @@ void RideConstructionSetDefaultNextPiece() // Set track slope and lift hill _currentTrackPitchEnd = slope; _previousTrackPitchEnd = slope; - if (!gCheatsEnableChainLiftOnAllTrack) + if (!GetGameState().Cheats.EnableChainLiftOnAllTrack) { _currentTrackLiftHill = tileElement->AsTrack()->HasChain(); } diff --git a/src/openrct2/ride/RideData.cpp b/src/openrct2/ride/RideData.cpp index 61cd09ee81..9741aa7dc7 100644 --- a/src/openrct2/ride/RideData.cpp +++ b/src/openrct2/ride/RideData.cpp @@ -20,6 +20,7 @@ #include "RideData.h" #include "../Cheats.h" +#include "../GameState.h" #include "../audio/audio.h" #include "../interface/Colour.h" #include "../localisation/Localisation.h" @@ -33,6 +34,7 @@ #include "coaster/meta/AlpineCoaster.h" #include "coaster/meta/BobsleighCoaster.h" #include "coaster/meta/ClassicMiniRollerCoaster.h" +#include "coaster/meta/ClassicStandUpRollerCoaster.h" #include "coaster/meta/ClassicWoodenRollerCoaster.h" #include "coaster/meta/CompactInvertedCoaster.h" #include "coaster/meta/CorkscrewRollerCoaster.h" @@ -120,6 +122,7 @@ #include +using namespace OpenRCT2; using namespace OpenRCT2::Entity::Yaw; // clang-format off @@ -180,7 +183,7 @@ const CarEntry CableLiftVehicle = { .no_seating_rows = 0, .spinning_inertia = 0, .spinning_friction = 255, - .friction_sound_id = OpenRCT2::Audio::SoundId::LiftClassic, + .friction_sound_id = Audio::SoundId::LiftClassic, .ReversedCarIndex = 0, .sound_range = 0, .double_sound_frequency = 0, @@ -348,6 +351,7 @@ constexpr RideTypeDescriptor RideTypeDescriptors[RIDE_TYPE_COUNT] = { /* RIDE_TYPE_SINGLE_RAIL_ROLLER_COASTER */ SingleRailRollerCoasterRTD, /* RIDE_TYPE_ALPINE_COASTER */ AlpineCoasterRTD, /* RIDE_TYPE_CLASSIC_WOODEN_ROLLER_COASTER */ ClassicWoodenRollerCoasterRTD, + /* RIDE_TYPE_CLASSIC_STAND_UP_ROLLER_COASTER */ ClassicStandUpRollerCoasterRTD, }; bool RideTypeDescriptor::HasFlag(uint64_t flag) const @@ -358,13 +362,14 @@ bool RideTypeDescriptor::HasFlag(uint64_t flag) const void RideTypeDescriptor::GetAvailableTrackPieces(RideTrackGroup& res) const { res = EnabledTrackPieces; - if (gCheatsEnableAllDrawableTrackPieces) + if (GetGameState().Cheats.EnableAllDrawableTrackPieces) res |= ExtraTrackPieces; } bool RideTypeDescriptor::SupportsTrackPiece(const uint64_t trackPiece) const { - return EnabledTrackPieces.get(trackPiece) || (gCheatsEnableAllDrawableTrackPieces && ExtraTrackPieces.get(trackPiece)); + return EnabledTrackPieces.get(trackPiece) + || (GetGameState().Cheats.EnableAllDrawableTrackPieces && ExtraTrackPieces.get(trackPiece)); } ResearchCategory RideTypeDescriptor::GetResearchCategory() const @@ -407,7 +412,7 @@ void UpdateEnabledRidePieces(ride_type_t rideType) { GetRideTypeDescriptor(rideType).GetAvailableTrackPieces(_enabledRidePieces); - if (!gCheatsEnableAllDrawableTrackPieces) + if (!GetGameState().Cheats.EnableAllDrawableTrackPieces) { _enabledRidePieces &= ~_disabledRidePieces; } diff --git a/src/openrct2/ride/RideData.h b/src/openrct2/ride/RideData.h index 3659a9ce16..1addb4053a 100644 --- a/src/openrct2/ride/RideData.h +++ b/src/openrct2/ride/RideData.h @@ -512,7 +512,7 @@ extern const CarEntry CableLiftVehicle; extern const uint16_t RideFilmLength[3]; -extern const StringId RideModeNames[static_cast(RideMode::Count)]; +extern const StringId RideModeNames[EnumValue(RideMode::Count)]; // clang-format off constexpr RideTypeDescriptor DummyRTD = @@ -546,7 +546,7 @@ constexpr RideTypeDescriptor DummyRTD = .ColourPreview = { static_cast(SPR_NONE), static_cast(SPR_NONE) }, .ColourKey = RideColourKey::Ride, .Name = "invalid", - .RatingsData = + .RatingsData = { RatingsCalculationType::FlatRide, { RIDE_RATING(1, 00), RIDE_RATING(1, 00), RIDE_RATING(1, 00) }, diff --git a/src/openrct2/ride/RideRatings.cpp b/src/openrct2/ride/RideRatings.cpp index 5344c9b6f9..55f2c96c8f 100644 --- a/src/openrct2/ride/RideRatings.cpp +++ b/src/openrct2/ride/RideRatings.cpp @@ -78,8 +78,6 @@ struct ShelteredEights uint8_t TotalShelteredEighths; }; -static RideRatingUpdateStates gRideRatingUpdateStates; - // Amount of updates allowed per updating state on the current tick. // The total amount would be MaxRideRatingSubSteps * RideRatingMaxUpdateStates which // would be currently 80, this is the worst case of sub-steps and may break out earlier. @@ -153,17 +151,13 @@ static void RideRatingsApplyRequirementStations(RatingTuple& ratings, const Ride static void RideRatingsApplyRequirementSplashdown(RatingTuple& ratings, const Ride& ride, RatingsModifier modifier); static void RideRatingsApplyPenaltyLateralGs(RatingTuple& ratings, const Ride& ride, RatingsModifier modifier); -RideRatingUpdateStates& RideRatingGetUpdateStates() -{ - return gRideRatingUpdateStates; -} - void RideRatingResetUpdateStates() { RideRatingUpdateState nullState{}; nullState.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE; - std::fill(gRideRatingUpdateStates.begin(), gRideRatingUpdateStates.end(), nullState); + auto& updateStates = GetGameState().RideRatingUpdateStates; + std::fill(updateStates.begin(), updateStates.end(), nullState); } /** @@ -197,7 +191,7 @@ void RideRatingsUpdateAll() if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) return; - for (auto& updateState : gRideRatingUpdateStates) + for (auto& updateState : GetGameState().RideRatingUpdateStates) { for (size_t i = 0; i < MaxRideRatingUpdateSubSteps; ++i) { @@ -237,7 +231,8 @@ static void ride_ratings_update_state(RideRatingUpdateState& state) static bool RideRatingIsUpdatingRide(RideId id) { - return std::any_of(gRideRatingUpdateStates.begin(), gRideRatingUpdateStates.end(), [id](auto& state) { + const auto& updateStates = GetGameState().RideRatingUpdateStates; + return std::any_of(updateStates.begin(), updateStates.end(), [id](auto& state) { return state.CurrentRide == id && state.State != RIDE_RATINGS_STATE_FIND_NEXT_RIDE; }); } @@ -1142,7 +1137,7 @@ static void RideRatingsCalculateValue(Ride& ride) + (((ride.nausea * ratingsMultipliers.Nausea) * 32) >> 15); int32_t monthsOld = 0; - if (!gCheatsDisableRideValueAging) + if (!GetGameState().Cheats.DisableRideValueAging) { monthsOld = ride.GetAge(); } diff --git a/src/openrct2/ride/RideRatings.h b/src/openrct2/ride/RideRatings.h index 82c8579d62..257f617106 100644 --- a/src/openrct2/ride/RideRatings.h +++ b/src/openrct2/ride/RideRatings.h @@ -19,7 +19,7 @@ using track_type_t = uint16_t; // Convenience function for writing ride ratings. The result is a 16 bit signed // integer. To create the ride rating 3.65 type RIDE_RATING(3,65) #define RIDE_RATING(whole, fraction) FIXED_2DP(whole, fraction) -#define RIDE_RATING_UNDEFINED static_cast(static_cast(0xFFFF)) +constexpr ride_rating kRideRatingUndefined = 0xFFFFu; #pragma pack(push, 1) @@ -55,10 +55,8 @@ struct RideRatingUpdateState }; static constexpr size_t RideRatingMaxUpdateStates = 4; - using RideRatingUpdateStates = std::array; -RideRatingUpdateStates& RideRatingGetUpdateStates(); void RideRatingResetUpdateStates(); void RideRatingsUpdateRide(const Ride& ride); diff --git a/src/openrct2/ride/ShopItem.cpp b/src/openrct2/ride/ShopItem.cpp index 1dd91d92ed..f85620c1a2 100644 --- a/src/openrct2/ride/ShopItem.cpp +++ b/src/openrct2/ride/ShopItem.cpp @@ -9,19 +9,20 @@ #include "ShopItem.h" +#include "../GameState.h" #include "../common.h" #include "../entity/Guest.h" #include "../localisation/StringIds.h" #include "../ride/RideEntry.h" #include "../sprites.h" +using namespace OpenRCT2; + ShopItem& operator++(ShopItem& d, int) { return d = (d == ShopItem::Count) ? ShopItem::Balloon : ShopItem(EnumValue(d) + 1); } -uint64_t gSamePriceThroughoutPark; - // clang-format off /** rct2: 0x00982164 (cost, base value, hot and cold value); 0x00982358 (default price) */ constexpr ShopItemDescriptor ShopItems[EnumValue(ShopItem::Count)] = { @@ -146,7 +147,7 @@ money64 ShopItemGetCommonPrice(Ride* forRide, const ShopItem shopItem) bool ShopItemHasCommonPrice(const ShopItem shopItem) { - return (gSamePriceThroughoutPark & EnumToFlag(shopItem)) != 0; + return (GetGameState().SamePriceThroughoutPark & EnumToFlag(shopItem)) != 0; } bool ShopItemDescriptor::IsFood() const diff --git a/src/openrct2/ride/ShopItem.h b/src/openrct2/ride/ShopItem.h index 241ecfae5f..9aa53277c5 100644 --- a/src/openrct2/ride/ShopItem.h +++ b/src/openrct2/ride/ShopItem.h @@ -128,8 +128,6 @@ enum SHOP_ITEM_FLAG_IS_RECOLOURABLE = (1 << 5), }; -extern uint64_t gSamePriceThroughoutPark; - money64 ShopItemGetCommonPrice(Ride* forRide, const ShopItem shopItem); bool ShopItemHasCommonPrice(const ShopItem shopItem); diff --git a/src/openrct2/ride/Station.cpp b/src/openrct2/ride/Station.cpp index e43a3c1053..69ace102fb 100644 --- a/src/openrct2/ride/Station.cpp +++ b/src/openrct2/ride/Station.cpp @@ -66,16 +66,16 @@ static void RideUpdateStationBlockSection(Ride& ride, StationIndex stationIndex) if ((ride.status == RideStatus::Closed && ride.num_riders == 0) || (tileElement != nullptr && tileElement->AsTrack()->IsBrakeClosed())) { - station.Depart &= ~STATION_DEPART_FLAG; + station.Depart &= ~kStationDepartFlag; - if ((station.Depart & STATION_DEPART_FLAG) || (tileElement != nullptr && tileElement->AsTrack()->HasGreenLight())) + if ((station.Depart & kStationDepartFlag) || (tileElement != nullptr && tileElement->AsTrack()->HasGreenLight())) RideInvalidateStationStart(ride, stationIndex, false); } else { - if (!(station.Depart & STATION_DEPART_FLAG)) + if (!(station.Depart & kStationDepartFlag)) { - station.Depart |= STATION_DEPART_FLAG; + station.Depart |= kStationDepartFlag; RideInvalidateStationStart(ride, stationIndex, true); } else if (tileElement != nullptr && tileElement->AsTrack()->HasGreenLight()) @@ -97,7 +97,7 @@ static void RideUpdateStationDodgems(Ride& ride, StationIndex stationIndex) // but since dodgems do not have station lights there is no point. if (ride.status == RideStatus::Closed || (ride.lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))) { - station.Depart &= ~STATION_DEPART_FLAG; + station.Depart &= ~kStationDepartFlag; return; } @@ -116,12 +116,12 @@ static void RideUpdateStationDodgems(Ride& ride, StationIndex stationIndex) // End match ride.lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING; - station.Depart &= ~STATION_DEPART_FLAG; + station.Depart &= ~kStationDepartFlag; return; } // Continue match - station.Depart |= STATION_DEPART_FLAG; + station.Depart |= kStationDepartFlag; } else { @@ -134,14 +134,14 @@ static void RideUpdateStationDodgems(Ride& ride, StationIndex stationIndex) if (vehicle->status != Vehicle::Status::WaitingToDepart) { - station.Depart &= ~STATION_DEPART_FLAG; + station.Depart &= ~kStationDepartFlag; return; } } // Begin the match ride.lifecycle_flags |= RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING; - station.Depart |= STATION_DEPART_FLAG; + station.Depart |= kStationDepartFlag; ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST; } } @@ -153,7 +153,7 @@ static void RideUpdateStationDodgems(Ride& ride, StationIndex stationIndex) static void RideUpdateStationNormal(Ride& ride, StationIndex stationIndex) { auto& station = ride.GetStation(stationIndex); - int32_t time = station.Depart & STATION_DEPART_MASK; + int32_t time = station.Depart & kStationDepartMask; const auto currentTicks = GetGameState().CurrentTicks; if ((ride.lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) || (ride.status == RideStatus::Closed && ride.num_riders == 0)) @@ -168,7 +168,7 @@ static void RideUpdateStationNormal(Ride& ride, StationIndex stationIndex) { if (time == 0) { - station.Depart |= STATION_DEPART_FLAG; + station.Depart |= kStationDepartFlag; RideInvalidateStationStart(ride, stationIndex, true); } else @@ -191,9 +191,9 @@ static void RideUpdateStationRace(Ride& ride, StationIndex stationIndex) auto& station = ride.GetStation(stationIndex); if (ride.status == RideStatus::Closed || (ride.lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))) { - if (station.Depart & STATION_DEPART_FLAG) + if (station.Depart & kStationDepartFlag) { - station.Depart &= ~STATION_DEPART_FLAG; + station.Depart &= ~kStationDepartFlag; RideInvalidateStationStart(ride, stationIndex, false); } return; @@ -224,9 +224,9 @@ static void RideUpdateStationRace(Ride& ride, StationIndex stationIndex) // Race is over ride.lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING; - if (station.Depart & STATION_DEPART_FLAG) + if (station.Depart & kStationDepartFlag) { - station.Depart &= ~STATION_DEPART_FLAG; + station.Depart &= ~kStationDepartFlag; RideInvalidateStationStart(ride, stationIndex, false); } return; @@ -234,7 +234,7 @@ static void RideUpdateStationRace(Ride& ride, StationIndex stationIndex) } // Continue racing - station.Depart |= STATION_DEPART_FLAG; + station.Depart |= kStationDepartFlag; } else { @@ -247,9 +247,9 @@ static void RideUpdateStationRace(Ride& ride, StationIndex stationIndex) if (vehicle->status != Vehicle::Status::WaitingToDepart && vehicle->status != Vehicle::Status::Departing) { - if (station.Depart & STATION_DEPART_FLAG) + if (station.Depart & kStationDepartFlag) { - station.Depart &= ~STATION_DEPART_FLAG; + station.Depart &= ~kStationDepartFlag; RideInvalidateStationStart(ride, stationIndex, false); } return; @@ -259,9 +259,9 @@ static void RideUpdateStationRace(Ride& ride, StationIndex stationIndex) // Begin the race RideRaceInitVehicleSpeeds(ride); ride.lifecycle_flags |= RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING; - if (!(station.Depart & STATION_DEPART_FLAG)) + if (!(station.Depart & kStationDepartFlag)) { - station.Depart |= STATION_DEPART_FLAG; + station.Depart |= kStationDepartFlag; RideInvalidateStationStart(ride, stationIndex, true); } ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST; diff --git a/src/openrct2/ride/Track.cpp b/src/openrct2/ride/Track.cpp index 81dacc60ac..c660cec881 100644 --- a/src/openrct2/ride/Track.cpp +++ b/src/openrct2/ride/Track.cpp @@ -11,6 +11,7 @@ #include "../Cheats.h" #include "../Game.h" +#include "../GameState.h" #include "../audio/audio.h" #include "../config/Config.h" #include "../interface/Viewport.h" @@ -34,6 +35,7 @@ #include "TrackData.h" #include "TrackDesign.h" +using namespace OpenRCT2; using namespace OpenRCT2::TrackMetaData; PitchAndRoll TrackPitchAndRollStart(track_type_t trackType) @@ -121,7 +123,7 @@ ResultWithMessage TrackAddStationElement(CoordsXYZD loc, RideId rideIndex, int32 if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_SINGLE_PIECE_STATION)) { - if (ride->num_stations >= OpenRCT2::Limits::MaxStationsPerRide) + if (ride->num_stations >= Limits::MaxStationsPerRide) { return { false, STR_NO_MORE_STATIONS_ALLOWED_ON_THIS_RIDE }; } @@ -190,12 +192,12 @@ ResultWithMessage TrackAddStationElement(CoordsXYZD loc, RideId rideIndex, int32 // When attempting to place a track design, it sometimes happens that the front and back of station 0 are built, // but the middle is not. Allow this, so the track place function can actually finish building all 4 stations. // This _might_ cause issues if the track designs is bugged and actually has 5. - if (stationBackLoc == stationFrontLoc && ride->num_stations >= OpenRCT2::Limits::MaxStationsPerRide && !fromTrackDesign) + if (stationBackLoc == stationFrontLoc && ride->num_stations >= Limits::MaxStationsPerRide && !fromTrackDesign) { return { false, STR_NO_MORE_STATIONS_ALLOWED_ON_THIS_RIDE }; } - if (stationLength > MAX_STATION_PLATFORM_LENGTH) + if (stationLength > kMaxStationPlatformLength) { return { false, STR_STATION_PLATFORM_TOO_LONG }; } @@ -327,8 +329,7 @@ ResultWithMessage TrackRemoveStationElement(const CoordsXYZD& loc, RideId rideIn if (!(flags & GAME_COMMAND_FLAG_APPLY)) { - if ((removeLoc != stationBackLoc) && (removeLoc != stationFrontLoc) - && ride->num_stations >= OpenRCT2::Limits::MaxStationsPerRide) + if ((removeLoc != stationBackLoc) && (removeLoc != stationFrontLoc) && ride->num_stations >= Limits::MaxStationsPerRide) { return { false, STR_NO_MORE_STATIONS_ALLOWED_ON_THIS_RIDE }; } @@ -732,6 +733,9 @@ bool TrackTypeIsHelix(track_type_t trackType) std::optional GetTrackSegmentOrigin(const CoordsXYE& posEl) { + if (posEl.element == nullptr) + return {}; + auto trackEl = posEl.element->AsTrack(); if (trackEl == nullptr) return {}; @@ -943,7 +947,7 @@ void TrackElement::SetBrakeClosed(bool isClosed) bool TrackElement::IsIndestructible() const { - return (Flags2 & TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE) != 0 && !gCheatsMakeAllDestructible; + return (Flags2 & TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE) != 0 && !GetGameState().Cheats.MakeAllDestructible; } void TrackElement::SetIsIndestructible(bool isIndestructible) diff --git a/src/openrct2/ride/Track.h b/src/openrct2/ride/Track.h index 6796ca2c0c..4bb779476d 100644 --- a/src/openrct2/ride/Track.h +++ b/src/openrct2/ride/Track.h @@ -123,7 +123,7 @@ enum TRACK_ELEMENT_COLOUR_SEAT_ROTATION_MASK = 0b11110000, }; -#define MAX_STATION_PLATFORM_LENGTH 32 +constexpr int8_t kMaxStationPlatformLength = 32; constexpr uint16_t const MAX_TRACK_HEIGHT = 254 * COORDS_Z_STEP; constexpr uint8_t const DEFAULT_SEAT_ROTATION = 4; diff --git a/src/openrct2/ride/TrackData.cpp b/src/openrct2/ride/TrackData.cpp index f093d636b1..b37108a215 100644 --- a/src/openrct2/ride/TrackData.cpp +++ b/src/openrct2/ride/TrackData.cpp @@ -705,86 +705,86 @@ static constexpr uint8_t TrackSequenceProperties[][MaxSequencesPerPiece] = { }; static_assert(std::size(TrackSequenceProperties) == TrackElemType::Count); -#define TRACK_BLOCK_END { 255, 255, 255, 255, 255, {255, 255}, 255 } +constexpr PreviewTrack kTrackBlockEnd { 255, 255, 255, 255, 255, {255, 255}, 255 }; static constexpr PreviewTrack TrackBlocks000[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks001[] = { { 0, 0, 0, 0, 0,{ 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks002[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks003[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks004[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks005[] = { { 0, 0, 0, 0, 64, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks006[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks007[] = { { 0, 0, 0, 0, 32, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks008[] = { { 0, 0, 0, 0, 32, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks009[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks010[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks011[] = { { 0, 0, 0, 0, 64, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks012[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks013[] = { { 0, 0, 0, 0, 32, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks014[] = { { 0, 0, 0, 0, 32, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks015[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks016[] = { @@ -795,7 +795,7 @@ static constexpr PreviewTrack TrackBlocks016[] = { { 4, -32, -64, 0, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 0, 0, { 0b0111, 0 }, 0 }, { 6, -64, -64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks017[] = { @@ -806,27 +806,27 @@ static constexpr PreviewTrack TrackBlocks017[] = { { 4, -32, 64, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 0, 0, { 0b1011, 0 }, 0 }, { 6, -64, 64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks018[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks019[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks020[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks021[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks022[] = { @@ -837,7 +837,7 @@ static constexpr PreviewTrack TrackBlocks022[] = { { 4, -32, -64, 0, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 0, 0, { 0b0111, 0 }, 0 }, { 6, -64, -64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks023[] = { @@ -848,57 +848,57 @@ static constexpr PreviewTrack TrackBlocks023[] = { { 4, -32, 64, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 0, 0, { 0b1011, 0 }, 0 }, { 6, -64, 64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks024[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks025[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks026[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks027[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks028[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks029[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks030[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks031[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks032[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks033[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks034[] = { @@ -909,7 +909,7 @@ static constexpr PreviewTrack TrackBlocks034[] = { { 4, -32, -64, 48, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 32, 16, { 0b0111, 0b0100 }, 0 }, { 6, -64, -64, 48, 16, { 0b1111, 0b0110 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks035[] = { @@ -920,7 +920,7 @@ static constexpr PreviewTrack TrackBlocks035[] = { { 4, -32, 64, 48, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 32, 16, { 0b1011, 0b1000 }, 0 }, { 6, -64, 64, 48, 16, { 0b1111, 0b1001 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks036[] = { @@ -931,7 +931,7 @@ static constexpr PreviewTrack TrackBlocks036[] = { { 4, -32, -64, 16, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 16, 16, { 0b0111, 0b0001 }, 0 }, { 6, -64, -64, 0, 16, { 0b1111, 0b1001 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks037[] = { @@ -942,7 +942,7 @@ static constexpr PreviewTrack TrackBlocks037[] = { { 4, -32, 64, 16, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 16, 16, { 0b1011, 0b0010 }, 0 }, { 6, -64, 64, 0, 16, { 0b1111, 0b0110 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks038[] = { @@ -950,7 +950,7 @@ static constexpr PreviewTrack TrackBlocks038[] = { { 1, -32, 0, 0, 0, { 0b0111, 0 }, 0 }, { 2, -32, -32, 0, 0, { 0b1101, 0 }, 0 }, { 3, -64, -32, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks039[] = { @@ -958,7 +958,7 @@ static constexpr PreviewTrack TrackBlocks039[] = { { 1, -32, 0, 0, 0, { 0b1011, 0 }, 0 }, { 2, -32, 32, 0, 0, { 0b1110, 0 }, 0 }, { 3, -64, 32, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; // LeftVerticalLoop @@ -973,7 +973,7 @@ static constexpr PreviewTrack TrackBlocks040[] = { { 7, 32, -32, 32, 96, { 0b1000, 0 }, 0 }, { 8, 0, -32, 16, 16, { 0b1111, 0b0011 }, 0 }, { 9, -32, -32, 0, 16, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; // RightVerticalLoop @@ -988,7 +988,7 @@ static constexpr PreviewTrack TrackBlocks041[] = { { 7, 32, 32, 32, 96, { 0b0100, 0 }, 0 }, { 8, 0, 32, 16, 16, { 0b1111, 0b0011 }, 0 }, { 9, -32, 32, 0, 16, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks042[] = { @@ -996,7 +996,7 @@ static constexpr PreviewTrack TrackBlocks042[] = { { 1, 0, -32, 0, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0010, 0 }, 0 }, { 3, -32, -32, 0, 0, { 0b0111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks043[] = { @@ -1004,7 +1004,7 @@ static constexpr PreviewTrack TrackBlocks043[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0001, 0 }, 0 }, { 3, -32, 32, 0, 0, { 0b1011, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks044[] = { @@ -1012,7 +1012,7 @@ static constexpr PreviewTrack TrackBlocks044[] = { { 1, 0, -32, 0, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0010, 0 }, 0 }, { 3, -32, -32, 0, 0, { 0b0111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks045[] = { @@ -1020,7 +1020,7 @@ static constexpr PreviewTrack TrackBlocks045[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0001, 0 }, 0 }, { 3, -32, 32, 0, 0, { 0b1011, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks046[] = { @@ -1028,7 +1028,7 @@ static constexpr PreviewTrack TrackBlocks046[] = { { 1, 0, -32, 16, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 16, 0, { 0b0010, 0 }, 0 }, { 3, -32, -32, 16, 16,{ 0b0111, 0b0110 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks047[] = { @@ -1036,7 +1036,7 @@ static constexpr PreviewTrack TrackBlocks047[] = { { 1, 0, 32, 16, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 16, 0, { 0b0001, 0 }, 0 }, { 3, -32, 32, 16, 16,{ 0b1011, 0b1001 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks048[] = { @@ -1044,7 +1044,7 @@ static constexpr PreviewTrack TrackBlocks048[] = { { 1, 0, -32, 16, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 16, 0, { 0b0010, 0 }, 0 }, { 3, -32, -32, 0, 16, { 0b0111, 0b0001 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks049[] = { @@ -1052,45 +1052,45 @@ static constexpr PreviewTrack TrackBlocks049[] = { { 1, 0, 32, 16, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 16, 0, { 0b0001, 0 }, 0 }, { 3, -32, 32, 0, 16, { 0b1011, 0b0010 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks050[] = { { 0, 0, 0, 0, 0, { 0b0111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks051[] = { { 0, 0, 0, 0, 0, { 0b1011, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks052[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, 16, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks053[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, 16, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks054[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, -16, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, -16, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks055[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, -16, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, -16, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; // HalfLoopUp @@ -1099,7 +1099,7 @@ static constexpr PreviewTrack TrackBlocks056[] = { { 1, -32, 0, 16, 16, { 0b1111, 0b1100 }, 0 }, { 2, -64, 0, 32, 96,{ 0b0011, 0 }, 0 }, { 3, -32, 0, 120, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; // HalfLoopDown @@ -1108,55 +1108,55 @@ static constexpr PreviewTrack TrackBlocks057[] = { { 1, -32, 0, -120, 96,{ 0b0011, 0 }, 0 }, { 2, 0, 0, -136, 16, { 0b1111, 0b1100 }, 0 }, { 3, 32, 0, -152, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks058[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, 24, 32, { 0b0111, 0 }, 0 }, { 2, -32, -32, 48, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks059[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, 24, 32, { 0b1011, 0 }, 0 }, { 2, -32, 32, 48, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks060[] = { { 0, 0, 0, -32, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, -56, 32, { 0b0111, 0 }, 0 }, { 2, -32, -32, -80, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks061[] = { { 0, 0, 0, -32, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, -56, 32, { 0b1011, 0 }, 0 }, { 2, -32, 32, -80, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks062[] = { { 0, 0, 0, 0, 24, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks063[] = { { 0, 0, 0, 0, 24, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks064[] = { { 0, 0, 0, 0, 24, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks065[] = { { 0, 0, 0, 0, 24, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks066[] = { @@ -1169,78 +1169,78 @@ static constexpr PreviewTrack TrackBlocks066[] = { { 6, 32, -32, 0, 0, { 0b1111, 0 }, 0 }, { 7, 32, 32, 0, 0, { 0b1111, 0 }, 0 }, { 8, 32, 0, 0, 0, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_1 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks067[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, 32, 0, 0, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_1 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks068[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks069[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks070[] = { { 0, 0, 0, 0, 64, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks071[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks072[] = { { 0, 0, 0, 0, 32, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks073[] = { { 0, 0, 0, 0, 32, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks074[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks075[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks076[] = { { 0, 0, 0, 0, 64, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks077[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks078[] = { { 0, 0, 0, 0, 32, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks079[] = { { 0, 0, 0, 0, 32, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks080[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks081[] = { @@ -1251,7 +1251,7 @@ static constexpr PreviewTrack TrackBlocks081[] = { { 4, -32, -64, 0, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 0, 0, { 0b0111, 0 }, 0 }, { 6, -64, -64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks082[] = { @@ -1262,7 +1262,7 @@ static constexpr PreviewTrack TrackBlocks082[] = { { 4, -32, 64, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 0, 0, { 0b1011, 0 }, 0 }, { 6, -64, 64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks083[] = { @@ -1270,7 +1270,7 @@ static constexpr PreviewTrack TrackBlocks083[] = { { 1, -32, 0, 0, 0, { 0b0111, 0 }, 0 }, { 2, -32, -32, 0, 0, { 0b1101, 0 }, 0 }, { 3, -64, -32, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks084[] = { @@ -1278,7 +1278,7 @@ static constexpr PreviewTrack TrackBlocks084[] = { { 1, -32, 0, 0, 0, { 0b1011, 0 }, 0 }, { 2, -32, 32, 0, 0, { 0b1110, 0 }, 0 }, { 3, -64, 32, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks085[] = { @@ -1286,7 +1286,7 @@ static constexpr PreviewTrack TrackBlocks085[] = { { 1, 0, -32, 0, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0010, 0 }, 0 }, { 3, -32, -32, 0, 0, { 0b0111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks086[] = { @@ -1294,7 +1294,7 @@ static constexpr PreviewTrack TrackBlocks086[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0001, 0 }, 0 }, { 3, -32, 32, 0, 0, { 0b1011, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks087[] = { @@ -1306,7 +1306,7 @@ static constexpr PreviewTrack TrackBlocks087[] = { { 5, 0, -64, 8, 0, { 0b0100, 0b0000 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 6, -32, -96, 8, 4, { 0b0001, 0 }, 0 }, { 7, 0, -96, 8, 4, { 0b1011, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks088[] = { @@ -1318,7 +1318,7 @@ static constexpr PreviewTrack TrackBlocks088[] = { { 5, 0, 64, 8, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 6, -32, 96, 8, 4, { 0b0010, 0 }, 0 }, { 7, 0, 96, 8, 4, { 0b0111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks089[] = { @@ -1330,7 +1330,7 @@ static constexpr PreviewTrack TrackBlocks089[] = { { 5, 0, -64, 0, 4, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 6, -32, -96, 0, 0, { 0b0001, 0 }, 0 }, { 7, 0, -96, 0, 0, { 0b1011, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks090[] = { @@ -1342,7 +1342,7 @@ static constexpr PreviewTrack TrackBlocks090[] = { { 5, 0, 64, 0, 4, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 6, -32, 96, 0, 0, { 0b0010, 0 }, 0 }, { 7, 0, 96, 0, 0, { 0b0111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks091[] = { @@ -1360,7 +1360,7 @@ static constexpr PreviewTrack TrackBlocks091[] = { { 11, 0, -128, 8, 4, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 12, -32, -160, 8, 4, { 0b1011, 0 }, 0 }, { 13, 0, -160, 8, 4, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks092[] = { @@ -1378,7 +1378,7 @@ static constexpr PreviewTrack TrackBlocks092[] = { { 11, 0, 128, 8, 4, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 12, -32, 160, 8, 4, { 0b0111, 0 }, 0 }, { 13, 0, 160, 8, 4, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks093[] = { @@ -1396,7 +1396,7 @@ static constexpr PreviewTrack TrackBlocks093[] = { { 11, 0, -128, 0, 0, { 0b0100, 0b0000 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 12, -32, -160, 0, 0, { 0b1011, 0 }, 0 }, { 13, 0, -160, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks094[] = { @@ -1414,42 +1414,42 @@ static constexpr PreviewTrack TrackBlocks094[] = { { 11, 0, 128, 0, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 12, -32, 160, 0, 0, { 0b0111, 0 }, 0 }, { 13, 0, 160, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks095[] = { { 0, 0, 0, 0, 64, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks096[] = { { 0, 0, 0, 0, 64, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks097[] = { { 0, 0, 0, 0, 64, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks098[] = { { 0, 0, 0, 0, 64, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks099[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks100[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks101[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks102[] = { @@ -1460,7 +1460,7 @@ static constexpr PreviewTrack TrackBlocks102[] = { { 4, -32, -64, 0, 12, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 0, 12, { 0b0111, 0 }, 0 }, { 6, -64, -64, 0, 12, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks103[] = { @@ -1471,7 +1471,7 @@ static constexpr PreviewTrack TrackBlocks103[] = { { 4, -32, 64, 0, 12, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 0, 12, { 0b1011, 0 }, 0 }, { 6, -64, 64, 0, 12, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks104[] = { @@ -1482,7 +1482,7 @@ static constexpr PreviewTrack TrackBlocks104[] = { { 4, -32, -64, 0, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 0, 0, { 0b0111, 0 }, 0 }, { 6, -64, -64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks105[] = { @@ -1493,7 +1493,7 @@ static constexpr PreviewTrack TrackBlocks105[] = { { 4, -32, 64, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 0, 0, { 0b1011, 0 }, 0 }, { 6, -64, 64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks106[] = { @@ -1504,7 +1504,7 @@ static constexpr PreviewTrack TrackBlocks106[] = { { 4, -32, -64, 0, 12, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 0, 12, { 0b0111, 0 }, 0 }, { 6, -64, -64, 0, 12, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks107[] = { @@ -1515,7 +1515,7 @@ static constexpr PreviewTrack TrackBlocks107[] = { { 4, -32, 64, 0, 12, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 0, 12, { 0b1011, 0 }, 0 }, { 6, -64, 64, 0, 12, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks108[] = { @@ -1526,7 +1526,7 @@ static constexpr PreviewTrack TrackBlocks108[] = { { 4, -32, -64, 0, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 0, 0, { 0b0111, 0 }, 0 }, { 6, -64, -64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks109[] = { @@ -1537,42 +1537,42 @@ static constexpr PreviewTrack TrackBlocks109[] = { { 4, -32, 64, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 0, 0, { 0b1011, 0 }, 0 }, { 6, -64, 64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks110[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks111[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks112[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks113[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks114[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks115[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks116[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks117[] = { @@ -1581,7 +1581,7 @@ static constexpr PreviewTrack TrackBlocks117[] = { { 2, -64, 0, 0, 16, { 0b1111, 0 }, 0 }, { 3, -96, 0, 0, 16, { 0b1111, 0 }, 0 }, { 4, -128, 0, 0, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks118[] = { @@ -1589,7 +1589,7 @@ static constexpr PreviewTrack TrackBlocks118[] = { { 1, -32, 0, 0, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, 16, 24, { 0b1111, 0 }, 0 }, { 3, -96, 0, 40, 48, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks119[] = { @@ -1597,12 +1597,12 @@ static constexpr PreviewTrack TrackBlocks119[] = { { 1, -32, 0, 40, 48, { 0b1111, 0 }, 0 }, { 2, -64, 0, 64, 24, { 0b1111, 0 }, 0 }, { 3, -96, 0, 80, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks120[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks121[] = { @@ -1610,7 +1610,7 @@ static constexpr PreviewTrack TrackBlocks121[] = { { 1, -32, 0, 16, 24, { 0b1111, 0 }, 0 }, { 2, -64, 0, 0, 16, { 0b1111, 0 }, 0 }, { 3, -96, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks122[] = { @@ -1618,7 +1618,7 @@ static constexpr PreviewTrack TrackBlocks122[] = { { 1, -32, 0, 64, 24, { 0b1111, 0 }, 0 }, { 2, -64, 0, 40, 48, { 0b1111, 0 }, 0 }, { 3, -96, 0, 0, 48, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks123[] = { @@ -1626,7 +1626,7 @@ static constexpr PreviewTrack TrackBlocks123[] = { { 1, -32, 0, 0, 8, { 0b1111, 0b0011 }, 0 }, { 2, -64, 0, -32, 32, { 0b1111, 0b0011 }, 0 }, { 3, -96, 0, -96, 64, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks124[] = { @@ -1637,52 +1637,52 @@ static constexpr PreviewTrack TrackBlocks124[] = { { 4, -128, 0, 0, 160, { 0b1111, 0 }, 0 }, { 5, -192, 0, 0, 208, { 0b1111, 0 }, 0 }, { 6, -160, 0, 0, 208, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks125[] = { { 0, 0, 0, 0, 48, { 0b1111, 0 }, 0 }, { 1, 32, 0, 0, 48, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks126[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 32, 0, 0, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks127[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 32, 0, 0, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks128[] = { { 0, 0, 0, 0, 32, { 0b1111, 0b1100 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 32, 0, 0, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks129[] = { { 0, 0, 0, 0, 32, { 0b1111, 0b0011 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks130[] = { { 0, 0, 0, 0, 56, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks131[] = { { 0, 0, 0, 0, 56, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 32, 0, 0, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks132[] = { { 0, 0, 0, 0, 24, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks133[] = { @@ -1691,7 +1691,7 @@ static constexpr PreviewTrack TrackBlocks133[] = { { 2, -32, -32, 0, 0, { 0b1000, 0 }, 0 }, { 3, -64, 0, 0, 0, { 0b0010, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 4, -64, -32, 0, 0, { 0b0001, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks134[] = { @@ -1700,7 +1700,7 @@ static constexpr PreviewTrack TrackBlocks134[] = { { 2, -32, 32, 0, 0, { 0b0100, 0 }, 0 }, { 3, -64, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 4, -64, 32, 0, 0, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks135[] = { @@ -1709,7 +1709,7 @@ static constexpr PreviewTrack TrackBlocks135[] = { { 2, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b1111, 0 }, 0 }, { 4, -64, 32, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks136[] = { @@ -1718,7 +1718,7 @@ static constexpr PreviewTrack TrackBlocks136[] = { { 2, -32, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b1111, 0 }, 0 }, { 4, -32, 64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks137[] = { @@ -1727,7 +1727,7 @@ static constexpr PreviewTrack TrackBlocks137[] = { { 2, -32, -32, 0, 0, { 0b1000, 0 }, 0 }, { 3, -64, 0, 0, 0, { 0b0010, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 4, -64, -32, 0, 0, { 0b0001, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks138[] = { @@ -1736,7 +1736,7 @@ static constexpr PreviewTrack TrackBlocks138[] = { { 2, -32, 32, 0, 0, { 0b0100, 0 }, 0 }, { 3, -64, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 4, -64, 32, 0, 0, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks139[] = { @@ -1745,7 +1745,7 @@ static constexpr PreviewTrack TrackBlocks139[] = { { 2, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b1111, 0 }, 0 }, { 4, -64, 32, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks140[] = { @@ -1754,7 +1754,7 @@ static constexpr PreviewTrack TrackBlocks140[] = { { 2, -32, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b1111, 0 }, 0 }, { 4, -32, 64, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks141[] = { @@ -1762,7 +1762,7 @@ static constexpr PreviewTrack TrackBlocks141[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks142[] = { @@ -1770,7 +1770,7 @@ static constexpr PreviewTrack TrackBlocks142[] = { { 1, 0, 32, 0, 16, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 16, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 16, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks143[] = { @@ -1778,7 +1778,7 @@ static constexpr PreviewTrack TrackBlocks143[] = { { 1, 0, 32, 0, 64, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 64, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 64, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks144[] = { @@ -1786,7 +1786,7 @@ static constexpr PreviewTrack TrackBlocks144[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks145[] = { @@ -1794,7 +1794,7 @@ static constexpr PreviewTrack TrackBlocks145[] = { { 1, 0, 32, 0, 32, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 32, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 32, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks146[] = { @@ -1802,7 +1802,7 @@ static constexpr PreviewTrack TrackBlocks146[] = { { 1, 0, 32, 0, 32, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 32, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 32, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks147[] = { @@ -1810,7 +1810,7 @@ static constexpr PreviewTrack TrackBlocks147[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks148[] = { @@ -1818,7 +1818,7 @@ static constexpr PreviewTrack TrackBlocks148[] = { { 1, 0, 32, 0, 16, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 16, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 16, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks149[] = { @@ -1826,7 +1826,7 @@ static constexpr PreviewTrack TrackBlocks149[] = { { 1, 0, 32, 0, 64, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 64, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 64, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks150[] = { @@ -1834,7 +1834,7 @@ static constexpr PreviewTrack TrackBlocks150[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks151[] = { @@ -1842,7 +1842,7 @@ static constexpr PreviewTrack TrackBlocks151[] = { { 1, 0, 32, 0, 32, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 32, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 32, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks152[] = { @@ -1850,7 +1850,7 @@ static constexpr PreviewTrack TrackBlocks152[] = { { 1, 0, 32, 0, 32, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 32, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 32, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks153[] = { @@ -1858,7 +1858,7 @@ static constexpr PreviewTrack TrackBlocks153[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks154[] = { @@ -1866,7 +1866,7 @@ static constexpr PreviewTrack TrackBlocks154[] = { { 1, 0, 32, 0, 24, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 24, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 24, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks155[] = { @@ -1874,7 +1874,7 @@ static constexpr PreviewTrack TrackBlocks155[] = { { 1, 0, 32, 0, 24, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 24, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 24, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks156[] = { @@ -1882,7 +1882,7 @@ static constexpr PreviewTrack TrackBlocks156[] = { { 1, 0, 32, 0, 24, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 24, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 24, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks157[] = { @@ -1890,7 +1890,7 @@ static constexpr PreviewTrack TrackBlocks157[] = { { 1, 0, 32, 0, 24, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 24, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 24, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks158[] = { @@ -1898,7 +1898,7 @@ static constexpr PreviewTrack TrackBlocks158[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks159[] = { @@ -1906,7 +1906,7 @@ static constexpr PreviewTrack TrackBlocks159[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks160[] = { @@ -1914,7 +1914,7 @@ static constexpr PreviewTrack TrackBlocks160[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks161[] = { @@ -1922,7 +1922,7 @@ static constexpr PreviewTrack TrackBlocks161[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks162[] = { @@ -1930,7 +1930,7 @@ static constexpr PreviewTrack TrackBlocks162[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks163[] = { @@ -1938,7 +1938,7 @@ static constexpr PreviewTrack TrackBlocks163[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks164[] = { @@ -1946,7 +1946,7 @@ static constexpr PreviewTrack TrackBlocks164[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks165[] = { @@ -1954,7 +1954,7 @@ static constexpr PreviewTrack TrackBlocks165[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks166[] = { @@ -1962,7 +1962,7 @@ static constexpr PreviewTrack TrackBlocks166[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks167[] = { @@ -1970,7 +1970,7 @@ static constexpr PreviewTrack TrackBlocks167[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks168[] = { @@ -1978,7 +1978,7 @@ static constexpr PreviewTrack TrackBlocks168[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks169[] = { @@ -1986,7 +1986,7 @@ static constexpr PreviewTrack TrackBlocks169[] = { { 1, 0, 32, 0, 8, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 8, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks170[] = { @@ -1994,7 +1994,7 @@ static constexpr PreviewTrack TrackBlocks170[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks171[] = { @@ -2002,45 +2002,45 @@ static constexpr PreviewTrack TrackBlocks171[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 0, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 0, 0, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks172[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks173[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks174[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, 0, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks175[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, 0, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks176[] = { { 0, 0, 0, -32, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, -32, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, -32, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks177[] = { { 0, 0, 0, -32, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, -32, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, -32, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks178[] = { @@ -2048,7 +2048,7 @@ static constexpr PreviewTrack TrackBlocks178[] = { { 1, 0, -32, 0, 16, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 16, { 0b0010, 0 }, 0 }, { 3, -32, -32, 16, 16,{ 0b0111, 0b0110 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks179[] = { @@ -2056,7 +2056,7 @@ static constexpr PreviewTrack TrackBlocks179[] = { { 1, 0, 32, 0, 16, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 16, { 0b0001, 0 }, 0 }, { 3, -32, 32, 16, 16,{ 0b1011, 0b1001 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks180[] = { @@ -2064,7 +2064,7 @@ static constexpr PreviewTrack TrackBlocks180[] = { { 1, 0, -32, 0, 16, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 16, { 0b0010, 0 }, 0 }, { 3, -32, -32, 0, 0, { 0b0111, 0b0001 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks181[] = { @@ -2072,12 +2072,12 @@ static constexpr PreviewTrack TrackBlocks181[] = { { 1, 0, 32, 0, 16, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 16, { 0b0001, 0 }, 0 }, { 3, -32, 32, 0, 0, { 0b1011, 0b0010 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks182[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; // LeftLargeHalfLoopUp @@ -2089,7 +2089,7 @@ static constexpr PreviewTrack TrackBlocks183[] = { { 4, -128, -32, 120, 96, { 0b1111, 0 }, 0 }, { 5, -96, -32, 64, 192, { 0b1111, 0 }, 0 }, { 6, -64, -32, 248, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; // RightLargeHalfLoopUp @@ -2101,7 +2101,7 @@ static constexpr PreviewTrack TrackBlocks184[] = { { 4, -128, 32, 120, 96, { 0b1111, 0 }, 0 }, { 5, -96, 32, 64, 192, { 0b1111, 0 }, 0 }, { 6, -64, 32, 248, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; // LeftLargeHalfLoopDown @@ -2113,7 +2113,7 @@ static constexpr PreviewTrack TrackBlocks185[] = { { 4, 0, -32, -248, 56, { 0b1111, 0 }, 0 }, { 5, 32, -32, -264, 40, { 0b1111, 0b1100 }, 0 }, { 6, 64, -32, -280, 24, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; // RightLargeHalfLoopDown @@ -2125,35 +2125,35 @@ static constexpr PreviewTrack TrackBlocks186[] = { { 4, 0, 32, -248, 56, { 0b1111, 0 }, 0 }, { 5, 32, 32, -264, 40, { 0b1111, 0b1100 }, 0 }, { 6, 64, 32, -280, 24, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks187[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, -16, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, -16, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks188[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, -16, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, -16, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks189[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, 16, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks190[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 16, { 0b1111, 0 }, 0 }, { 2, -64, 0, 16, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; // FlyerHalfLoopUninvertedUp @@ -2162,7 +2162,7 @@ static constexpr PreviewTrack TrackBlocks191[] = { { 1, -32, 0, 16, 16, { 0b1111, 0b1100 }, 0 }, { 2, -64, 0, 32, 96,{ 0b0011, 0 }, 0 }, { 3, -32, 0, 120, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; // FlyerHalfLoopInvertedDown @@ -2171,35 +2171,35 @@ static constexpr PreviewTrack TrackBlocks192[] = { { 1, -32, 0, -88, 96,{ 0b0011, 0 }, 0 }, { 2, 0, 0, -104, 16, { 0b1111, 0b1100 }, 0 }, { 3, 32, 0, -120, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks193[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, 24, 32, { 0b0111, 0 }, 0 }, { 2, -32, -32, 48, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks194[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, 24, 32, { 0b1011, 0 }, 0 }, { 2, -32, 32, 48, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks195[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, -24, 32, { 0b0111, 0 }, 0 }, { 2, -32, -32, -48, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks196[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, -24, 32, { 0b1011, 0 }, 0 }, { 2, -32, 32, -48, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks197[] = { @@ -2207,7 +2207,7 @@ static constexpr PreviewTrack TrackBlocks197[] = { { 1, -32, 0, 0, 32, { 0b1111, 0 }, 0 }, { 2, -64, 0, 16, 0, { 0b1111, 0 }, 0 }, { 3, 0, 0, 32, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks198[] = { @@ -2215,7 +2215,7 @@ static constexpr PreviewTrack TrackBlocks198[] = { { 1, -32, 0, -32, 32, { 0b1111, 0 }, 0 }, { 2, -64, 0, -16, 0, { 0b1111, 0 }, 0 }, { 3, 0, 0, -32, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks199[] = { @@ -2225,7 +2225,7 @@ static constexpr PreviewTrack TrackBlocks199[] = { { 3, -96, 0, 0, 0, { 0b1111, 0 }, 0 }, { 4, -128, 0, 0, 0, { 0b1111, 0 }, 0 }, { 5, -160, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks200[] = { @@ -2235,39 +2235,39 @@ static constexpr PreviewTrack TrackBlocks200[] = { { 3, -96, 0, 0, 0, { 0b1111, 0 }, 0 }, { 4, -128, 0, 0, 0, { 0b1111, 0 }, 0 }, { 5, -160, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks201[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks202[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks203[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks204[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, { 2, -32, 32, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks205[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, { 1, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, { 2, -32, -32, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks206[] = { @@ -2275,14 +2275,14 @@ static constexpr PreviewTrack TrackBlocks206[] = { { 1, -32, 0, -40, 32, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 2, -64, 0, -96, 56, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 3, -96, 0, -96, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks207[] = { { 0, 0, 0, 0, 56, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 32, 0, 56, 32, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 2, 64, 0, 96, 16, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks208[] = { @@ -2290,7 +2290,7 @@ static constexpr PreviewTrack TrackBlocks208[] = { { 1, -32, 0, -72, 32, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 2, -64, 0, -128, 56, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 3, -96, 0, -128, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks209[] = { @@ -2298,7 +2298,7 @@ static constexpr PreviewTrack TrackBlocks209[] = { { 1, 0, -32, 0, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0010, 0 }, 0 }, { 3, -32, -32, 0, 8, { 0b0111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks210[] = { @@ -2306,7 +2306,7 @@ static constexpr PreviewTrack TrackBlocks210[] = { { 1, 0, 32, 0, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 0, 8, { 0b0001, 0 }, 0 }, { 3, -32, 32, 0, 8, { 0b1011, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks211[] = { @@ -2316,7 +2316,7 @@ static constexpr PreviewTrack TrackBlocks211[] = { { 3, -64, -32, 0, 0, { 0b1111, 0 }, 0 }, { 4, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, { 5, -64, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks212[] = { @@ -2326,7 +2326,7 @@ static constexpr PreviewTrack TrackBlocks212[] = { { 3, -64, 32, 0, 0, { 0b1111, 0 }, 0 }, { 4, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, { 5, -64, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks213[] = { @@ -2334,13 +2334,13 @@ static constexpr PreviewTrack TrackBlocks213[] = { { 1, 32, 0, 0, 32, { 0b1111, 0 }, 0 }, { 2, -64, 0, 0, 32, { 0b1111, 0 }, 0 }, { 3, -32, 0, 0, 32, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks214[] = { { 0, 0, 0, 0, 48, { 0b1111, 0 }, 0 }, { 1, 32, 0, 0, 48, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks215[] = { @@ -2351,12 +2351,12 @@ static constexpr PreviewTrack TrackBlocks215[] = { { 4, -96, 0, 0, 48, { 0b1111, 0 }, 0 }, { 5, -128, 0, 0, 32, { 0b1111, 0 }, 0 }, { 6, -160, 0, 0, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks216[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks217[] = { @@ -2364,7 +2364,7 @@ static constexpr PreviewTrack TrackBlocks217[] = { { 1, 0, -32, 16, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 16, 0, { 0b0010, 0 }, 0 }, { 3, -32, -32, 16, 16,{ 0b0111, 0b0110 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks218[] = { @@ -2372,7 +2372,7 @@ static constexpr PreviewTrack TrackBlocks218[] = { { 1, 0, 32, 16, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 16, 0, { 0b0001, 0 }, 0 }, { 3, -32, 32, 16, 16,{ 0b1011, 0b1001 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks219[] = { @@ -2380,7 +2380,7 @@ static constexpr PreviewTrack TrackBlocks219[] = { { 1, 0, -32, 16, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 16, 0, { 0b0010, 0 }, 0 }, { 3, -32, -32, 0, 16, { 0b0111, 0b0001 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks220[] = { @@ -2388,7 +2388,7 @@ static constexpr PreviewTrack TrackBlocks220[] = { { 1, 0, 32, 16, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 2, -32, 0, 16, 0, { 0b0001, 0 }, 0 }, { 3, -32, 32, 0, 16, { 0b1011, 0b0010 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks221[] = { @@ -2399,7 +2399,7 @@ static constexpr PreviewTrack TrackBlocks221[] = { { 4, -32, -64, 48, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 32, 16, { 0b0111, 0b0100 }, 0 }, { 6, -64, -64, 48, 16, { 0b1111, 0b0110 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks222[] = { @@ -2410,7 +2410,7 @@ static constexpr PreviewTrack TrackBlocks222[] = { { 4, -32, 64, 48, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 32, 16, { 0b1011, 0b1000 }, 0 }, { 6, -64, 64, 48, 16, { 0b1111, 0b1001 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks223[] = { @@ -2421,7 +2421,7 @@ static constexpr PreviewTrack TrackBlocks223[] = { { 4, -32, -64, 16, 0, { 0b1000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, -32, 16, 16, { 0b0111, 0b0001 }, 0 }, { 6, -64, -64, 0, 16, { 0b1111, 0b1001 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks224[] = { @@ -2432,158 +2432,158 @@ static constexpr PreviewTrack TrackBlocks224[] = { { 4, -32, 64, 16, 0, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 5, -64, 32, 16, 16, { 0b1011, 0b0010 }, 0 }, { 6, -64, 64, 0, 16, { 0b1111, 0b0110 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks225[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks226[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks227[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks228[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks229[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks230[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks231[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks232[] = { { 0, 0, 0, 0, 16, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks233[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks234[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks235[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks236[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks237[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks238[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks239[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks240[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks241[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks242[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks243[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks244[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks245[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks246[] = { { 0, 0, 0, 0, 8, { 0b1111, 0b0011 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks247[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks248[] = { { 0, 0, 0, 0, 8, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks249[] = { { 0, 0, 0, 0, 72, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 0, 32, 0, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks250[] = { { 0, 0, 0, 0, 72, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 0, -32, 0, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks251[] = { { 0, 0, 0, 0, 72, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 0, 32, 0, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks252[] = { { 0, 0, 0, 0, 72, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 0, -32, 0, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks253[] = { { 0, 0, 0, 0, 56, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 32, 0, 56, 32, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 2, 64, 0, 96, 16, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks254[] = { @@ -2591,19 +2591,19 @@ static constexpr PreviewTrack TrackBlocks254[] = { { 1, -32, 0, -72, 32, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 2, -64, 0, -128, 56, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 3, -96, 0, -128, 0, { 0b0000, 0 }, RCT_PREVIEW_TRACK_FLAG_0 | RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocks255[] = { { 0, 0, 0, 32, 56, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 1, 32, 0, 88, 32, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, { 2, 64, 0, 128, 16, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRotationControlToggle[] = { { 0, 0, 0, 0, 0, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlatTrack1x4A[] = { @@ -2611,7 +2611,7 @@ static constexpr PreviewTrack TrackBlocksFlatTrack1x4A[] = { { 1, -64, 0, 0, 0, { 0b1111, 0 }, 0 }, { 2, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, { 3, 32, 0, 0, 0, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_1 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlatTrack2x2[] = { @@ -2619,7 +2619,7 @@ static constexpr PreviewTrack TrackBlocksFlatTrack2x2[] = { { 1, 0, 32, 0, 0, { 0b1111, 0 }, 0 }, { 2, 32, 0, 0, 0, { 0b1111, 0 }, 0 }, { 3, 32, 32, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlatTrack4x4[] = { @@ -2639,7 +2639,7 @@ static constexpr PreviewTrack TrackBlocksFlatTrack4x4[] = { { 13, 96, 32, 0, 0, { 0b1111, 0 }, 0 }, { 14, 96, 64, 0, 0, { 0b1111, 0 }, 0 }, { 15, 96, 96, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlatTrack2x4[] = { @@ -2651,7 +2651,7 @@ static constexpr PreviewTrack TrackBlocksFlatTrack2x4[] = { { 5, 32, 32, 0, 0, { 0b1111, 0 }, 0 }, { 6, 32, 64, 0, 0, { 0b1111, 0 }, 0 }, { 7, 32, 96, 0, 0, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_1 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlatTrack1x5[] = { @@ -2660,12 +2660,12 @@ static constexpr PreviewTrack TrackBlocksFlatTrack1x5[] = { { 2, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, { 3, 32, 0, 0, 0, { 0b1111, 0 }, 0 }, { 4, 64, 0, 0, 0, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_1 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlatTrack1x1A[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlatTrack1x4B[] = { @@ -2673,12 +2673,12 @@ static constexpr PreviewTrack TrackBlocksFlatTrack1x4B[] = { { 1, -64, 0, 0, 0, { 0b1111, 0 }, 0 }, { 2, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, { 3, 32, 0, 0, 0, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_1 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlatTrack1x1B[] = { { 0, 0, 0, 0, 0, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlatTrack1x4C[] = { @@ -2686,7 +2686,7 @@ static constexpr PreviewTrack TrackBlocksFlatTrack1x4C[] = { { 1, -64, 0, 0, 0, { 0b1111, 0 }, 0 }, { 2, -32, 0, 0, 0, { 0b1111, 0 }, 0 }, { 3, 32, 0, 0, 0, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_1 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlatTrack3x3[] = { @@ -2699,7 +2699,7 @@ static constexpr PreviewTrack TrackBlocksFlatTrack3x3[] = { { 6, 32, -32, 0, 0, { 0b1111, 0 }, 0 }, { 7, 32, 32, 0, 0, { 0b1111, 0 }, 0 }, { 8, 32, 0, 0, 0, { 0b1111, 0 }, RCT_PREVIEW_TRACK_FLAG_1 }, - TRACK_BLOCK_END + kTrackBlockEnd }; @@ -2710,7 +2710,7 @@ static constexpr PreviewTrack TrackBlocksLeftLargeCorkscrewUp[] = { { 3, -32, -32, 32, 24, { 0b1000, 0 }, 0 }, { 4, -64, -32, 48, 40, { 0b1111, 0 }, 0 }, { 5, -64, -64, 72, 24, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightLargeCorkscrewUp[] = { @@ -2720,7 +2720,7 @@ static constexpr PreviewTrack TrackBlocksRightLargeCorkscrewUp[] = { { 3, -32, 32, 32, 24, { 0b0100, 0 }, 0 }, { 4, -64, 32, 48, 40, { 0b1111, 0 }, 0 }, { 5, -64, 64, 72, 24, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftLargeCorkscrewDown[] = { @@ -2730,7 +2730,7 @@ static constexpr PreviewTrack TrackBlocksLeftLargeCorkscrewDown[] = { { 3, -64, 0, -80, 24, { 0b0111, 0 }, 0 }, { 4, -64, -32, -104, 32, { 0b1111, 0 }, 0 }, { 5, -64, -64, -112, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightLargeCorkscrewDown[] = { @@ -2740,7 +2740,7 @@ static constexpr PreviewTrack TrackBlocksRightLargeCorkscrewDown[] = { { 3, -64, 0, -80, 24, { 0b1011, 0 }, 0 }, { 4, -64, 32, -104, 32, { 0b1111, 0 }, 0 }, { 5, -64, 64, -112, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftMediumHalfLoopUp[] = { @@ -2749,7 +2749,7 @@ static constexpr PreviewTrack TrackBlocksLeftMediumHalfLoopUp[] = { { 2, -64, 0, 56,120, { 0b1111, 0 }, 0 }, { 3, -64, -32, 56,120, { 0b1111, 0 }, 0 }, { 4, -32, -32,168, 24, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightMediumHalfLoopUp[] = { @@ -2758,7 +2758,7 @@ static constexpr PreviewTrack TrackBlocksRightMediumHalfLoopUp[] = { { 2, -64, 0, 56,120, { 0b1111, 0 }, 0 }, { 3, -64, 32, 56,120, { 0b1111, 0 }, 0 }, { 4, -32, 32,168, 24, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftMediumHalfLoopDown[] = { @@ -2767,7 +2767,7 @@ static constexpr PreviewTrack TrackBlocksLeftMediumHalfLoopDown[] = { { 2, -32, -32, -160,120, { 0b1111, 0 }, 0 }, { 3, 0, -32, -200, 48, { 0b1111, 0 }, 0 }, { 4, 32, -32, -216, 24, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightMediumHalfLoopDown[] = { @@ -2776,35 +2776,35 @@ static constexpr PreviewTrack TrackBlocksRightMediumHalfLoopDown[] = { { 2, -32, 32, -160, 120, { 0b1111, 0 }, 0 }, { 3, 0, 32, -200, 48, { 0b1111, 0 }, 0 }, { 4, 32, 32, -216, 24, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftZeroGRollUp[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, 8, 24, { 0b1111, 0 }, 0 }, { 2, -64, 0, 24, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightZeroGRollUp[] = { { 0, 0, 0, 0, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, 8, 24, { 0b1111, 0 }, 0 }, { 2, -64, 0, 24, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftZeroGRollDown[] = { { 0, 0, 0, -32, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, -48, 24, { 0b1111, 0 }, 0 }, { 2, -64, 0, -56, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightZeroGRollDown[] = { { 0, 0, 0 ,-32, 16, { 0b1111, 0 }, 0 }, { 1, -32, 0, -48, 24, { 0b1111, 0 }, 0 }, { 2, -64, 0, -56, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; @@ -2813,7 +2813,7 @@ static constexpr PreviewTrack TrackBlocksLeftLargeZeroGRollUp[] = { { 1, -32, 0, 56, 48, { 0b1111, 0 }, 0 }, { 2, -64, 0, 96, 40, { 0b1111, 0 }, 0 }, { 3, -96, 0,120, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightLargeZeroGRollUp[] = { @@ -2821,7 +2821,7 @@ static constexpr PreviewTrack TrackBlocksRightLargeZeroGRollUp[] = { { 1, -32, 0, 56, 48, { 0b1111, 0 }, 0 }, { 2, -64, 0, 96, 40, { 0b1111, 0 }, 0 }, { 3, -96, 0, 120, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftLargeZeroGRollDown[] = { @@ -2829,7 +2829,7 @@ static constexpr PreviewTrack TrackBlocksLeftLargeZeroGRollDown[] = { { 1, -32, 0, -56, 40, { 0b1111, 0 }, 0 }, { 2, -64, 0, -96, 48, { 0b1111, 0 }, 0 }, { 3, -96, 0, -152, 64, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightLargeZeroGRollDown[] = { @@ -2837,7 +2837,7 @@ static constexpr PreviewTrack TrackBlocksRightLargeZeroGRollDown[] = { { 1, -32, 0, -56, 40, { 0b1111, 0 }, 0 }, { 2, -64, 0, -96, 48, { 0b1111, 0 }, 0 }, { 3, -96, 0, -152, 64, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftFlyerLargeHalfLoopUninvertedUp[] = { @@ -2848,7 +2848,7 @@ static constexpr PreviewTrack TrackBlocksLeftFlyerLargeHalfLoopUninvertedUp[] = { 4, -128, -32, 120, 96, { 0b1111, 0 }, 0 }, { 5, -96, -32, 64, 192, { 0b1111, 0 }, 0 }, { 6, -64, -32, 248, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightFlyerLargeHalfLoopUninvertedUp[] = { @@ -2859,7 +2859,7 @@ static constexpr PreviewTrack TrackBlocksRightFlyerLargeHalfLoopUninvertedUp[] = { 4, -128, 32, 120, 96, { 0b1111, 0 }, 0 }, { 5, -96, 32, 64, 192, { 0b1111, 0 }, 0 }, { 6, -64, 32, 248, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftFlyerLargeHalfLoopInvertedDown[] = { @@ -2870,7 +2870,7 @@ static constexpr PreviewTrack TrackBlocksLeftFlyerLargeHalfLoopInvertedDown[] = { 4, 0, -32, -216, 56, { 0b1111, 0 }, 0 }, { 5, 32, -32, -232, 40, { 0b1111, 0b1100 }, 0 }, { 6, 64, -32, -248, 24, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightFlyerLargeHalfLoopInvertedDown[] = { @@ -2881,7 +2881,7 @@ static constexpr PreviewTrack TrackBlocksRightFlyerLargeHalfLoopInvertedDown[] = { 4, 0, 32, -216, 56, { 0b1111, 0 }, 0 }, { 5, 32, 32, -232, 40, { 0b1111, 0b1100 }, 0 }, { 6, 64, 32, -248, 24, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftFlyerLargeHalfLoopInvertedUp[] = { @@ -2892,7 +2892,7 @@ static constexpr PreviewTrack TrackBlocksLeftFlyerLargeHalfLoopInvertedUp[] = { { 4, -128, -32, 120, 96, { 0b1111, 0 }, 0 }, { 5, -96, -32, 64, 192, { 0b1111, 0 }, 0 }, { 6, -64, -32, 248, 32, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightFlyerLargeHalfLoopInvertedUp[] = { @@ -2903,7 +2903,7 @@ static constexpr PreviewTrack TrackBlocksRightFlyerLargeHalfLoopInvertedUp[] = { { 4, -128, 32, 120, 96, { 0b1111, 0 }, 0 }, { 5, -96, 32, 64, 192, { 0b1111, 0 }, 0 }, { 6, -64, 32, 248, 32, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftFlyerLargeHalfLoopUninvertedDown[] = { @@ -2914,7 +2914,7 @@ static constexpr PreviewTrack TrackBlocksLeftFlyerLargeHalfLoopUninvertedDown[] { 4, 0, -32, -248, 56, { 0b1111, 0 }, 0 }, { 5, 32, -32, -264, 40, { 0b1111, 0b1100 }, 0 }, { 6, 64, -32, -280, 24, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightFlyerLargeHalfLoopUninvertedDown[] = { @@ -2925,7 +2925,7 @@ static constexpr PreviewTrack TrackBlocksRightFlyerLargeHalfLoopUninvertedDown[] { 4, 0, 32, -248, 56, { 0b1111, 0 }, 0 }, { 5, 32, 32, -264, 40, { 0b1111, 0b1100 }, 0 }, { 6, 64, 32, -280, 24, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlyerHalfLoopUpInverted[] = { @@ -2933,7 +2933,7 @@ static constexpr PreviewTrack TrackBlocksFlyerHalfLoopUpInverted[] = { { 1, -32, 0, 16, 16, { 0b1111, 0b1100 }, 0 }, { 2, -64, 0, 32, 96,{ 0b0011, 0 }, 0 }, { 3, -32, 0, 120, 32, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksFlyerHalfLoopDownUpright[] = { @@ -2941,7 +2941,7 @@ static constexpr PreviewTrack TrackBlocksFlyerHalfLoopDownUpright[] = { { 1, -32, 0, -120, 96,{ 0b0011, 0 }, 0 }, { 2, 0, 0, -136, 16, { 0b1111, 0b1100 }, 0 }, { 3, 32, 0, -152, 16, { 0b1111, 0b1100 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftEighthToDiagUp25[] = { @@ -2950,7 +2950,7 @@ static constexpr PreviewTrack TrackBlocksLeftEighthToDiagUp25[] = { { 2, -32, -32, 32, 16, { 0b1000, 0 }, 0 }, { 3, -64, 0, 32, 16, { 0b0010, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 4, -64, -32, 32, 24, { 0b0001, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightEighthToDiagUp25[] = { @@ -2959,7 +2959,7 @@ static constexpr PreviewTrack TrackBlocksRightEighthToDiagUp25[] = { { 2, -32, 32, 32, 16, { 0b0100, 0 }, 0 }, { 3, -64, 0, 32, 16, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 4, -64, 32, 32, 24, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftEighthToDiagDown25[] = { @@ -2968,7 +2968,7 @@ static constexpr PreviewTrack TrackBlocksLeftEighthToDiagDown25[] = { { 2, -32, -32, -48, 16, { 0b1000, 0 }, 0 }, { 3, -64, 0, -48, 16, { 0b0010, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 4, -64, -32, -48, 16, { 0b0001, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightEighthToDiagDown25[] = { @@ -2977,7 +2977,7 @@ static constexpr PreviewTrack TrackBlocksRightEighthToDiagDown25[] = { { 2, -32, 32, -48, 16, { 0b0100, 0 }, 0 }, { 3, -64, 0, -48, 16, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 4, -64, 32, -48, 16, { 0b0010, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftEighthToOrthogonalUp25[] = { @@ -2986,7 +2986,7 @@ static constexpr PreviewTrack TrackBlocksLeftEighthToOrthogonalUp25[] = { { 2, 0, 32, 0, 16, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 16, 16, { 0b1111, 0 }, 0 }, { 4, -64, 32, 32, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightEighthToOrthogonalUp25[] = { @@ -2995,7 +2995,7 @@ static constexpr PreviewTrack TrackBlocksRightEighthToOrthogonalUp25[] = { { 2, -32, 0, 0, 16, { 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, 16, 16, { 0b1111, 0 }, 0 }, { 4, -32, 64, 32, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksLeftEighthToOrthogonalDown25[] = { @@ -3004,7 +3004,7 @@ static constexpr PreviewTrack TrackBlocksLeftEighthToOrthogonalDown25[] = { { 2, 0, 32, -16, 16, { 0b0100, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, -32, 32, { 0b1111, 0 }, 0 }, { 4, -64, 32, -48, 16, { 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; static constexpr PreviewTrack TrackBlocksRightEighthToOrthogonalDown25[] = { @@ -3013,7 +3013,7 @@ static constexpr PreviewTrack TrackBlocksRightEighthToOrthogonalDown25[] = { { 2, -32, 0, -16, 16,{ 0b0001, 0 }, RCT_PREVIEW_TRACK_FLAG_0 }, { 3, -32, 32, -32, 32,{ 0b1111, 0 }, 0 }, { 4, -32, 64, -48, 16,{ 0b1111, 0 }, 0 }, - TRACK_BLOCK_END + kTrackBlockEnd }; diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 590898b7ea..e852fb6e17 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -307,7 +307,7 @@ ResultWithMessage TrackDesign::CreateTrackDesignTrack(TrackDesignState& tds, con Direction entranceDirection = tileElement->GetDirection(); entranceDirection -= _saveDirection; - entranceDirection &= TILE_ELEMENT_DIRECTION_MASK; + entranceDirection &= kTileElementDirectionMask; mapLocation -= tds.Origin; // Rotate entrance coordinates backwards to the correct direction @@ -743,7 +743,7 @@ static std::optional TrackDesignPlaceSceneryElementGetEntry(c { result.Type = obj->GetObjectType(); result.Index = objectMgr.GetLoadedObjectEntryIndex(obj); - if (!gCheatsIgnoreResearchStatus) + if (!GetGameState().Cheats.IgnoreResearchStatus) { objectUnavailable = !ResearchIsInvented(result.Type, result.Index); } @@ -973,7 +973,7 @@ static GameActions::Result TrackDesignPlaceSceneryElementRemoveGhost( } int32_t z = scenery.loc.z + originZ; - uint8_t sceneryRotation = (rotation + scenery.flags) & TILE_ELEMENT_DIRECTION_MASK; + uint8_t sceneryRotation = (rotation + scenery.flags) & kTileElementDirectionMask; const uint32_t flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST; std::unique_ptr ga; @@ -1873,7 +1873,7 @@ int32_t TrackDesignGetZPlacement(TrackDesign* td6, Ride& ride, const CoordsXYZD& static money64 TrackDesignCreateRide(int32_t type, int32_t subType, int32_t flags, RideId* outRideIndex) { // Don't set colours as will be set correctly later. - auto gameAction = RideCreateAction(type, subType, 0, 0, gLastEntranceStyle); + auto gameAction = RideCreateAction(type, subType, 0, 0, GetGameState().LastEntranceStyle); gameAction.SetFlags(flags); auto res = GameActions::ExecuteNested(&gameAction); @@ -1900,6 +1900,7 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon *outRide = nullptr; *flags = 0; + auto& gameState = GetGameState(); auto& objManager = GetContext()->GetObjectManager(); auto entry_index = objManager.GetLoadedObjectEntryIndex(td6->vehicle_object); @@ -1919,7 +1920,7 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon ride->entrance_style = objManager.GetLoadedObjectEntryIndex(td6->StationObjectIdentifier); if (ride->entrance_style == OBJECT_ENTRY_INDEX_NULL) { - ride->entrance_style = gLastEntranceStyle; + ride->entrance_style = gameState.LastEntranceStyle; } for (int32_t i = 0; i < OpenRCT2::Limits::NumColourSchemes; i++) @@ -1939,7 +1940,6 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon } } - auto& gameState = GetGameState(); _trackDesignDrawingPreview = true; uint8_t backup_rotation = _currentTrackPieceDirection; uint32_t backup_park_flags = gameState.ParkFlags; @@ -1975,7 +1975,7 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon { *flags |= TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE; } - else if (!RideEntryIsInvented(entry_index) && !gCheatsIgnoreResearchStatus) + else if (!RideEntryIsInvented(entry_index) && !GetGameState().Cheats.IgnoreResearchStatus) { *flags |= TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE; } @@ -2016,7 +2016,7 @@ void TrackDesignDrawPreview(TrackDesign* td6, uint8_t* pixels) uint8_t flags; if (!TrackDesignPlacePreview(tds, td6, &cost, &ride, &flags)) { - std::fill_n(pixels, TRACK_PREVIEW_IMAGE_SIZE * 4, 0x00); + std::fill_n(pixels, kTrackPreviewImageSize * 4, 0x00); UnstashMap(); return; } @@ -2081,12 +2081,11 @@ void TrackDesignDrawPreview(TrackDesign* td6, uint8_t* pixels) const ScreenCoordsXY offset = { size_x / 2, size_y / 2 }; for (uint8_t i = 0; i < 4; i++) { - gCurrentRotation = i; - view.viewPos = Translate3DTo2DWithZ(i, centre) - offset; - ViewportPaint(&view, dpi, { view.viewPos, view.viewPos + ScreenCoordsXY{ size_x, size_y } }); + view.rotation = i; + ViewportRender(dpi, &view, { {}, ScreenCoordsXY{ size_x, size_y } }); - dpi.bits += TRACK_PREVIEW_IMAGE_SIZE; + dpi.bits += kTrackPreviewImageSize; } ride->Delete(); @@ -2099,7 +2098,7 @@ void TrackDesignDrawPreview(TrackDesign* td6, uint8_t* pixels) */ static void TrackDesignPreviewClearMap() { - auto numTiles = MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL; + auto numTiles = kMaximumMapSizeTechnical * kMaximumMapSizeTechnical; GetGameState().MapSize = TRACK_DESIGN_PREVIEW_MAP_SIZE; diff --git a/src/openrct2/ride/TrackDesign.h b/src/openrct2/ride/TrackDesign.h index 800d4904eb..faf5ae735f 100644 --- a/src/openrct2/ride/TrackDesign.h +++ b/src/openrct2/ride/TrackDesign.h @@ -21,7 +21,7 @@ struct Ride; struct ResultWithMessage; -#define TRACK_PREVIEW_IMAGE_SIZE (370 * 217) +constexpr uint32_t kTrackPreviewImageSize = 370 * 217; struct TrackDesignState { diff --git a/src/openrct2/ride/TrackPaint.cpp b/src/openrct2/ride/TrackPaint.cpp index fdcd509784..b4ad3fba81 100644 --- a/src/openrct2/ride/TrackPaint.cpp +++ b/src/openrct2/ride/TrackPaint.cpp @@ -114,10 +114,10 @@ const uint8_t edges_4x4[] = { // clang-format on const int32_t DiagBlockedSegments[] = { - SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4 | SEGMENT_BC, - SEGMENT_C4 | SEGMENT_CC | SEGMENT_C8 | SEGMENT_B4, - SEGMENT_D0 | SEGMENT_C4 | SEGMENT_C0 | SEGMENT_D4, - SEGMENT_D0 | SEGMENT_C4 | SEGMENT_B8 | SEGMENT_C8, + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::topLeftSide, PaintSegment::topCorner), + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomCorner, PaintSegment::bottomRightSide), + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::leftCorner, PaintSegment::topLeftSide), }; const MetalSupportPlace DiagSupportPlacement[] = { @@ -1347,6 +1347,13 @@ const uint8_t mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[] = { 6, 4, 5, 3, 1, 2, 0, }; +const uint8_t mapReversedDiagonalStraight[4] = { + 3, + 2, + 1, + 0, +}; + constexpr CoordsXY defaultRightQuarterTurn5TilesOffsets[4][5] = { { { 0, 6 }, @@ -2138,16 +2145,28 @@ void TrackPaintUtilOnridePhotoPaint( } static constexpr uint16_t RightVerticalLoopSegments[] = { - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + EnumsToFlags(PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), 0, 0, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, - SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + EnumsToFlags(PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), }; void TrackPaintUtilRightVerticalLoopSegments(PaintSession& session, Direction direction, uint8_t trackSequence) @@ -2168,15 +2187,25 @@ void TrackPaintUtilLeftCorkscrewUpSupports(PaintSession& session, Direction dire if (direction == 2) { PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, - 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); } MetalASupportsPaintSetup(session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); if (direction != 2) { PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, - 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); } } diff --git a/src/openrct2/ride/TrackPaint.h b/src/openrct2/ride/TrackPaint.h index 695f2ce357..3f47862be2 100644 --- a/src/openrct2/ride/TrackPaint.h +++ b/src/openrct2/ride/TrackPaint.h @@ -247,6 +247,8 @@ extern const uint32_t trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles[ extern const uint32_t trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile[4]; extern const uint8_t mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[]; +extern const Direction mapReversedDiagonalStraight[]; + extern const CoordsXY defaultRightQuarterTurn5TilesOffsets[4][5]; extern const CoordsXYZ defaultRightQuarterTurn5TilesBoundOffsets[4][5]; extern const CoordsXY defaultRightQuarterTurn5TilesBoundLengths[4][5]; @@ -494,3 +496,4 @@ namespace AlpineRC TRACK_PAINT_FUNCTION GetTrackPaintFunction(int32_t trackType); } TRACK_PAINT_FUNCTION GetTrackPaintFunctionClassicWoodenRC(int32_t trackType); +TRACK_PAINT_FUNCTION GetTrackPaintFunctionClassicStandUpRC(int32_t trackType); diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 3b57f5b7ac..462038b032 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -35,6 +35,8 @@ #include "../scenario/Scenario.h" #include "../scripting/HookEngine.h" #include "../scripting/ScriptEngine.h" +#include "../ui/UiContext.h" +#include "../ui/WindowManager.h" #include "../util/Util.h" #include "../windows/Intent.h" #include "../world/Map.h" @@ -517,7 +519,7 @@ static bool vehicle_move_info_valid( { return false; } - if (offset >= gTrackVehicleInfo[static_cast(trackSubposition)][typeAndDirection]->size) + if (offset >= gTrackVehicleInfo[EnumValue(trackSubposition)][typeAndDirection]->size) { return false; } @@ -534,7 +536,7 @@ static const VehicleInfo* vehicle_get_move_info( static constexpr VehicleInfo zero = {}; return &zero; } - return &gTrackVehicleInfo[static_cast(trackSubposition)][typeAndDirection]->info[offset]; + return &gTrackVehicleInfo[EnumValue(trackSubposition)][typeAndDirection]->info[offset]; } const VehicleInfo* Vehicle::GetMoveInfo() const @@ -550,7 +552,7 @@ uint16_t VehicleGetMoveInfoSize(VehicleTrackSubposition trackSubposition, track_ { return 0; } - return gTrackVehicleInfo[static_cast(trackSubposition)][typeAndDirection]->size; + return gTrackVehicleInfo[EnumValue(trackSubposition)][typeAndDirection]->size; } uint16_t Vehicle::GetTrackProgress() const @@ -577,596 +579,10 @@ Vehicle* TryGetVehicle(EntityId spriteIndex) return TryGetEntity(spriteIndex); } -namespace -{ - template class TrainIterator; - template class Train - { - public: - explicit Train(T* vehicle) - : FirstCar(vehicle) - { - assert(FirstCar->IsHead()); - } - int32_t Mass(); - - friend class TrainIterator; - using iterator = TrainIterator; - iterator begin() - { - return iterator{ FirstCar }; - } - iterator end() - { - return iterator{}; - } - - private: - T* FirstCar; - }; - template class TrainIterator - { - public: - using iterator = TrainIterator; - using iterator_category = std::forward_iterator_tag; - using value_type = T; - using pointer = T*; - using reference = T&; - - TrainIterator() = default; - explicit TrainIterator(T* vehicle) - : Current(vehicle) - { - } - reference operator*() - { - return *Current; - } - iterator& operator++() - { - Current = GetEntity(NextVehicleId); - if (Current != nullptr) - { - NextVehicleId = Current->next_vehicle_on_train; - } - return *this; - } - iterator operator++(int) - { - iterator temp = *this; - ++*this; - return temp; - } - bool operator!=(const iterator& other) - { - return Current != other.Current; - } - - private: - T* Current = nullptr; - EntityId NextVehicleId = EntityId::GetNull(); - }; -} // namespace - -template int32_t Train::Mass() -{ - int32_t totalMass = 0; - for (const auto& vehicle : *this) - { - totalMass += vehicle.mass; - } - - return totalMass; -} - -bool Vehicle::SoundCanPlay() const -{ - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) - return false; - - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) - return false; - - if (sound1_id == OpenRCT2::Audio::SoundId::Null && sound2_id == OpenRCT2::Audio::SoundId::Null) - return false; - - if (x == LOCATION_NULL) - return false; - - if (g_music_tracking_viewport == nullptr) - return false; - - const auto quarter_w = g_music_tracking_viewport->view_width / 4; - const auto quarter_h = g_music_tracking_viewport->view_height / 4; - - auto left = g_music_tracking_viewport->viewPos.x; - auto bottom = g_music_tracking_viewport->viewPos.y; - - if (WindowGetClassification(*gWindowAudioExclusive) == WindowClass::MainWindow) - { - left -= quarter_w; - bottom -= quarter_h; - } - - if (left >= SpriteData.SpriteRect.GetRight() || bottom >= SpriteData.SpriteRect.GetBottom()) - return false; - - auto right = g_music_tracking_viewport->view_width + left; - auto top = g_music_tracking_viewport->view_height + bottom; - - if (WindowGetClassification(*gWindowAudioExclusive) == WindowClass::MainWindow) - { - right += quarter_w + quarter_w; - top += quarter_h + quarter_h; - } - - if (right < SpriteData.SpriteRect.GetRight() || top < SpriteData.SpriteRect.GetTop()) - return false; - - return true; -} - -/** - * - * rct2: 0x006BC2F3 - */ -uint16_t Vehicle::GetSoundPriority() const -{ - int32_t result = Train(this).Mass() + (std::abs(velocity) >> 13); - - for (const auto& vehicleSound : OpenRCT2::Audio::gVehicleSoundList) - { - if (vehicleSound.id == Id.ToUnderlying()) - { - // Vehicle sounds will get higher priority if they are already playing - return result + 300; - } - } - - return result; -} - -OpenRCT2::Audio::VehicleSoundParams Vehicle::CreateSoundParam(uint16_t priority) const -{ - OpenRCT2::Audio::VehicleSoundParams param; - param.priority = priority; - int32_t panX = (SpriteData.SpriteRect.GetLeft() / 2) + (SpriteData.SpriteRect.GetRight() / 2) - - g_music_tracking_viewport->viewPos.x; - panX = g_music_tracking_viewport->zoom.ApplyInversedTo(panX); - panX += g_music_tracking_viewport->pos.x; - - uint16_t screenWidth = ContextGetWidth(); - if (screenWidth < 64) - { - screenWidth = 64; - } - param.pan_x = ((((panX * 65536) / screenWidth) - 0x8000) >> 4); - - int32_t panY = (SpriteData.SpriteRect.GetTop() / 2) + (SpriteData.SpriteRect.GetBottom() / 2) - - g_music_tracking_viewport->viewPos.y; - panY = g_music_tracking_viewport->zoom.ApplyInversedTo(panY); - panY += g_music_tracking_viewport->pos.y; - - uint16_t screenHeight = ContextGetHeight(); - if (screenHeight < 64) - { - screenHeight = 64; - } - param.pan_y = ((((panY * 65536) / screenHeight) - 0x8000) >> 4); - - int32_t frequency = std::abs(velocity); - - const auto* rideType = GetRideEntry(); - if (rideType != nullptr) - { - if (rideType->Cars[vehicle_type].double_sound_frequency & 1) - { - frequency *= 2; - } - } - - // * 0.0105133... - frequency >>= 5; // /32 - frequency *= 5512; - frequency >>= 14; // /16384 - - frequency += 11025; - frequency += 16 * sound_vector_factor; - param.frequency = static_cast(frequency); - param.id = Id.ToUnderlying(); - param.volume = 0; - - if (x != LOCATION_NULL) - { - auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y }); - - // vehicle underground - if (surfaceElement != nullptr && surfaceElement->GetBaseZ() > z) - { - param.volume = 0x30; - } - } - return param; -} - -/** - * - * rct2: 0x006BB9FF - */ -void Vehicle::UpdateSoundParams(std::vector& vehicleSoundParamsList) const -{ - if (!SoundCanPlay()) - return; - - uint16_t soundPriority = GetSoundPriority(); - // Find a sound param of lower priority to use - auto soundParamIter = std::find_if( - vehicleSoundParamsList.begin(), vehicleSoundParamsList.end(), - [soundPriority](const auto& param) { return soundPriority > param.priority; }); - - if (soundParamIter == std::end(vehicleSoundParamsList)) - { - if (vehicleSoundParamsList.size() < OpenRCT2::Audio::MaxVehicleSounds) - { - vehicleSoundParamsList.push_back(CreateSoundParam(soundPriority)); - } - } - else - { - if (vehicleSoundParamsList.size() < OpenRCT2::Audio::MaxVehicleSounds) - { - // Shift all sound params down one if using a free space - vehicleSoundParamsList.insert(soundParamIter, CreateSoundParam(soundPriority)); - } - else - { - *soundParamIter = CreateSoundParam(soundPriority); - } - } -} - -static void vehicle_sounds_update_window_setup() -{ - g_music_tracking_viewport = nullptr; - - WindowBase* window = WindowGetListening(); - if (window == nullptr) - { - return; - } - - Viewport* viewport = WindowGetViewport(window); - if (viewport == nullptr) - { - return; - } - - g_music_tracking_viewport = viewport; - gWindowAudioExclusive = window; - if (viewport->zoom <= ZoomLevel{ 0 }) - OpenRCT2::Audio::gVolumeAdjustZoom = 0; - else if (viewport->zoom == ZoomLevel{ 1 }) - OpenRCT2::Audio::gVolumeAdjustZoom = 35; - else - OpenRCT2::Audio::gVolumeAdjustZoom = 70; -} - -static uint8_t vehicle_sounds_update_get_pan_volume(OpenRCT2::Audio::VehicleSoundParams* sound_params) -{ - uint8_t vol1 = 0xFF; - uint8_t vol2 = 0xFF; - - int16_t pan_y = std::abs(sound_params->pan_y); - pan_y = std::min(static_cast(0xFFF), pan_y); - pan_y -= 0x800; - if (pan_y > 0) - { - pan_y = (0x400 - pan_y) / 4; - vol1 = LoByte(pan_y); - if (static_cast(HiByte(pan_y)) != 0) - { - vol1 = 0xFF; - if (static_cast(HiByte(pan_y)) < 0) - { - vol1 = 0; - } - } - } - - int16_t pan_x = std::abs(sound_params->pan_x); - pan_x = std::min(static_cast(0xFFF), pan_x); - pan_x -= 0x800; - - if (pan_x > 0) - { - pan_x = (0x400 - pan_x) / 4; - vol2 = LoByte(pan_x); - if (static_cast(HiByte(pan_x)) != 0) - { - vol2 = 0xFF; - if (static_cast(HiByte(pan_x)) < 0) - { - vol2 = 0; - } - } - } - - vol1 = std::min(vol1, vol2); - return std::max(0, vol1 - OpenRCT2::Audio::gVolumeAdjustZoom); -} - -/* Returns the vehicle sound for a sound_param. - * - * If already playing returns sound. - * If not playing allocates a sound slot to sound_param->id. - * If no free slots returns nullptr. - */ -static OpenRCT2::Audio::VehicleSound* vehicle_sounds_update_get_vehicle_sound(OpenRCT2::Audio::VehicleSoundParams* sound_params) -{ - // Search for already playing vehicle sound - for (auto& vehicleSound : OpenRCT2::Audio::gVehicleSoundList) - { - if (vehicleSound.id == sound_params->id) - return &vehicleSound; - } - - // No sound already playing - for (auto& vehicleSound : OpenRCT2::Audio::gVehicleSoundList) - { - // Use free slot - if (vehicleSound.id == OpenRCT2::Audio::SoundIdNull) - { - vehicleSound.id = sound_params->id; - vehicleSound.TrackSound.Id = OpenRCT2::Audio::SoundId::Null; - vehicleSound.OtherSound.Id = OpenRCT2::Audio::SoundId::Null; - vehicleSound.volume = 0x30; - return &vehicleSound; - } - } - - return nullptr; -} - -static bool IsLoopingSound(SoundId id) -{ - switch (id) - { - case SoundId::LiftClassic: - case SoundId::TrackFrictionClassicWood: - case SoundId::FrictionClassic: - case SoundId::LiftFrictionWheels: - case SoundId::GoKartEngine: - case SoundId::TrackFrictionTrain: - case SoundId::TrackFrictionWater: - case SoundId::LiftArrow: - case SoundId::LiftWood: - case SoundId::TrackFrictionWood: - case SoundId::LiftWildMouse: - case SoundId::LiftBM: - case SoundId::TrackFrictionBM: - case SoundId::LiftRMC: - case SoundId::TrackFrictionRMC: - return true; - default: - return false; - } -} - -static bool IsFixedFrequencySound(SoundId id) -{ - switch (id) - { - case SoundId::Scream1: - case SoundId::Scream2: - case SoundId::Scream3: - case SoundId::Scream4: - case SoundId::Scream5: - case SoundId::Scream6: - case SoundId::Scream7: - case SoundId::Scream8: - case SoundId::TrainWhistle: - case SoundId::TrainDeparting: - case SoundId::Tram: - return true; - default: - return false; - } -} - -static bool IsSpecialFrequencySound(SoundId id) -{ - switch (id) - { - case SoundId::TrackFrictionBM: - case SoundId::TrackFrictionRMC: - return true; - default: - return false; - } -} - -enum class SoundType -{ - TrackNoises, - OtherNoises, // e.g. Screams -}; - -template static uint16_t SoundFrequency(const OpenRCT2::Audio::SoundId id, uint16_t baseFrequency) -{ - if constexpr (type == SoundType::TrackNoises) - { - if (IsSpecialFrequencySound(id)) - { - return (baseFrequency / 2) + 4000; - } - return baseFrequency; - } - else - { - if (IsFixedFrequencySound(id)) - { - return 22050; - } - return std::min((baseFrequency * 2) - 3248, 25700); - } -} - -template static bool ShouldUpdateChannelRate(const OpenRCT2::Audio::SoundId id) -{ - return type == SoundType::TrackNoises || !IsFixedFrequencySound(id); -} - -template -static void UpdateSound( - const OpenRCT2::Audio::SoundId id, int32_t volume, OpenRCT2::Audio::VehicleSoundParams* sound_params, - OpenRCT2::Audio::Sound& sound, uint8_t panVol) -{ - volume *= panVol; - volume = volume / 8; - volume = std::max(volume - 0x1FFF, -10000); - - if (sound.Channel != nullptr && sound.Channel->IsDone()) - { - sound.Id = OpenRCT2::Audio::SoundId::Null; - sound.Channel = nullptr; - } - if (id != sound.Id && sound.Id != OpenRCT2::Audio::SoundId::Null) - { - sound.Id = OpenRCT2::Audio::SoundId::Null; - sound.Channel->Stop(); - } - if (id == OpenRCT2::Audio::SoundId::Null) - { - return; - } - - if (sound.Id == OpenRCT2::Audio::SoundId::Null) - { - auto frequency = SoundFrequency(id, sound_params->frequency); - auto looping = IsLoopingSound(id); - auto pan = sound_params->pan_x; - auto channel = CreateAudioChannel( - id, looping, DStoMixerVolume(volume), DStoMixerPan(pan), DStoMixerRate(frequency), false); - if (channel != nullptr) - { - sound.Id = id; - sound.Pan = sound_params->pan_x; - sound.Volume = volume; - sound.Frequency = sound_params->frequency; - sound.Channel = channel; - } - else - { - sound.Id = OpenRCT2::Audio::SoundId::Null; - } - return; - } - if (volume != sound.Volume) - { - sound.Volume = volume; - sound.Channel->SetVolume(DStoMixerVolume(volume)); - } - if (sound_params->pan_x != sound.Pan) - { - sound.Pan = sound_params->pan_x; - sound.Channel->SetPan(DStoMixerPan(sound_params->pan_x)); - } - if (!(GetGameState().CurrentTicks & 3) && sound_params->frequency != sound.Frequency) - { - sound.Frequency = sound_params->frequency; - if (ShouldUpdateChannelRate(id)) - { - uint16_t frequency = SoundFrequency(id, sound_params->frequency); - sound.Channel->SetRate(DStoMixerRate(frequency)); - } - } -} - -/** - * - * rct2: 0x006BBC6B - */ void VehicleSoundsUpdate() { - PROFILED_FUNCTION(); - - if (!OpenRCT2::Audio::IsAvailable()) - return; - - std::vector vehicleSoundParamsList; - vehicleSoundParamsList.reserve(OpenRCT2::Audio::MaxVehicleSounds); - - vehicle_sounds_update_window_setup(); - - for (auto vehicle : TrainManager::View()) - { - vehicle->UpdateSoundParams(vehicleSoundParamsList); - } - - // Stop all playing sounds that no longer have priority to play after vehicle_update_sound_params - for (auto& vehicle_sound : OpenRCT2::Audio::gVehicleSoundList) - { - if (vehicle_sound.id != OpenRCT2::Audio::SoundIdNull) - { - bool keepPlaying = false; - for (auto vehicleSoundParams : vehicleSoundParamsList) - { - if (vehicle_sound.id == vehicleSoundParams.id) - { - keepPlaying = true; - break; - } - } - - if (keepPlaying) - continue; - - if (vehicle_sound.TrackSound.Id != OpenRCT2::Audio::SoundId::Null) - { - vehicle_sound.TrackSound.Channel->Stop(); - } - if (vehicle_sound.OtherSound.Id != OpenRCT2::Audio::SoundId::Null) - { - vehicle_sound.OtherSound.Channel->Stop(); - } - vehicle_sound.id = OpenRCT2::Audio::SoundIdNull; - } - } - - for (auto& vehicleSoundParams : vehicleSoundParamsList) - { - uint8_t panVol = vehicle_sounds_update_get_pan_volume(&vehicleSoundParams); - - auto* vehicleSound = vehicle_sounds_update_get_vehicle_sound(&vehicleSoundParams); - // No free vehicle sound slots (RCT2 corrupts the pointer here) - if (vehicleSound == nullptr) - continue; - - // Move the Sound Volume towards the SoundsParam Volume - int32_t tempvolume = vehicleSound->volume; - if (tempvolume != vehicleSoundParams.volume) - { - if (tempvolume < vehicleSoundParams.volume) - { - tempvolume += 4; - } - else - { - tempvolume -= 4; - } - } - vehicleSound->volume = tempvolume; - panVol = std::max(0, panVol - tempvolume); - - Vehicle* vehicle = GetEntity(EntityId::FromUnderlying(vehicleSoundParams.id)); - if (vehicle != nullptr) - { - UpdateSound( - vehicle->sound1_id, vehicle->sound1_volume, &vehicleSoundParams, vehicleSound->TrackSound, panVol); - UpdateSound( - vehicle->sound2_id, vehicle->sound2_volume, &vehicleSoundParams, vehicleSound->OtherSound, panVol); - } - } + auto windowManager = OpenRCT2::GetContext()->GetUiContext()->GetWindowManager(); + windowManager->BroadcastIntent(Intent(INTENT_ACTION_UPDATE_VEHICLE_SOUNDS)); } /** @@ -1521,12 +937,12 @@ void Vehicle::UpdateMeasurements() uint32_t testingFlags = curRide->testing_flags; if (testingFlags & RIDE_TESTING_TURN_LEFT && trackFlags & TRACK_ELEM_FLAG_TURN_LEFT) { - // 0x800 as this is masked to CURRENT_TURN_COUNT_MASK + // 0x800 as this is masked to kCurrentTurnCountMask curRide->turn_count_default += 0x800; } else if (testingFlags & RIDE_TESTING_TURN_RIGHT && trackFlags & TRACK_ELEM_FLAG_TURN_RIGHT) { - // 0x800 as this is masked to CURRENT_TURN_COUNT_MASK + // 0x800 as this is masked to kCurrentTurnCountMask curRide->turn_count_default += 0x800; } else if (testingFlags & RIDE_TESTING_TURN_RIGHT || testingFlags & RIDE_TESTING_TURN_LEFT) @@ -1564,7 +980,7 @@ void Vehicle::UpdateMeasurements() if (trackFlags & TRACK_ELEM_FLAG_TURN_LEFT) { curRide->testing_flags |= RIDE_TESTING_TURN_LEFT; - curRide->turn_count_default &= ~CURRENT_TURN_COUNT_MASK; + curRide->turn_count_default &= ~kCurrentTurnCountMask; if (trackFlags & TRACK_ELEM_FLAG_TURN_BANKED) { @@ -1579,7 +995,7 @@ void Vehicle::UpdateMeasurements() if (trackFlags & TRACK_ELEM_FLAG_TURN_RIGHT) { curRide->testing_flags |= RIDE_TESTING_TURN_RIGHT; - curRide->turn_count_default &= ~CURRENT_TURN_COUNT_MASK; + curRide->turn_count_default &= ~kCurrentTurnCountMask; if (trackFlags & TRACK_ELEM_FLAG_TURN_BANKED) { @@ -2044,7 +1460,7 @@ void Vehicle::TrainReadyToDepart(uint8_t num_peeps_on_train, uint8_t num_used_se // Boat Hire with passengers on it. if (curRide->status != RideStatus::Closed || (curRide->num_riders != 0 && curRide->type != RIDE_TYPE_BOAT_HIRE)) { - curRide->GetStation(current_station).TrainAtStation = RideStation::NO_TRAIN; + curRide->GetStation(current_station).TrainAtStation = RideStation::kNoTrain; sub_state = 2; return; } @@ -2055,7 +1471,7 @@ void Vehicle::TrainReadyToDepart(uint8_t num_peeps_on_train, uint8_t num_used_se uint8_t seat = ((-Pitch) / 8) & 0xF; if (!peep[seat].IsNull()) { - curRide->GetStation(current_station).TrainAtStation = RideStation::NO_TRAIN; + curRide->GetStation(current_station).TrainAtStation = RideStation::kNoTrain; SetState(Vehicle::Status::UnloadingPassengers); return; } @@ -2063,7 +1479,7 @@ void Vehicle::TrainReadyToDepart(uint8_t num_peeps_on_train, uint8_t num_used_se if (num_peeps == 0) return; - curRide->GetStation(current_station).TrainAtStation = RideStation::NO_TRAIN; + curRide->GetStation(current_station).TrainAtStation = RideStation::kNoTrain; sub_state = 2; return; } @@ -2071,7 +1487,7 @@ void Vehicle::TrainReadyToDepart(uint8_t num_peeps_on_train, uint8_t num_used_se if (num_peeps_on_train == 0) return; - curRide->GetStation(current_station).TrainAtStation = RideStation::NO_TRAIN; + curRide->GetStation(current_station).TrainAtStation = RideStation::kNoTrain; SetState(Vehicle::Status::WaitingForPassengers); } @@ -2116,7 +1532,7 @@ void Vehicle::UpdateWaitingForPassengers() auto& station = curRide->GetStation(current_station); if (station.Entrance.IsNull()) { - station.TrainAtStation = RideStation::NO_TRAIN; + station.TrainAtStation = RideStation::kNoTrain; sub_state = 2; return; } @@ -2127,7 +1543,7 @@ void Vehicle::UpdateWaitingForPassengers() return; } - if (station.TrainAtStation != RideStation::NO_TRAIN) + if (station.TrainAtStation != RideStation::kNoTrain) return; station.TrainAtStation = trainIndex.value(); @@ -2379,7 +1795,7 @@ void Vehicle::UpdateWaitingToDepart() if (!skipCheck) { - if (!(currentStation.Depart & STATION_DEPART_FLAG)) + if (!(currentStation.Depart & kStationDepartFlag)) return; } @@ -2599,7 +2015,7 @@ static bool try_add_synchronised_station(const CoordsXYZ& coords) /* Station is not ready to depart, so just return; * vehicle_id for this station is SPRITE_INDEX_NULL. */ - if (!(ride->GetStation(stationIndex).Depart & STATION_DEPART_FLAG)) + if (!(ride->GetStation(stationIndex).Depart & kStationDepartFlag)) { return true; } @@ -2671,8 +2087,8 @@ static bool ride_station_can_depart_synchronised(const Ride& ride, StationIndex */ int32_t direction = tileElement->GetDirectionWithOffset(1); - int32_t maxCheckDistance = RIDE_ADJACENCY_CHECK_DISTANCE; - int32_t spaceBetween = maxCheckDistance; + constexpr uint8_t maxCheckDistance = kRideAdjacencyCheckDistance; + uint8_t spaceBetween = maxCheckDistance; while (_lastSynchronisedVehicle < &_synchronisedVehicles[SYNCHRONISED_VEHICLE_COUNT - 1]) { @@ -2722,7 +2138,7 @@ static bool ride_station_can_depart_synchronised(const Ride& ride, StationIndex { if (sv_ride->IsBlockSectioned()) { - if (!(sv_ride->GetStation(sv->stationIndex).Depart & STATION_DEPART_FLAG)) + if (!(sv_ride->GetStation(sv->stationIndex).Depart & kStationDepartFlag)) { sv = _synchronisedVehicles; RideId rideId = RideId::GetNull(); @@ -3028,7 +2444,7 @@ void Vehicle::UpdateDepartingBoatHire() return; auto& station = curRide->GetStation(current_station); - station.Depart &= STATION_DEPART_FLAG; + station.Depart &= kStationDepartFlag; uint8_t waitingTime = std::max(curRide->min_waiting_time, static_cast(3)); waitingTime = std::min(waitingTime, static_cast(127)); station.Depart |= waitingTime; @@ -3301,7 +2717,7 @@ void Vehicle::FinishDeparting() if (curRide->mode != RideMode::Race && !curRide->IsBlockSectioned()) { auto& currentStation = curRide->GetStation(current_station); - currentStation.Depart &= STATION_DEPART_FLAG; + currentStation.Depart &= kStationDepartFlag; uint8_t waitingTime = 3; if (curRide->depart_flags & RIDE_DEPART_WAIT_FOR_MINIMUM_LENGTH) { @@ -4146,7 +3562,7 @@ void Vehicle::UpdateTravellingCableLift() // This is slightly different to the vanilla function auto& currentStation = curRide->GetStation(current_station); - currentStation.Depart &= STATION_DEPART_FLAG; + currentStation.Depart &= kStationDepartFlag; uint8_t waitingTime = 3; if (curRide->depart_flags & RIDE_DEPART_WAIT_FOR_MINIMUM_LENGTH) { @@ -4823,17 +4239,17 @@ void Vehicle::UpdateRotating() timeToSpriteMap = Rotation3TimeToSpriteMaps[sub_state]; } - int32_t time = current_time; + uint16_t time = current_time; if (_vehicleBreakdown == BREAKDOWN_CONTROL_FAILURE) { time += (curRide->breakdown_sound_modifier >> 6) + 1; } time++; - uint8_t sprite = timeToSpriteMap[static_cast(time)]; + uint8_t sprite = timeToSpriteMap[time]; if (sprite != 0xFF) { - current_time = static_cast(time); + current_time = time; if (sprite == Pitch) return; Pitch = sprite; @@ -5113,9 +4529,10 @@ static void ride_train_crash(Ride& ride, uint16_t numFatalities) ride.id.ToUnderlying(), ft); } - if (gParkRatingCasualtyPenalty < 500) + auto& gameState = GetGameState(); + if (gameState.ParkRatingCasualtyPenalty < 500) { - gParkRatingCasualtyPenalty += 200; + gameState.ParkRatingCasualtyPenalty += 200; } } } @@ -5638,6 +5055,8 @@ void Vehicle::SetMapToolbar() const if (curRide != nullptr && curRide->type < RIDE_TYPE_COUNT) { const Vehicle* vehicle = GetHead(); + if (vehicle == nullptr) + return; size_t vehicleIndex; for (vehicleIndex = 0; vehicleIndex < std::size(curRide->vehicles); vehicleIndex++) @@ -5696,7 +5115,7 @@ Vehicle* Vehicle::TrainTail() const int32_t Vehicle::IsUsedInPairs() const { - return num_seats & VEHICLE_SEAT_PAIR_FLAG; + return num_seats & kVehicleSeatPairFlag; } /** diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index 3e25225f94..cfb8c660a4 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -222,7 +222,6 @@ struct Vehicle : EntityBase Vehicle* GetCar(size_t carIndex) const; void SetState(Vehicle::Status vehicleStatus, uint8_t subState = 0); bool IsGhost() const; - void UpdateSoundParams(std::vector& vehicleSoundParamsList) const; std::optional DodgemsCarWouldCollideAt(const CoordsXY& coords) const; int32_t UpdateTrackMotion(int32_t* outStation); int32_t CableLiftUpdateTrackMotion(); @@ -281,11 +280,8 @@ struct Vehicle : EntityBase friend void UpdateRotatingEnterprise(Vehicle& vehicle); private: - bool SoundCanPlay() const; - uint16_t GetSoundPriority() const; const VehicleInfo* GetMoveInfo() const; uint16_t GetTrackProgress() const; - OpenRCT2::Audio::VehicleSoundParams CreateSoundParam(uint16_t priority) const; void CableLiftUpdate(); bool CableLiftUpdateTrackMotionForwards(); bool CableLiftUpdateTrackMotionBackwards(); @@ -520,8 +516,8 @@ enum SOUND_RANGE_NONE = 255 }; -#define VEHICLE_SEAT_PAIR_FLAG 0x80 -#define VEHICLE_SEAT_NUM_MASK 0x7F +constexpr uint8_t kVehicleSeatPairFlag = 0x80; +constexpr uint8_t kVehicleSeatNumMask = 0x7F; Vehicle* TryGetVehicle(EntityId spriteIndex); void VehicleUpdateAll(); diff --git a/src/openrct2/ride/VehicleRiderControl.cpp b/src/openrct2/ride/VehicleRiderControl.cpp index ff35bf1494..86be123f87 100644 --- a/src/openrct2/ride/VehicleRiderControl.cpp +++ b/src/openrct2/ride/VehicleRiderControl.cpp @@ -10,7 +10,10 @@ #include "../entity/EntityRegistry.h" #include "Vehicle.h" -#define MPH(x) (x * 29127) +constexpr int operator"" _MPH(unsigned long long x) noexcept +{ + return x * 29127; +} // Acceleration to apply when rider is braking constexpr int32_t minBrake = (1 << 16); @@ -20,7 +23,7 @@ constexpr int32_t minBrake = (1 << 16); constexpr int32_t maxBrake = (12 << 16); // Velocity above which riders will attempt to maintain separation from the vehicle in front -constexpr int32_t minFollowVelocity = MPH(4); +constexpr int32_t minFollowVelocity = 4_MPH; // Minimum separation distance that riders will allow (regardless of followDistance) constexpr int32_t minFollowDistance = 32; @@ -35,92 +38,92 @@ struct RiderControlSettings }; static RiderControlSettings riderTable[256] = { - { MPH(22), MPH(11), MPH(10), 10 }, { MPH(23), MPH(10), MPH(5), 9 }, { MPH(23), MPH(8), MPH(7), 11 }, - { MPH(27), MPH(17), MPH(12), 6 }, { MPH(25), MPH(18), MPH(15), 6 }, { MPH(23), MPH(14), MPH(12), 9 }, - { MPH(20), MPH(12), MPH(12), 5 }, { MPH(23), MPH(10), MPH(5), 11 }, { MPH(26), MPH(9), MPH(4), 11 }, - { MPH(16), MPH(11), MPH(9), 7 }, { MPH(28), MPH(10), MPH(9), 10 }, { MPH(24), MPH(18), MPH(8), 4 }, - { MPH(23), MPH(15), MPH(13), 5 }, { MPH(18), MPH(10), MPH(10), 10 }, { MPH(25), MPH(15), MPH(8), 9 }, - { MPH(18), MPH(12), MPH(12), 7 }, { MPH(24), MPH(14), MPH(7), 7 }, { MPH(27), MPH(19), MPH(13), 7 }, - { MPH(26), MPH(19), MPH(9), 5 }, { MPH(22), MPH(10), MPH(6), 9 }, { MPH(20), MPH(12), MPH(11), 10 }, - { MPH(27), MPH(16), MPH(12), 7 }, { MPH(22), MPH(13), MPH(10), 7 }, { MPH(23), MPH(11), MPH(10), 11 }, - { MPH(17), MPH(10), MPH(9), 8 }, { MPH(19), MPH(13), MPH(10), 5 }, { MPH(14), MPH(8), MPH(11), 10 }, - { MPH(22), MPH(15), MPH(12), 8 }, { MPH(15), MPH(7), MPH(8), 8 }, { MPH(23), MPH(17), MPH(14), 4 }, - { MPH(25), MPH(14), MPH(13), 7 }, { MPH(22), MPH(8), MPH(6), 13 }, { MPH(27), MPH(11), MPH(6), 11 }, - { MPH(19), MPH(10), MPH(9), 11 }, { MPH(24), MPH(13), MPH(11), 7 }, { MPH(12), MPH(7), MPH(8), 7 }, - { MPH(27), MPH(11), MPH(5), 9 }, { MPH(15), MPH(9), MPH(7), 7 }, { MPH(16), MPH(10), MPH(9), 8 }, - { MPH(11), MPH(7), MPH(7), 9 }, { MPH(25), MPH(17), MPH(9), 6 }, { MPH(22), MPH(10), MPH(4), 13 }, - { MPH(25), MPH(13), MPH(7), 10 }, { MPH(28), MPH(18), MPH(10), 5 }, { MPH(21), MPH(11), MPH(10), 10 }, - { MPH(23), MPH(11), MPH(11), 7 }, { MPH(21), MPH(15), MPH(8), 5 }, { MPH(27), MPH(14), MPH(6), 9 }, - { MPH(26), MPH(17), MPH(12), 6 }, { MPH(17), MPH(7), MPH(6), 12 }, { MPH(17), MPH(9), MPH(8), 9 }, - { MPH(17), MPH(10), MPH(12), 6 }, { MPH(20), MPH(10), MPH(9), 9 }, { MPH(26), MPH(14), MPH(10), 7 }, - { MPH(28), MPH(14), MPH(7), 12 }, { MPH(24), MPH(11), MPH(7), 9 }, { MPH(26), MPH(12), MPH(6), 8 }, - { MPH(24), MPH(12), MPH(11), 9 }, { MPH(24), MPH(11), MPH(5), 7 }, { MPH(29), MPH(21), MPH(16), 5 }, - { MPH(22), MPH(13), MPH(13), 5 }, { MPH(27), MPH(20), MPH(12), 6 }, { MPH(21), MPH(14), MPH(7), 9 }, - { MPH(27), MPH(18), MPH(7), 6 }, { MPH(19), MPH(12), MPH(12), 6 }, { MPH(25), MPH(18), MPH(9), 7 }, - { MPH(20), MPH(10), MPH(10), 10 }, { MPH(19), MPH(9), MPH(7), 9 }, { MPH(24), MPH(14), MPH(7), 7 }, - { MPH(25), MPH(12), MPH(10), 10 }, { MPH(24), MPH(15), MPH(8), 7 }, { MPH(23), MPH(11), MPH(6), 8 }, - { MPH(18), MPH(11), MPH(7), 9 }, { MPH(23), MPH(8), MPH(5), 11 }, { MPH(12), MPH(8), MPH(12), 8 }, - { MPH(22), MPH(14), MPH(12), 9 }, { MPH(25), MPH(13), MPH(14), 8 }, { MPH(26), MPH(12), MPH(5), 12 }, - { MPH(29), MPH(15), MPH(6), 10 }, { MPH(20), MPH(12), MPH(8), 9 }, { MPH(25), MPH(13), MPH(10), 8 }, - { MPH(23), MPH(12), MPH(8), 9 }, { MPH(20), MPH(11), MPH(5), 11 }, { MPH(22), MPH(11), MPH(5), 11 }, - { MPH(21), MPH(9), MPH(6), 9 }, { MPH(28), MPH(13), MPH(8), 10 }, { MPH(27), MPH(14), MPH(10), 11 }, - { MPH(22), MPH(16), MPH(10), 5 }, { MPH(25), MPH(14), MPH(9), 6 }, { MPH(20), MPH(10), MPH(7), 10 }, - { MPH(24), MPH(15), MPH(13), 7 }, { MPH(22), MPH(11), MPH(4), 9 }, { MPH(19), MPH(9), MPH(4), 12 }, - { MPH(19), MPH(11), MPH(8), 7 }, { MPH(24), MPH(16), MPH(15), 5 }, { MPH(15), MPH(11), MPH(9), 7 }, - { MPH(25), MPH(10), MPH(7), 10 }, { MPH(23), MPH(11), MPH(5), 9 }, { MPH(24), MPH(13), MPH(11), 8 }, - { MPH(26), MPH(16), MPH(9), 8 }, { MPH(25), MPH(16), MPH(10), 6 }, { MPH(26), MPH(16), MPH(8), 6 }, - { MPH(26), MPH(16), MPH(12), 7 }, { MPH(25), MPH(11), MPH(10), 11 }, { MPH(21), MPH(13), MPH(13), 6 }, - { MPH(9), MPH(6), MPH(4), 11 }, { MPH(26), MPH(11), MPH(5), 10 }, { MPH(25), MPH(18), MPH(14), 5 }, - { MPH(26), MPH(16), MPH(9), 4 }, { MPH(24), MPH(11), MPH(11), 9 }, { MPH(26), MPH(16), MPH(11), 8 }, - { MPH(29), MPH(12), MPH(5), 10 }, { MPH(26), MPH(11), MPH(4), 12 }, { MPH(19), MPH(9), MPH(12), 8 }, - { MPH(18), MPH(8), MPH(5), 12 }, { MPH(28), MPH(11), MPH(4), 10 }, { MPH(25), MPH(16), MPH(10), 8 }, - { MPH(29), MPH(17), MPH(12), 6 }, { MPH(18), MPH(11), MPH(10), 8 }, { MPH(25), MPH(10), MPH(9), 10 }, - { MPH(25), MPH(12), MPH(6), 12 }, { MPH(23), MPH(12), MPH(8), 8 }, { MPH(27), MPH(9), MPH(9), 11 }, - { MPH(27), MPH(19), MPH(10), 3 }, { MPH(28), MPH(12), MPH(10), 8 }, { MPH(25), MPH(14), MPH(10), 7 }, - { MPH(28), MPH(17), MPH(8), 7 }, { MPH(24), MPH(13), MPH(4), 9 }, { MPH(25), MPH(12), MPH(8), 9 }, - { MPH(18), MPH(9), MPH(6), 13 }, { MPH(19), MPH(8), MPH(7), 11 }, { MPH(28), MPH(12), MPH(7), 10 }, - { MPH(21), MPH(10), MPH(6), 9 }, { MPH(26), MPH(13), MPH(8), 9 }, { MPH(21), MPH(12), MPH(12), 6 }, - { MPH(25), MPH(15), MPH(8), 5 }, { MPH(17), MPH(12), MPH(13), 7 }, { MPH(20), MPH(9), MPH(6), 12 }, - { MPH(27), MPH(18), MPH(13), 5 }, { MPH(22), MPH(14), MPH(14), 5 }, { MPH(19), MPH(12), MPH(15), 5 }, - { MPH(26), MPH(13), MPH(10), 10 }, { MPH(23), MPH(11), MPH(8), 10 }, { MPH(28), MPH(17), MPH(11), 8 }, - { MPH(23), MPH(9), MPH(5), 10 }, { MPH(20), MPH(11), MPH(10), 7 }, { MPH(24), MPH(9), MPH(7), 12 }, - { MPH(25), MPH(13), MPH(8), 8 }, { MPH(25), MPH(18), MPH(14), 6 }, { MPH(22), MPH(16), MPH(12), 7 }, - { MPH(21), MPH(12), MPH(11), 8 }, { MPH(22), MPH(16), MPH(10), 6 }, { MPH(21), MPH(15), MPH(11), 6 }, - { MPH(24), MPH(16), MPH(12), 7 }, { MPH(28), MPH(21), MPH(9), 4 }, { MPH(26), MPH(14), MPH(12), 8 }, - { MPH(23), MPH(13), MPH(8), 7 }, { MPH(26), MPH(16), MPH(14), 7 }, { MPH(23), MPH(14), MPH(8), 7 }, - { MPH(21), MPH(13), MPH(8), 7 }, { MPH(26), MPH(17), MPH(7), 6 }, { MPH(28), MPH(10), MPH(9), 10 }, - { MPH(28), MPH(11), MPH(6), 12 }, { MPH(21), MPH(9), MPH(9), 10 }, { MPH(27), MPH(12), MPH(10), 9 }, - { MPH(20), MPH(10), MPH(11), 8 }, { MPH(26), MPH(17), MPH(15), 6 }, { MPH(23), MPH(9), MPH(6), 11 }, - { MPH(26), MPH(17), MPH(10), 8 }, { MPH(22), MPH(13), MPH(12), 9 }, { MPH(24), MPH(12), MPH(11), 8 }, - { MPH(27), MPH(17), MPH(9), 7 }, { MPH(27), MPH(14), MPH(7), 10 }, { MPH(26), MPH(9), MPH(6), 9 }, - { MPH(23), MPH(10), MPH(11), 9 }, { MPH(30), MPH(23), MPH(10), 3 }, { MPH(14), MPH(7), MPH(7), 10 }, - { MPH(25), MPH(12), MPH(9), 10 }, { MPH(20), MPH(12), MPH(8), 4 }, { MPH(24), MPH(16), MPH(12), 7 }, - { MPH(24), MPH(13), MPH(6), 10 }, { MPH(24), MPH(14), MPH(9), 5 }, { MPH(27), MPH(14), MPH(7), 8 }, - { MPH(26), MPH(12), MPH(9), 9 }, { MPH(23), MPH(14), MPH(8), 8 }, { MPH(25), MPH(16), MPH(11), 6 }, - { MPH(29), MPH(17), MPH(7), 9 }, { MPH(25), MPH(17), MPH(15), 5 }, { MPH(27), MPH(16), MPH(11), 4 }, - { MPH(13), MPH(8), MPH(10), 10 }, { MPH(27), MPH(17), MPH(8), 7 }, { MPH(22), MPH(13), MPH(6), 7 }, - { MPH(25), MPH(18), MPH(16), 4 }, { MPH(23), MPH(12), MPH(6), 8 }, { MPH(22), MPH(16), MPH(12), 5 }, - { MPH(25), MPH(14), MPH(10), 6 }, { MPH(19), MPH(11), MPH(10), 8 }, { MPH(24), MPH(10), MPH(10), 8 }, - { MPH(27), MPH(17), MPH(12), 7 }, { MPH(27), MPH(16), MPH(12), 5 }, { MPH(24), MPH(16), MPH(8), 7 }, - { MPH(20), MPH(9), MPH(8), 9 }, { MPH(27), MPH(19), MPH(15), 4 }, { MPH(21), MPH(10), MPH(11), 8 }, - { MPH(17), MPH(8), MPH(5), 11 }, { MPH(16), MPH(10), MPH(10), 8 }, { MPH(29), MPH(18), MPH(10), 7 }, - { MPH(23), MPH(16), MPH(14), 5 }, { MPH(16), MPH(8), MPH(6), 10 }, { MPH(24), MPH(10), MPH(8), 11 }, - { MPH(21), MPH(11), MPH(7), 11 }, { MPH(26), MPH(13), MPH(8), 7 }, { MPH(22), MPH(10), MPH(8), 11 }, - { MPH(25), MPH(13), MPH(11), 9 }, { MPH(24), MPH(15), MPH(8), 5 }, { MPH(26), MPH(12), MPH(6), 8 }, - { MPH(21), MPH(15), MPH(15), 7 }, { MPH(28), MPH(19), MPH(14), 6 }, { MPH(23), MPH(14), MPH(9), 8 }, - { MPH(25), MPH(13), MPH(6), 9 }, { MPH(18), MPH(11), MPH(12), 7 }, { MPH(22), MPH(13), MPH(7), 6 }, - { MPH(23), MPH(13), MPH(7), 8 }, { MPH(27), MPH(18), MPH(9), 5 }, { MPH(20), MPH(9), MPH(6), 10 }, - { MPH(29), MPH(9), MPH(9), 12 }, { MPH(26), MPH(12), MPH(9), 11 }, { MPH(27), MPH(10), MPH(5), 11 }, - { MPH(26), MPH(20), MPH(9), 3 }, { MPH(18), MPH(10), MPH(11), 8 }, { MPH(28), MPH(16), MPH(12), 8 }, - { MPH(13), MPH(9), MPH(7), 9 }, { MPH(24), MPH(15), MPH(9), 6 }, { MPH(20), MPH(11), MPH(9), 8 }, - { MPH(24), MPH(15), MPH(12), 4 }, { MPH(24), MPH(14), MPH(9), 5 }, { MPH(22), MPH(11), MPH(8), 10 }, - { MPH(24), MPH(11), MPH(10), 10 }, { MPH(24), MPH(17), MPH(10), 7 }, { MPH(28), MPH(18), MPH(13), 7 }, - { MPH(23), MPH(11), MPH(8), 12 }, { MPH(25), MPH(12), MPH(11), 8 }, { MPH(21), MPH(10), MPH(11), 8 }, - { MPH(15), MPH(8), MPH(7), 10 }, { MPH(26), MPH(16), MPH(9), 8 }, { MPH(21), MPH(10), MPH(9), 10 }, - { MPH(27), MPH(17), MPH(16), 6 }, { MPH(22), MPH(12), MPH(6), 9 }, { MPH(25), MPH(9), MPH(4), 11 }, - { MPH(26), MPH(16), MPH(13), 9 }, { MPH(26), MPH(19), MPH(11), 6 }, { MPH(24), MPH(15), MPH(13), 7 }, - { MPH(16), MPH(9), MPH(10), 8 }, { MPH(21), MPH(11), MPH(7), 6 }, { MPH(28), MPH(20), MPH(15), 6 }, - { MPH(25), MPH(15), MPH(9), 6 } + { 22_MPH, 11_MPH, 10_MPH, 10 }, { 23_MPH, 10_MPH, 5_MPH, 9 }, { 23_MPH, 8_MPH, 7_MPH, 11 }, + { 27_MPH, 17_MPH, 12_MPH, 6 }, { 25_MPH, 18_MPH, 15_MPH, 6 }, { 23_MPH, 14_MPH, 12_MPH, 9 }, + { 20_MPH, 12_MPH, 12_MPH, 5 }, { 23_MPH, 10_MPH, 5_MPH, 11 }, { 26_MPH, 9_MPH, 4_MPH, 11 }, + { 16_MPH, 11_MPH, 9_MPH, 7 }, { 28_MPH, 10_MPH, 9_MPH, 10 }, { 24_MPH, 18_MPH, 8_MPH, 4 }, + { 23_MPH, 15_MPH, 13_MPH, 5 }, { 18_MPH, 10_MPH, 10_MPH, 10 }, { 25_MPH, 15_MPH, 8_MPH, 9 }, + { 18_MPH, 12_MPH, 12_MPH, 7 }, { 24_MPH, 14_MPH, 7_MPH, 7 }, { 27_MPH, 19_MPH, 13_MPH, 7 }, + { 26_MPH, 19_MPH, 9_MPH, 5 }, { 22_MPH, 10_MPH, 6_MPH, 9 }, { 20_MPH, 12_MPH, 11_MPH, 10 }, + { 27_MPH, 16_MPH, 12_MPH, 7 }, { 22_MPH, 13_MPH, 10_MPH, 7 }, { 23_MPH, 11_MPH, 10_MPH, 11 }, + { 17_MPH, 10_MPH, 9_MPH, 8 }, { 19_MPH, 13_MPH, 10_MPH, 5 }, { 14_MPH, 8_MPH, 11_MPH, 10 }, + { 22_MPH, 15_MPH, 12_MPH, 8 }, { 15_MPH, 7_MPH, 8_MPH, 8 }, { 23_MPH, 17_MPH, 14_MPH, 4 }, + { 25_MPH, 14_MPH, 13_MPH, 7 }, { 22_MPH, 8_MPH, 6_MPH, 13 }, { 27_MPH, 11_MPH, 6_MPH, 11 }, + { 19_MPH, 10_MPH, 9_MPH, 11 }, { 24_MPH, 13_MPH, 11_MPH, 7 }, { 12_MPH, 7_MPH, 8_MPH, 7 }, + { 27_MPH, 11_MPH, 5_MPH, 9 }, { 15_MPH, 9_MPH, 7_MPH, 7 }, { 16_MPH, 10_MPH, 9_MPH, 8 }, + { 11_MPH, 7_MPH, 7_MPH, 9 }, { 25_MPH, 17_MPH, 9_MPH, 6 }, { 22_MPH, 10_MPH, 4_MPH, 13 }, + { 25_MPH, 13_MPH, 7_MPH, 10 }, { 28_MPH, 18_MPH, 10_MPH, 5 }, { 21_MPH, 11_MPH, 10_MPH, 10 }, + { 23_MPH, 11_MPH, 11_MPH, 7 }, { 21_MPH, 15_MPH, 8_MPH, 5 }, { 27_MPH, 14_MPH, 6_MPH, 9 }, + { 26_MPH, 17_MPH, 12_MPH, 6 }, { 17_MPH, 7_MPH, 6_MPH, 12 }, { 17_MPH, 9_MPH, 8_MPH, 9 }, + { 17_MPH, 10_MPH, 12_MPH, 6 }, { 20_MPH, 10_MPH, 9_MPH, 9 }, { 26_MPH, 14_MPH, 10_MPH, 7 }, + { 28_MPH, 14_MPH, 7_MPH, 12 }, { 24_MPH, 11_MPH, 7_MPH, 9 }, { 26_MPH, 12_MPH, 6_MPH, 8 }, + { 24_MPH, 12_MPH, 11_MPH, 9 }, { 24_MPH, 11_MPH, 5_MPH, 7 }, { 29_MPH, 21_MPH, 16_MPH, 5 }, + { 22_MPH, 13_MPH, 13_MPH, 5 }, { 27_MPH, 20_MPH, 12_MPH, 6 }, { 21_MPH, 14_MPH, 7_MPH, 9 }, + { 27_MPH, 18_MPH, 7_MPH, 6 }, { 19_MPH, 12_MPH, 12_MPH, 6 }, { 25_MPH, 18_MPH, 9_MPH, 7 }, + { 20_MPH, 10_MPH, 10_MPH, 10 }, { 19_MPH, 9_MPH, 7_MPH, 9 }, { 24_MPH, 14_MPH, 7_MPH, 7 }, + { 25_MPH, 12_MPH, 10_MPH, 10 }, { 24_MPH, 15_MPH, 8_MPH, 7 }, { 23_MPH, 11_MPH, 6_MPH, 8 }, + { 18_MPH, 11_MPH, 7_MPH, 9 }, { 23_MPH, 8_MPH, 5_MPH, 11 }, { 12_MPH, 8_MPH, 12_MPH, 8 }, + { 22_MPH, 14_MPH, 12_MPH, 9 }, { 25_MPH, 13_MPH, 14_MPH, 8 }, { 26_MPH, 12_MPH, 5_MPH, 12 }, + { 29_MPH, 15_MPH, 6_MPH, 10 }, { 20_MPH, 12_MPH, 8_MPH, 9 }, { 25_MPH, 13_MPH, 10_MPH, 8 }, + { 23_MPH, 12_MPH, 8_MPH, 9 }, { 20_MPH, 11_MPH, 5_MPH, 11 }, { 22_MPH, 11_MPH, 5_MPH, 11 }, + { 21_MPH, 9_MPH, 6_MPH, 9 }, { 28_MPH, 13_MPH, 8_MPH, 10 }, { 27_MPH, 14_MPH, 10_MPH, 11 }, + { 22_MPH, 16_MPH, 10_MPH, 5 }, { 25_MPH, 14_MPH, 9_MPH, 6 }, { 20_MPH, 10_MPH, 7_MPH, 10 }, + { 24_MPH, 15_MPH, 13_MPH, 7 }, { 22_MPH, 11_MPH, 4_MPH, 9 }, { 19_MPH, 9_MPH, 4_MPH, 12 }, + { 19_MPH, 11_MPH, 8_MPH, 7 }, { 24_MPH, 16_MPH, 15_MPH, 5 }, { 15_MPH, 11_MPH, 9_MPH, 7 }, + { 25_MPH, 10_MPH, 7_MPH, 10 }, { 23_MPH, 11_MPH, 5_MPH, 9 }, { 24_MPH, 13_MPH, 11_MPH, 8 }, + { 26_MPH, 16_MPH, 9_MPH, 8 }, { 25_MPH, 16_MPH, 10_MPH, 6 }, { 26_MPH, 16_MPH, 8_MPH, 6 }, + { 26_MPH, 16_MPH, 12_MPH, 7 }, { 25_MPH, 11_MPH, 10_MPH, 11 }, { 21_MPH, 13_MPH, 13_MPH, 6 }, + { 9_MPH, 6_MPH, 4_MPH, 11 }, { 26_MPH, 11_MPH, 5_MPH, 10 }, { 25_MPH, 18_MPH, 14_MPH, 5 }, + { 26_MPH, 16_MPH, 9_MPH, 4 }, { 24_MPH, 11_MPH, 11_MPH, 9 }, { 26_MPH, 16_MPH, 11_MPH, 8 }, + { 29_MPH, 12_MPH, 5_MPH, 10 }, { 26_MPH, 11_MPH, 4_MPH, 12 }, { 19_MPH, 9_MPH, 12_MPH, 8 }, + { 18_MPH, 8_MPH, 5_MPH, 12 }, { 28_MPH, 11_MPH, 4_MPH, 10 }, { 25_MPH, 16_MPH, 10_MPH, 8 }, + { 29_MPH, 17_MPH, 12_MPH, 6 }, { 18_MPH, 11_MPH, 10_MPH, 8 }, { 25_MPH, 10_MPH, 9_MPH, 10 }, + { 25_MPH, 12_MPH, 6_MPH, 12 }, { 23_MPH, 12_MPH, 8_MPH, 8 }, { 27_MPH, 9_MPH, 9_MPH, 11 }, + { 27_MPH, 19_MPH, 10_MPH, 3 }, { 28_MPH, 12_MPH, 10_MPH, 8 }, { 25_MPH, 14_MPH, 10_MPH, 7 }, + { 28_MPH, 17_MPH, 8_MPH, 7 }, { 24_MPH, 13_MPH, 4_MPH, 9 }, { 25_MPH, 12_MPH, 8_MPH, 9 }, + { 18_MPH, 9_MPH, 6_MPH, 13 }, { 19_MPH, 8_MPH, 7_MPH, 11 }, { 28_MPH, 12_MPH, 7_MPH, 10 }, + { 21_MPH, 10_MPH, 6_MPH, 9 }, { 26_MPH, 13_MPH, 8_MPH, 9 }, { 21_MPH, 12_MPH, 12_MPH, 6 }, + { 25_MPH, 15_MPH, 8_MPH, 5 }, { 17_MPH, 12_MPH, 13_MPH, 7 }, { 20_MPH, 9_MPH, 6_MPH, 12 }, + { 27_MPH, 18_MPH, 13_MPH, 5 }, { 22_MPH, 14_MPH, 14_MPH, 5 }, { 19_MPH, 12_MPH, 15_MPH, 5 }, + { 26_MPH, 13_MPH, 10_MPH, 10 }, { 23_MPH, 11_MPH, 8_MPH, 10 }, { 28_MPH, 17_MPH, 11_MPH, 8 }, + { 23_MPH, 9_MPH, 5_MPH, 10 }, { 20_MPH, 11_MPH, 10_MPH, 7 }, { 24_MPH, 9_MPH, 7_MPH, 12 }, + { 25_MPH, 13_MPH, 8_MPH, 8 }, { 25_MPH, 18_MPH, 14_MPH, 6 }, { 22_MPH, 16_MPH, 12_MPH, 7 }, + { 21_MPH, 12_MPH, 11_MPH, 8 }, { 22_MPH, 16_MPH, 10_MPH, 6 }, { 21_MPH, 15_MPH, 11_MPH, 6 }, + { 24_MPH, 16_MPH, 12_MPH, 7 }, { 28_MPH, 21_MPH, 9_MPH, 4 }, { 26_MPH, 14_MPH, 12_MPH, 8 }, + { 23_MPH, 13_MPH, 8_MPH, 7 }, { 26_MPH, 16_MPH, 14_MPH, 7 }, { 23_MPH, 14_MPH, 8_MPH, 7 }, + { 21_MPH, 13_MPH, 8_MPH, 7 }, { 26_MPH, 17_MPH, 7_MPH, 6 }, { 28_MPH, 10_MPH, 9_MPH, 10 }, + { 28_MPH, 11_MPH, 6_MPH, 12 }, { 21_MPH, 9_MPH, 9_MPH, 10 }, { 27_MPH, 12_MPH, 10_MPH, 9 }, + { 20_MPH, 10_MPH, 11_MPH, 8 }, { 26_MPH, 17_MPH, 15_MPH, 6 }, { 23_MPH, 9_MPH, 6_MPH, 11 }, + { 26_MPH, 17_MPH, 10_MPH, 8 }, { 22_MPH, 13_MPH, 12_MPH, 9 }, { 24_MPH, 12_MPH, 11_MPH, 8 }, + { 27_MPH, 17_MPH, 9_MPH, 7 }, { 27_MPH, 14_MPH, 7_MPH, 10 }, { 26_MPH, 9_MPH, 6_MPH, 9 }, + { 23_MPH, 10_MPH, 11_MPH, 9 }, { 30_MPH, 23_MPH, 10_MPH, 3 }, { 14_MPH, 7_MPH, 7_MPH, 10 }, + { 25_MPH, 12_MPH, 9_MPH, 10 }, { 20_MPH, 12_MPH, 8_MPH, 4 }, { 24_MPH, 16_MPH, 12_MPH, 7 }, + { 24_MPH, 13_MPH, 6_MPH, 10 }, { 24_MPH, 14_MPH, 9_MPH, 5 }, { 27_MPH, 14_MPH, 7_MPH, 8 }, + { 26_MPH, 12_MPH, 9_MPH, 9 }, { 23_MPH, 14_MPH, 8_MPH, 8 }, { 25_MPH, 16_MPH, 11_MPH, 6 }, + { 29_MPH, 17_MPH, 7_MPH, 9 }, { 25_MPH, 17_MPH, 15_MPH, 5 }, { 27_MPH, 16_MPH, 11_MPH, 4 }, + { 13_MPH, 8_MPH, 10_MPH, 10 }, { 27_MPH, 17_MPH, 8_MPH, 7 }, { 22_MPH, 13_MPH, 6_MPH, 7 }, + { 25_MPH, 18_MPH, 16_MPH, 4 }, { 23_MPH, 12_MPH, 6_MPH, 8 }, { 22_MPH, 16_MPH, 12_MPH, 5 }, + { 25_MPH, 14_MPH, 10_MPH, 6 }, { 19_MPH, 11_MPH, 10_MPH, 8 }, { 24_MPH, 10_MPH, 10_MPH, 8 }, + { 27_MPH, 17_MPH, 12_MPH, 7 }, { 27_MPH, 16_MPH, 12_MPH, 5 }, { 24_MPH, 16_MPH, 8_MPH, 7 }, + { 20_MPH, 9_MPH, 8_MPH, 9 }, { 27_MPH, 19_MPH, 15_MPH, 4 }, { 21_MPH, 10_MPH, 11_MPH, 8 }, + { 17_MPH, 8_MPH, 5_MPH, 11 }, { 16_MPH, 10_MPH, 10_MPH, 8 }, { 29_MPH, 18_MPH, 10_MPH, 7 }, + { 23_MPH, 16_MPH, 14_MPH, 5 }, { 16_MPH, 8_MPH, 6_MPH, 10 }, { 24_MPH, 10_MPH, 8_MPH, 11 }, + { 21_MPH, 11_MPH, 7_MPH, 11 }, { 26_MPH, 13_MPH, 8_MPH, 7 }, { 22_MPH, 10_MPH, 8_MPH, 11 }, + { 25_MPH, 13_MPH, 11_MPH, 9 }, { 24_MPH, 15_MPH, 8_MPH, 5 }, { 26_MPH, 12_MPH, 6_MPH, 8 }, + { 21_MPH, 15_MPH, 15_MPH, 7 }, { 28_MPH, 19_MPH, 14_MPH, 6 }, { 23_MPH, 14_MPH, 9_MPH, 8 }, + { 25_MPH, 13_MPH, 6_MPH, 9 }, { 18_MPH, 11_MPH, 12_MPH, 7 }, { 22_MPH, 13_MPH, 7_MPH, 6 }, + { 23_MPH, 13_MPH, 7_MPH, 8 }, { 27_MPH, 18_MPH, 9_MPH, 5 }, { 20_MPH, 9_MPH, 6_MPH, 10 }, + { 29_MPH, 9_MPH, 9_MPH, 12 }, { 26_MPH, 12_MPH, 9_MPH, 11 }, { 27_MPH, 10_MPH, 5_MPH, 11 }, + { 26_MPH, 20_MPH, 9_MPH, 3 }, { 18_MPH, 10_MPH, 11_MPH, 8 }, { 28_MPH, 16_MPH, 12_MPH, 8 }, + { 13_MPH, 9_MPH, 7_MPH, 9 }, { 24_MPH, 15_MPH, 9_MPH, 6 }, { 20_MPH, 11_MPH, 9_MPH, 8 }, + { 24_MPH, 15_MPH, 12_MPH, 4 }, { 24_MPH, 14_MPH, 9_MPH, 5 }, { 22_MPH, 11_MPH, 8_MPH, 10 }, + { 24_MPH, 11_MPH, 10_MPH, 10 }, { 24_MPH, 17_MPH, 10_MPH, 7 }, { 28_MPH, 18_MPH, 13_MPH, 7 }, + { 23_MPH, 11_MPH, 8_MPH, 12 }, { 25_MPH, 12_MPH, 11_MPH, 8 }, { 21_MPH, 10_MPH, 11_MPH, 8 }, + { 15_MPH, 8_MPH, 7_MPH, 10 }, { 26_MPH, 16_MPH, 9_MPH, 8 }, { 21_MPH, 10_MPH, 9_MPH, 10 }, + { 27_MPH, 17_MPH, 16_MPH, 6 }, { 22_MPH, 12_MPH, 6_MPH, 9 }, { 25_MPH, 9_MPH, 4_MPH, 11 }, + { 26_MPH, 16_MPH, 13_MPH, 9 }, { 26_MPH, 19_MPH, 11_MPH, 6 }, { 24_MPH, 15_MPH, 13_MPH, 7 }, + { 16_MPH, 9_MPH, 10_MPH, 8 }, { 21_MPH, 11_MPH, 7_MPH, 6 }, { 28_MPH, 20_MPH, 15_MPH, 6 }, + { 25_MPH, 15_MPH, 9_MPH, 6 } }; int32_t Vehicle::CalculateRiderBraking() const @@ -139,7 +142,7 @@ int32_t Vehicle::CalculateRiderBraking() const int32_t relativeVelocity = velocity - prevVehicle->velocity; int32_t z_diff = abs(z - prevVehicle->z); - if (distance < followDistance && z_diff < 16 && relativeVelocity > -MPH(2)) + if (distance < followDistance && z_diff < 16 && relativeVelocity > -2_MPH) { if (distance < followDistance / 2 || relativeVelocity > riderSettings.brakeThreshold) { diff --git a/src/openrct2/ride/VehicleSubpositionData.cpp b/src/openrct2/ride/VehicleSubpositionData.cpp index 53cdc1f3c4..4a1696f887 100644 --- a/src/openrct2/ride/VehicleSubpositionData.cpp +++ b/src/openrct2/ride/VehicleSubpositionData.cpp @@ -31742,7 +31742,7 @@ static constexpr const VehicleInfoList *TrackVehicleInfoListReverserRCRearBogie[ }; // rct2: 0x008B8F30 -constexpr const VehicleInfoList * const * gTrackVehicleInfo[static_cast(VehicleTrackSubposition::Count)] = { +constexpr const VehicleInfoList * const * gTrackVehicleInfo[EnumValue(VehicleTrackSubposition::Count)] = { TrackVehicleInfoListDefault, // VehicleTrackSubposition::Default TrackVehicleInfoListChairliftGoingOut, // VehicleTrackSubposition::ChairliftGoingOut TrackVehicleInfoListChairliftGoingBack, // VehicleTrackSubposition::ChairliftGoingBack diff --git a/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp b/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp index 9a3028be45..c49ec54db5 100644 --- a/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp +++ b/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp @@ -184,7 +184,7 @@ static void AirPoweredVerticalRCTrackFlat( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -213,7 +213,7 @@ static void AirPoweredVerticalRCTrackStation( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -259,38 +259,55 @@ static void AirPoweredVerticalRCTrackRightQuarterTurn5( switch (trackSequence) { case 0: - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre, + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; } @@ -331,7 +348,7 @@ static void AirPoweredVerticalRCTrackFlatToLeftBank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -361,7 +378,7 @@ static void AirPoweredVerticalRCTrackFlatToRightBank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -434,38 +451,55 @@ static void AirPoweredVerticalRCTrackBankedRightQuarterTurn5( switch (trackSequence) { case 0: - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre, + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; } @@ -507,7 +541,7 @@ static void AirPoweredVerticalRCTrackLeftBank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -537,7 +571,7 @@ static void AirPoweredVerticalRCTrackBrakes( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -658,7 +692,7 @@ static void AirPoweredVerticalRCTrackVerticalSlopeUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + supportHeights[trackSequence], 0x20); break; case 1: @@ -690,7 +724,7 @@ static void AirPoweredVerticalRCTrackVerticalSlopeUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + supportHeights[trackSequence], 0x20); break; case 4: @@ -713,7 +747,7 @@ static void AirPoweredVerticalRCTrackVerticalSlopeUp( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + supportHeights[trackSequence], 0x20); break; case 5: @@ -738,7 +772,7 @@ static void AirPoweredVerticalRCTrackVerticalSlopeUp( PaintAddImageAsParentRotated( session, direction, supportsImageId, { 0, 0, height }, { { 3, 3, height }, { 26, 26, 126 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + supportHeights[trackSequence], 0x20); break; case 6: @@ -761,7 +795,7 @@ static void AirPoweredVerticalRCTrackVerticalSlopeUp( PaintUtilSetVerticalTunnel(session, height + 240); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + supportHeights[trackSequence], 0x20); break; } @@ -802,7 +836,7 @@ static void AirPoweredVerticalRCTrackVerticalUp( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); } @@ -904,7 +938,7 @@ static void AirPoweredVerticalRCTrackVerticalTop( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); } @@ -949,7 +983,7 @@ static void AirPoweredVerticalRCTrackBooster( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -973,7 +1007,7 @@ static void AirPoweredVerticalRCTrackOnridePhoto( TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/AlpineCoaster.cpp b/src/openrct2/ride/coaster/AlpineCoaster.cpp index 2b09477330..2ab9d5a0b0 100644 --- a/src/openrct2/ride/coaster/AlpineCoaster.cpp +++ b/src/openrct2/ride/coaster/AlpineCoaster.cpp @@ -88,7 +88,10 @@ namespace AlpineRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -121,7 +124,7 @@ namespace AlpineRC DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Boxed); TrackPaintUtilDrawStation2(session, ride, direction, height, trackElement, 4, 7); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -202,7 +205,10 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -283,7 +289,10 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -364,7 +373,10 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -427,7 +439,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -458,7 +476,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -498,7 +522,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -550,7 +580,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -583,7 +619,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -612,7 +651,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -645,7 +690,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -686,7 +734,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -738,7 +792,11 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -768,7 +826,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -797,13 +858,24 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -843,7 +915,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -888,7 +963,11 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -918,7 +997,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -947,13 +1029,24 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -994,7 +1087,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1048,7 +1144,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1076,7 +1178,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1104,7 +1212,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1168,7 +1282,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1205,7 +1325,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -1233,7 +1359,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -1261,7 +1393,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -1325,7 +1463,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -1362,7 +1506,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -1390,7 +1540,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -1418,7 +1574,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -1482,7 +1644,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -1519,7 +1687,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -1547,7 +1721,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -1575,7 +1755,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -1639,7 +1825,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -1676,7 +1868,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -1704,7 +1902,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -1732,7 +1936,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -1796,7 +2006,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -1833,7 +2049,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -1860,7 +2082,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -1887,7 +2115,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -1950,7 +2184,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -1988,7 +2228,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2016,7 +2262,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2044,7 +2296,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2108,7 +2366,13 @@ namespace AlpineRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -2155,7 +2419,10 @@ namespace AlpineRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -2200,7 +2467,10 @@ namespace AlpineRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -2266,7 +2536,10 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -2318,7 +2591,10 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -2370,7 +2646,10 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -2422,7 +2701,10 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -2489,7 +2771,10 @@ namespace AlpineRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -2517,7 +2802,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2535,7 +2826,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -2549,7 +2846,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2579,7 +2882,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2602,7 +2911,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2616,7 +2931,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -2634,7 +2955,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2664,7 +2991,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2687,7 +3020,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2705,7 +3044,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -2719,7 +3064,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2749,7 +3100,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2772,7 +3129,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2786,7 +3149,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -2804,7 +3173,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2834,7 +3209,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2857,7 +3238,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2875,7 +3262,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2889,7 +3282,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2919,7 +3318,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -2942,7 +3347,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2956,7 +3367,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2974,7 +3391,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -3004,7 +3427,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -3027,7 +3456,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -3045,7 +3480,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -3059,7 +3500,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -3089,7 +3536,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -3112,7 +3565,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -3126,7 +3585,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -3144,7 +3609,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -3174,7 +3645,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -3197,7 +3674,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -3214,7 +3697,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -3227,7 +3716,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -3256,7 +3751,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -3280,7 +3781,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -3293,7 +3800,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -3310,7 +3823,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -3339,7 +3858,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -3363,7 +3888,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -3381,7 +3912,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -3395,7 +3932,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -3425,7 +3968,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -3448,7 +3997,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -3462,7 +4017,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -3480,7 +4041,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -3510,7 +4077,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -3533,7 +4106,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3547,7 +4126,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3561,7 +4146,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3591,7 +4182,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3614,7 +4211,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3628,7 +4231,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3642,7 +4251,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3672,7 +4287,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3719,7 +4340,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3750,7 +4377,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3793,7 +4426,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3848,7 +4487,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3881,7 +4526,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3910,7 +4558,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3943,7 +4597,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3987,7 +4644,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4039,7 +4702,11 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4069,7 +4736,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4098,13 +4768,24 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4144,7 +4825,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4189,7 +4873,11 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4219,7 +4907,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4248,13 +4939,24 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4295,7 +4997,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4356,7 +5061,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -4402,7 +5113,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -4446,7 +5163,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -4497,7 +5220,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -4557,7 +5286,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -4590,7 +5325,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -4619,7 +5357,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -4652,7 +5396,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -4693,7 +5440,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -4737,7 +5490,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -4770,7 +5529,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -4799,7 +5561,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -4832,7 +5600,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -4873,7 +5644,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -4933,7 +5710,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4968,7 +5751,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5004,7 +5790,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5045,7 +5834,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5089,7 +5884,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5125,7 +5926,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5162,7 +5966,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5203,7 +6010,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5250,7 +6063,12 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5282,7 +6100,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5325,7 +6149,12 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5369,7 +6198,12 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5401,7 +6235,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -5439,7 +6279,12 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5487,7 +6332,12 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5519,7 +6369,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5562,7 +6418,12 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5606,7 +6467,12 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5638,7 +6504,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -5676,7 +6548,12 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5750,7 +6627,12 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5784,7 +6666,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5813,7 +6698,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5846,7 +6737,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5890,7 +6784,12 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5934,7 +6833,12 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5968,7 +6872,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5997,7 +6904,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -6030,7 +6943,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6069,7 +6985,12 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6116,7 +7037,12 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6150,7 +7076,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6179,7 +7108,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -6212,7 +7147,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6261,7 +7199,12 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6305,7 +7248,12 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6339,7 +7287,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6368,7 +7319,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -6401,7 +7358,10 @@ namespace AlpineRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6445,7 +7405,12 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6505,7 +7470,10 @@ namespace AlpineRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -6550,7 +7518,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -6596,7 +7570,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -6643,7 +7623,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -6689,7 +7675,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -6733,7 +7725,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -6782,7 +7780,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -6826,7 +7830,13 @@ namespace AlpineRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -6875,7 +7885,13 @@ namespace AlpineRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } diff --git a/src/openrct2/ride/coaster/BobsleighCoaster.cpp b/src/openrct2/ride/coaster/BobsleighCoaster.cpp index 43102659c2..3dcc10d481 100644 --- a/src/openrct2/ride/coaster/BobsleighCoaster.cpp +++ b/src/openrct2/ride/coaster/BobsleighCoaster.cpp @@ -95,7 +95,10 @@ static void BobsleighRCTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -119,7 +122,7 @@ static void BobsleighRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -223,7 +226,10 @@ static void BobsleighRCTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -327,7 +333,10 @@ static void BobsleighRCTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -431,7 +440,10 @@ static void BobsleighRCTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -509,7 +521,13 @@ static void BobsleighRCTrackLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -553,7 +571,11 @@ static void BobsleighRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -594,7 +616,13 @@ static void BobsleighRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -638,7 +666,11 @@ static void BobsleighRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -690,7 +722,13 @@ static void BobsleighRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -752,7 +790,10 @@ static void BobsleighRCTrackFlatToLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -803,7 +844,10 @@ static void BobsleighRCTrackFlatToRightBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -854,7 +898,10 @@ static void BobsleighRCTrackLeftBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -905,7 +952,10 @@ static void BobsleighRCTrackRightBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -959,7 +1009,13 @@ static void BobsleighRCTrackBankedLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1003,7 +1059,11 @@ static void BobsleighRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1044,7 +1104,13 @@ static void BobsleighRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1088,7 +1154,11 @@ static void BobsleighRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1140,7 +1210,13 @@ static void BobsleighRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1209,7 +1285,10 @@ static void BobsleighRCTrackLeftBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1267,7 +1346,10 @@ static void BobsleighRCTrackRightBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1325,7 +1407,10 @@ static void BobsleighRCTrack25DegUpToLeftBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1383,7 +1468,10 @@ static void BobsleighRCTrack25DegUpToRightBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1466,7 +1554,10 @@ static void BobsleighRCTrackLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1528,7 +1619,13 @@ static void BobsleighRCTrackSBendLeft( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1573,7 +1670,11 @@ static void BobsleighRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1619,7 +1720,11 @@ static void BobsleighRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1671,7 +1776,13 @@ static void BobsleighRCTrackSBendLeft( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1727,7 +1838,13 @@ static void BobsleighRCTrackSBendRight( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1773,7 +1890,11 @@ static void BobsleighRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1820,7 +1941,11 @@ static void BobsleighRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1872,7 +1997,13 @@ static void BobsleighRCTrackSBendRight( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1928,7 +2059,13 @@ static void BobsleighRCTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1971,7 +2108,13 @@ static void BobsleighRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2022,7 +2165,13 @@ static void BobsleighRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2087,7 +2236,13 @@ static void BobsleighRCTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2130,7 +2285,13 @@ static void BobsleighRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2181,7 +2342,13 @@ static void BobsleighRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2246,7 +2413,12 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2290,7 +2462,13 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2341,7 +2519,12 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2393,7 +2576,12 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2437,7 +2625,13 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -2483,7 +2677,12 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2540,7 +2739,12 @@ static void BobsleighRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2584,7 +2788,13 @@ static void BobsleighRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2635,7 +2845,12 @@ static void BobsleighRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2687,7 +2902,12 @@ static void BobsleighRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2731,7 +2951,13 @@ static void BobsleighRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -2777,7 +3003,12 @@ static void BobsleighRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2862,7 +3093,12 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2907,7 +3143,11 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2948,7 +3188,13 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -2992,7 +3238,11 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3044,7 +3294,12 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3096,7 +3351,12 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3141,7 +3401,11 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3182,7 +3446,12 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -3226,7 +3495,11 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3273,7 +3546,12 @@ static void BobsleighRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3330,7 +3608,12 @@ static void BobsleighRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3375,7 +3658,11 @@ static void BobsleighRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3416,7 +3703,12 @@ static void BobsleighRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3460,7 +3752,11 @@ static void BobsleighRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3512,7 +3808,12 @@ static void BobsleighRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3564,7 +3865,12 @@ static void BobsleighRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3609,7 +3915,11 @@ static void BobsleighRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3650,7 +3960,13 @@ static void BobsleighRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -3694,7 +4010,11 @@ static void BobsleighRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3741,7 +4061,12 @@ static void BobsleighRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3809,7 +4134,10 @@ static void BobsleighRCTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3847,7 +4175,10 @@ static void BobsleighRCTrackBlockBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3896,7 +4227,7 @@ static void BobsleighRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } diff --git a/src/openrct2/ride/coaster/BolligerMabillardTrack.hpp b/src/openrct2/ride/coaster/BolligerMabillardTrack.hpp index ac8e70509a..eeb43bac0b 100644 --- a/src/openrct2/ride/coaster/BolligerMabillardTrack.hpp +++ b/src/openrct2/ride/coaster/BolligerMabillardTrack.hpp @@ -96,7 +96,10 @@ static void BolligerMabillardTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -133,7 +136,7 @@ static void BolligerMabillardTrackStation( TrackPaintUtilDrawNarrowStationPlatform(session, ride, direction, height, 9, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -211,7 +214,10 @@ static void BolligerMabillardTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -289,7 +295,10 @@ static void BolligerMabillardTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -367,7 +376,10 @@ static void BolligerMabillardTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -457,7 +469,10 @@ static void BolligerMabillardTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -547,7 +562,10 @@ static void BolligerMabillardTrack60DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -625,7 +643,10 @@ static void BolligerMabillardTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -716,7 +737,13 @@ static void BolligerMabillardTrackLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -748,7 +775,11 @@ static void BolligerMabillardTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -777,7 +808,13 @@ static void BolligerMabillardTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -809,7 +846,11 @@ static void BolligerMabillardTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -848,7 +889,13 @@ static void BolligerMabillardTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -904,7 +951,10 @@ static void BolligerMabillardTrackFlatToLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -948,7 +998,10 @@ static void BolligerMabillardTrackFlatToRightBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -992,7 +1045,10 @@ static void BolligerMabillardTrackLeftBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1036,7 +1092,10 @@ static void BolligerMabillardTrackRightBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1087,7 +1146,13 @@ static void BolligerMabillardTrackBankedLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1119,7 +1184,11 @@ static void BolligerMabillardTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1148,7 +1217,13 @@ static void BolligerMabillardTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1180,7 +1255,11 @@ static void BolligerMabillardTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1222,7 +1301,13 @@ static void BolligerMabillardTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1285,7 +1370,10 @@ static void BolligerMabillardTrackLeftBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1336,7 +1424,10 @@ static void BolligerMabillardTrackRightBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1387,7 +1478,10 @@ static void BolligerMabillardTrack25DegUpToLeftBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1438,7 +1532,10 @@ static void BolligerMabillardTrack25DegUpToRightBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1512,7 +1609,10 @@ static void BolligerMabillardTrackLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1561,7 +1661,13 @@ static void BolligerMabillardTrackLeftQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1591,7 +1697,11 @@ static void BolligerMabillardTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1619,7 +1729,13 @@ static void BolligerMabillardTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1649,7 +1765,11 @@ static void BolligerMabillardTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1688,7 +1808,13 @@ static void BolligerMabillardTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -1731,7 +1857,13 @@ static void BolligerMabillardTrackRightQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1761,7 +1893,11 @@ static void BolligerMabillardTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1789,7 +1925,12 @@ static void BolligerMabillardTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1819,7 +1960,11 @@ static void BolligerMabillardTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1858,7 +2003,13 @@ static void BolligerMabillardTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -1921,7 +2072,13 @@ static void BolligerMabillardTrackSBendLeft( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1952,7 +2109,11 @@ static void BolligerMabillardTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1984,7 +2145,11 @@ static void BolligerMabillardTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2023,7 +2188,13 @@ static void BolligerMabillardTrackSBendLeft( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2066,7 +2237,13 @@ static void BolligerMabillardTrackSBendRight( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2097,7 +2274,11 @@ static void BolligerMabillardTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2129,7 +2310,11 @@ static void BolligerMabillardTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2168,7 +2353,13 @@ static void BolligerMabillardTrackSBendRight( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2215,7 +2406,11 @@ static void BolligerMabillardTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -2249,7 +2444,11 @@ static void BolligerMabillardTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2278,7 +2477,13 @@ static void BolligerMabillardTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -2303,7 +2508,11 @@ static void BolligerMabillardTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2335,7 +2544,11 @@ static void BolligerMabillardTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2364,7 +2577,13 @@ static void BolligerMabillardTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -2397,7 +2616,11 @@ static void BolligerMabillardTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2440,7 +2663,11 @@ static void BolligerMabillardTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -2717,7 +2944,13 @@ static void BolligerMabillardTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2748,7 +2981,13 @@ static void BolligerMabillardTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2786,7 +3025,13 @@ static void BolligerMabillardTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2842,7 +3087,13 @@ static void BolligerMabillardTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2873,7 +3124,13 @@ static void BolligerMabillardTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2914,7 +3171,13 @@ static void BolligerMabillardTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2963,7 +3226,13 @@ static void BolligerMabillardTrackLeftQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3003,7 +3272,13 @@ static void BolligerMabillardTrackLeftQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3042,7 +3317,13 @@ static void BolligerMabillardTrackRightQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3089,7 +3370,13 @@ static void BolligerMabillardTrackRightQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3155,7 +3442,12 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3187,7 +3479,13 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3228,7 +3526,12 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3270,7 +3573,12 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3302,7 +3610,13 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3338,7 +3652,12 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3385,7 +3704,12 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3417,7 +3741,13 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3458,7 +3788,12 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3500,7 +3835,12 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3532,7 +3872,13 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3568,7 +3914,12 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3645,7 +3996,12 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3678,7 +4034,11 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3707,7 +4067,13 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3739,7 +4105,11 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3781,7 +4151,12 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3823,7 +4198,12 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3856,7 +4236,11 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3885,7 +4269,12 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -3917,7 +4306,11 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3954,7 +4347,12 @@ static void BolligerMabillardTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4001,7 +4399,12 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4034,7 +4437,11 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4063,7 +4470,12 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4095,7 +4507,11 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4144,7 +4560,12 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4186,7 +4607,12 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4219,7 +4645,11 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4248,7 +4678,13 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -4280,7 +4716,11 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4324,7 +4764,12 @@ static void BolligerMabillardTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4402,7 +4847,7 @@ static void BolligerMabillardTrackLeftQuarterTurn160DegUp( break; } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4447,7 +4892,7 @@ static void BolligerMabillardTrackRightQuarterTurn160DegUp( break; } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4495,7 +4940,10 @@ static void BolligerMabillardTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -4540,7 +4988,10 @@ static void BolligerMabillardTrack25DegUpLeftBanked( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -4585,7 +5036,10 @@ static void BolligerMabillardTrack25DegUpRightBanked( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -4621,7 +5075,7 @@ static void BolligerMabillardTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -4676,7 +5130,10 @@ static void BolligerMabillardTrack90DegUp( } PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4729,7 +5186,10 @@ static void BolligerMabillardTrack60DegUpTo90DegUp( } PaintUtilSetVerticalTunnel(session, height + 56); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4784,7 +5244,10 @@ static void BolligerMabillardTrack90DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); } @@ -4824,7 +5287,10 @@ static void BolligerMabillardTrack60DegDownTo90DegDown( PaintUtilPushTunnelRotated(session, direction, height + 48, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -4869,7 +5335,10 @@ static void BolligerMabillardTrackLeftEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4898,7 +5367,11 @@ static void BolligerMabillardTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4927,13 +5400,24 @@ static void BolligerMabillardTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4970,7 +5454,11 @@ static void BolligerMabillardTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5014,7 +5502,10 @@ static void BolligerMabillardTrackRightEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5043,7 +5534,11 @@ static void BolligerMabillardTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5072,13 +5567,24 @@ static void BolligerMabillardTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5115,7 +5621,11 @@ static void BolligerMabillardTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5179,7 +5689,10 @@ static void BolligerMabillardTrackLeftEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5208,7 +5721,11 @@ static void BolligerMabillardTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5237,13 +5754,24 @@ static void BolligerMabillardTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5280,7 +5808,11 @@ static void BolligerMabillardTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5324,7 +5856,10 @@ static void BolligerMabillardTrackRightEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5353,7 +5888,11 @@ static void BolligerMabillardTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5382,13 +5921,24 @@ static void BolligerMabillardTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5425,7 +5975,11 @@ static void BolligerMabillardTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5483,7 +6037,13 @@ static void BolligerMabillardTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5510,7 +6070,12 @@ static void BolligerMabillardTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5537,7 +6102,13 @@ static void BolligerMabillardTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5592,7 +6163,13 @@ static void BolligerMabillardTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5629,7 +6206,13 @@ static void BolligerMabillardTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5656,7 +6239,12 @@ static void BolligerMabillardTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5683,7 +6271,13 @@ static void BolligerMabillardTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5738,7 +6332,13 @@ static void BolligerMabillardTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -5775,7 +6375,13 @@ static void BolligerMabillardTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -5802,7 +6408,12 @@ static void BolligerMabillardTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -5829,7 +6440,13 @@ static void BolligerMabillardTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -5884,7 +6501,13 @@ static void BolligerMabillardTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -5921,7 +6544,13 @@ static void BolligerMabillardTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5948,7 +6577,12 @@ static void BolligerMabillardTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5975,7 +6609,13 @@ static void BolligerMabillardTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6030,7 +6670,13 @@ static void BolligerMabillardTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -6067,7 +6713,13 @@ static void BolligerMabillardTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6094,7 +6746,12 @@ static void BolligerMabillardTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6121,7 +6778,13 @@ static void BolligerMabillardTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6176,7 +6839,13 @@ static void BolligerMabillardTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6213,7 +6882,13 @@ static void BolligerMabillardTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6240,7 +6915,12 @@ static void BolligerMabillardTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6267,7 +6947,13 @@ static void BolligerMabillardTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6322,7 +7008,13 @@ static void BolligerMabillardTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6359,7 +7051,13 @@ static void BolligerMabillardTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6386,7 +7084,12 @@ static void BolligerMabillardTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6413,7 +7116,13 @@ static void BolligerMabillardTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6468,7 +7177,13 @@ static void BolligerMabillardTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6505,7 +7220,13 @@ static void BolligerMabillardTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6532,7 +7253,12 @@ static void BolligerMabillardTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6559,7 +7285,13 @@ static void BolligerMabillardTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6614,7 +7346,13 @@ static void BolligerMabillardTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6651,7 +7389,13 @@ static void BolligerMabillardTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -6678,7 +7422,12 @@ static void BolligerMabillardTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -6705,7 +7454,13 @@ static void BolligerMabillardTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -6760,7 +7515,13 @@ static void BolligerMabillardTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -6797,7 +7558,13 @@ static void BolligerMabillardTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -6823,7 +7590,12 @@ static void BolligerMabillardTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -6849,7 +7621,13 @@ static void BolligerMabillardTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -6903,7 +7681,13 @@ static void BolligerMabillardTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -6941,7 +7725,13 @@ static void BolligerMabillardTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6968,7 +7758,12 @@ static void BolligerMabillardTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6995,7 +7790,13 @@ static void BolligerMabillardTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7050,7 +7851,13 @@ static void BolligerMabillardTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7087,7 +7894,13 @@ static void BolligerMabillardTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7114,7 +7927,12 @@ static void BolligerMabillardTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7141,7 +7959,13 @@ static void BolligerMabillardTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7196,7 +8020,13 @@ static void BolligerMabillardTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7233,7 +8063,13 @@ static void BolligerMabillardTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7260,7 +8096,12 @@ static void BolligerMabillardTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7287,7 +8128,13 @@ static void BolligerMabillardTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7342,7 +8189,13 @@ static void BolligerMabillardTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7379,7 +8232,13 @@ static void BolligerMabillardTrackDiagFlatTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -7406,7 +8265,12 @@ static void BolligerMabillardTrackDiagFlatTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -7433,7 +8297,13 @@ static void BolligerMabillardTrackDiagFlatTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -7488,7 +8358,13 @@ static void BolligerMabillardTrackDiagFlatTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -7525,7 +8401,13 @@ static void BolligerMabillardTrackDiag60DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7552,7 +8434,12 @@ static void BolligerMabillardTrackDiag60DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7579,7 +8466,13 @@ static void BolligerMabillardTrackDiag60DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7634,7 +8527,13 @@ static void BolligerMabillardTrackDiag60DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7671,7 +8570,13 @@ static void BolligerMabillardTrackDiagFlatTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7698,7 +8603,12 @@ static void BolligerMabillardTrackDiagFlatTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7725,7 +8635,13 @@ static void BolligerMabillardTrackDiagFlatTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7780,7 +8696,13 @@ static void BolligerMabillardTrackDiagFlatTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7817,7 +8739,13 @@ static void BolligerMabillardTrackDiag60DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -7844,7 +8772,12 @@ static void BolligerMabillardTrackDiag60DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -7871,7 +8804,13 @@ static void BolligerMabillardTrackDiag60DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -7926,7 +8865,13 @@ static void BolligerMabillardTrackDiag60DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -7949,7 +8894,13 @@ static void BolligerMabillardTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7965,7 +8916,12 @@ static void BolligerMabillardTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7978,7 +8934,13 @@ static void BolligerMabillardTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8005,7 +8967,13 @@ static void BolligerMabillardTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8028,7 +8996,13 @@ static void BolligerMabillardTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8041,7 +9015,12 @@ static void BolligerMabillardTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8057,7 +9036,13 @@ static void BolligerMabillardTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8084,7 +9069,13 @@ static void BolligerMabillardTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8107,7 +9098,13 @@ static void BolligerMabillardTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8123,7 +9120,12 @@ static void BolligerMabillardTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8136,7 +9138,13 @@ static void BolligerMabillardTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8163,7 +9171,13 @@ static void BolligerMabillardTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8186,7 +9200,13 @@ static void BolligerMabillardTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8199,7 +9219,12 @@ static void BolligerMabillardTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8215,7 +9240,13 @@ static void BolligerMabillardTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8242,7 +9273,13 @@ static void BolligerMabillardTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8265,7 +9302,13 @@ static void BolligerMabillardTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8281,7 +9324,12 @@ static void BolligerMabillardTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8294,7 +9342,13 @@ static void BolligerMabillardTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8321,7 +9375,13 @@ static void BolligerMabillardTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8344,7 +9404,13 @@ static void BolligerMabillardTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8357,7 +9423,12 @@ static void BolligerMabillardTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8373,7 +9444,13 @@ static void BolligerMabillardTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8400,7 +9477,13 @@ static void BolligerMabillardTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8423,7 +9506,13 @@ static void BolligerMabillardTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8439,7 +9528,12 @@ static void BolligerMabillardTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -8452,7 +9546,13 @@ static void BolligerMabillardTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -8479,7 +9579,13 @@ static void BolligerMabillardTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -8502,7 +9608,13 @@ static void BolligerMabillardTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8515,7 +9627,12 @@ static void BolligerMabillardTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -8531,7 +9648,13 @@ static void BolligerMabillardTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -8558,7 +9681,13 @@ static void BolligerMabillardTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -8581,7 +9710,13 @@ static void BolligerMabillardTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8596,7 +9731,12 @@ static void BolligerMabillardTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8608,7 +9748,13 @@ static void BolligerMabillardTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8634,7 +9780,13 @@ static void BolligerMabillardTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -8658,7 +9810,13 @@ static void BolligerMabillardTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8670,7 +9828,12 @@ static void BolligerMabillardTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8685,7 +9848,13 @@ static void BolligerMabillardTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8711,7 +9880,13 @@ static void BolligerMabillardTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -8735,7 +9910,13 @@ static void BolligerMabillardTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8751,7 +9932,12 @@ static void BolligerMabillardTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8764,7 +9950,13 @@ static void BolligerMabillardTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8791,7 +9983,13 @@ static void BolligerMabillardTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8814,7 +10012,13 @@ static void BolligerMabillardTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8827,7 +10031,12 @@ static void BolligerMabillardTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8843,7 +10052,13 @@ static void BolligerMabillardTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8870,7 +10085,13 @@ static void BolligerMabillardTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8893,7 +10114,13 @@ static void BolligerMabillardTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8906,7 +10133,12 @@ static void BolligerMabillardTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8919,7 +10151,13 @@ static void BolligerMabillardTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8946,7 +10184,13 @@ static void BolligerMabillardTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8969,7 +10213,13 @@ static void BolligerMabillardTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8982,7 +10232,12 @@ static void BolligerMabillardTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8995,7 +10250,13 @@ static void BolligerMabillardTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -9022,7 +10283,13 @@ static void BolligerMabillardTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -9064,7 +10331,13 @@ static void BolligerMabillardTrackLeftBankToLeftQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -9104,7 +10377,13 @@ static void BolligerMabillardTrackLeftBankToLeftQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -9146,7 +10425,13 @@ static void BolligerMabillardTrackRightBankToRightQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -9193,7 +10478,13 @@ static void BolligerMabillardTrackRightBankToRightQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -9239,7 +10530,13 @@ static void BolligerMabillardTrackLeftQuarterTurn325DegDownToLeftBank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -9282,7 +10579,13 @@ static void BolligerMabillardTrackLeftQuarterTurn325DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -9321,7 +10624,13 @@ static void BolligerMabillardTrackRightQuarterTurn325DegDownToRightBank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -9364,7 +10673,13 @@ static void BolligerMabillardTrackRightQuarterTurn325DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -9397,7 +10712,10 @@ static void BolligerMabillardTrackBlockBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -9435,7 +10753,13 @@ static void BolligerMabillardTrackLeftBankedQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -9477,7 +10801,13 @@ static void BolligerMabillardTrackLeftBankedQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -9517,7 +10847,13 @@ static void BolligerMabillardTrackRightBankedQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -9566,7 +10902,13 @@ static void BolligerMabillardTrackRightBankedQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -9629,7 +10971,13 @@ static void BolligerMabillardTrackLeftBankedQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -9660,7 +11008,11 @@ static void BolligerMabillardTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -9688,7 +11040,13 @@ static void BolligerMabillardTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -9720,7 +11078,11 @@ static void BolligerMabillardTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -9759,7 +11121,13 @@ static void BolligerMabillardTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -9802,7 +11170,13 @@ static void BolligerMabillardTrackRightBankedQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -9833,7 +11207,11 @@ static void BolligerMabillardTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -9861,7 +11239,12 @@ static void BolligerMabillardTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -9893,7 +11276,11 @@ static void BolligerMabillardTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -9932,7 +11319,13 @@ static void BolligerMabillardTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -10002,7 +11395,10 @@ static void BolligerMabillardTrack25DegUpToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -10050,7 +11446,10 @@ static void BolligerMabillardTrack25DegUpToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -10098,7 +11497,10 @@ static void BolligerMabillardTrackLeftBanked25DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -10146,7 +11548,10 @@ static void BolligerMabillardTrackRightBanked25DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -10227,7 +11632,10 @@ static void BolligerMabillardTrackLeftBankedFlatToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -10272,7 +11680,10 @@ static void BolligerMabillardTrackRightBankedFlatToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -10317,7 +11728,10 @@ static void BolligerMabillardTrackLeftBanked25DegUpToLeftBankedFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -10362,7 +11776,10 @@ static void BolligerMabillardTrackRightBanked25DegUpToRightBankedFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -10446,7 +11863,10 @@ static void BolligerMabillardTrackFlatToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -10494,7 +11914,10 @@ static void BolligerMabillardTrackFlatToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -10542,7 +11965,10 @@ static void BolligerMabillardTrackLeftBanked25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -10590,7 +12016,10 @@ static void BolligerMabillardTrackRightBanked25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -10669,7 +12098,10 @@ static void BolligerMabillardTrackLeftQuarterTurn190DegUp( } PaintUtilSetVerticalTunnel(session, height + 96); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -10716,7 +12148,10 @@ static void BolligerMabillardTrackRightQuarterTurn190DegUp( } PaintUtilSetVerticalTunnel(session, height + 96); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -10823,7 +12258,10 @@ static void BolligerMabillardTrackFlatTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } @@ -10907,7 +12345,10 @@ static void BolligerMabillardTrack60DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -10971,7 +12412,10 @@ static void BolligerMabillardTrackBrakeForDrop( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -11009,7 +12453,10 @@ static void BolligerMabillardTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -11043,7 +12490,7 @@ static void BolligerMabillardTrackHalfLoopUp( session, supportType, MetalSupportPlace::Centre, 16, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11070,7 +12517,11 @@ static void BolligerMabillardTrackHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -11099,7 +12550,10 @@ static void BolligerMabillardTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -11177,7 +12631,7 @@ static void BolligerMabillardTrackLeftCorkscrewUp( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11206,7 +12660,12 @@ static void BolligerMabillardTrackLeftCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); @@ -11261,7 +12720,12 @@ static void BolligerMabillardTrackRightCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -11289,7 +12753,7 @@ static void BolligerMabillardTrackRightCorkscrewUp( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11318,7 +12782,12 @@ static void BolligerMabillardTrackRightCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); @@ -11394,7 +12863,10 @@ static void BolligerMabillardTrackFlatTo60DegUpLongBase( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11426,7 +12898,10 @@ static void BolligerMabillardTrackFlatTo60DegUpLongBase( MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 7, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -11458,7 +12933,10 @@ static void BolligerMabillardTrackFlatTo60DegUpLongBase( MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 9, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -11499,7 +12977,10 @@ static void BolligerMabillardTrackFlatTo60DegUpLongBase( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; } @@ -11546,7 +13027,10 @@ static void BolligerMabillardTrack60DegUpToFlatLongBase( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -11578,7 +13062,10 @@ static void BolligerMabillardTrack60DegUpToFlatLongBase( MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 16, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 2: @@ -11610,7 +13097,10 @@ static void BolligerMabillardTrack60DegUpToFlatLongBase( MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 13, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -11651,7 +13141,10 @@ static void BolligerMabillardTrack60DegUpToFlatLongBase( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; } @@ -11731,7 +13224,12 @@ static void BolligerMabillardTrackLeftBarrelRollUpToDown( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -11773,7 +13271,11 @@ static void BolligerMabillardTrackLeftBarrelRollUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -11823,7 +13325,12 @@ static void BolligerMabillardTrackLeftBarrelRollUpToDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -11886,7 +13393,12 @@ static void BolligerMabillardTrackRightBarrelRollUpToDown( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -11928,7 +13440,11 @@ static void BolligerMabillardTrackRightBarrelRollUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -11978,7 +13494,12 @@ static void BolligerMabillardTrackRightBarrelRollUpToDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -12041,7 +13562,10 @@ static void BolligerMabillardTrackPoweredLift( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -12082,7 +13606,10 @@ static void BolligerMabillardTrackLeftLargeHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -12111,7 +13638,10 @@ static void BolligerMabillardTrackLeftLargeHalfLoopUp( } MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 9, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -12140,7 +13670,11 @@ static void BolligerMabillardTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -12178,7 +13712,11 @@ static void BolligerMabillardTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -12207,7 +13745,13 @@ static void BolligerMabillardTrackLeftLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -12236,7 +13780,11 @@ static void BolligerMabillardTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -12270,7 +13818,11 @@ static void BolligerMabillardTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -12314,7 +13866,10 @@ static void BolligerMabillardTrackRightLargeHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -12343,7 +13898,10 @@ static void BolligerMabillardTrackRightLargeHalfLoopUp( } MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 9, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -12372,7 +13930,11 @@ static void BolligerMabillardTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -12410,7 +13972,11 @@ static void BolligerMabillardTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -12439,7 +14005,13 @@ static void BolligerMabillardTrackRightLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -12468,7 +14040,11 @@ static void BolligerMabillardTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -12502,7 +14078,11 @@ static void BolligerMabillardTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -12557,7 +14137,10 @@ static void BolligerMabillardTrack90DegToInvertedFlatQuarterLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -12585,7 +14168,10 @@ static void BolligerMabillardTrack90DegToInvertedFlatQuarterLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -12617,7 +14203,10 @@ static void BolligerMabillardTrack90DegToInvertedFlatQuarterLoopUp( PaintUtilPushTunnelRotated(session, direction, height + 16, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -12658,7 +14247,10 @@ void BolligerMabillardTrackBooster( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -12700,7 +14292,11 @@ static void BolligerMabillardTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12726,7 +14322,11 @@ static void BolligerMabillardTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12752,7 +14352,11 @@ static void BolligerMabillardTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 0, height + 4, session.SupportColours); @@ -12808,7 +14412,11 @@ static void BolligerMabillardTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12834,7 +14442,11 @@ static void BolligerMabillardTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12860,7 +14472,11 @@ static void BolligerMabillardTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 0, height + 4, session.SupportColours); @@ -12907,7 +14523,11 @@ static void BolligerMabillardTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 0, height + 4, session.SupportColours); @@ -12939,7 +14559,11 @@ static void BolligerMabillardTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12979,7 +14603,11 @@ static void BolligerMabillardTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -13015,7 +14643,11 @@ static void BolligerMabillardTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup(session, supportType, MetalSupportPlace::Centre, 0, height + 4, session.SupportColours); @@ -13047,7 +14679,11 @@ static void BolligerMabillardTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -13087,7 +14723,11 @@ static void BolligerMabillardTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; diff --git a/src/openrct2/ride/coaster/ClassicStandUpRollerCoaster.cpp b/src/openrct2/ride/coaster/ClassicStandUpRollerCoaster.cpp new file mode 100644 index 0000000000..46ab987077 --- /dev/null +++ b/src/openrct2/ride/coaster/ClassicStandUpRollerCoaster.cpp @@ -0,0 +1,1528 @@ +/***************************************************************************** + * Copyright (c) 2014-2024 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "../../sprites.h" +#include "../Track.h" +#include "../TrackPaint.h" + +#include + +static constexpr ImageIndex kClassicStandUpRcFlatToRightBank0 = SPR_CSG_BEGIN + 67009; +static constexpr ImageIndex kClassicStandUpRcFlatToLeftBank2 = SPR_CSG_BEGIN + 67010; +static constexpr ImageIndex kClassicStandUpRcFlatToLeftBank0 = SPR_CSG_BEGIN + 67011; +static constexpr ImageIndex kClassicStandUpRcFlatToRightBank2 = SPR_CSG_BEGIN + 67012; +static constexpr ImageIndex kClassicStandUpRcFlatToLeftBank3 = SPR_CSG_BEGIN + 67013; +static constexpr ImageIndex kClassicStandUpRcFlatToRightBank1 = SPR_CSG_BEGIN + 67014; +static constexpr ImageIndex kClassicStandUpRcFlatToRightBank3 = SPR_CSG_BEGIN + 67015; +static constexpr ImageIndex kClassicStandUpRcFlatToLeftBank1 = SPR_CSG_BEGIN + 67016; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked0_0 = SPR_CSG_BEGIN + 67017; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked0_1 = SPR_CSG_BEGIN + 67018; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked0_2 = SPR_CSG_BEGIN + 67019; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked0_3 = SPR_CSG_BEGIN + 67020; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked0_4 = SPR_CSG_BEGIN + 67021; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked1_0 = SPR_CSG_BEGIN + 67022; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked1_1 = SPR_CSG_BEGIN + 67023; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked1_2 = SPR_CSG_BEGIN + 67024; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked1_3 = SPR_CSG_BEGIN + 67025; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked1_4 = SPR_CSG_BEGIN + 67026; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked2_0 = SPR_CSG_BEGIN + 67027; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked2_1 = SPR_CSG_BEGIN + 67028; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked2_2 = SPR_CSG_BEGIN + 67029; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked2_3 = SPR_CSG_BEGIN + 67030; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked2_4 = SPR_CSG_BEGIN + 67031; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked3_0 = SPR_CSG_BEGIN + 67032; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked3_1 = SPR_CSG_BEGIN + 67033; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked3_2 = SPR_CSG_BEGIN + 67034; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked3_3 = SPR_CSG_BEGIN + 67035; +static constexpr ImageIndex kClassicStandUpRcRightTurn5TilesBanked3_4 = SPR_CSG_BEGIN + 67036; +static constexpr ImageIndex kClassicStandUpRc25DegUpToFlatRightBanked0 = SPR_CSG_BEGIN + 67037; +static constexpr ImageIndex kClassicStandUpRc25DegUpToFlatRightBanked1 = SPR_CSG_BEGIN + 67038; +static constexpr ImageIndex kClassicStandUpRc25DegUpToFlatRightBanked2 = SPR_CSG_BEGIN + 67039; +static constexpr ImageIndex kClassicStandUpRc25DegUpToFlatRightBanked3 = SPR_CSG_BEGIN + 67040; +static constexpr ImageIndex kClassicStandUpRc25DegUpToFlatLeftBanked0 = SPR_CSG_BEGIN + 67041; +static constexpr ImageIndex kClassicStandUpRc25DegUpToFlatLeftBanked1 = SPR_CSG_BEGIN + 67042; +static constexpr ImageIndex kClassicStandUpRc25DegUpToFlatLeftBanked2 = SPR_CSG_BEGIN + 67043; +static constexpr ImageIndex kClassicStandUpRc25DegUpToFlatLeftBanked3 = SPR_CSG_BEGIN + 67044; +static constexpr ImageIndex kClassicStandUpRcLeftBankedTo25DegUp0 = SPR_CSG_BEGIN + 67045; +static constexpr ImageIndex kClassicStandUpRcLeftBankedTo25DegUp1 = SPR_CSG_BEGIN + 67046; +static constexpr ImageIndex kClassicStandUpRcLeftBankedTo25DegUp2 = SPR_CSG_BEGIN + 67047; +static constexpr ImageIndex kClassicStandUpRcLeftBankedTo25DegUp3 = SPR_CSG_BEGIN + 67048; +static constexpr ImageIndex kClassicStandUpRcRightBankedTo25DegUp0 = SPR_CSG_BEGIN + 67049; +static constexpr ImageIndex kClassicStandUpRcRightBankedTo25DegUp1 = SPR_CSG_BEGIN + 67050; +static constexpr ImageIndex kClassicStandUpRcRightBankedTo25DegUp2 = SPR_CSG_BEGIN + 67051; +static constexpr ImageIndex kClassicStandUpRcRightBankedTo25DegUp3 = SPR_CSG_BEGIN + 67052; +static constexpr ImageIndex kClassicStandUpRcLeftBanked0 = SPR_CSG_BEGIN + 67053; +static constexpr ImageIndex kClassicStandUpRcLeftBanked1 = SPR_CSG_BEGIN + 67054; +static constexpr ImageIndex kClassicStandUpRcLeftBanked2 = SPR_CSG_BEGIN + 67055; +static constexpr ImageIndex kClassicStandUpRcLeftBanked3 = SPR_CSG_BEGIN + 67056; + +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked0_0 = SPR_CSG_BEGIN + 67229; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked0_1 = SPR_CSG_BEGIN + 67230; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked0_2 = SPR_CSG_BEGIN + 67231; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked1_0 = SPR_CSG_BEGIN + 67232; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked1_1 = SPR_CSG_BEGIN + 67233; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked1_2 = SPR_CSG_BEGIN + 67234; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked2_0 = SPR_CSG_BEGIN + 67235; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked2_1 = SPR_CSG_BEGIN + 67236; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked2_2 = SPR_CSG_BEGIN + 67237; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked3_0 = SPR_CSG_BEGIN + 67238; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked3_1 = SPR_CSG_BEGIN + 67239; +static constexpr ImageIndex kClassicStandUpRcRightTurn3TilesBanked3_2 = SPR_CSG_BEGIN + 67240; + +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag0_0 = SPR_CSG_BEGIN + 67361; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag0_1 = SPR_CSG_BEGIN + 67362; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag0_2 = SPR_CSG_BEGIN + 67363; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag0_3 = SPR_CSG_BEGIN + 67364; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag1_0 = SPR_CSG_BEGIN + 67365; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag1_1 = SPR_CSG_BEGIN + 67366; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag1_2 = SPR_CSG_BEGIN + 67367; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag1_3 = SPR_CSG_BEGIN + 67368; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag2_0 = SPR_CSG_BEGIN + 67369; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag2_1 = SPR_CSG_BEGIN + 67370; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag2_2 = SPR_CSG_BEGIN + 67371; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag2_3 = SPR_CSG_BEGIN + 67372; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag3_0 = SPR_CSG_BEGIN + 67373; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag3_1 = SPR_CSG_BEGIN + 67374; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag3_2 = SPR_CSG_BEGIN + 67375; +static constexpr ImageIndex kClassicStandUpRcRightBankedOrthogonalToDiag3_3 = SPR_CSG_BEGIN + 67376; + +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag0_0 = SPR_CSG_BEGIN + 67377; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag0_1 = SPR_CSG_BEGIN + 67378; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag0_2 = SPR_CSG_BEGIN + 67379; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag0_3 = SPR_CSG_BEGIN + 67380; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag1_0 = SPR_CSG_BEGIN + 67381; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag1_1 = SPR_CSG_BEGIN + 67382; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag1_2 = SPR_CSG_BEGIN + 67383; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag1_3 = SPR_CSG_BEGIN + 67384; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag2_0 = SPR_CSG_BEGIN + 67385; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag2_1 = SPR_CSG_BEGIN + 67386; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag2_2 = SPR_CSG_BEGIN + 67387; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag2_3 = SPR_CSG_BEGIN + 67388; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag3_0 = SPR_CSG_BEGIN + 67389; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag3_1 = SPR_CSG_BEGIN + 67390; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag3_2 = SPR_CSG_BEGIN + 67391; +static constexpr ImageIndex kClassicStandUpRcLeftBankedOrthogonalToDiag3_3 = SPR_CSG_BEGIN + 67392; + +static constexpr ImageIndex kClassicStandUpRcLeftBankedStraightDiag0 = SPR_CSG_BEGIN + 67421; +static constexpr ImageIndex kClassicStandUpRcLeftBankedStraightDiag1 = SPR_CSG_BEGIN + 67422; +static constexpr ImageIndex kClassicStandUpRcLeftBankedStraightDiag2 = SPR_CSG_BEGIN + 67423; +static constexpr ImageIndex kClassicStandUpRcLeftBankedStraightDiag3 = SPR_CSG_BEGIN + 67424; +static constexpr ImageIndex kClassicStandUpRcFlatToLeftBankDiag0 = SPR_CSG_BEGIN + 67425; +static constexpr ImageIndex kClassicStandUpRcFlatToLeftBankDiag1 = SPR_CSG_BEGIN + 67426; +static constexpr ImageIndex kClassicStandUpRcFlatToLeftBankDiag2 = SPR_CSG_BEGIN + 67427; +static constexpr ImageIndex kClassicStandUpRcFlatToLeftBankDiag3 = SPR_CSG_BEGIN + 67428; +static constexpr ImageIndex kClassicStandUpRcFlatToRightBankDiag0 = SPR_CSG_BEGIN + 67429; +static constexpr ImageIndex kClassicStandUpRcFlatToRightBankDiag1 = SPR_CSG_BEGIN + 67430; +static constexpr ImageIndex kClassicStandUpRcFlatToRightBankDiag2 = SPR_CSG_BEGIN + 67431; +static constexpr ImageIndex kClassicStandUpRcFlatToRightBankDiag3 = SPR_CSG_BEGIN + 67432; +static constexpr ImageIndex kClassicStandUpRc25DegUpToLeftBankDiag0 = SPR_CSG_BEGIN + 67433; +static constexpr ImageIndex kClassicStandUpRc25DegUpToLeftBankDiag1 = SPR_CSG_BEGIN + 67434; +static constexpr ImageIndex kClassicStandUpRc25DegUpToLeftBankDiag2 = SPR_CSG_BEGIN + 67435; +static constexpr ImageIndex kClassicStandUpRc25DegUpToLeftBankDiag3 = SPR_CSG_BEGIN + 67436; +static constexpr ImageIndex kClassicStandUpRc25DegUpToRightBankDiag0 = SPR_CSG_BEGIN + 67437; +static constexpr ImageIndex kClassicStandUpRc25DegUpToRightBankDiag1 = SPR_CSG_BEGIN + 67438; +static constexpr ImageIndex kClassicStandUpRc25DegUpToRightBankDiag2 = SPR_CSG_BEGIN + 67439; +static constexpr ImageIndex kClassicStandUpRc25DegUpToRightBankDiag3 = SPR_CSG_BEGIN + 67440; +static constexpr ImageIndex kClassicStandUpRcLeftBankTo25DegUpDiag0 = SPR_CSG_BEGIN + 67441; +static constexpr ImageIndex kClassicStandUpRcLeftBankTo25DegUpDiag1 = SPR_CSG_BEGIN + 67442; +static constexpr ImageIndex kClassicStandUpRcLeftBankTo25DegUpDiag2 = SPR_CSG_BEGIN + 67443; +static constexpr ImageIndex kClassicStandUpRcLeftBankTo25DegUpDiag3 = SPR_CSG_BEGIN + 67444; +static constexpr ImageIndex kClassicStandUpRcRightBankTo25DegUpDiag0 = SPR_CSG_BEGIN + 67445; +static constexpr ImageIndex kClassicStandUpRcRightBankTo25DegUpDiag1 = SPR_CSG_BEGIN + 67446; +static constexpr ImageIndex kClassicStandUpRcRightBankTo25DegUpDiag2 = SPR_CSG_BEGIN + 67447; +static constexpr ImageIndex kClassicStandUpRcRightBankTo25DegUpDiag3 = SPR_CSG_BEGIN + 67448; + +static void classicStandUpRCTrackFlatToLeftBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + static constexpr ImageIndex map[NumOrthogonalDirections] = { + kClassicStandUpRcFlatToLeftBank0, + kClassicStandUpRcFlatToLeftBank1, + kClassicStandUpRcFlatToLeftBank2, + kClassicStandUpRcFlatToLeftBank3, + }; + + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(map[direction]), { 0, 6, height }, { 32, 20, 3 }); + + if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) + { + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); + } + + PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); +} + +static void classicStandUpRCTrackFlatToRightBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + static constexpr ImageIndex map[NumOrthogonalDirections] = { + kClassicStandUpRcFlatToRightBank0, + kClassicStandUpRcFlatToRightBank1, + kClassicStandUpRcFlatToRightBank2, + kClassicStandUpRcFlatToRightBank3, + }; + + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(map[direction]), { 0, 6, height }, { 32, 20, 3 }); + + if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) + { + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); + } + + PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); +} + +static void classicStandUpRCTrackLeftBankToFlat( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + return classicStandUpRCTrackFlatToRightBank( + session, ride, trackSequence, (direction + 2) % NumOrthogonalDirections, height, trackElement); +} + +static void classicStandUpRCTrackRightBankToFlat( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + return classicStandUpRCTrackFlatToLeftBank( + session, ride, trackSequence, (direction + 2) % NumOrthogonalDirections, height, trackElement); +} + +static void classicStandUpRCTrackBankedRightQuarterTurn5( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + switch (trackSequence) + { + case 0: + { + constexpr ImageIndex map[NumOrthogonalDirections] = { + kClassicStandUpRcRightTurn5TilesBanked0_0, + kClassicStandUpRcRightTurn5TilesBanked1_0, + kClassicStandUpRcRightTurn5TilesBanked2_0, + kClassicStandUpRcRightTurn5TilesBanked3_0, + }; + + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(map[direction]), { 0, 6, height }, { 32, 20, 3 }); + + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); + switch (direction) + { + case 0: + PaintUtilPushTunnelLeft(session, height, TUNNEL_0); + break; + case 3: + PaintUtilPushTunnelRight(session, height, TUNNEL_0); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); + break; + } + case 1: + break; + + case 2: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked0_1), + { 0, 16, height }, { 32, 16, 3 }); + break; + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked1_1), + { 0, 16, height }, { 32, 16, 3 }); + break; + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked2_1), + { 0, 0, height }, { 32, 16, 3 }); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked3_1), + { 0, 0, height }, { 32, 16, 3 }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); + break; + + case 3: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked0_2), + { 0, 0, height }, { 16, 16, 3 }); + break; + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked1_2), + { 16, 0, height }, { 16, 16, 3 }); + break; + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked2_2), + { 16, 16, height }, { 16, 16, 3 }); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked3_2), + { 0, 16, height }, { 16, 16, 3 }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); + break; + + case 4: + break; + + case 5: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked0_3), + { 16, 0, height }, { 16, 32, 3 }); + break; + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked1_3), + { 0, 0, height }, { 16, 32, 3 }); + break; + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked2_3), + { 0, 0, height }, { 16, 32, 3 }); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(kClassicStandUpRcRightTurn5TilesBanked3_3), + { 16, 0, height }, { 16, 32, 3 }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::bottomLeftSide, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + break; + + case 6: + { + constexpr ImageIndex map[NumOrthogonalDirections] = { + kClassicStandUpRcRightTurn5TilesBanked0_4, + kClassicStandUpRcRightTurn5TilesBanked1_4, + kClassicStandUpRcRightTurn5TilesBanked2_4, + kClassicStandUpRcRightTurn5TilesBanked3_4, + }; + + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(map[direction]), { 6, 0, height }, { 20, 32, 3 }); + + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); + if (direction == 1 || direction == 0) + { + PaintUtilPushTunnelRotated(session, direction ^ 1, height, TUNNEL_0); + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + break; + } + } + + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); +} + +static void classicStandUpRCTrackBankedLeftQuarterTurn5( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence]; + direction = (direction + 1) % NumOrthogonalDirections; + return classicStandUpRCTrackBankedRightQuarterTurn5(session, ride, trackSequence, direction, height, trackElement); +} + +static void classicStandUpRCTrackLeftBankTo25DegUp( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + static constexpr ImageIndex map[NumOrthogonalDirections] = { + kClassicStandUpRcLeftBankedTo25DegUp0, + kClassicStandUpRcLeftBankedTo25DegUp1, + kClassicStandUpRcLeftBankedTo25DegUp2, + kClassicStandUpRcLeftBankedTo25DegUp3, + }; + + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(map[direction]), { 0, 6, height }, { 32, 20, 3 }); + + if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) + { + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 3, height, session.SupportColours); + } + + if (direction == 0 || direction == 3) + { + PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); + } + else + { + PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); +} + +static void classicStandUpRCTrackRightBankTo25DegUp( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + static constexpr ImageIndex map[NumOrthogonalDirections] = { + kClassicStandUpRcRightBankedTo25DegUp0, + kClassicStandUpRcRightBankedTo25DegUp1, + kClassicStandUpRcRightBankedTo25DegUp2, + kClassicStandUpRcRightBankedTo25DegUp3, + }; + + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(map[direction]), { 0, 6, height }, { 32, 20, 3 }); + + if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) + { + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 3, height, session.SupportColours); + } + + if (direction == 0 || direction == 3) + { + PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); + } + else + { + PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); +} + +static void classicStandUpRCTrack25DegUpToLeftBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + static constexpr ImageIndex map[NumOrthogonalDirections] = { + kClassicStandUpRc25DegUpToFlatLeftBanked0, + kClassicStandUpRc25DegUpToFlatLeftBanked1, + kClassicStandUpRc25DegUpToFlatLeftBanked2, + kClassicStandUpRc25DegUpToFlatLeftBanked3, + }; + + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(map[direction]), { 0, 6, height }, { 32, 20, 3 }); + + if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) + { + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 6, height, session.SupportColours); + } + + if (direction == 0 || direction == 3) + { + PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_0); + } + else + { + PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); +} + +static void classicStandUpRCTrack25DegUpToRightBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + static constexpr ImageIndex map[NumOrthogonalDirections] = { + kClassicStandUpRc25DegUpToFlatRightBanked0, + kClassicStandUpRc25DegUpToFlatRightBanked1, + kClassicStandUpRc25DegUpToFlatRightBanked2, + kClassicStandUpRc25DegUpToFlatRightBanked3, + }; + + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(map[direction]), { 0, 6, height }, { 32, 20, 3 }); + + if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) + { + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 6, height, session.SupportColours); + } + + if (direction == 0 || direction == 3) + { + PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_0); + } + else + { + PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); +} + +static void classicStandUpRCTrackLeftBankTo25DegDown( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrack25DegUpToRightBank( + session, ride, trackSequence, (direction + 2) % NumOrthogonalDirections, height, trackElement); +} + +static void classicStandUpRCTrackRightBankTo25DegDown( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrack25DegUpToLeftBank( + session, ride, trackSequence, (direction + 2) % NumOrthogonalDirections, height, trackElement); +} + +static void classicStandUpRCTrack25DegDownToLeftBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrackRightBankTo25DegUp( + session, ride, trackSequence, (direction + 2) % NumOrthogonalDirections, height, trackElement); +} + +static void classicStandUpRCTrack25DegDownToRightBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrackLeftBankTo25DegUp( + session, ride, trackSequence, (direction + 2) % NumOrthogonalDirections, height, trackElement); +} + +static void classicStandUpRCTrackLeftBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + static constexpr ImageIndex map[NumOrthogonalDirections] = { + kClassicStandUpRcLeftBanked0, + kClassicStandUpRcLeftBanked1, + kClassicStandUpRcLeftBanked2, + kClassicStandUpRcLeftBanked3, + }; + + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(map[direction]), { 0, 6, height }, { 32, 20, 3 }); + + if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) + { + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); + } + + PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); +} + +static void classicStandUpRCTrackRightBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + return classicStandUpRCTrackLeftBank( + session, ride, trackSequence, (direction + 2) % NumOrthogonalDirections, height, trackElement); +} + +static void classicStandUpRCTrackLeftEighthBankToDiag( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + static constexpr ImageIndex map[5][NumOrthogonalDirections] = { + { kClassicStandUpRcLeftBankedOrthogonalToDiag0_0, kClassicStandUpRcLeftBankedOrthogonalToDiag1_0, + kClassicStandUpRcLeftBankedOrthogonalToDiag2_0, kClassicStandUpRcLeftBankedOrthogonalToDiag3_0 }, + { kClassicStandUpRcLeftBankedOrthogonalToDiag0_1, kClassicStandUpRcLeftBankedOrthogonalToDiag1_1, + kClassicStandUpRcLeftBankedOrthogonalToDiag2_1, kClassicStandUpRcLeftBankedOrthogonalToDiag3_1 }, + { kClassicStandUpRcLeftBankedOrthogonalToDiag0_2, kClassicStandUpRcLeftBankedOrthogonalToDiag1_2, + kClassicStandUpRcLeftBankedOrthogonalToDiag2_2, kClassicStandUpRcLeftBankedOrthogonalToDiag3_2 }, + { ImageIndexUndefined, ImageIndexUndefined, ImageIndexUndefined, ImageIndexUndefined }, + { kClassicStandUpRcLeftBankedOrthogonalToDiag0_3, kClassicStandUpRcLeftBankedOrthogonalToDiag1_3, + kClassicStandUpRcLeftBankedOrthogonalToDiag2_3, kClassicStandUpRcLeftBankedOrthogonalToDiag3_3 }, + }; + + const auto imageId = map[trackSequence][direction]; + + switch (trackSequence) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 6, height }, { 32, 20, 3 } }); + + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); + if (direction == 0 || direction == 3) + { + PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); + break; + case 1: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 0, height }, { 32, 16, 3 } }); + break; + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 0, height }, { 34, 16, 3 } }); + break; + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 16, height }, { 32, 16, 3 } }); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 16, height }, { 32, 16, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); + break; + case 2: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 16, height }, { 16, 16, 3 } }); + break; + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 16, 16, height }, { 16, 16, 3 } }); + break; + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 16, 0, height }, { 16, 16, 3 } }); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 0, height }, { 16, 16, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); + break; + case 3: + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); + break; + case 4: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 16, 16, height }, { 16, 16, 3 } }); + break; + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 16, height }, { 16, 18, 3 } }); + break; + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 0, height }, { 16, 16, 3 } }); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 16, 0, height }, { 16, 16, 3 } }); + break; + } + MetalASupportsPaintSetupRotated( + session, MetalSupportType::Tubes, MetalSupportPlace::BottomCorner, direction, 0, height, + session.SupportColours); + + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); + break; + } +} + +static void classicStandUpRCTrackRightEighthBankToDiag( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + static constexpr ImageIndex map[5][NumOrthogonalDirections] = { + { kClassicStandUpRcRightBankedOrthogonalToDiag0_0, kClassicStandUpRcRightBankedOrthogonalToDiag1_0, + kClassicStandUpRcRightBankedOrthogonalToDiag2_0, kClassicStandUpRcRightBankedOrthogonalToDiag3_0 }, + { kClassicStandUpRcRightBankedOrthogonalToDiag0_1, kClassicStandUpRcRightBankedOrthogonalToDiag1_1, + kClassicStandUpRcRightBankedOrthogonalToDiag2_1, kClassicStandUpRcRightBankedOrthogonalToDiag3_1 }, + { kClassicStandUpRcRightBankedOrthogonalToDiag0_2, kClassicStandUpRcRightBankedOrthogonalToDiag1_2, + kClassicStandUpRcRightBankedOrthogonalToDiag2_2, kClassicStandUpRcRightBankedOrthogonalToDiag3_2 }, + { ImageIndexUndefined, ImageIndexUndefined, ImageIndexUndefined, ImageIndexUndefined }, + { kClassicStandUpRcRightBankedOrthogonalToDiag0_3, kClassicStandUpRcRightBankedOrthogonalToDiag1_3, + kClassicStandUpRcRightBankedOrthogonalToDiag2_3, kClassicStandUpRcRightBankedOrthogonalToDiag3_3 }, + }; + + const auto imageId = map[trackSequence][direction]; + + switch (trackSequence) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 6, height }, { 32, 20, 3 } }); + + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); + if (direction == 0 || direction == 3) + { + PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); + break; + case 1: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 16, height }, { 32, 16, 3 } }); + break; + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 16, height }, { 32, 16, 3 } }); + break; + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 0, height }, { 34, 16, 3 } }); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 0, height }, { 32, 16, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); + break; + case 2: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 0, height }, { 16, 16, 3 } }); + break; + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 16, 0, height }, { 16, 16, 3 } }); + break; + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 4, 4, height }, { 28, 28, 3 } }); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 16, height }, { 16, 16, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); + break; + case 3: + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); + break; + case 4: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 16, 0, height }, { 16, 16, 3 } }); + break; + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 0, height }, { 16, 16, 3 } }); + break; + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 0, 16, height }, { 16, 18, 3 } }); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, + { { 16, 16, height }, { 16, 16, 3 } }); + break; + } + MetalASupportsPaintSetupRotated( + session, MetalSupportType::Tubes, MetalSupportPlace::LeftCorner, direction, 0, height, session.SupportColours); + + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); + break; + } +} + +static void classicStandUpRCTrackLeftEighthDiagBankToOrthogonal( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence]; + direction = (direction + 2) % NumOrthogonalDirections; + classicStandUpRCTrackRightEighthBankToDiag(session, ride, trackSequence, direction, height, trackElement); +} + +static void classicStandUpRCTrackRightEighthDiagBankToOrthogonal( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence]; + direction = (direction + 3) % NumOrthogonalDirections; + classicStandUpRCTrackLeftEighthBankToDiag(session, ride, trackSequence, direction, height, trackElement); +} + +static void classicStandUpRCTrackRightBankedQuarterTurn3( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + static constexpr ImageIndex map[4][NumOrthogonalDirections] = { + { kClassicStandUpRcRightTurn3TilesBanked0_0, kClassicStandUpRcRightTurn3TilesBanked1_0, + kClassicStandUpRcRightTurn3TilesBanked2_0, kClassicStandUpRcRightTurn3TilesBanked3_0 }, + { ImageIndexUndefined, ImageIndexUndefined, ImageIndexUndefined, ImageIndexUndefined }, + { kClassicStandUpRcRightTurn3TilesBanked0_1, kClassicStandUpRcRightTurn3TilesBanked1_1, + kClassicStandUpRcRightTurn3TilesBanked2_1, kClassicStandUpRcRightTurn3TilesBanked3_1 }, + + { kClassicStandUpRcRightTurn3TilesBanked0_2, kClassicStandUpRcRightTurn3TilesBanked1_2, + kClassicStandUpRcRightTurn3TilesBanked2_2, kClassicStandUpRcRightTurn3TilesBanked3_2 }, + }; + + auto imageId = map[trackSequence][direction]; + + switch (trackSequence) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 6, height }, { 32, 20, 3 }); + + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); + switch (direction) + { + case 0: + PaintUtilPushTunnelLeft(session, height, TUNNEL_0); + break; + case 3: + PaintUtilPushTunnelRight(session, height, TUNNEL_0); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); + break; + case 1: + break; + case 2: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 16, 16, height }, { 16, 16, 3 }); + break; + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 16, height }, { 16, 16, 3 }); + break; + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 0, 0, height }, { 16, 16, 3 }); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 16, 0, height }, { 16, 16, 3 }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + break; + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(imageId), { 6, 0, height }, { 20, 32, 3 }); + + MetalASupportsPaintSetup( + session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); + if (direction == 0 || direction == 1) + { + PaintUtilPushTunnelRotated(session, direction ^ 1, height, TUNNEL_0); + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + break; + } + + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); +} + +static void classicStandUpRCTrackLeftBankedQuarterTurn3( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence]; + direction = (direction + 1) % NumOrthogonalDirections; + classicStandUpRCTrackRightBankedQuarterTurn3(session, ride, trackSequence, direction, height, trackElement); +} + +template +static inline void classicStandUpRCTrackDiagFlatWithBank( + PaintSession& session, uint8_t trackSequence, uint8_t direction, int32_t height) +{ + switch (trackSequence) + { + case 0: + switch (direction) + { + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img3), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + break; + case 1: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img0), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); + break; + case 2: + switch (direction) + { + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img2), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + break; + case 3: + switch (direction) + { + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img1), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + MetalASupportsPaintSetupRotated( + session, MetalSupportType::Tubes, MetalSupportPlace::LeftCorner, direction, 0, height, session.SupportColours); + + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); + break; + } + + PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); +} + +static void classicStandUpRCTrackDiagFlatToLeftBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrackDiagFlatWithBank< + kClassicStandUpRcFlatToLeftBankDiag0, kClassicStandUpRcFlatToLeftBankDiag1, kClassicStandUpRcFlatToLeftBankDiag2, + kClassicStandUpRcFlatToLeftBankDiag3>(session, trackSequence, direction, height); +} + +static void classicStandUpRCTrackDiagFlatToRightBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrackDiagFlatWithBank< + kClassicStandUpRcFlatToRightBankDiag0, kClassicStandUpRcFlatToRightBankDiag1, kClassicStandUpRcFlatToRightBankDiag2, + kClassicStandUpRcFlatToRightBankDiag3>(session, trackSequence, direction, height); +} + +static void classicStandUpRCTrackDiagLeftBankToFlat( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapReversedDiagonalStraight[trackSequence]; + return classicStandUpRCTrackDiagFlatToRightBank( + session, ride, trackSequence, (direction + 2) % NumOrthogonalDirections, height, trackElement); +} + +static void classicStandUpRCTrackDiagRightBankToFlat( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapReversedDiagonalStraight[trackSequence]; + return classicStandUpRCTrackDiagFlatToLeftBank( + session, ride, trackSequence, (direction + 2) % NumOrthogonalDirections, height, trackElement); +} + +static void classicStandUpRCTrackDiagLeftBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrackDiagFlatWithBank< + kClassicStandUpRcLeftBankedStraightDiag0, kClassicStandUpRcLeftBankedStraightDiag1, + kClassicStandUpRcLeftBankedStraightDiag2, kClassicStandUpRcLeftBankedStraightDiag3>( + session, trackSequence, direction, height); +} + +static void classicStandUpRCTrackDiagRightBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapReversedDiagonalStraight[trackSequence]; + return classicStandUpRCTrackDiagLeftBank( + session, ride, trackSequence, (direction + 2) % NumOrthogonalDirections, height, trackElement); +} + +template +static void classicStandUpRCTrackDiagFlatTo25DegUpBanked( + PaintSession& session, uint8_t trackSequence, uint8_t direction, int32_t height) +{ + switch (trackSequence) + { + case 0: + switch (direction) + { + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img3), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + break; + case 1: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img0), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); + break; + case 2: + switch (direction) + { + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img2), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + break; + case 3: + switch (direction) + { + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img1), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + MetalBSupportsPaintSetupRotated( + session, MetalSupportType::Tubes, MetalSupportPlace::LeftCorner, direction, 4, height, session.SupportColours); + + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); + break; + } + + PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); +} + +static void classicStandUpRCTrackDiagLeftBankTo25DegUp( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrackDiagFlatTo25DegUpBanked< + kClassicStandUpRcLeftBankTo25DegUpDiag0, kClassicStandUpRcLeftBankTo25DegUpDiag1, + kClassicStandUpRcLeftBankTo25DegUpDiag2, kClassicStandUpRcLeftBankTo25DegUpDiag3>( + session, trackSequence, direction, height); +} + +static void classicStandUpRCTrackDiagRightBankTo25DegUp( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrackDiagFlatTo25DegUpBanked< + kClassicStandUpRcRightBankTo25DegUpDiag0, kClassicStandUpRcRightBankTo25DegUpDiag1, + kClassicStandUpRcRightBankTo25DegUpDiag2, kClassicStandUpRcRightBankTo25DegUpDiag3>( + session, trackSequence, direction, height); +} + +static void classicStandUpRCTrackDiag25DegDownToLeftBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapReversedDiagonalStraight[trackSequence]; + direction = (direction + 2) % NumOrthogonalDirections; + classicStandUpRCTrackDiagRightBankTo25DegUp(session, ride, trackSequence, direction, height, trackElement); +} + +static void classicStandUpRCTrackDiag25DegDownToRightBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapReversedDiagonalStraight[trackSequence]; + direction = (direction + 2) % NumOrthogonalDirections; + classicStandUpRCTrackDiagLeftBankTo25DegUp(session, ride, trackSequence, direction, height, trackElement); +} + +template +static void classicStandUpRCTrackDiag25DegUpToFlatBanked( + PaintSession& session, uint8_t trackSequence, uint8_t direction, int32_t height) +{ + switch (trackSequence) + { + case 0: + switch (direction) + { + case 3: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img3), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + break; + case 1: + switch (direction) + { + case 0: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img0), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); + break; + case 2: + switch (direction) + { + case 2: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img2), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); + break; + case 3: + switch (direction) + { + case 1: + PaintAddImageAsParentRotated( + session, direction, session.TrackColours.WithIndex(img1), { -16, -16, height }, + { { -16, -16, height }, { 32, 32, 3 } }); + break; + } + MetalBSupportsPaintSetupRotated( + session, MetalSupportType::Tubes, MetalSupportPlace::LeftCorner, direction, 8, height, session.SupportColours); + + PaintUtilSetSegmentSupportHeight( + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); + break; + } + + PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); +} + +static void classicStandUpRCTrackDiag25DegUpToLeftBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrackDiag25DegUpToFlatBanked< + kClassicStandUpRc25DegUpToLeftBankDiag0, kClassicStandUpRc25DegUpToLeftBankDiag1, + kClassicStandUpRc25DegUpToLeftBankDiag2, kClassicStandUpRc25DegUpToLeftBankDiag3>( + session, trackSequence, direction, height); +} + +static void classicStandUpRCTrackDiag25DegUpToRightBank( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + classicStandUpRCTrackDiag25DegUpToFlatBanked< + kClassicStandUpRc25DegUpToRightBankDiag0, kClassicStandUpRc25DegUpToRightBankDiag1, + kClassicStandUpRc25DegUpToRightBankDiag2, kClassicStandUpRc25DegUpToRightBankDiag3>( + session, trackSequence, direction, height); +} + +static void classicStandUpRCTrackDiagLeftBankTo25DegDown( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapReversedDiagonalStraight[trackSequence]; + direction = (direction + 2) % NumOrthogonalDirections; + classicStandUpRCTrackDiag25DegUpToRightBank(session, ride, trackSequence, direction, height, trackElement); +} + +static void classicStandUpRCTrackDiagRightBankTo25DegDown( + PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, + const TrackElement& trackElement) +{ + trackSequence = mapReversedDiagonalStraight[trackSequence]; + direction = (direction + 2) % NumOrthogonalDirections; + classicStandUpRCTrackDiag25DegUpToLeftBank(session, ride, trackSequence, direction, height, trackElement); +} + +TRACK_PAINT_FUNCTION GetTrackPaintFunctionClassicStandUpRC(int32_t trackType) +{ + if (!IsCsgLoaded()) + { + return GetTrackPaintFunctionStandUpRC(trackType); + } + + switch (trackType) + { + case TrackElemType::FlatToLeftBank: + return classicStandUpRCTrackFlatToLeftBank; + case TrackElemType::FlatToRightBank: + return classicStandUpRCTrackFlatToRightBank; + case TrackElemType::LeftBankToFlat: + return classicStandUpRCTrackLeftBankToFlat; + case TrackElemType::RightBankToFlat: + return classicStandUpRCTrackRightBankToFlat; + case TrackElemType::BankedLeftQuarterTurn5Tiles: + return classicStandUpRCTrackBankedLeftQuarterTurn5; + case TrackElemType::BankedRightQuarterTurn5Tiles: + return classicStandUpRCTrackBankedRightQuarterTurn5; + case TrackElemType::LeftBankToUp25: + return classicStandUpRCTrackLeftBankTo25DegUp; + case TrackElemType::RightBankToUp25: + return classicStandUpRCTrackRightBankTo25DegUp; + case TrackElemType::Up25ToLeftBank: + return classicStandUpRCTrack25DegUpToLeftBank; + case TrackElemType::Up25ToRightBank: + return classicStandUpRCTrack25DegUpToRightBank; + case TrackElemType::LeftBankToDown25: + return classicStandUpRCTrackLeftBankTo25DegDown; + case TrackElemType::RightBankToDown25: + return classicStandUpRCTrackRightBankTo25DegDown; + case TrackElemType::Down25ToLeftBank: + return classicStandUpRCTrack25DegDownToLeftBank; + case TrackElemType::Down25ToRightBank: + return classicStandUpRCTrack25DegDownToRightBank; + case TrackElemType::LeftBank: + return classicStandUpRCTrackLeftBank; + case TrackElemType::RightBank: + return classicStandUpRCTrackRightBank; + + case TrackElemType::LeftEighthBankToDiag: + return classicStandUpRCTrackLeftEighthBankToDiag; + case TrackElemType::RightEighthBankToDiag: + return classicStandUpRCTrackRightEighthBankToDiag; + case TrackElemType::LeftEighthBankToOrthogonal: + return classicStandUpRCTrackLeftEighthDiagBankToOrthogonal; + case TrackElemType::RightEighthBankToOrthogonal: + return classicStandUpRCTrackRightEighthDiagBankToOrthogonal; + + case TrackElemType::LeftBankedQuarterTurn3Tiles: + return classicStandUpRCTrackLeftBankedQuarterTurn3; + case TrackElemType::RightBankedQuarterTurn3Tiles: + return classicStandUpRCTrackRightBankedQuarterTurn3; + case TrackElemType::DiagFlatToLeftBank: + return classicStandUpRCTrackDiagFlatToLeftBank; + case TrackElemType::DiagFlatToRightBank: + return classicStandUpRCTrackDiagFlatToRightBank; + case TrackElemType::DiagLeftBankToFlat: + return classicStandUpRCTrackDiagLeftBankToFlat; + case TrackElemType::DiagRightBankToFlat: + return classicStandUpRCTrackDiagRightBankToFlat; + case TrackElemType::DiagLeftBankToUp25: + return classicStandUpRCTrackDiagLeftBankTo25DegUp; + case TrackElemType::DiagRightBankToUp25: + return classicStandUpRCTrackDiagRightBankTo25DegUp; + case TrackElemType::DiagUp25ToLeftBank: + return classicStandUpRCTrackDiag25DegUpToLeftBank; + case TrackElemType::DiagUp25ToRightBank: + return classicStandUpRCTrackDiag25DegUpToRightBank; + case TrackElemType::DiagLeftBankToDown25: + return classicStandUpRCTrackDiagLeftBankTo25DegDown; + case TrackElemType::DiagRightBankToDown25: + return classicStandUpRCTrackDiagRightBankTo25DegDown; + case TrackElemType::DiagDown25ToLeftBank: + return classicStandUpRCTrackDiag25DegDownToLeftBank; + case TrackElemType::DiagDown25ToRightBank: + return classicStandUpRCTrackDiag25DegDownToRightBank; + case TrackElemType::DiagLeftBank: + return classicStandUpRCTrackDiagLeftBank; + case TrackElemType::DiagRightBank: + return classicStandUpRCTrackDiagRightBank; + } + + return GetTrackPaintFunctionStandUpRC(trackType); +} diff --git a/src/openrct2/ride/coaster/ClassicWoodenRollerCoaster.cpp b/src/openrct2/ride/coaster/ClassicWoodenRollerCoaster.cpp index 0cdacd6f7f..abeb498630 100644 --- a/src/openrct2/ride/coaster/ClassicWoodenRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/ClassicWoodenRollerCoaster.cpp @@ -255,7 +255,7 @@ static void ClassicWoodenRCTrackFlatToLeftBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -289,7 +289,7 @@ static void ClassicWoodenRCTrackFlatToRightBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -336,7 +336,7 @@ static void ClassicWoodenRCTrackLeftBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -385,7 +385,7 @@ static void ClassicWoodenRCTrackLeftBankTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -428,7 +428,7 @@ static void ClassicWoodenRCTrackRightBankTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -471,7 +471,7 @@ static void ClassicWoodenRCTrack25DegUpToLeftBank( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -514,7 +514,7 @@ static void ClassicWoodenRCTrack25DegUpToRightBank( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -774,13 +774,19 @@ static void ClassicWoodenRCTrackBankedRightQuarterTurn5( }; static constexpr int blockedSegments[7] = { - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + kSegmentsAll, + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + kSegmentsAll, }; WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][0], height); @@ -938,10 +944,12 @@ static void ClassicWoodenRCTrackRightQuarterTurn3Bank( }; static constexpr int blockedSegments[4] = { - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + kSegmentsAll, 0, - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags(PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), }; WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][0], height); @@ -1145,11 +1153,7 @@ static void ClassicWoodenRCTrackLeftEighthBankToDiag( }; static constexpr int blockedSegments[5] = { - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + kSegmentsAll, kSegmentsAll, kSegmentsAll, kSegmentsAll, kSegmentsAll, }; if (trackSequence == 0 && (direction == 0 || direction == 3)) @@ -1348,11 +1352,7 @@ static void ClassicWoodenRCTrackRightEighthBankToDiag( }; static constexpr int blockedSegments[5] = { - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + kSegmentsAll, kSegmentsAll, kSegmentsAll, kSegmentsAll, kSegmentsAll, }; if (trackSequence == 0 && (direction == 0 || direction == 3)) @@ -1498,7 +1498,7 @@ static void ClassicWoodenRCTrackDiagFlatToLeftBank( WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][0], height); WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][1], height); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1612,7 +1612,7 @@ static void ClassicWoodenRCTrackDiagFlatToRightBank( WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][0], height); WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][1], height); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1728,7 +1728,7 @@ static void ClassicWoodenRCTrackDiagLeftBank( WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][0], height); WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][1], height); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1849,7 +1849,7 @@ static void ClassicWoodenRCTrackDiagLeftBankTo25DegUp( WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][0], height); WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][1], height); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -1963,7 +1963,7 @@ static void ClassicWoodenRCTrackDiagRightBankTo25DegUp( WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][0], height); WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][1], height); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -2077,7 +2077,7 @@ static void ClassicWoodenRCTrackDiag25DegUpToLeftBank( WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][0], height); WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][1], height); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -2191,7 +2191,7 @@ static void ClassicWoodenRCTrackDiag25DegUpToRightBank( WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][0], height); WoodenRCTrackPaintBb(session, &imageIds[direction][trackSequence][1], height); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } diff --git a/src/openrct2/ride/coaster/CompactInvertedCoaster.cpp b/src/openrct2/ride/coaster/CompactInvertedCoaster.cpp index 2e8a253172..d01bfff6ce 100644 --- a/src/openrct2/ride/coaster/CompactInvertedCoaster.cpp +++ b/src/openrct2/ride/coaster/CompactInvertedCoaster.cpp @@ -83,7 +83,10 @@ static void CompactInvertedRCTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -118,7 +121,7 @@ static void CompactInvertedRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::TubesInverted); TrackPaintUtilDrawStationInverted(session, ride, direction, height, trackElement, STATION_VARIANT_TALL); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_INVERTED_9); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -181,7 +184,10 @@ static void CompactInvertedRCTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -286,7 +292,10 @@ static void CompactInvertedRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); } @@ -349,7 +358,10 @@ static void CompactInvertedRCTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -466,7 +478,10 @@ static void CompactInvertedRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); } @@ -541,7 +556,10 @@ static void CompactInvertedRCTrack60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -639,7 +657,10 @@ static void CompactInvertedRCTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -759,7 +780,12 @@ static void CompactInvertedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -797,7 +823,11 @@ static void CompactInvertedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -825,7 +855,13 @@ static void CompactInvertedRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -855,7 +891,11 @@ static void CompactInvertedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -885,7 +925,12 @@ static void CompactInvertedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -944,8 +989,12 @@ static void CompactInvertedRCTrackFlatToLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -987,8 +1036,12 @@ static void CompactInvertedRCTrackFlatToRightBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -1030,8 +1083,12 @@ static void CompactInvertedRCTrackLeftBankToFlat( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -1073,8 +1130,12 @@ static void CompactInvertedRCTrackRightBankToFlat( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -1118,7 +1179,12 @@ static void CompactInvertedRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -1156,7 +1222,11 @@ static void CompactInvertedRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1184,7 +1254,13 @@ static void CompactInvertedRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -1214,7 +1290,11 @@ static void CompactInvertedRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1244,7 +1324,12 @@ static void CompactInvertedRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -1303,8 +1388,12 @@ static void CompactInvertedRCTrackLeftBankTo25DegUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -1374,8 +1463,12 @@ static void CompactInvertedRCTrackRightBankTo25DegUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -1445,8 +1538,12 @@ static void CompactInvertedRCTrack25DegUpToLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -1516,8 +1613,12 @@ static void CompactInvertedRCTrack25DegUpToRightBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -1619,8 +1720,12 @@ static void CompactInvertedRCTrackLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -1668,7 +1773,12 @@ static void CompactInvertedRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 48, session.SupportColours); @@ -1704,7 +1814,11 @@ static void CompactInvertedRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -1729,7 +1843,13 @@ static void CompactInvertedRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 4: @@ -1757,7 +1877,11 @@ static void CompactInvertedRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -1783,7 +1907,12 @@ static void CompactInvertedRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 48, session.SupportColours); @@ -1831,7 +1960,12 @@ static void CompactInvertedRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 48, session.SupportColours); @@ -1867,7 +2001,11 @@ static void CompactInvertedRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -1892,7 +2030,12 @@ static void CompactInvertedRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 4: @@ -1920,7 +2063,11 @@ static void CompactInvertedRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -1946,7 +2093,12 @@ static void CompactInvertedRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 48, session.SupportColours); @@ -2016,7 +2168,13 @@ static void CompactInvertedRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -2051,7 +2209,11 @@ static void CompactInvertedRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2094,7 +2256,11 @@ static void CompactInvertedRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2138,7 +2304,13 @@ static void CompactInvertedRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -2189,7 +2361,13 @@ static void CompactInvertedRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -2224,7 +2402,11 @@ static void CompactInvertedRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2267,7 +2449,11 @@ static void CompactInvertedRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2311,7 +2497,13 @@ static void CompactInvertedRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -2364,7 +2556,10 @@ static void CompactInvertedRCTrackLeftVerticalLoop( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); switch (direction) @@ -2421,7 +2616,7 @@ static void CompactInvertedRCTrackLeftVerticalLoop( { { 29, 20, height + 29 }, { 2, 2, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -2449,7 +2644,13 @@ static void CompactInvertedRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -2478,7 +2679,11 @@ static void CompactInvertedRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -2514,7 +2719,11 @@ static void CompactInvertedRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -2543,7 +2752,13 @@ static void CompactInvertedRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -2570,7 +2785,7 @@ static void CompactInvertedRCTrackLeftVerticalLoop( { { 0, 29, height + 29 }, { 32, 2, 63 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 9: @@ -2601,7 +2816,10 @@ static void CompactInvertedRCTrackLeftVerticalLoop( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); switch (direction) @@ -2677,7 +2895,10 @@ static void CompactInvertedRCTrackRightVerticalLoop( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); switch (direction) @@ -2734,7 +2955,7 @@ static void CompactInvertedRCTrackRightVerticalLoop( { { 0, 29, height + 29 }, { 32, 2, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -2762,7 +2983,13 @@ static void CompactInvertedRCTrackRightVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -2791,7 +3018,11 @@ static void CompactInvertedRCTrackRightVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -2827,7 +3058,11 @@ static void CompactInvertedRCTrackRightVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -2856,7 +3091,12 @@ static void CompactInvertedRCTrackRightVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -2883,7 +3123,7 @@ static void CompactInvertedRCTrackRightVerticalLoop( { { 0, 0, height + 29 }, { 32, 2, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 9: @@ -2914,7 +3154,10 @@ static void CompactInvertedRCTrackRightVerticalLoop( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); switch (direction) @@ -2988,7 +3231,12 @@ static void CompactInvertedRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -3026,7 +3274,13 @@ static void CompactInvertedRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -3055,7 +3309,12 @@ static void CompactInvertedRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -3116,7 +3375,12 @@ static void CompactInvertedRCTrackLeftQuarterTurn3Bank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -3155,7 +3419,13 @@ static void CompactInvertedRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -3184,7 +3454,12 @@ static void CompactInvertedRCTrackLeftQuarterTurn3Bank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -3241,7 +3516,12 @@ static void CompactInvertedRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -3280,7 +3560,12 @@ static void CompactInvertedRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -3328,7 +3613,12 @@ static void CompactInvertedRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -3367,7 +3657,12 @@ static void CompactInvertedRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -3434,7 +3729,11 @@ static void CompactInvertedRCTrackLeftTwistDownToUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -3467,7 +3766,11 @@ static void CompactInvertedRCTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3504,7 +3807,11 @@ static void CompactInvertedRCTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3541,7 +3848,11 @@ static void CompactInvertedRCTrackRightTwistDownToUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -3574,7 +3885,11 @@ static void CompactInvertedRCTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3611,7 +3926,11 @@ static void CompactInvertedRCTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3653,7 +3972,11 @@ static void CompactInvertedRCTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3679,7 +4002,11 @@ static void CompactInvertedRCTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3706,7 +4033,11 @@ static void CompactInvertedRCTrackLeftTwistUpToDown( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -3760,7 +4091,11 @@ static void CompactInvertedRCTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3786,7 +4121,11 @@ static void CompactInvertedRCTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3813,7 +4152,11 @@ static void CompactInvertedRCTrackRightTwistUpToDown( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -3865,7 +4208,10 @@ static void CompactInvertedRCTrackHalfLoopUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -3920,7 +4266,7 @@ static void CompactInvertedRCTrackHalfLoopUp( { { 29, 20, height + 29 }, { 2, 2, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -3949,7 +4295,11 @@ static void CompactInvertedRCTrackHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -3982,7 +4332,10 @@ static void CompactInvertedRCTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height + 32, TUNNEL_INVERTED_3); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -4031,7 +4384,10 @@ static void CompactInvertedRCTrackLeftCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -4066,7 +4422,7 @@ static void CompactInvertedRCTrackLeftCorkscrewUp( { { 6, 6, height + 24 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -4107,7 +4463,10 @@ static void CompactInvertedRCTrackLeftCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -4149,7 +4508,10 @@ static void CompactInvertedRCTrackRightCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -4184,7 +4546,7 @@ static void CompactInvertedRCTrackRightCorkscrewUp( { { 6, 6, height + 24 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -4225,7 +4587,10 @@ static void CompactInvertedRCTrackRightCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -4289,7 +4654,7 @@ static void CompactInvertedRCTrackLeftQuarterTurn160DegUp( break; } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_INVERTED_4, +56, TUNNEL_INVERTED_5); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4334,7 +4699,7 @@ static void CompactInvertedRCTrackRightQuarterTurn160DegUp( break; } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_INVERTED_4, +56, TUNNEL_INVERTED_5); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4376,7 +4741,10 @@ static void CompactInvertedRCTrackBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -4420,7 +4788,12 @@ static void CompactInvertedRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -4460,7 +4833,11 @@ static void CompactInvertedRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4489,7 +4866,13 @@ static void CompactInvertedRCTrackLeftQuarterBankedHelixLargeUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -4521,7 +4904,11 @@ static void CompactInvertedRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4551,7 +4938,12 @@ static void CompactInvertedRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 56, session.SupportColours); @@ -4603,7 +4995,12 @@ static void CompactInvertedRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -4643,7 +5040,11 @@ static void CompactInvertedRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4672,7 +5073,12 @@ static void CompactInvertedRCTrackRightQuarterBankedHelixLargeUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -4704,7 +5110,11 @@ static void CompactInvertedRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4734,7 +5144,12 @@ static void CompactInvertedRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 56, session.SupportColours); @@ -4786,7 +5201,12 @@ static void CompactInvertedRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 56, session.SupportColours); @@ -4826,7 +5246,11 @@ static void CompactInvertedRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4855,7 +5279,13 @@ static void CompactInvertedRCTrackLeftQuarterBankedHelixLargeDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -4887,7 +5317,11 @@ static void CompactInvertedRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4917,7 +5351,12 @@ static void CompactInvertedRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -4969,7 +5408,12 @@ static void CompactInvertedRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 56, session.SupportColours); @@ -5009,7 +5453,11 @@ static void CompactInvertedRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -5038,7 +5486,12 @@ static void CompactInvertedRCTrackRightQuarterBankedHelixLargeDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -5070,7 +5523,11 @@ static void CompactInvertedRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -5100,7 +5557,12 @@ static void CompactInvertedRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -5151,7 +5613,7 @@ static void CompactInvertedRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_INVERTED_3); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } @@ -5217,7 +5679,10 @@ static void CompactInvertedRCTrack90DegUp( } PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5299,7 +5764,10 @@ static void CompactInvertedRCTrack60DegUpTo90DegUp( } PaintUtilSetVerticalTunnel(session, height + 56); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5382,7 +5850,10 @@ static void CompactInvertedRCTrack90DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); } @@ -5451,7 +5922,10 @@ static void CompactInvertedRCTrack60DegDownTo90DegDown( PaintUtilPushTunnelRotated(session, direction, height + 48, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -5492,7 +5966,10 @@ static void CompactInvertedRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -5528,7 +6005,11 @@ static void CompactInvertedRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -5557,13 +6038,24 @@ static void CompactInvertedRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -5593,7 +6085,11 @@ static void CompactInvertedRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -5657,7 +6153,10 @@ static void CompactInvertedRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -5693,7 +6192,11 @@ static void CompactInvertedRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -5722,13 +6225,24 @@ static void CompactInvertedRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -5758,7 +6272,11 @@ static void CompactInvertedRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -5840,7 +6358,13 @@ static void CompactInvertedRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -5876,7 +6400,11 @@ static void CompactInvertedRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -5905,13 +6433,24 @@ static void CompactInvertedRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -5942,7 +6481,10 @@ static void CompactInvertedRCTrackLeftEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -6006,7 +6548,13 @@ static void CompactInvertedRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -6042,7 +6590,11 @@ static void CompactInvertedRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -6071,13 +6623,24 @@ static void CompactInvertedRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -6108,7 +6671,10 @@ static void CompactInvertedRCTrackRightEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -6188,7 +6754,13 @@ static void CompactInvertedRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6215,7 +6787,12 @@ static void CompactInvertedRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6242,7 +6819,13 @@ static void CompactInvertedRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6270,7 +6853,13 @@ static void CompactInvertedRCTrackDiagFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6370,7 +6959,13 @@ static void CompactInvertedRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6397,7 +6992,12 @@ static void CompactInvertedRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6424,7 +7024,13 @@ static void CompactInvertedRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6452,7 +7058,13 @@ static void CompactInvertedRCTrackDiag25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6499,7 +7111,13 @@ static void CompactInvertedRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 1: @@ -6512,7 +7130,12 @@ static void CompactInvertedRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 2: @@ -6525,7 +7148,13 @@ static void CompactInvertedRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 3: @@ -6539,7 +7168,13 @@ static void CompactInvertedRCTrackDiag60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6600,7 +7235,13 @@ static void CompactInvertedRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -6627,7 +7268,12 @@ static void CompactInvertedRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -6654,7 +7300,13 @@ static void CompactInvertedRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -6682,7 +7334,13 @@ static void CompactInvertedRCTrackDiagFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6729,7 +7387,13 @@ static void CompactInvertedRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -6742,7 +7406,12 @@ static void CompactInvertedRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -6755,7 +7424,13 @@ static void CompactInvertedRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -6769,7 +7444,13 @@ static void CompactInvertedRCTrackDiag25DegUpTo60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6816,7 +7497,13 @@ static void CompactInvertedRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -6829,7 +7516,12 @@ static void CompactInvertedRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -6842,7 +7534,13 @@ static void CompactInvertedRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -6856,7 +7554,13 @@ static void CompactInvertedRCTrackDiag60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6917,7 +7621,13 @@ static void CompactInvertedRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6944,7 +7654,12 @@ static void CompactInvertedRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6971,7 +7686,13 @@ static void CompactInvertedRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6999,7 +7720,13 @@ static void CompactInvertedRCTrackDiag25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7060,7 +7787,13 @@ static void CompactInvertedRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7087,7 +7820,12 @@ static void CompactInvertedRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7114,7 +7852,13 @@ static void CompactInvertedRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7142,7 +7886,13 @@ static void CompactInvertedRCTrackDiag25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7189,7 +7939,13 @@ static void CompactInvertedRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 1: @@ -7202,7 +7958,12 @@ static void CompactInvertedRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 2: @@ -7215,7 +7976,13 @@ static void CompactInvertedRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 3: @@ -7229,7 +7996,13 @@ static void CompactInvertedRCTrackDiag60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7290,7 +8063,13 @@ static void CompactInvertedRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -7316,7 +8095,12 @@ static void CompactInvertedRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -7342,7 +8126,13 @@ static void CompactInvertedRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -7369,7 +8159,13 @@ static void CompactInvertedRCTrackDiagFlatTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7416,7 +8212,13 @@ static void CompactInvertedRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -7429,7 +8231,12 @@ static void CompactInvertedRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -7442,7 +8249,13 @@ static void CompactInvertedRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -7456,7 +8269,13 @@ static void CompactInvertedRCTrackDiag25DegDownTo60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7503,7 +8322,13 @@ static void CompactInvertedRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -7516,7 +8341,12 @@ static void CompactInvertedRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -7529,7 +8359,13 @@ static void CompactInvertedRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -7543,7 +8379,13 @@ static void CompactInvertedRCTrackDiag60DegDownTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7604,7 +8446,13 @@ static void CompactInvertedRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -7631,7 +8479,12 @@ static void CompactInvertedRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -7658,7 +8511,13 @@ static void CompactInvertedRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -7686,7 +8545,13 @@ static void CompactInvertedRCTrackDiag25DegDownToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7733,7 +8598,13 @@ static void CompactInvertedRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7746,7 +8617,12 @@ static void CompactInvertedRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7759,7 +8635,13 @@ static void CompactInvertedRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7773,7 +8655,12 @@ static void CompactInvertedRCTrackDiagFlatToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -7821,7 +8708,13 @@ static void CompactInvertedRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7834,7 +8727,12 @@ static void CompactInvertedRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7847,7 +8745,13 @@ static void CompactInvertedRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7861,7 +8765,12 @@ static void CompactInvertedRCTrackDiagFlatToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -7909,7 +8818,13 @@ static void CompactInvertedRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7922,7 +8837,12 @@ static void CompactInvertedRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7935,7 +8855,13 @@ static void CompactInvertedRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7949,7 +8875,12 @@ static void CompactInvertedRCTrackDiagLeftBankToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -7997,7 +8928,13 @@ static void CompactInvertedRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8010,7 +8947,12 @@ static void CompactInvertedRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8023,7 +8965,13 @@ static void CompactInvertedRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8037,7 +8985,12 @@ static void CompactInvertedRCTrackDiagRightBankToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -8085,7 +9038,13 @@ static void CompactInvertedRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -8098,7 +9057,12 @@ static void CompactInvertedRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -8111,7 +9075,13 @@ static void CompactInvertedRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -8125,7 +9095,13 @@ static void CompactInvertedRCTrackDiagLeftBankTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8172,7 +9148,13 @@ static void CompactInvertedRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -8185,7 +9167,12 @@ static void CompactInvertedRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -8198,7 +9185,13 @@ static void CompactInvertedRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -8212,7 +9205,13 @@ static void CompactInvertedRCTrackDiagRightBankTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8259,7 +9258,13 @@ static void CompactInvertedRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8272,7 +9277,12 @@ static void CompactInvertedRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -8285,7 +9295,13 @@ static void CompactInvertedRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -8299,7 +9315,13 @@ static void CompactInvertedRCTrackDiag25DegUpToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8346,7 +9368,13 @@ static void CompactInvertedRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8359,7 +9387,12 @@ static void CompactInvertedRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -8372,7 +9405,13 @@ static void CompactInvertedRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -8386,7 +9425,13 @@ static void CompactInvertedRCTrackDiag25DegUpToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8433,7 +9478,13 @@ static void CompactInvertedRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8445,7 +9496,12 @@ static void CompactInvertedRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8457,7 +9513,13 @@ static void CompactInvertedRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8470,7 +9532,13 @@ static void CompactInvertedRCTrackDiagLeftBankTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8517,7 +9585,13 @@ static void CompactInvertedRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8529,7 +9603,12 @@ static void CompactInvertedRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8541,7 +9620,13 @@ static void CompactInvertedRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8554,7 +9639,13 @@ static void CompactInvertedRCTrackDiagRightBankTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8601,7 +9692,13 @@ static void CompactInvertedRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -8614,7 +9711,12 @@ static void CompactInvertedRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -8627,7 +9729,13 @@ static void CompactInvertedRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -8641,7 +9749,13 @@ static void CompactInvertedRCTrackDiag25DegDownToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8688,7 +9802,13 @@ static void CompactInvertedRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -8701,7 +9821,12 @@ static void CompactInvertedRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -8714,7 +9839,13 @@ static void CompactInvertedRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -8728,7 +9859,13 @@ static void CompactInvertedRCTrackDiag25DegDownToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8775,7 +9912,13 @@ static void CompactInvertedRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8788,7 +9931,12 @@ static void CompactInvertedRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8801,7 +9949,13 @@ static void CompactInvertedRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8815,7 +9969,12 @@ static void CompactInvertedRCTrackDiagLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -8863,7 +10022,13 @@ static void CompactInvertedRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8876,7 +10041,12 @@ static void CompactInvertedRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8889,7 +10059,13 @@ static void CompactInvertedRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8903,7 +10079,12 @@ static void CompactInvertedRCTrackDiagRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -8956,7 +10137,10 @@ static void CompactInvertedRCTrackBlockBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( diff --git a/src/openrct2/ride/coaster/CorkscrewRollerCoaster.cpp b/src/openrct2/ride/coaster/CorkscrewRollerCoaster.cpp index e0744f3abc..a99e9d3649 100644 --- a/src/openrct2/ride/coaster/CorkscrewRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/CorkscrewRollerCoaster.cpp @@ -113,7 +113,10 @@ static void CorkscrewRCTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -148,7 +151,7 @@ static void CorkscrewRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStation2(session, ride, direction, height, trackElement, 9, 11); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -228,7 +231,10 @@ static void CorkscrewRCTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -308,7 +314,10 @@ static void CorkscrewRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -388,7 +397,10 @@ static void CorkscrewRCTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -480,7 +492,10 @@ static void CorkscrewRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -572,7 +587,10 @@ static void CorkscrewRCTrack60DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -652,7 +670,10 @@ static void CorkscrewRCTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -742,7 +763,13 @@ static void CorkscrewRCTrackLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -774,7 +801,11 @@ static void CorkscrewRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -803,7 +834,13 @@ static void CorkscrewRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -835,7 +872,11 @@ static void CorkscrewRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -875,7 +916,13 @@ static void CorkscrewRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -931,7 +978,10 @@ static void CorkscrewRCTrackFlatToLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -976,7 +1026,10 @@ static void CorkscrewRCTrackFlatToRightBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1021,7 +1074,10 @@ static void CorkscrewRCTrackLeftBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1066,7 +1122,10 @@ static void CorkscrewRCTrackRightBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1111,7 +1170,13 @@ static void CorkscrewRCTrackBankedLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1143,7 +1208,11 @@ static void CorkscrewRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1172,7 +1241,13 @@ static void CorkscrewRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1204,7 +1279,11 @@ static void CorkscrewRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1247,7 +1326,13 @@ static void CorkscrewRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1310,7 +1395,10 @@ static void CorkscrewRCTrackLeftBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1362,7 +1450,10 @@ static void CorkscrewRCTrackRightBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1414,7 +1505,10 @@ static void CorkscrewRCTrack25DegUpToLeftBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1466,7 +1560,10 @@ static void CorkscrewRCTrack25DegUpToRightBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1537,7 +1634,10 @@ static void CorkscrewRCTrackLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1587,7 +1687,13 @@ static void CorkscrewRCTrackLeftQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1617,7 +1723,11 @@ static void CorkscrewRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1645,7 +1755,13 @@ static void CorkscrewRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1675,7 +1791,11 @@ static void CorkscrewRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1715,7 +1835,13 @@ static void CorkscrewRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -1759,7 +1885,13 @@ static void CorkscrewRCTrackRightQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1789,7 +1921,11 @@ static void CorkscrewRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1817,7 +1953,12 @@ static void CorkscrewRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1847,7 +1988,11 @@ static void CorkscrewRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1887,7 +2032,13 @@ static void CorkscrewRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -1949,7 +2100,13 @@ static void CorkscrewRCTrackSBendLeft( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1980,7 +2137,11 @@ static void CorkscrewRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2012,7 +2173,11 @@ static void CorkscrewRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2052,7 +2217,13 @@ static void CorkscrewRCTrackSBendLeft( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2096,7 +2267,13 @@ static void CorkscrewRCTrackSBendRight( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2128,7 +2305,11 @@ static void CorkscrewRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2161,7 +2342,11 @@ static void CorkscrewRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2201,7 +2386,13 @@ static void CorkscrewRCTrackSBendRight( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2248,7 +2439,11 @@ static void CorkscrewRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -2282,7 +2477,11 @@ static void CorkscrewRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2311,7 +2510,13 @@ static void CorkscrewRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -2336,7 +2541,11 @@ static void CorkscrewRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2368,7 +2577,11 @@ static void CorkscrewRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2397,7 +2610,13 @@ static void CorkscrewRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -2430,7 +2649,11 @@ static void CorkscrewRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2473,7 +2696,11 @@ static void CorkscrewRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -2753,7 +2980,13 @@ static void CorkscrewRCTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2784,7 +3017,13 @@ static void CorkscrewRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2823,7 +3062,13 @@ static void CorkscrewRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2879,7 +3124,13 @@ static void CorkscrewRCTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2910,7 +3161,13 @@ static void CorkscrewRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2952,7 +3209,13 @@ static void CorkscrewRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3001,7 +3264,13 @@ static void CorkscrewRCTrackLeftQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3042,7 +3311,13 @@ static void CorkscrewRCTrackLeftQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3082,7 +3357,13 @@ static void CorkscrewRCTrackRightQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3129,7 +3410,13 @@ static void CorkscrewRCTrackRightQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3187,7 +3474,10 @@ static void CorkscrewRCTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -3221,7 +3511,7 @@ static void CorkscrewRCTrackHalfLoopUp( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 16, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3248,7 +3538,11 @@ static void CorkscrewRCTrackHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -3277,7 +3571,10 @@ static void CorkscrewRCTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -3355,7 +3652,7 @@ static void CorkscrewRCTrackLeftCorkscrewUp( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3384,7 +3681,12 @@ static void CorkscrewRCTrackLeftCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); @@ -3441,7 +3743,12 @@ static void CorkscrewRCTrackRightCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3469,7 +3776,7 @@ static void CorkscrewRCTrackRightCorkscrewUp( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3498,7 +3805,12 @@ static void CorkscrewRCTrackRightCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); @@ -3574,7 +3886,12 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3606,7 +3923,13 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3648,7 +3971,12 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3691,7 +4019,12 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3723,7 +4056,13 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3760,7 +4099,12 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3808,7 +4152,12 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3840,7 +4189,13 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3882,7 +4237,12 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3925,7 +4285,12 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3957,7 +4322,13 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3994,7 +4365,12 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4070,7 +4446,12 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4103,7 +4484,11 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4132,7 +4517,13 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4164,7 +4555,11 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4207,7 +4602,12 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4250,7 +4650,12 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4283,7 +4688,11 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4312,7 +4721,12 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -4344,7 +4758,11 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4382,7 +4800,12 @@ static void CorkscrewRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4430,7 +4853,12 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4463,7 +4891,11 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4492,7 +4924,12 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4524,7 +4961,11 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4567,7 +5008,12 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4610,7 +5056,12 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4643,7 +5094,11 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4672,7 +5127,13 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -4704,7 +5165,11 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4742,7 +5207,12 @@ static void CorkscrewRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4818,7 +5288,7 @@ static void CorkscrewRCTrackLeftQuarterTurn160DegUp( break; } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_1, +56, TUNNEL_2); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4863,7 +5333,7 @@ static void CorkscrewRCTrackRightQuarterTurn160DegUp( break; } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_1, +56, TUNNEL_2); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4910,7 +5380,10 @@ static void CorkscrewRCTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -4946,7 +5419,7 @@ static void CorkscrewRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -4991,7 +5464,10 @@ static void CorkscrewRCTrackFlatTo60DegUpLongBase( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5024,7 +5500,10 @@ static void CorkscrewRCTrackFlatTo60DegUpLongBase( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 7, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5057,7 +5536,10 @@ static void CorkscrewRCTrackFlatTo60DegUpLongBase( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 9, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -5099,7 +5581,10 @@ static void CorkscrewRCTrackFlatTo60DegUpLongBase( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; } @@ -5146,7 +5631,10 @@ static void CorkscrewRCTrack60DegUpToFlatLongBase( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -5179,7 +5667,10 @@ static void CorkscrewRCTrack60DegUpToFlatLongBase( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 16, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 2: @@ -5212,7 +5703,10 @@ static void CorkscrewRCTrack60DegUpToFlatLongBase( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 13, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5254,7 +5748,10 @@ static void CorkscrewRCTrack60DegUpToFlatLongBase( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; } @@ -5314,7 +5811,10 @@ static void CorkscrewRCTrackLeftEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5343,7 +5843,11 @@ static void CorkscrewRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5372,13 +5876,24 @@ static void CorkscrewRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5415,7 +5930,11 @@ static void CorkscrewRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5460,7 +5979,10 @@ static void CorkscrewRCTrackRightEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5489,7 +6011,11 @@ static void CorkscrewRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5518,13 +6044,24 @@ static void CorkscrewRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5561,7 +6098,11 @@ static void CorkscrewRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5624,7 +6165,10 @@ static void CorkscrewRCTrackLeftEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5653,7 +6197,11 @@ static void CorkscrewRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5682,13 +6230,24 @@ static void CorkscrewRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5725,7 +6284,11 @@ static void CorkscrewRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5770,7 +6333,10 @@ static void CorkscrewRCTrackRightEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5799,7 +6365,11 @@ static void CorkscrewRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5828,13 +6398,24 @@ static void CorkscrewRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5871,7 +6452,11 @@ static void CorkscrewRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5927,7 +6512,13 @@ static void CorkscrewRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5954,7 +6545,12 @@ static void CorkscrewRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5981,7 +6577,13 @@ static void CorkscrewRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6040,7 +6642,13 @@ static void CorkscrewRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6116,7 +6724,13 @@ static void CorkscrewRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6143,7 +6757,12 @@ static void CorkscrewRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6170,7 +6789,13 @@ static void CorkscrewRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6229,7 +6854,13 @@ static void CorkscrewRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6266,7 +6897,13 @@ static void CorkscrewRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -6293,7 +6930,12 @@ static void CorkscrewRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -6320,7 +6962,13 @@ static void CorkscrewRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -6381,7 +7029,13 @@ static void CorkscrewRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -6418,7 +7072,13 @@ static void CorkscrewRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6445,7 +7105,12 @@ static void CorkscrewRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6472,7 +7137,13 @@ static void CorkscrewRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6531,7 +7202,13 @@ static void CorkscrewRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -6568,7 +7245,13 @@ static void CorkscrewRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6595,7 +7278,12 @@ static void CorkscrewRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6622,7 +7310,13 @@ static void CorkscrewRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6683,7 +7377,13 @@ static void CorkscrewRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6720,7 +7420,13 @@ static void CorkscrewRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6747,7 +7453,12 @@ static void CorkscrewRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6774,7 +7485,13 @@ static void CorkscrewRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6835,7 +7552,13 @@ static void CorkscrewRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6872,7 +7595,13 @@ static void CorkscrewRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6899,7 +7628,12 @@ static void CorkscrewRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6926,7 +7660,13 @@ static void CorkscrewRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6985,7 +7725,13 @@ static void CorkscrewRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -7022,7 +7768,13 @@ static void CorkscrewRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -7049,7 +7801,12 @@ static void CorkscrewRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -7076,7 +7833,13 @@ static void CorkscrewRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7135,7 +7898,13 @@ static void CorkscrewRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -7172,7 +7941,13 @@ static void CorkscrewRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -7199,7 +7974,12 @@ static void CorkscrewRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -7226,7 +8006,13 @@ static void CorkscrewRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -7287,7 +8073,13 @@ static void CorkscrewRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -7324,7 +8116,13 @@ static void CorkscrewRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -7350,7 +8148,12 @@ static void CorkscrewRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -7376,7 +8179,13 @@ static void CorkscrewRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -7434,7 +8243,13 @@ static void CorkscrewRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -7472,7 +8287,13 @@ static void CorkscrewRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7499,7 +8320,12 @@ static void CorkscrewRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7526,7 +8352,13 @@ static void CorkscrewRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7587,7 +8419,13 @@ static void CorkscrewRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7624,7 +8462,13 @@ static void CorkscrewRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7651,7 +8495,12 @@ static void CorkscrewRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7678,7 +8527,13 @@ static void CorkscrewRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7737,7 +8592,13 @@ static void CorkscrewRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7774,7 +8635,13 @@ static void CorkscrewRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7801,7 +8668,12 @@ static void CorkscrewRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7828,7 +8700,13 @@ static void CorkscrewRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7887,7 +8765,13 @@ static void CorkscrewRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7910,7 +8794,13 @@ static void CorkscrewRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7926,7 +8816,12 @@ static void CorkscrewRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7939,7 +8834,13 @@ static void CorkscrewRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7966,7 +8867,13 @@ static void CorkscrewRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7989,7 +8896,13 @@ static void CorkscrewRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8002,7 +8915,12 @@ static void CorkscrewRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8018,7 +8936,13 @@ static void CorkscrewRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8045,7 +8969,13 @@ static void CorkscrewRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8068,7 +8998,13 @@ static void CorkscrewRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8084,7 +9020,12 @@ static void CorkscrewRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8097,7 +9038,13 @@ static void CorkscrewRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8124,7 +9071,13 @@ static void CorkscrewRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8147,7 +9100,13 @@ static void CorkscrewRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8160,7 +9119,12 @@ static void CorkscrewRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8176,7 +9140,13 @@ static void CorkscrewRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8203,7 +9173,13 @@ static void CorkscrewRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8226,7 +9202,13 @@ static void CorkscrewRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8242,7 +9224,12 @@ static void CorkscrewRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8255,7 +9242,13 @@ static void CorkscrewRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8282,7 +9275,13 @@ static void CorkscrewRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8305,7 +9304,13 @@ static void CorkscrewRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8318,7 +9323,12 @@ static void CorkscrewRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8334,7 +9344,13 @@ static void CorkscrewRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8361,7 +9377,13 @@ static void CorkscrewRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8384,7 +9406,13 @@ static void CorkscrewRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8400,7 +9428,12 @@ static void CorkscrewRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -8413,7 +9446,13 @@ static void CorkscrewRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -8440,7 +9479,13 @@ static void CorkscrewRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -8463,7 +9508,13 @@ static void CorkscrewRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8476,7 +9527,12 @@ static void CorkscrewRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -8492,7 +9548,13 @@ static void CorkscrewRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -8519,7 +9581,13 @@ static void CorkscrewRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -8542,7 +9610,13 @@ static void CorkscrewRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8557,7 +9631,12 @@ static void CorkscrewRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8569,7 +9648,13 @@ static void CorkscrewRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8595,7 +9680,13 @@ static void CorkscrewRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -8619,7 +9710,13 @@ static void CorkscrewRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8631,7 +9728,12 @@ static void CorkscrewRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8646,7 +9748,13 @@ static void CorkscrewRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8672,7 +9780,13 @@ static void CorkscrewRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -8696,7 +9810,13 @@ static void CorkscrewRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8712,7 +9832,12 @@ static void CorkscrewRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8725,7 +9850,13 @@ static void CorkscrewRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8752,7 +9883,13 @@ static void CorkscrewRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8775,7 +9912,13 @@ static void CorkscrewRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8788,7 +9931,12 @@ static void CorkscrewRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8804,7 +9952,13 @@ static void CorkscrewRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8831,7 +9985,13 @@ static void CorkscrewRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8854,7 +10014,13 @@ static void CorkscrewRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8867,7 +10033,12 @@ static void CorkscrewRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8880,7 +10051,13 @@ static void CorkscrewRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8907,7 +10084,13 @@ static void CorkscrewRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8930,7 +10113,13 @@ static void CorkscrewRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8943,7 +10132,12 @@ static void CorkscrewRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8956,7 +10150,13 @@ static void CorkscrewRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8983,7 +10183,13 @@ static void CorkscrewRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -9001,7 +10207,10 @@ static void CorkscrewRCTrackBlockBrakes( MetalASupportsPaintSetup(session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -9048,7 +10257,10 @@ static void CorkscrewRCTrackBooster( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -9086,7 +10298,11 @@ static void CorkscrewRCTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9112,7 +10328,11 @@ static void CorkscrewRCTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9138,7 +10358,11 @@ static void CorkscrewRCTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); @@ -9191,7 +10415,11 @@ static void CorkscrewRCTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9217,7 +10445,11 @@ static void CorkscrewRCTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9243,7 +10475,11 @@ static void CorkscrewRCTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); @@ -9290,7 +10526,11 @@ static void CorkscrewRCTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); @@ -9323,7 +10563,11 @@ static void CorkscrewRCTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9360,7 +10604,11 @@ static void CorkscrewRCTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9395,7 +10643,11 @@ static void CorkscrewRCTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); @@ -9428,7 +10680,11 @@ static void CorkscrewRCTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9465,7 +10721,11 @@ static void CorkscrewRCTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9507,7 +10767,11 @@ static void LayDownRCTrackLeftFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9534,7 +10798,11 @@ static void LayDownRCTrackLeftFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9562,7 +10830,11 @@ static void LayDownRCTrackLeftFlyerTwistUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -9616,7 +10888,11 @@ static void LayDownRCTrackRightFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9642,7 +10918,11 @@ static void LayDownRCTrackRightFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9669,7 +10949,11 @@ static void LayDownRCTrackRightFlyerTwistUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -9722,7 +11006,10 @@ static void LayDownRCTrackFlyerHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -9760,7 +11047,7 @@ static void LayDownRCTrackFlyerHalfLoopUp( session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -9787,7 +11074,11 @@ static void LayDownRCTrackFlyerHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -9816,7 +11107,10 @@ static void LayDownRCTrackFlyerHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -9857,7 +11151,12 @@ static void LayDownRCTrackLeftFlyerCorkscrewUp( if (direction == 2) { PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); } MetalASupportsPaintSetup( @@ -9865,7 +11164,12 @@ static void LayDownRCTrackLeftFlyerCorkscrewUp( if (direction != 2) { PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); } @@ -9899,7 +11203,7 @@ static void LayDownRCTrackLeftFlyerCorkscrewUp( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -9928,7 +11232,12 @@ static void LayDownRCTrackLeftFlyerCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); @@ -9985,7 +11294,12 @@ static void LayDownRCTrackRightFlyerCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10013,7 +11327,7 @@ static void LayDownRCTrackRightFlyerCorkscrewUp( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10042,7 +11356,12 @@ static void LayDownRCTrackRightFlyerCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); diff --git a/src/openrct2/ride/coaster/FlyingRollerCoaster.cpp b/src/openrct2/ride/coaster/FlyingRollerCoaster.cpp index 69a9912482..4c869ebc89 100644 --- a/src/openrct2/ride/coaster/FlyingRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/FlyingRollerCoaster.cpp @@ -89,7 +89,10 @@ static void FlyingRCTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -132,7 +135,10 @@ static void FlyingRCTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -198,7 +204,7 @@ static void FlyingRCTrackStation( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -275,7 +281,10 @@ static void FlyingRCTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } else @@ -334,7 +343,10 @@ static void FlyingRCTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -418,7 +430,10 @@ static void FlyingRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } else @@ -455,7 +470,10 @@ static void FlyingRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } } @@ -533,7 +551,10 @@ static void FlyingRCTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -592,7 +613,10 @@ static void FlyingRCTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -682,7 +706,10 @@ static void FlyingRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } else @@ -725,7 +752,10 @@ static void FlyingRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } } @@ -780,7 +810,10 @@ static void FlyingRCTrack60DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } else @@ -816,7 +849,10 @@ static void FlyingRCTrack60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -929,7 +965,10 @@ static void FlyingRCTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } else @@ -988,7 +1027,10 @@ static void FlyingRCTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -1116,7 +1158,13 @@ static void FlyingRCTrackLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1149,7 +1197,10 @@ static void FlyingRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1178,7 +1229,13 @@ static void FlyingRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1211,7 +1268,10 @@ static void FlyingRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1251,7 +1311,13 @@ static void FlyingRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1286,7 +1352,12 @@ static void FlyingRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, @@ -1328,7 +1399,10 @@ static void FlyingRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1357,7 +1431,13 @@ static void FlyingRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1390,7 +1470,10 @@ static void FlyingRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1420,7 +1503,12 @@ static void FlyingRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, @@ -1493,7 +1581,10 @@ static void FlyingRCTrackFlatToLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -1524,7 +1615,11 @@ static void FlyingRCTrackFlatToLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1580,7 +1675,10 @@ static void FlyingRCTrackFlatToRightBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -1611,7 +1709,11 @@ static void FlyingRCTrackFlatToRightBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1667,7 +1769,10 @@ static void FlyingRCTrackLeftBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -1698,7 +1803,11 @@ static void FlyingRCTrackLeftBankToFlat( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1754,7 +1863,10 @@ static void FlyingRCTrackRightBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -1785,7 +1897,11 @@ static void FlyingRCTrackRightBankToFlat( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1841,7 +1957,13 @@ static void FlyingRCTrackBankedLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1874,7 +1996,10 @@ static void FlyingRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1903,7 +2028,13 @@ static void FlyingRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1936,7 +2067,10 @@ static void FlyingRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1979,7 +2113,13 @@ static void FlyingRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2014,7 +2154,12 @@ static void FlyingRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, @@ -2054,7 +2199,10 @@ static void FlyingRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2082,7 +2230,13 @@ static void FlyingRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -2113,7 +2267,10 @@ static void FlyingRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2143,7 +2300,12 @@ static void FlyingRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, @@ -2223,7 +2385,10 @@ static void FlyingRCTrackLeftBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -2254,7 +2419,11 @@ static void FlyingRCTrackLeftBankTo25DegUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -2345,7 +2514,10 @@ static void FlyingRCTrackRightBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -2376,7 +2548,11 @@ static void FlyingRCTrackRightBankTo25DegUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -2467,7 +2643,10 @@ static void FlyingRCTrack25DegUpToLeftBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } else @@ -2498,7 +2677,11 @@ static void FlyingRCTrack25DegUpToLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -2589,7 +2772,10 @@ static void FlyingRCTrack25DegUpToRightBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } else @@ -2620,7 +2806,11 @@ static void FlyingRCTrack25DegUpToRightBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -2730,7 +2920,10 @@ static void FlyingRCTrackLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -2761,7 +2954,11 @@ static void FlyingRCTrackLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -2822,7 +3019,13 @@ static void FlyingRCTrackLeftQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2853,7 +3056,10 @@ static void FlyingRCTrackLeftQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2881,7 +3087,13 @@ static void FlyingRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -2912,7 +3124,10 @@ static void FlyingRCTrackLeftQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2952,7 +3167,13 @@ static void FlyingRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2983,7 +3204,12 @@ static void FlyingRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 49, @@ -3021,7 +3247,10 @@ static void FlyingRCTrackLeftQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -3046,7 +3275,13 @@ static void FlyingRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -3075,7 +3310,10 @@ static void FlyingRCTrackLeftQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -3101,7 +3339,12 @@ static void FlyingRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 49, @@ -3162,7 +3405,13 @@ static void FlyingRCTrackRightQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3193,7 +3442,10 @@ static void FlyingRCTrackRightQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -3221,7 +3473,13 @@ static void FlyingRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -3252,7 +3510,10 @@ static void FlyingRCTrackRightQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -3292,7 +3553,13 @@ static void FlyingRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3323,7 +3590,12 @@ static void FlyingRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 49, @@ -3361,7 +3633,10 @@ static void FlyingRCTrackRightQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -3386,7 +3661,13 @@ static void FlyingRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -3415,7 +3696,10 @@ static void FlyingRCTrackRightQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -3441,7 +3725,12 @@ static void FlyingRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 49, @@ -3520,7 +3809,13 @@ static void FlyingRCTrackSBendLeft( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3554,7 +3849,10 @@ static void FlyingRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3589,7 +3887,10 @@ static void FlyingRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3629,7 +3930,13 @@ static void FlyingRCTrackSBendLeft( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3664,7 +3971,13 @@ static void FlyingRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -3703,7 +4016,10 @@ static void FlyingRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -3749,7 +4065,10 @@ static void FlyingRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -3793,7 +4112,13 @@ static void FlyingRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -3853,7 +4178,13 @@ static void FlyingRCTrackSBendRight( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3887,7 +4218,10 @@ static void FlyingRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3922,7 +4256,10 @@ static void FlyingRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3962,7 +4299,13 @@ static void FlyingRCTrackSBendRight( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3997,7 +4340,13 @@ static void FlyingRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -4036,7 +4385,10 @@ static void FlyingRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -4082,7 +4434,10 @@ static void FlyingRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -4126,7 +4481,13 @@ static void FlyingRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -4186,7 +4547,13 @@ static void FlyingRCTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4217,7 +4584,13 @@ static void FlyingRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4256,7 +4629,13 @@ static void FlyingRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4291,7 +4670,12 @@ static void FlyingRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, @@ -4331,7 +4715,13 @@ static void FlyingRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4360,7 +4750,12 @@ static void FlyingRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, @@ -4433,7 +4828,13 @@ static void FlyingRCTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4464,7 +4865,13 @@ static void FlyingRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4506,7 +4913,13 @@ static void FlyingRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4541,7 +4954,12 @@ static void FlyingRCTrackLeftQuarterTurn3Bank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, @@ -4581,7 +4999,13 @@ static void FlyingRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4610,7 +5034,12 @@ static void FlyingRCTrackLeftQuarterTurn3Bank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, @@ -4676,7 +5105,13 @@ static void FlyingRCTrackLeftQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -4717,7 +5152,13 @@ static void FlyingRCTrackLeftQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -4748,7 +5189,12 @@ static void FlyingRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 47, @@ -4788,7 +5234,12 @@ static void FlyingRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 47, @@ -4845,7 +5296,13 @@ static void FlyingRCTrackRightQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -4896,7 +5353,13 @@ static void FlyingRCTrackRightQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -4927,7 +5390,12 @@ static void FlyingRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 47, @@ -4967,7 +5435,12 @@ static void FlyingRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 47, @@ -5047,7 +5520,12 @@ static void FlyingRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5079,7 +5557,13 @@ static void FlyingRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5121,7 +5605,12 @@ static void FlyingRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5164,7 +5653,12 @@ static void FlyingRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5196,7 +5690,13 @@ static void FlyingRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -5233,7 +5733,12 @@ static void FlyingRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5281,7 +5786,12 @@ static void FlyingRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5313,7 +5823,13 @@ static void FlyingRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5355,7 +5871,12 @@ static void FlyingRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5398,7 +5919,12 @@ static void FlyingRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5430,7 +5956,13 @@ static void FlyingRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -5467,7 +5999,12 @@ static void FlyingRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5543,7 +6080,12 @@ static void FlyingRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5576,7 +6118,11 @@ static void FlyingRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5605,7 +6151,13 @@ static void FlyingRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5637,7 +6189,11 @@ static void FlyingRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5680,7 +6236,12 @@ static void FlyingRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5723,7 +6284,12 @@ static void FlyingRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5756,7 +6322,11 @@ static void FlyingRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5785,7 +6355,12 @@ static void FlyingRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -5817,7 +6392,11 @@ static void FlyingRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5855,7 +6434,12 @@ static void FlyingRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5903,7 +6487,12 @@ static void FlyingRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5936,7 +6525,11 @@ static void FlyingRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5965,7 +6558,12 @@ static void FlyingRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5997,7 +6595,11 @@ static void FlyingRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6040,7 +6642,12 @@ static void FlyingRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6083,7 +6690,12 @@ static void FlyingRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6116,7 +6728,11 @@ static void FlyingRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6145,7 +6761,13 @@ static void FlyingRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -6177,7 +6799,11 @@ static void FlyingRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6215,7 +6841,12 @@ static void FlyingRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6333,7 +6964,7 @@ static void FlyingRCTrackLeftQuarterTurn160DegUp( } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -6419,7 +7050,7 @@ static void FlyingRCTrackRightQuarterTurn160DegUp( } } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -6468,7 +7099,10 @@ static void FlyingRCTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -6490,7 +7124,10 @@ static void FlyingRCTrackBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -6519,7 +7156,10 @@ static void FlyingRCTrackBooster( { { 0, 6, height + 22 }, { 32, 20, 1 } }); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -6564,7 +7204,12 @@ static void FlyingRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 41, session.SupportColours); @@ -6604,7 +7249,11 @@ static void FlyingRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -6633,7 +7282,13 @@ static void FlyingRCTrackLeftQuarterBankedHelixLargeUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -6665,7 +7320,11 @@ static void FlyingRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -6695,7 +7354,12 @@ static void FlyingRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 53, session.SupportColours); @@ -6747,7 +7411,12 @@ static void FlyingRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 41, session.SupportColours); @@ -6787,7 +7456,11 @@ static void FlyingRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -6816,7 +7489,12 @@ static void FlyingRCTrackRightQuarterBankedHelixLargeUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -6848,7 +7526,11 @@ static void FlyingRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -6878,7 +7560,12 @@ static void FlyingRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 53, session.SupportColours); @@ -6930,7 +7617,12 @@ static void FlyingRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 53, session.SupportColours); @@ -6970,7 +7662,11 @@ static void FlyingRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -6999,7 +7695,13 @@ static void FlyingRCTrackLeftQuarterBankedHelixLargeDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -7031,7 +7733,11 @@ static void FlyingRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -7061,7 +7767,12 @@ static void FlyingRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 41, session.SupportColours); @@ -7113,7 +7824,12 @@ static void FlyingRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 53, session.SupportColours); @@ -7153,7 +7869,11 @@ static void FlyingRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -7182,7 +7902,12 @@ static void FlyingRCTrackRightQuarterBankedHelixLargeDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -7214,7 +7939,11 @@ static void FlyingRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -7244,7 +7973,12 @@ static void FlyingRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 41, session.SupportColours); @@ -7307,7 +8041,10 @@ static void FlyingRCTrack25DegUpLeftBanked( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } else @@ -7337,7 +8074,10 @@ static void FlyingRCTrack25DegUpLeftBanked( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -7421,7 +8161,10 @@ static void FlyingRCTrack25DegUpRightBanked( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } else @@ -7451,7 +8194,10 @@ static void FlyingRCTrack25DegUpRightBanked( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -7525,7 +8271,7 @@ static void FlyingRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -7557,7 +8303,7 @@ static void FlyingRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } } @@ -7618,7 +8364,11 @@ static void FlyingRCTrackLeftEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7648,7 +8398,10 @@ static void FlyingRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7677,13 +8430,24 @@ static void FlyingRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -7725,7 +8489,10 @@ static void FlyingRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7761,7 +8528,11 @@ static void FlyingRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -7799,7 +8570,10 @@ static void FlyingRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7828,13 +8602,24 @@ static void FlyingRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -7865,7 +8650,10 @@ static void FlyingRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -7937,7 +8725,11 @@ static void FlyingRCTrackRightEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7967,7 +8759,10 @@ static void FlyingRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7996,13 +8791,24 @@ static void FlyingRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8044,7 +8850,10 @@ static void FlyingRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8080,7 +8889,11 @@ static void FlyingRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -8118,7 +8931,10 @@ static void FlyingRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8147,13 +8963,24 @@ static void FlyingRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8184,7 +9011,10 @@ static void FlyingRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -8274,7 +9104,11 @@ static void FlyingRCTrackLeftEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8304,7 +9138,10 @@ static void FlyingRCTrackLeftEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8333,13 +9170,24 @@ static void FlyingRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8381,7 +9229,10 @@ static void FlyingRCTrackLeftEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8417,7 +9268,13 @@ static void FlyingRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -8455,7 +9312,10 @@ static void FlyingRCTrackLeftEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8484,13 +9344,24 @@ static void FlyingRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8521,7 +9392,11 @@ static void FlyingRCTrackLeftEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -8593,7 +9468,11 @@ static void FlyingRCTrackRightEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8623,7 +9502,10 @@ static void FlyingRCTrackRightEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8652,13 +9534,24 @@ static void FlyingRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8700,7 +9593,10 @@ static void FlyingRCTrackRightEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8736,7 +9632,13 @@ static void FlyingRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -8774,7 +9676,10 @@ static void FlyingRCTrackRightEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8803,13 +9708,24 @@ static void FlyingRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8840,7 +9756,10 @@ static void FlyingRCTrackRightEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -8923,7 +9842,13 @@ static void FlyingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8950,7 +9875,13 @@ static void FlyingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8977,7 +9908,13 @@ static void FlyingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -9040,7 +9977,13 @@ static void FlyingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -9073,7 +10016,13 @@ static void FlyingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -9100,7 +10049,13 @@ static void FlyingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -9127,7 +10082,13 @@ static void FlyingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -9155,7 +10116,13 @@ static void FlyingRCTrackDiagFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -9263,7 +10230,13 @@ static void FlyingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -9290,7 +10263,13 @@ static void FlyingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -9317,7 +10296,13 @@ static void FlyingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -9380,7 +10365,13 @@ static void FlyingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -9413,7 +10404,13 @@ static void FlyingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -9440,7 +10437,13 @@ static void FlyingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -9467,7 +10470,13 @@ static void FlyingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -9495,7 +10504,13 @@ static void FlyingRCTrackDiag25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -9559,7 +10574,13 @@ static void FlyingRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -9586,7 +10607,13 @@ static void FlyingRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -9613,7 +10640,13 @@ static void FlyingRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -9676,7 +10709,13 @@ static void FlyingRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -9695,7 +10734,13 @@ static void FlyingRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -9708,7 +10753,13 @@ static void FlyingRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -9721,7 +10772,13 @@ static void FlyingRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -9735,7 +10792,13 @@ static void FlyingRCTrackDiag60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -9799,7 +10862,13 @@ static void FlyingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -9826,7 +10895,13 @@ static void FlyingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -9853,7 +10928,13 @@ static void FlyingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -9916,7 +10997,13 @@ static void FlyingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -9949,7 +11036,13 @@ static void FlyingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -9976,7 +11069,13 @@ static void FlyingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -10003,7 +11102,13 @@ static void FlyingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -10031,7 +11136,13 @@ static void FlyingRCTrackDiagFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -10095,7 +11206,13 @@ static void FlyingRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -10122,7 +11239,13 @@ static void FlyingRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10149,7 +11272,13 @@ static void FlyingRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -10212,7 +11341,13 @@ static void FlyingRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -10231,7 +11366,13 @@ static void FlyingRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -10244,7 +11385,13 @@ static void FlyingRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10257,7 +11404,13 @@ static void FlyingRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -10271,7 +11424,13 @@ static void FlyingRCTrackDiag25DegUpTo60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -10335,7 +11494,13 @@ static void FlyingRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -10362,7 +11527,13 @@ static void FlyingRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10389,7 +11560,13 @@ static void FlyingRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -10452,7 +11629,13 @@ static void FlyingRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -10471,7 +11654,13 @@ static void FlyingRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -10484,7 +11673,13 @@ static void FlyingRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10497,7 +11692,13 @@ static void FlyingRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -10511,7 +11712,13 @@ static void FlyingRCTrackDiag60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -10575,7 +11782,13 @@ static void FlyingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -10602,7 +11815,13 @@ static void FlyingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -10629,7 +11848,13 @@ static void FlyingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -10692,7 +11917,13 @@ static void FlyingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -10725,7 +11956,13 @@ static void FlyingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -10752,7 +11989,13 @@ static void FlyingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -10779,7 +12022,13 @@ static void FlyingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -10807,7 +12056,13 @@ static void FlyingRCTrackDiag25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -10871,7 +12126,13 @@ static void FlyingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -10898,7 +12159,13 @@ static void FlyingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -10925,7 +12192,13 @@ static void FlyingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -10988,7 +12261,13 @@ static void FlyingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -11007,7 +12286,13 @@ static void FlyingRCTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -11020,7 +12305,13 @@ static void FlyingRCTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -11033,7 +12324,13 @@ static void FlyingRCTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -11047,7 +12344,13 @@ static void FlyingRCTrackDiag25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -11111,7 +12414,13 @@ static void FlyingRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -11138,7 +12447,13 @@ static void FlyingRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -11165,7 +12480,13 @@ static void FlyingRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -11228,7 +12549,13 @@ static void FlyingRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -11247,7 +12574,13 @@ static void FlyingRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -11260,7 +12593,13 @@ static void FlyingRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -11273,7 +12612,13 @@ static void FlyingRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -11287,7 +12632,13 @@ static void FlyingRCTrackDiag60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -11351,7 +12702,13 @@ static void FlyingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -11377,7 +12734,13 @@ static void FlyingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -11403,7 +12766,13 @@ static void FlyingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -11465,7 +12834,13 @@ static void FlyingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } } @@ -11483,7 +12858,13 @@ static void FlyingRCTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -11495,7 +12876,13 @@ static void FlyingRCTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -11507,7 +12894,13 @@ static void FlyingRCTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -11520,7 +12913,13 @@ static void FlyingRCTrackDiagFlatTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -11584,7 +12983,13 @@ static void FlyingRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -11611,7 +13016,13 @@ static void FlyingRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11638,7 +13049,13 @@ static void FlyingRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -11701,7 +13118,13 @@ static void FlyingRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -11720,7 +13143,13 @@ static void FlyingRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -11733,7 +13162,13 @@ static void FlyingRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11746,7 +13181,13 @@ static void FlyingRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -11760,7 +13201,13 @@ static void FlyingRCTrackDiag25DegDownTo60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -11824,7 +13271,13 @@ static void FlyingRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -11851,7 +13304,13 @@ static void FlyingRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11878,7 +13337,13 @@ static void FlyingRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -11941,7 +13406,13 @@ static void FlyingRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -11960,7 +13431,13 @@ static void FlyingRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -11973,7 +13450,13 @@ static void FlyingRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11986,7 +13469,13 @@ static void FlyingRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -12000,7 +13489,13 @@ static void FlyingRCTrackDiag60DegDownTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -12064,7 +13559,13 @@ static void FlyingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -12091,7 +13592,13 @@ static void FlyingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -12118,7 +13625,13 @@ static void FlyingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -12181,7 +13694,13 @@ static void FlyingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -12200,7 +13719,13 @@ static void FlyingRCTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -12213,7 +13738,13 @@ static void FlyingRCTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -12226,7 +13757,13 @@ static void FlyingRCTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -12240,7 +13777,13 @@ static void FlyingRCTrackDiag25DegDownToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -12290,7 +13833,13 @@ static void FlyingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12306,7 +13855,13 @@ static void FlyingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12319,7 +13874,13 @@ static void FlyingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12350,7 +13911,13 @@ static void FlyingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -12369,7 +13936,13 @@ static void FlyingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12382,7 +13955,13 @@ static void FlyingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12395,7 +13974,13 @@ static void FlyingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12409,7 +13994,12 @@ static void FlyingRCTrackDiagFlatToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -12460,7 +14050,13 @@ static void FlyingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12473,7 +14069,13 @@ static void FlyingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12489,7 +14091,13 @@ static void FlyingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12520,7 +14128,13 @@ static void FlyingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -12539,7 +14153,13 @@ static void FlyingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12552,7 +14172,13 @@ static void FlyingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12565,7 +14191,13 @@ static void FlyingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12579,7 +14211,12 @@ static void FlyingRCTrackDiagFlatToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -12630,7 +14267,13 @@ static void FlyingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12646,7 +14289,13 @@ static void FlyingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12659,7 +14308,13 @@ static void FlyingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12690,7 +14345,13 @@ static void FlyingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -12709,7 +14370,13 @@ static void FlyingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12722,7 +14389,13 @@ static void FlyingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12735,7 +14408,13 @@ static void FlyingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12749,7 +14428,12 @@ static void FlyingRCTrackDiagLeftBankToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -12800,7 +14484,13 @@ static void FlyingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12813,7 +14503,13 @@ static void FlyingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12829,7 +14525,13 @@ static void FlyingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12860,7 +14562,13 @@ static void FlyingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -12879,7 +14587,13 @@ static void FlyingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12892,7 +14606,13 @@ static void FlyingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12905,7 +14625,13 @@ static void FlyingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12919,7 +14645,12 @@ static void FlyingRCTrackDiagRightBankToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -12970,7 +14701,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -12986,7 +14723,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -12999,7 +14742,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -13030,7 +14779,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -13049,7 +14804,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -13062,7 +14823,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -13075,7 +14842,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -13089,7 +14862,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -13139,7 +14918,13 @@ static void FlyingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -13152,7 +14937,13 @@ static void FlyingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -13168,7 +14959,13 @@ static void FlyingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -13199,7 +14996,13 @@ static void FlyingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -13218,7 +15021,13 @@ static void FlyingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -13231,7 +15040,13 @@ static void FlyingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -13244,7 +15059,13 @@ static void FlyingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -13258,7 +15079,13 @@ static void FlyingRCTrackDiagRightBankTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -13308,7 +15135,13 @@ static void FlyingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13324,7 +15157,13 @@ static void FlyingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -13337,7 +15176,13 @@ static void FlyingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13368,7 +15213,13 @@ static void FlyingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -13387,7 +15238,13 @@ static void FlyingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13400,7 +15257,13 @@ static void FlyingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -13413,7 +15276,13 @@ static void FlyingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13427,7 +15296,13 @@ static void FlyingRCTrackDiag25DegUpToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -13477,7 +15352,13 @@ static void FlyingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13490,7 +15371,13 @@ static void FlyingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -13506,7 +15393,13 @@ static void FlyingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13537,7 +15430,13 @@ static void FlyingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -13556,7 +15455,13 @@ static void FlyingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13569,7 +15474,13 @@ static void FlyingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -13582,7 +15493,13 @@ static void FlyingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13596,7 +15513,13 @@ static void FlyingRCTrackDiag25DegUpToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -13646,7 +15569,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -13661,7 +15590,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -13673,7 +15608,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -13703,7 +15644,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } } @@ -13721,7 +15668,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -13733,7 +15686,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -13745,7 +15704,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -13758,7 +15723,13 @@ static void FlyingRCTrackDiagLeftBankTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -13808,7 +15779,13 @@ static void FlyingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -13820,7 +15797,13 @@ static void FlyingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -13835,7 +15818,13 @@ static void FlyingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -13865,7 +15854,13 @@ static void FlyingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } } @@ -13883,7 +15878,13 @@ static void FlyingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -13895,7 +15896,13 @@ static void FlyingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -13907,7 +15914,13 @@ static void FlyingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -13920,7 +15933,13 @@ static void FlyingRCTrackDiagRightBankTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -13970,7 +15989,13 @@ static void FlyingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -13986,7 +16011,13 @@ static void FlyingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -13999,7 +16030,13 @@ static void FlyingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -14030,7 +16067,13 @@ static void FlyingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -14049,7 +16092,13 @@ static void FlyingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -14062,7 +16111,13 @@ static void FlyingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -14075,7 +16130,13 @@ static void FlyingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -14089,7 +16150,13 @@ static void FlyingRCTrackDiag25DegDownToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -14139,7 +16206,13 @@ static void FlyingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -14152,7 +16225,13 @@ static void FlyingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -14168,7 +16247,13 @@ static void FlyingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -14199,7 +16284,13 @@ static void FlyingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -14218,7 +16309,13 @@ static void FlyingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -14231,7 +16328,13 @@ static void FlyingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -14244,7 +16347,13 @@ static void FlyingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -14258,7 +16367,13 @@ static void FlyingRCTrackDiag25DegDownToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -14308,7 +16423,13 @@ static void FlyingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -14321,7 +16442,13 @@ static void FlyingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -14334,7 +16461,13 @@ static void FlyingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -14365,7 +16498,13 @@ static void FlyingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -14384,7 +16523,13 @@ static void FlyingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -14397,7 +16542,13 @@ static void FlyingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -14410,7 +16561,13 @@ static void FlyingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -14424,7 +16581,12 @@ static void FlyingRCTrackDiagLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -14475,7 +16637,13 @@ static void FlyingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -14488,7 +16656,13 @@ static void FlyingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -14501,7 +16675,13 @@ static void FlyingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -14532,7 +16712,13 @@ static void FlyingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -14551,7 +16737,13 @@ static void FlyingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -14564,7 +16756,13 @@ static void FlyingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -14577,7 +16775,13 @@ static void FlyingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -14591,7 +16795,12 @@ static void FlyingRCTrackDiagRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -14662,7 +16871,11 @@ static void FlyingRCTrackLeftFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -14689,7 +16902,11 @@ static void FlyingRCTrackLeftFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -14717,7 +16934,11 @@ static void FlyingRCTrackLeftFlyerTwistUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -14775,7 +16996,11 @@ static void FlyingRCTrackRightFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -14801,7 +17026,11 @@ static void FlyingRCTrackRightFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -14828,7 +17057,11 @@ static void FlyingRCTrackRightFlyerTwistUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -14878,7 +17111,11 @@ static void FlyingRCTrackLeftFlyerTwistDown( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -14912,7 +17149,11 @@ static void FlyingRCTrackLeftFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -14953,7 +17194,11 @@ static void FlyingRCTrackLeftFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -14990,7 +17235,11 @@ static void FlyingRCTrackRightFlyerTwistDown( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -15023,7 +17272,11 @@ static void FlyingRCTrackRightFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -15064,7 +17317,11 @@ static void FlyingRCTrackRightFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -15105,7 +17362,10 @@ static void FlyingRCTrackFlyerHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15143,7 +17403,7 @@ static void FlyingRCTrackFlyerHalfLoopUp( session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -15170,7 +17430,11 @@ static void FlyingRCTrackFlyerHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -15199,7 +17463,10 @@ static void FlyingRCTrackFlyerHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -15237,7 +17504,10 @@ static void FlyingRCTrackFlyerHalfLoopDown( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -15264,7 +17534,11 @@ static void FlyingRCTrackFlyerHalfLoopDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -15303,7 +17577,7 @@ static void FlyingRCTrackFlyerHalfLoopDown( session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -15333,7 +17607,10 @@ static void FlyingRCTrackFlyerHalfLoopDown( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15365,7 +17642,10 @@ static void FlyingRCTrackBlockBrakes( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -15387,7 +17667,10 @@ static void FlyingRCTrackBlockBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -15436,7 +17719,13 @@ static void FlyingRCTrackLeftBankedQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -15479,7 +17768,13 @@ static void FlyingRCTrackLeftBankedQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -15510,7 +17805,12 @@ static void FlyingRCTrackLeftBankedQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 47, @@ -15550,7 +17850,12 @@ static void FlyingRCTrackLeftBankedQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 47, @@ -15608,7 +17913,13 @@ static void FlyingRCTrackRightBankedQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -15661,7 +17972,13 @@ static void FlyingRCTrackRightBankedQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -15692,7 +18009,12 @@ static void FlyingRCTrackRightBankedQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 47, @@ -15732,7 +18054,12 @@ static void FlyingRCTrackRightBankedQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 47, @@ -15811,7 +18138,13 @@ static void FlyingRCTrackLeftBankedQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -15843,7 +18176,10 @@ static void FlyingRCTrackLeftBankedQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -15871,7 +18207,13 @@ static void FlyingRCTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -15904,7 +18246,10 @@ static void FlyingRCTrackLeftBankedQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -15944,7 +18289,13 @@ static void FlyingRCTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -15975,7 +18326,12 @@ static void FlyingRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 49, @@ -16013,7 +18369,10 @@ static void FlyingRCTrackLeftBankedQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -16038,7 +18397,13 @@ static void FlyingRCTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 4: @@ -16067,7 +18432,10 @@ static void FlyingRCTrackLeftBankedQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -16093,7 +18461,12 @@ static void FlyingRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 49, @@ -16154,7 +18527,13 @@ static void FlyingRCTrackRightBankedQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -16186,7 +18565,10 @@ static void FlyingRCTrackRightBankedQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16214,7 +18596,13 @@ static void FlyingRCTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -16247,7 +18635,10 @@ static void FlyingRCTrackRightBankedQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16287,7 +18678,13 @@ static void FlyingRCTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -16318,7 +18715,12 @@ static void FlyingRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 49, @@ -16356,7 +18758,10 @@ static void FlyingRCTrackRightBankedQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -16381,7 +18786,13 @@ static void FlyingRCTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 4: @@ -16410,7 +18821,10 @@ static void FlyingRCTrackRightBankedQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -16436,7 +18850,12 @@ static void FlyingRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 49, @@ -16522,7 +18941,10 @@ static void FlyingRCTrack25DegUpToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } else @@ -16552,7 +18974,10 @@ static void FlyingRCTrack25DegUpToLeftBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -16639,7 +19064,10 @@ static void FlyingRCTrack25DegUpToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } else @@ -16669,7 +19097,10 @@ static void FlyingRCTrack25DegUpToRightBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -16756,7 +19187,10 @@ static void FlyingRCTrackLeftBanked25DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } else @@ -16786,7 +19220,10 @@ static void FlyingRCTrackLeftBanked25DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -16873,7 +19310,10 @@ static void FlyingRCTrackRightBanked25DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } else @@ -16903,7 +19343,10 @@ static void FlyingRCTrackRightBanked25DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -17019,7 +19462,10 @@ static void FlyingRCTrackLeftBankedFlatToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -17049,7 +19495,10 @@ static void FlyingRCTrackLeftBankedFlatToLeftBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -17133,7 +19582,10 @@ static void FlyingRCTrackRightBankedFlatToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -17163,7 +19615,10 @@ static void FlyingRCTrackRightBankedFlatToRightBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -17247,7 +19702,10 @@ static void FlyingRCTrackLeftBanked25DegUpToLeftBankedFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } else @@ -17277,7 +19735,10 @@ static void FlyingRCTrackLeftBanked25DegUpToLeftBankedFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -17361,7 +19822,10 @@ static void FlyingRCTrackRightBanked25DegUpToRightBankedFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } else @@ -17391,7 +19855,10 @@ static void FlyingRCTrackRightBanked25DegUpToRightBankedFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -17510,7 +19977,10 @@ static void FlyingRCTrackFlatToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -17540,7 +20010,10 @@ static void FlyingRCTrackFlatToLeftBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -17627,7 +20100,10 @@ static void FlyingRCTrackFlatToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -17657,7 +20133,10 @@ static void FlyingRCTrackFlatToRightBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -17744,7 +20223,10 @@ static void FlyingRCTrackLeftBanked25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } else @@ -17774,7 +20256,10 @@ static void FlyingRCTrackLeftBanked25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -17861,7 +20346,10 @@ static void FlyingRCTrackRightBanked25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } else @@ -17891,7 +20379,10 @@ static void FlyingRCTrackRightBanked25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -17999,7 +20490,10 @@ static void FlyingRCTrack90DegUp( } PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -18052,7 +20546,10 @@ static void FlyingRCTrack60DegUpTo90DegUp( } PaintUtilSetVerticalTunnel(session, height + 56); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -18106,7 +20603,10 @@ static void FlyingRCTrack90DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); } @@ -18147,7 +20647,10 @@ static void FlyingRCTrack60DegDownTo90DegDown( PaintUtilPushTunnelRotated(session, direction, height + 48, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -18186,7 +20689,10 @@ static void FlyingRCTrack90DegToInvertedFlatQuarterLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -18214,7 +20720,10 @@ static void FlyingRCTrack90DegToInvertedFlatQuarterLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -18246,7 +20755,10 @@ static void FlyingRCTrack90DegToInvertedFlatQuarterLoopUp( PaintUtilPushTunnelRotated(session, direction, height + 16, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -18330,7 +20842,10 @@ static void FlyingRCTrackHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -18385,7 +20900,7 @@ static void FlyingRCTrackHalfLoopInvertedUp( { { 29, 20, height + 29 }, { 2, 2, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -18414,7 +20929,11 @@ static void FlyingRCTrackHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -18447,7 +20966,10 @@ static void FlyingRCTrackHalfLoopInvertedUp( PaintUtilPushTunnelRotated(session, direction, height + 32, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -18495,7 +21017,10 @@ static void FlyingRCTrackLeftFlyingLargeHalfLoopInvertedUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -18523,7 +21048,10 @@ static void FlyingRCTrackLeftFlyingLargeHalfLoopInvertedUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -18552,7 +21080,11 @@ static void FlyingRCTrackLeftFlyingLargeHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -18582,7 +21114,11 @@ static void FlyingRCTrackLeftFlyingLargeHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -18611,7 +21147,13 @@ static void FlyingRCTrackLeftFlyingLargeHalfLoopInvertedUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -18640,7 +21182,11 @@ static void FlyingRCTrackLeftFlyingLargeHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -18686,7 +21232,11 @@ static void FlyingRCTrackLeftFlyingLargeHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -18728,7 +21278,10 @@ static void FlyingRCTrackRightFlyingLargeHalfLoopInvertedUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -18756,7 +21309,10 @@ static void FlyingRCTrackRightFlyingLargeHalfLoopInvertedUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -18785,7 +21341,11 @@ static void FlyingRCTrackRightFlyingLargeHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -18815,7 +21375,11 @@ static void FlyingRCTrackRightFlyingLargeHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -18844,7 +21408,13 @@ static void FlyingRCTrackRightFlyingLargeHalfLoopInvertedUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -18873,7 +21443,11 @@ static void FlyingRCTrackRightFlyingLargeHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -18919,7 +21493,11 @@ static void FlyingRCTrackRightFlyingLargeHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; diff --git a/src/openrct2/ride/coaster/GigaCoaster.cpp b/src/openrct2/ride/coaster/GigaCoaster.cpp index 5b0b26ec6d..8b0779daef 100644 --- a/src/openrct2/ride/coaster/GigaCoaster.cpp +++ b/src/openrct2/ride/coaster/GigaCoaster.cpp @@ -164,7 +164,10 @@ static void GigaRCTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -198,7 +201,7 @@ static void GigaRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStation2(session, ride, direction, height, trackElement, 9, 11); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -309,7 +312,10 @@ static void GigaRCTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -389,7 +395,10 @@ static void GigaRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -500,7 +509,10 @@ static void GigaRCTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -592,7 +604,10 @@ static void GigaRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -684,7 +699,10 @@ static void GigaRCTrack60DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -795,7 +813,10 @@ static void GigaRCTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -885,7 +906,13 @@ static void GigaRCTrackLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -917,7 +944,11 @@ static void GigaRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -946,7 +977,13 @@ static void GigaRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -978,7 +1015,11 @@ static void GigaRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1018,7 +1059,13 @@ static void GigaRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1074,7 +1121,10 @@ static void GigaRCTrackFlatToLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1119,7 +1169,10 @@ static void GigaRCTrackFlatToRightBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1164,7 +1217,10 @@ static void GigaRCTrackLeftBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1209,7 +1265,10 @@ static void GigaRCTrackRightBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1254,7 +1313,13 @@ static void GigaRCTrackBankedLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1286,7 +1351,11 @@ static void GigaRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1315,7 +1384,13 @@ static void GigaRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1347,7 +1422,11 @@ static void GigaRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1390,7 +1469,13 @@ static void GigaRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1453,7 +1538,10 @@ static void GigaRCTrackLeftBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1505,7 +1593,10 @@ static void GigaRCTrackRightBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1557,7 +1648,10 @@ static void GigaRCTrack25DegUpToLeftBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1609,7 +1703,10 @@ static void GigaRCTrack25DegUpToRightBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1680,7 +1777,10 @@ static void GigaRCTrackLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1730,7 +1830,13 @@ static void GigaRCTrackLeftQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1760,7 +1866,11 @@ static void GigaRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1788,7 +1898,13 @@ static void GigaRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1818,7 +1934,11 @@ static void GigaRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1858,7 +1978,13 @@ static void GigaRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -1902,7 +2028,13 @@ static void GigaRCTrackRightQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1932,7 +2064,11 @@ static void GigaRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1960,7 +2096,12 @@ static void GigaRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1990,7 +2131,11 @@ static void GigaRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2030,7 +2175,13 @@ static void GigaRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2092,7 +2243,13 @@ static void GigaRCTrackSBendLeft( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2123,7 +2280,11 @@ static void GigaRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2155,7 +2316,11 @@ static void GigaRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2195,7 +2360,13 @@ static void GigaRCTrackSBendLeft( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2239,7 +2410,13 @@ static void GigaRCTrackSBendRight( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2271,7 +2448,11 @@ static void GigaRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2304,7 +2485,11 @@ static void GigaRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2344,7 +2529,13 @@ static void GigaRCTrackSBendRight( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2388,7 +2579,13 @@ static void GigaRCTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2419,7 +2616,13 @@ static void GigaRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2458,7 +2661,13 @@ static void GigaRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2514,7 +2723,13 @@ static void GigaRCTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2545,7 +2760,13 @@ static void GigaRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2587,7 +2808,13 @@ static void GigaRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2636,7 +2863,13 @@ static void GigaRCTrackLeftQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2677,7 +2910,13 @@ static void GigaRCTrackLeftQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2717,7 +2956,13 @@ static void GigaRCTrackRightQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2764,7 +3009,13 @@ static void GigaRCTrackRightQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2829,7 +3080,12 @@ static void GigaRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2861,7 +3117,13 @@ static void GigaRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2903,7 +3165,12 @@ static void GigaRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2946,7 +3213,12 @@ static void GigaRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2978,7 +3250,13 @@ static void GigaRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3015,7 +3293,12 @@ static void GigaRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3063,7 +3346,12 @@ static void GigaRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3095,7 +3383,13 @@ static void GigaRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3137,7 +3431,12 @@ static void GigaRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3180,7 +3479,12 @@ static void GigaRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3212,7 +3516,13 @@ static void GigaRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3249,7 +3559,12 @@ static void GigaRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3325,7 +3640,12 @@ static void GigaRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3358,7 +3678,11 @@ static void GigaRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3387,7 +3711,13 @@ static void GigaRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3419,7 +3749,11 @@ static void GigaRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3462,7 +3796,12 @@ static void GigaRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3505,7 +3844,12 @@ static void GigaRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3538,7 +3882,11 @@ static void GigaRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3567,7 +3915,12 @@ static void GigaRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -3599,7 +3952,11 @@ static void GigaRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3637,7 +3994,12 @@ static void GigaRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3685,7 +4047,12 @@ static void GigaRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3718,7 +4085,11 @@ static void GigaRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3747,7 +4118,12 @@ static void GigaRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3779,7 +4155,11 @@ static void GigaRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3828,7 +4208,12 @@ static void GigaRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3871,7 +4256,12 @@ static void GigaRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3904,7 +4294,11 @@ static void GigaRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3933,7 +4327,13 @@ static void GigaRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -3965,7 +4365,11 @@ static void GigaRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4009,7 +4413,12 @@ static void GigaRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4085,7 +4494,7 @@ static void GigaRCTrackLeftQuarterTurn160DegUp( break; } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4130,7 +4539,7 @@ static void GigaRCTrackRightQuarterTurn160DegUp( break; } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4183,7 +4592,10 @@ static void GigaRCTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -4229,7 +4641,10 @@ static void GigaRCTrack25DegUpLeftBanked( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -4275,7 +4690,10 @@ static void GigaRCTrack25DegUpRightBanked( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -4311,7 +4729,7 @@ static void GigaRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -4406,7 +4824,10 @@ static void GigaRCTrackFlatTo60DegUpLongBase( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4473,7 +4894,10 @@ static void GigaRCTrackFlatTo60DegUpLongBase( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4540,7 +4964,10 @@ static void GigaRCTrackFlatTo60DegUpLongBase( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -4616,7 +5043,10 @@ static void GigaRCTrackFlatTo60DegUpLongBase( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; } @@ -4663,7 +5093,10 @@ static void GigaRCTrack60DegUpToFlatLongBase( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -4696,7 +5129,10 @@ static void GigaRCTrack60DegUpToFlatLongBase( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 12, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 2: @@ -4729,7 +5165,10 @@ static void GigaRCTrack60DegUpToFlatLongBase( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 9, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4771,7 +5210,10 @@ static void GigaRCTrack60DegUpToFlatLongBase( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; } @@ -4838,7 +5280,10 @@ static void GigaRCTrackCableLiftHill( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; case 1: @@ -4879,7 +5324,10 @@ static void GigaRCTrackCableLiftHill( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; case 2: @@ -4926,7 +5374,10 @@ static void GigaRCTrackCableLiftHill( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -4967,7 +5418,10 @@ static void GigaRCTrackCableLiftHill( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -5011,7 +5465,10 @@ static void GigaRCTrackLeftEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5040,7 +5497,11 @@ static void GigaRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5069,13 +5530,24 @@ static void GigaRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5112,7 +5584,11 @@ static void GigaRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5157,7 +5633,10 @@ static void GigaRCTrackRightEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5186,7 +5665,11 @@ static void GigaRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5215,13 +5698,24 @@ static void GigaRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5258,7 +5752,11 @@ static void GigaRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5321,7 +5819,10 @@ static void GigaRCTrackLeftEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5350,7 +5851,11 @@ static void GigaRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5379,13 +5884,24 @@ static void GigaRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5422,7 +5938,11 @@ static void GigaRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5467,7 +5987,10 @@ static void GigaRCTrackRightEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5496,7 +6019,11 @@ static void GigaRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5525,13 +6052,24 @@ static void GigaRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5568,7 +6106,11 @@ static void GigaRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5624,7 +6166,13 @@ static void GigaRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5651,7 +6199,12 @@ static void GigaRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5678,7 +6231,13 @@ static void GigaRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5737,7 +6296,13 @@ static void GigaRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5774,7 +6339,13 @@ static void GigaRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5801,7 +6372,12 @@ static void GigaRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5828,7 +6404,13 @@ static void GigaRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5887,7 +6469,13 @@ static void GigaRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -5910,7 +6498,13 @@ static void GigaRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -5923,7 +6517,12 @@ static void GigaRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -5936,7 +6535,13 @@ static void GigaRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -5963,7 +6568,13 @@ static void GigaRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -6000,7 +6611,13 @@ static void GigaRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6027,7 +6644,12 @@ static void GigaRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6054,7 +6676,13 @@ static void GigaRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6113,7 +6741,13 @@ static void GigaRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -6136,7 +6770,13 @@ static void GigaRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6149,7 +6789,12 @@ static void GigaRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6162,7 +6807,13 @@ static void GigaRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6189,7 +6840,13 @@ static void GigaRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6212,7 +6869,13 @@ static void GigaRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6225,7 +6888,12 @@ static void GigaRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6238,7 +6906,13 @@ static void GigaRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6265,7 +6939,13 @@ static void GigaRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6302,7 +6982,13 @@ static void GigaRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6329,7 +7015,12 @@ static void GigaRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6356,7 +7047,13 @@ static void GigaRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6415,7 +7112,13 @@ static void GigaRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6452,7 +7155,13 @@ static void GigaRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6479,7 +7188,12 @@ static void GigaRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6506,7 +7220,13 @@ static void GigaRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6565,7 +7285,13 @@ static void GigaRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6588,7 +7314,13 @@ static void GigaRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -6601,7 +7333,12 @@ static void GigaRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -6614,7 +7351,13 @@ static void GigaRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -6641,7 +7384,13 @@ static void GigaRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -6678,7 +7427,13 @@ static void GigaRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -6704,7 +7459,12 @@ static void GigaRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -6730,7 +7490,13 @@ static void GigaRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -6788,7 +7554,13 @@ static void GigaRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -6812,7 +7584,13 @@ static void GigaRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6825,7 +7603,12 @@ static void GigaRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6838,7 +7621,13 @@ static void GigaRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6865,7 +7654,13 @@ static void GigaRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6888,7 +7683,13 @@ static void GigaRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6901,7 +7702,12 @@ static void GigaRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6914,7 +7720,13 @@ static void GigaRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6941,7 +7753,13 @@ static void GigaRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6978,7 +7796,13 @@ static void GigaRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7005,7 +7829,12 @@ static void GigaRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7032,7 +7861,13 @@ static void GigaRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7091,7 +7926,13 @@ static void GigaRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7114,7 +7955,13 @@ static void GigaRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7130,7 +7977,12 @@ static void GigaRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7143,7 +7995,13 @@ static void GigaRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7170,7 +8028,13 @@ static void GigaRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7193,7 +8057,13 @@ static void GigaRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7206,7 +8076,12 @@ static void GigaRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7222,7 +8097,13 @@ static void GigaRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7249,7 +8130,13 @@ static void GigaRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7272,7 +8159,13 @@ static void GigaRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7288,7 +8181,12 @@ static void GigaRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7301,7 +8199,13 @@ static void GigaRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7328,7 +8232,13 @@ static void GigaRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7351,7 +8261,13 @@ static void GigaRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7364,7 +8280,12 @@ static void GigaRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7380,7 +8301,13 @@ static void GigaRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7407,7 +8334,13 @@ static void GigaRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7430,7 +8363,13 @@ static void GigaRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7446,7 +8385,12 @@ static void GigaRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7459,7 +8403,13 @@ static void GigaRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7486,7 +8436,13 @@ static void GigaRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7509,7 +8465,13 @@ static void GigaRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7522,7 +8484,12 @@ static void GigaRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7538,7 +8505,13 @@ static void GigaRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7565,7 +8538,13 @@ static void GigaRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7588,7 +8567,13 @@ static void GigaRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -7604,7 +8589,12 @@ static void GigaRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -7617,7 +8607,13 @@ static void GigaRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7644,7 +8640,13 @@ static void GigaRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -7667,7 +8669,13 @@ static void GigaRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -7680,7 +8688,12 @@ static void GigaRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -7696,7 +8709,13 @@ static void GigaRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7723,7 +8742,13 @@ static void GigaRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -7746,7 +8771,13 @@ static void GigaRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -7761,7 +8792,12 @@ static void GigaRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -7773,7 +8809,13 @@ static void GigaRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -7799,7 +8841,13 @@ static void GigaRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -7823,7 +8871,13 @@ static void GigaRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -7835,7 +8889,12 @@ static void GigaRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -7850,7 +8909,13 @@ static void GigaRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -7876,7 +8941,13 @@ static void GigaRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -7900,7 +8971,13 @@ static void GigaRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7916,7 +8993,12 @@ static void GigaRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7929,7 +9011,13 @@ static void GigaRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7956,7 +9044,13 @@ static void GigaRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7979,7 +9073,13 @@ static void GigaRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7992,7 +9092,12 @@ static void GigaRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8008,7 +9113,13 @@ static void GigaRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8035,7 +9146,13 @@ static void GigaRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8058,7 +9175,13 @@ static void GigaRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8071,7 +9194,12 @@ static void GigaRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8084,7 +9212,13 @@ static void GigaRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8111,7 +9245,13 @@ static void GigaRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8134,7 +9274,13 @@ static void GigaRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8147,7 +9293,12 @@ static void GigaRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8160,7 +9311,13 @@ static void GigaRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8187,7 +9344,13 @@ static void GigaRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8213,7 +9376,10 @@ static void GigaRCTrackBlockBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -8252,7 +9418,13 @@ static void GigaRCTrackLeftBankedQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8295,7 +9467,13 @@ static void GigaRCTrackLeftBankedQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8336,7 +9514,13 @@ static void GigaRCTrackRightBankedQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8385,7 +9569,13 @@ static void GigaRCTrackRightBankedQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8447,7 +9637,13 @@ static void GigaRCTrackLeftBankedQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8478,7 +9674,11 @@ static void GigaRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8506,7 +9706,13 @@ static void GigaRCTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -8538,7 +9744,11 @@ static void GigaRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8578,7 +9788,13 @@ static void GigaRCTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8622,7 +9838,13 @@ static void GigaRCTrackRightBankedQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8653,7 +9875,11 @@ static void GigaRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8681,7 +9907,12 @@ static void GigaRCTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -8713,7 +9944,11 @@ static void GigaRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8753,7 +9988,13 @@ static void GigaRCTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8822,7 +10063,10 @@ static void GigaRCTrack25DegUpToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -8871,7 +10115,10 @@ static void GigaRCTrack25DegUpToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -8920,7 +10167,10 @@ static void GigaRCTrackLeftBanked25DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -8969,7 +10219,10 @@ static void GigaRCTrackRightBanked25DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -9047,7 +10300,10 @@ static void GigaRCTrackLeftBankedFlatToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -9093,7 +10349,10 @@ static void GigaRCTrackRightBankedFlatToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -9139,7 +10398,10 @@ static void GigaRCTrackLeftBanked25DegUpToLeftBankedFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9185,7 +10447,10 @@ static void GigaRCTrackRightBanked25DegUpToRightBankedFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9266,7 +10531,10 @@ static void GigaRCTrackFlatToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -9315,7 +10583,10 @@ static void GigaRCTrackFlatToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -9364,7 +10635,10 @@ static void GigaRCTrackLeftBanked25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9413,7 +10687,10 @@ static void GigaRCTrackRightBanked25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9475,7 +10752,10 @@ static void GigaRCTrackBooster( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -9501,7 +10781,10 @@ static void GigaRCTrackPoweredLift( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -9537,7 +10820,10 @@ static void GigaRCTrack90DegUp( } PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -9593,7 +10879,10 @@ static void GigaRCTrack60DegUpTo90DegUp( } PaintUtilSetVerticalTunnel(session, height + 56); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -9645,7 +10934,10 @@ static void GigaRCTrack90DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); } @@ -9684,7 +10976,10 @@ static void GigaRCTrack60DegDownTo90DegDown( PaintUtilPushTunnelRotated(session, direction, height + 48, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -9730,7 +11025,10 @@ static void GigaRCTrackLeftQuarterTurn190DegUp( } PaintUtilSetVerticalTunnel(session, height + 96); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -9776,7 +11074,10 @@ static void GigaRCTrackRightQuarterTurn190DegUp( } PaintUtilSetVerticalTunnel(session, height + 96); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -9855,7 +11156,12 @@ static void GigaRCTrackLeftBarrelRollUpToDown( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9897,7 +11203,11 @@ static void GigaRCTrackLeftBarrelRollUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -9947,7 +11257,12 @@ static void GigaRCTrackLeftBarrelRollUpToDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10011,7 +11326,12 @@ static void GigaRCTrackRightBarrelRollUpToDown( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -10053,7 +11373,11 @@ static void GigaRCTrackRightBarrelRollUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10103,7 +11427,12 @@ static void GigaRCTrackRightBarrelRollUpToDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10161,7 +11490,10 @@ static void GigaRCTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -10196,7 +11528,7 @@ static void GigaRCTrackHalfLoopUp( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 16, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10225,7 +11557,11 @@ static void GigaRCTrackHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -10258,7 +11594,10 @@ static void GigaRCTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -10315,7 +11654,11 @@ static void GigaRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -10353,7 +11696,11 @@ static void GigaRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -10382,7 +11729,13 @@ static void GigaRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -10411,7 +11764,11 @@ static void GigaRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10447,7 +11804,11 @@ static void GigaRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10476,7 +11837,13 @@ static void GigaRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -10513,7 +11880,11 @@ static void GigaRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -10560,7 +11931,11 @@ static void GigaRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -10868,7 +12243,12 @@ static void GigaRCTrackLeftCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10896,7 +12276,7 @@ static void GigaRCTrackLeftCorkscrewUp( { 0, 0, height }, { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10925,7 +12305,12 @@ static void GigaRCTrackLeftCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 40, session.SupportColours); @@ -10987,7 +12372,12 @@ static void GigaRCTrackRightCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -11015,7 +12405,7 @@ static void GigaRCTrackRightCorkscrewUp( { 0, 0, height }, { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11044,7 +12434,12 @@ static void GigaRCTrackRightCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 40, session.SupportColours); @@ -11115,7 +12510,12 @@ static void GigaRCTrackLeftLargeCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -11155,7 +12555,11 @@ static void GigaRCTrackLeftLargeCorkscrewUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -11184,7 +12588,13 @@ static void GigaRCTrackLeftLargeCorkscrewUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11193,7 +12603,11 @@ static void GigaRCTrackLeftLargeCorkscrewUp( case 4: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -11260,7 +12674,11 @@ static void GigaRCTrackLeftLargeCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -11315,7 +12733,12 @@ static void GigaRCTrackRightLargeCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_BC | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::rightCorner, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -11355,7 +12778,11 @@ static void GigaRCTrackRightLargeCorkscrewUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::bottomRightSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -11384,7 +12811,13 @@ static void GigaRCTrackRightLargeCorkscrewUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11393,7 +12826,11 @@ static void GigaRCTrackRightLargeCorkscrewUp( case 4: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -11459,7 +12896,11 @@ static void GigaRCTrackRightLargeCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -11528,7 +12969,10 @@ static void GigaRCTrackLeftMediumHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11558,7 +13002,11 @@ static void GigaRCTrackLeftMediumHalfLoopUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_B4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::topCorner), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -11597,7 +13045,13 @@ static void GigaRCTrackLeftMediumHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 3: @@ -11625,7 +13079,13 @@ static void GigaRCTrackLeftMediumHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::centre, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 4: @@ -11655,7 +13115,11 @@ static void GigaRCTrackLeftMediumHalfLoopUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_CC | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + direction), 0xFFFF, 0); if (direction == 0 || direction == 3) @@ -11706,7 +13170,10 @@ static void GigaRCTrackRightMediumHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11736,7 +13203,11 @@ static void GigaRCTrackRightMediumHalfLoopUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_CC | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -11775,7 +13246,13 @@ static void GigaRCTrackRightMediumHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::centre, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 3: @@ -11804,7 +13281,13 @@ static void GigaRCTrackRightMediumHalfLoopUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 4: @@ -11834,7 +13317,11 @@ static void GigaRCTrackRightMediumHalfLoopUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_B4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::topCorner), + direction), 0xFFFF, 0); if (direction == 0 || direction == 3) { @@ -11909,7 +13396,10 @@ static void GigaRCTrackLeftZeroGRollUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; case 1: @@ -11938,7 +13428,11 @@ static void GigaRCTrackLeftZeroGRollUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -11983,7 +13477,11 @@ static void GigaRCTrackLeftZeroGRollUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -12041,7 +13539,10 @@ static void GigaRCTrackRightZeroGRollUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; case 1: @@ -12070,7 +13571,11 @@ static void GigaRCTrackRightZeroGRollUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -12115,7 +13620,11 @@ static void GigaRCTrackRightZeroGRollUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -12178,7 +13687,10 @@ static void GigaRCTrackLeftLargeZeroGRollUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -12209,7 +13721,10 @@ static void GigaRCTrackLeftLargeZeroGRollUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -12241,14 +13756,22 @@ static void GigaRCTrackLeftLargeZeroGRollUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -12342,7 +13865,10 @@ static void GigaRCTrackRightLargeZeroGRollUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -12373,7 +13899,10 @@ static void GigaRCTrackRightLargeZeroGRollUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -12406,14 +13935,22 @@ static void GigaRCTrackRightLargeZeroGRollUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -12512,7 +14049,10 @@ static void GigaRCTrack90DegToInvertedFlatQuarterLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -12540,7 +14080,10 @@ static void GigaRCTrack90DegToInvertedFlatQuarterLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -12572,7 +14115,10 @@ static void GigaRCTrack90DegToInvertedFlatQuarterLoopUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -12625,7 +14171,13 @@ static void GigaRCTrackLeftBankToLeftQuarterTurn3Tile25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -12670,7 +14222,13 @@ static void GigaRCTrackLeftBankToLeftQuarterTurn3Tile25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -12716,7 +14274,13 @@ static void GigaRCTrackRightBankToRightQuarterTurn3Tile25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -12761,7 +14325,13 @@ static void GigaRCTrackRightBankToRightQuarterTurn3Tile25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -12804,7 +14374,13 @@ static void GigaRCTrackLeftQuarterTurn3Tile25DegDownToLeftBank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -12852,7 +14428,13 @@ static void GigaRCTrackLeftQuarterTurn3Tile25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -12895,7 +14477,13 @@ static void GigaRCTrackRightQuarterTurn3Tile25DegDownToRightBank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -12943,7 +14531,13 @@ static void GigaRCTrackRightQuarterTurn3Tile25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -12986,7 +14580,10 @@ static void GigaRCTrackLeftLargeHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13022,7 +14619,10 @@ static void GigaRCTrackLeftLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -13051,7 +14651,11 @@ static void GigaRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -13093,7 +14697,11 @@ static void GigaRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -13122,7 +14730,13 @@ static void GigaRCTrackLeftLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -13151,7 +14765,11 @@ static void GigaRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -13185,7 +14803,11 @@ static void GigaRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -13229,7 +14851,10 @@ static void GigaRCTrackRightLargeHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13265,7 +14890,10 @@ static void GigaRCTrackRightLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -13294,7 +14922,11 @@ static void GigaRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -13336,7 +14968,11 @@ static void GigaRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -13365,7 +15001,13 @@ static void GigaRCTrackRightLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -13394,7 +15036,11 @@ static void GigaRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -13428,7 +15074,11 @@ static void GigaRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -13492,7 +15142,10 @@ static void GigaRCTrackFlatTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } @@ -13539,7 +15192,10 @@ static void GigaRCTrack60DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -13573,7 +15229,13 @@ static void GigaRCTrackDiagFlatTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -13586,7 +15248,12 @@ static void GigaRCTrackDiagFlatTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -13599,7 +15266,13 @@ static void GigaRCTrackDiagFlatTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -13626,7 +15299,13 @@ static void GigaRCTrackDiagFlatTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -13648,7 +15327,13 @@ static void GigaRCTrackDiag60DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13661,7 +15346,12 @@ static void GigaRCTrackDiag60DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -13674,7 +15364,13 @@ static void GigaRCTrackDiag60DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -13701,7 +15397,13 @@ static void GigaRCTrackDiag60DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -13723,7 +15425,13 @@ static void GigaRCTrackDiagFlatTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13736,7 +15444,12 @@ static void GigaRCTrackDiagFlatTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -13749,7 +15462,13 @@ static void GigaRCTrackDiagFlatTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -13776,7 +15495,13 @@ static void GigaRCTrackDiagFlatTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -13798,7 +15523,13 @@ static void GigaRCTrackDiag60DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -13811,7 +15542,12 @@ static void GigaRCTrackDiag60DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -13824,7 +15560,13 @@ static void GigaRCTrackDiag60DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -13851,7 +15593,13 @@ static void GigaRCTrackDiag60DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -13894,7 +15642,10 @@ static void GigaRCTrackLeftEighthToDiagUp25( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13923,7 +15674,11 @@ static void GigaRCTrackLeftEighthToDiagUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -13952,13 +15707,24 @@ static void GigaRCTrackLeftEighthToDiagUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -13995,7 +15761,11 @@ static void GigaRCTrackLeftEighthToDiagUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14039,7 +15809,10 @@ static void GigaRCTrackRightEighthToDiagUp25( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -14068,7 +15841,11 @@ static void GigaRCTrackRightEighthToDiagUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14097,13 +15874,24 @@ static void GigaRCTrackRightEighthToDiagUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -14140,7 +15928,11 @@ static void GigaRCTrackRightEighthToDiagUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14187,7 +15979,11 @@ static void GigaRCTrackLeftEighthToOrthogonalUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14216,13 +16012,23 @@ static void GigaRCTrackLeftEighthToOrthogonalUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -14251,7 +16057,11 @@ static void GigaRCTrackLeftEighthToOrthogonalUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14288,7 +16098,10 @@ static void GigaRCTrackLeftEighthToOrthogonalUp25( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -14334,7 +16147,11 @@ static void GigaRCTrackRightEighthToOrthogonalUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14363,13 +16180,24 @@ static void GigaRCTrackRightEighthToOrthogonalUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -14398,7 +16226,11 @@ static void GigaRCTrackRightEighthToOrthogonalUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14433,7 +16265,10 @@ static void GigaRCTrackRightEighthToOrthogonalUp25( PaintUtilPushTunnelRotated(session, direction + 1, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -14489,7 +16324,13 @@ static void GigaRCTrackDiagUp25ToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -14505,7 +16346,12 @@ static void GigaRCTrackDiagUp25ToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -14518,7 +16364,13 @@ static void GigaRCTrackDiagUp25ToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -14545,7 +16397,13 @@ static void GigaRCTrackDiagUp25ToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -14567,7 +16425,13 @@ static void GigaRCTrackDiagUp25ToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -14580,7 +16444,12 @@ static void GigaRCTrackDiagUp25ToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -14596,7 +16465,13 @@ static void GigaRCTrackDiagUp25ToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -14623,7 +16498,13 @@ static void GigaRCTrackDiagUp25ToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -14645,7 +16526,13 @@ static void GigaRCTrackDiagLeftBankedUp25ToUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -14661,7 +16548,12 @@ static void GigaRCTrackDiagLeftBankedUp25ToUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -14674,7 +16566,13 @@ static void GigaRCTrackDiagLeftBankedUp25ToUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -14701,7 +16599,13 @@ static void GigaRCTrackDiagLeftBankedUp25ToUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -14723,7 +16627,13 @@ static void GigaRCTrackDiagRightBankedUp25ToUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -14736,7 +16646,12 @@ static void GigaRCTrackDiagRightBankedUp25ToUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -14752,7 +16667,13 @@ static void GigaRCTrackDiagRightBankedUp25ToUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -14779,7 +16700,13 @@ static void GigaRCTrackDiagRightBankedUp25ToUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -14829,7 +16756,13 @@ static void GigaRCTrackDiagLeftBankedFlatToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -14842,7 +16775,12 @@ static void GigaRCTrackDiagLeftBankedFlatToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -14855,7 +16793,13 @@ static void GigaRCTrackDiagLeftBankedFlatToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -14882,7 +16826,13 @@ static void GigaRCTrackDiagLeftBankedFlatToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -14904,7 +16854,13 @@ static void GigaRCTrackDiagRightBankedFlatToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -14917,7 +16873,12 @@ static void GigaRCTrackDiagRightBankedFlatToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -14930,7 +16891,13 @@ static void GigaRCTrackDiagRightBankedFlatToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -14957,7 +16924,13 @@ static void GigaRCTrackDiagRightBankedFlatToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -14979,7 +16952,13 @@ static void GigaRCTrackDiagLeftBankedUp25ToLeftBankedFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -14992,7 +16971,12 @@ static void GigaRCTrackDiagLeftBankedUp25ToLeftBankedFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15005,7 +16989,13 @@ static void GigaRCTrackDiagLeftBankedUp25ToLeftBankedFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15032,7 +17022,13 @@ static void GigaRCTrackDiagLeftBankedUp25ToLeftBankedFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15054,7 +17050,13 @@ static void GigaRCTrackDiagRightBankedUp25ToRightBankedFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15067,7 +17069,12 @@ static void GigaRCTrackDiagRightBankedUp25ToRightBankedFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15080,7 +17087,13 @@ static void GigaRCTrackDiagRightBankedUp25ToRightBankedFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15107,7 +17120,13 @@ static void GigaRCTrackDiagRightBankedUp25ToRightBankedFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15159,7 +17178,13 @@ static void GigaRCTrackDiagUp25LeftBanked( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15172,7 +17197,12 @@ static void GigaRCTrackDiagUp25LeftBanked( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15185,7 +17215,13 @@ static void GigaRCTrackDiagUp25LeftBanked( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15212,7 +17248,13 @@ static void GigaRCTrackDiagUp25LeftBanked( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15234,7 +17276,13 @@ static void GigaRCTrackDiagUp25RightBanked( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15247,7 +17295,12 @@ static void GigaRCTrackDiagUp25RightBanked( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15260,7 +17313,13 @@ static void GigaRCTrackDiagUp25RightBanked( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15287,7 +17346,13 @@ static void GigaRCTrackDiagUp25RightBanked( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15323,7 +17388,13 @@ static void GigaRCTrackDiagFlatToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -15339,7 +17410,12 @@ static void GigaRCTrackDiagFlatToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -15352,7 +17428,13 @@ static void GigaRCTrackDiagFlatToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -15379,7 +17461,13 @@ static void GigaRCTrackDiagFlatToLeftBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -15401,7 +17489,13 @@ static void GigaRCTrackDiagFlatToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -15414,7 +17508,12 @@ static void GigaRCTrackDiagFlatToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -15430,7 +17529,13 @@ static void GigaRCTrackDiagFlatToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -15457,7 +17562,13 @@ static void GigaRCTrackDiagFlatToRightBankedUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -15479,7 +17590,13 @@ static void GigaRCTrackDiagLeftBankedUp25ToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15495,7 +17612,12 @@ static void GigaRCTrackDiagLeftBankedUp25ToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15508,7 +17630,13 @@ static void GigaRCTrackDiagLeftBankedUp25ToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15535,7 +17663,13 @@ static void GigaRCTrackDiagLeftBankedUp25ToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15557,7 +17691,13 @@ static void GigaRCTrackDiagRightBankedUp25ToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15570,7 +17710,12 @@ static void GigaRCTrackDiagRightBankedUp25ToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15586,7 +17731,13 @@ static void GigaRCTrackDiagRightBankedUp25ToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15613,7 +17764,13 @@ static void GigaRCTrackDiagRightBankedUp25ToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15690,7 +17847,10 @@ static void GigaRCTrackLeftEighthBankToDiagUp25( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -15719,7 +17879,11 @@ static void GigaRCTrackLeftEighthBankToDiagUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -15748,13 +17912,24 @@ static void GigaRCTrackLeftEighthBankToDiagUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -15791,7 +17966,11 @@ static void GigaRCTrackLeftEighthBankToDiagUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -15841,7 +18020,10 @@ static void GigaRCTrackRightEighthBankToDiagUp25( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -15870,7 +18052,11 @@ static void GigaRCTrackRightEighthBankToDiagUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -15899,13 +18085,24 @@ static void GigaRCTrackRightEighthBankToDiagUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -15942,7 +18139,11 @@ static void GigaRCTrackRightEighthBankToDiagUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -15989,7 +18190,11 @@ static void GigaRCTrackLeftEighthBankToOrthogonalUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16018,13 +18223,23 @@ static void GigaRCTrackLeftEighthBankToOrthogonalUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -16053,7 +18268,11 @@ static void GigaRCTrackLeftEighthBankToOrthogonalUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16094,7 +18313,10 @@ static void GigaRCTrackLeftEighthBankToOrthogonalUp25( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -16140,7 +18362,11 @@ static void GigaRCTrackRightEighthBankToOrthogonalUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16169,13 +18395,24 @@ static void GigaRCTrackRightEighthBankToOrthogonalUp25( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -16204,7 +18441,11 @@ static void GigaRCTrackRightEighthBankToOrthogonalUp25( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16245,7 +18486,10 @@ static void GigaRCTrackRightEighthBankToOrthogonalUp25( PaintUtilPushTunnelRotated(session, direction + 1, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -16311,7 +18555,7 @@ static void GigaRCTrackDiagBrakes( session, MetalSupportType::Tubes, DiagSupportPlacement[direction], 0, height, session.SupportColours); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/HeartlineTwisterCoaster.cpp b/src/openrct2/ride/coaster/HeartlineTwisterCoaster.cpp index bc53bf6ea7..1bbb7d7196 100644 --- a/src/openrct2/ride/coaster/HeartlineTwisterCoaster.cpp +++ b/src/openrct2/ride/coaster/HeartlineTwisterCoaster.cpp @@ -90,7 +90,7 @@ static void HeartlineTwisterRCTrackFlat( session, WoodenSupportType::Mine, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -114,7 +114,7 @@ static void HeartlineTwisterRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -212,7 +212,7 @@ static void HeartlineTwisterRCTrack25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -310,7 +310,7 @@ static void HeartlineTwisterRCTrack60DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -408,7 +408,7 @@ static void HeartlineTwisterRCTrackFlatTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -506,7 +506,7 @@ static void HeartlineTwisterRCTrack25DegUpTo60DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -604,7 +604,7 @@ static void HeartlineTwisterRCTrack60DegUpTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -702,7 +702,7 @@ static void HeartlineTwisterRCTrack25DegUpToFlat( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -810,7 +810,7 @@ static void HeartlineTwisterRCTrackHeartlineTransferUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -878,7 +878,7 @@ static void HeartlineTwisterRCTrackHeartlineTransferUp( session, WoodenSupportType::Mine, WoodenSupportSubType::NeSw, direction, height, session.SupportColours, WoodenSupportTransitionType::Up25DegToFlat); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -921,7 +921,7 @@ static void HeartlineTwisterRCTrackHeartlineTransferUp( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -968,7 +968,7 @@ static void HeartlineTwisterRCTrackHeartlineTransferUp( { PaintUtilPushTunnelRotated(session, direction, height - 16, TUNNEL_0); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1025,7 +1025,7 @@ static void HeartlineTwisterRCTrackHeartlineTransferDown( { PaintUtilPushTunnelRotated(session, direction, height - 16, TUNNEL_0); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1093,7 +1093,7 @@ static void HeartlineTwisterRCTrackHeartlineTransferDown( session, WoodenSupportType::Mine, WoodenSupportSubType::NeSw, direction, height, session.SupportColours, WoodenSupportTransitionType::Up25DegToFlat); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -1136,7 +1136,7 @@ static void HeartlineTwisterRCTrackHeartlineTransferDown( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1188,7 +1188,7 @@ static void HeartlineTwisterRCTrackHeartlineTransferDown( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -1429,7 +1429,7 @@ static void HeartlineTwisterRCTrackLeftHeartlineRoll( session, WoodenSupportType::Mine, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1668,7 +1668,7 @@ static void HeartlineTwisterRCTrackRightHeartlineRoll( session, WoodenSupportType::Mine, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/HybridCoaster.cpp b/src/openrct2/ride/coaster/HybridCoaster.cpp index 17f7e13242..a8aa4fb49c 100644 --- a/src/openrct2/ride/coaster/HybridCoaster.cpp +++ b/src/openrct2/ride/coaster/HybridCoaster.cpp @@ -53,7 +53,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -87,7 +87,7 @@ namespace HybridRC TrackPaintUtilDrawNarrowStationPlatform(session, ride, direction, height, 10, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -118,7 +118,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -175,7 +175,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -206,7 +206,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -289,7 +289,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -373,7 +373,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -404,7 +404,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -480,7 +480,7 @@ namespace HybridRC { { boundBoxOffsets[direction].x, boundBoxOffsets[direction].y, boundBoxOffsets[direction].z }, { boundBoxLengths[direction].x, boundBoxLengths[direction].y, boundBoxLengths[direction].z } }); PaintUtilSetVerticalTunnel(session, height + 32); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -532,7 +532,7 @@ namespace HybridRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetVerticalTunnel(session, height + 56); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -583,7 +583,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 48, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); } @@ -621,7 +621,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 48, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -671,7 +671,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -710,7 +710,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -754,7 +760,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -810,12 +816,16 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, (direction + 1) & 3), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + (direction + 1) & 3), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -853,7 +863,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, (direction + 1) & 3), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + (direction + 1) & 3), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -892,14 +905,21 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), (direction + 1) & 3), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, (direction + 1) & 3), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + (direction + 1) & 3), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -937,7 +957,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, (direction + 1) & 3), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + (direction + 1) & 3), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -982,7 +1005,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1038,7 +1061,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1073,7 +1096,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1108,7 +1131,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1131,7 +1154,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1158,7 +1181,7 @@ namespace HybridRC { 0, 0, height }, { { 16, 0, height }, { 16, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1206,7 +1229,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1241,7 +1264,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1276,7 +1299,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1299,7 +1322,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1326,7 +1349,7 @@ namespace HybridRC { 0, 0, height }, { { 16, 16, height }, { 16, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1379,7 +1402,13 @@ namespace HybridRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1428,7 +1457,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1474,7 +1503,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1501,7 +1530,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1523,7 +1552,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1554,7 +1589,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1585,7 +1620,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1597,7 +1632,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1619,7 +1654,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1650,7 +1691,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1681,7 +1722,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1693,7 +1734,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1729,7 +1770,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -1759,7 +1800,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -1789,7 +1830,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -1816,7 +1857,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -1852,7 +1893,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -1882,7 +1923,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -1912,7 +1953,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -1939,7 +1980,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -1975,7 +2016,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2005,7 +2046,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2035,7 +2076,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2062,7 +2103,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -2098,7 +2139,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -2128,7 +2169,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -2158,7 +2199,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -2185,7 +2226,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -2221,7 +2262,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -2250,7 +2291,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -2279,7 +2320,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -2305,7 +2346,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; } @@ -2342,7 +2383,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2372,7 +2413,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2402,7 +2443,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2429,7 +2470,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -2465,7 +2506,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -2495,7 +2536,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -2525,7 +2566,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -2552,7 +2593,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -2588,7 +2629,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2618,7 +2659,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -2648,7 +2689,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -2675,7 +2716,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2711,7 +2752,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2741,7 +2782,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -2771,7 +2812,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -2798,7 +2839,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2834,7 +2875,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -2864,7 +2905,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -2894,7 +2935,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -2921,7 +2962,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -2957,7 +2998,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2987,7 +3028,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3017,7 +3058,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -3044,7 +3085,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3080,7 +3121,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3110,7 +3151,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3140,7 +3181,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -3167,7 +3208,7 @@ namespace HybridRC break; } } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3209,7 +3250,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3249,7 +3290,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3311,7 +3352,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -3359,7 +3400,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -3407,7 +3448,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -3455,7 +3496,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -3523,7 +3564,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3550,7 +3591,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3570,7 +3611,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3586,7 +3627,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3599,7 +3640,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3621,7 +3662,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3637,7 +3678,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3657,7 +3698,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3670,7 +3711,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3692,7 +3733,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3712,7 +3753,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3728,7 +3769,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3741,7 +3782,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3763,7 +3804,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3779,7 +3820,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3799,7 +3840,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3812,7 +3853,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3834,7 +3875,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -3854,7 +3895,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -3870,7 +3911,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -3883,7 +3924,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -3905,7 +3946,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -3921,7 +3962,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -3941,7 +3982,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -3954,7 +3995,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -3976,7 +4017,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -3996,7 +4037,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -4012,7 +4053,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4025,7 +4066,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -4047,7 +4088,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4063,7 +4104,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -4083,7 +4124,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4096,7 +4137,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -4118,7 +4159,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; case 1: switch (direction) @@ -4137,7 +4178,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; case 2: switch (direction) @@ -4152,7 +4193,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; case 3: switch (direction) @@ -4164,7 +4205,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; } @@ -4187,7 +4228,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; case 1: switch (direction) @@ -4202,7 +4243,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; case 2: switch (direction) @@ -4221,7 +4262,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; case 3: switch (direction) @@ -4233,7 +4274,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; } @@ -4256,7 +4297,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4276,7 +4317,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4292,7 +4333,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -4305,7 +4346,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -4327,7 +4368,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4343,7 +4384,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4363,7 +4404,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -4376,7 +4417,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -4398,7 +4439,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4418,7 +4459,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4434,7 +4475,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4447,7 +4488,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4469,7 +4510,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4485,7 +4526,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4505,7 +4546,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4518,7 +4559,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4572,7 +4613,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4611,7 +4652,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4661,7 +4708,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4723,12 +4770,16 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, (direction + 1) & 3), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + (direction + 1) & 3), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4766,7 +4817,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, (direction + 1) & 3), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + (direction + 1) & 3), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4808,14 +4862,21 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), (direction + 1) & 3), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, (direction + 1) & 3), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + (direction + 1) & 3), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -4853,7 +4914,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, (direction + 1) & 3), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + (direction + 1) & 3), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4904,7 +4968,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4966,7 +5030,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5004,7 +5068,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5039,7 +5103,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5062,7 +5126,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5092,7 +5156,7 @@ namespace HybridRC { 0, 0, height }, { { 16, 0, height }, { 16, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5146,7 +5210,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5184,7 +5248,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5219,7 +5283,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5242,7 +5306,7 @@ namespace HybridRC session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5275,7 +5339,7 @@ namespace HybridRC { 0, 0, height }, { { 16, 16, height }, { 16, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5343,7 +5407,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5370,7 +5434,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5380,35 +5450,27 @@ namespace HybridRC PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE + 1), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE + 3), { 6, 0, height }, { 20, 34, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE + 5), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE + 7), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); + break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionPrev(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 2: @@ -5418,7 +5480,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5470,7 +5532,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5497,7 +5559,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5507,35 +5575,26 @@ namespace HybridRC PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE + 9), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE + 11), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE + 13), { 6, 0, height }, { 20, 34, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE + 15), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionNext(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 0: @@ -5545,7 +5604,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5613,12 +5672,16 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5656,7 +5719,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -5695,14 +5761,21 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 5: @@ -5740,7 +5813,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -5751,35 +5827,26 @@ namespace HybridRC PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE + 4), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE + 9), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE + 14), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE + 19), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionPrev(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 2: @@ -5789,7 +5856,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5841,12 +5908,16 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5884,7 +5955,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -5923,14 +5997,21 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 5: @@ -5968,7 +6049,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -5979,35 +6063,26 @@ namespace HybridRC PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE + 24), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE + 29), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE + 34), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE + 39), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionNext(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 0: @@ -6017,7 +6092,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6087,7 +6162,7 @@ namespace HybridRC break; } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -6139,7 +6214,7 @@ namespace HybridRC break; } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -6194,7 +6269,7 @@ namespace HybridRC break; } PaintUtilSetVerticalTunnel(session, height + 96); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -6239,7 +6314,7 @@ namespace HybridRC break; } PaintUtilSetVerticalTunnel(session, height + 96); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -6302,7 +6377,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -6347,7 +6422,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -6392,7 +6467,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -6437,7 +6512,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -6513,7 +6588,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -6561,7 +6636,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -6609,7 +6684,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -6657,7 +6732,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -6727,7 +6802,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -6769,7 +6844,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -6828,7 +6903,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -6873,7 +6948,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -6918,7 +6993,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -6963,7 +7038,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -7049,7 +7124,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7076,7 +7151,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7087,9 +7168,6 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 1), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( @@ -7100,9 +7178,6 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 5), { 6, 0, height }, { { 27, 0, height }, { 1, 34, 34 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( @@ -7113,20 +7188,17 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 8), { 6, 0, height }, { { 27, 0, height }, { 1, 32, 34 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 10), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionPrev(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 2: @@ -7136,7 +7208,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7156,18 +7228,12 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 11), { 0, 6, height }, { 32, 20, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 13), { 0, 6, height }, { 32, 20, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( @@ -7178,25 +7244,22 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 17), { 0, 6, height }, { { 0, 27, height }, { 34, 1, 34 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 20), { 0, 6, height }, { 32, 20, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionNext(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); if (direction == 0 || direction == 3) { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7223,7 +7286,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7234,9 +7303,6 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 12), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( @@ -7247,9 +7313,6 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 15), { 6, 0, height }, { { 27, 0, height }, { 1, 32, 34 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( @@ -7260,20 +7323,17 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 19), { 6, 0, height }, { { 27, 0, height }, { 1, 34, 34 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_SMALL_CURVE_BANKED + 21), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionNext(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 0: @@ -7283,7 +7343,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7359,12 +7419,16 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7410,7 +7474,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -7457,14 +7524,21 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 5: @@ -7510,7 +7584,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -7522,9 +7599,6 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE_BANKED + 4), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( @@ -7535,9 +7609,6 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE_BANKED + 14), { 0, 0, height }, { { 27, 0, height }, { 1, 32, 34 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( @@ -7548,20 +7619,17 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE_BANKED + 20), { 0, 0, height }, { { 27, 0, height }, { 1, 32, 34 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE_BANKED + 25), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionPrev(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 2: @@ -7571,7 +7639,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7631,12 +7699,16 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7682,7 +7754,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -7729,14 +7804,21 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 5: @@ -7782,7 +7864,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -7794,9 +7879,6 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE_BANKED + 30), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( @@ -7807,9 +7889,6 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE_BANKED + 36), { 0, 0, height }, { { 27, 0, height }, { 1, 32, 34 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( @@ -7820,20 +7899,17 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE_BANKED + 46), { 0, 0, height }, { { 27, 0, height }, { 1, 32, 34 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_GENTLE_MEDIUM_CURVE_BANKED + 51), { 0, 0, height }, { { 6, 0, height }, { 20, 32, 3 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionNext(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 0: @@ -7843,7 +7919,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7907,7 +7983,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7945,7 +8021,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7984,7 +8063,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8029,7 +8111,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8077,7 +8159,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8115,7 +8197,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8154,7 +8239,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8199,7 +8287,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8253,7 +8341,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8311,7 +8399,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8361,7 +8455,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8411,7 +8505,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -8469,7 +8563,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -8514,7 +8614,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8568,7 +8668,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8626,7 +8726,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8676,7 +8782,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8726,7 +8832,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -8784,7 +8890,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -8829,7 +8941,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8909,12 +9021,16 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8952,7 +9068,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8994,14 +9113,21 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4 | SEGMENT_B4 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_D0, + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide, PaintSegment::topCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -9039,7 +9165,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9090,7 +9219,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -9140,12 +9269,16 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 8: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 9: @@ -9183,7 +9316,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9225,14 +9361,21 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::leftCorner, PaintSegment::rightCorner, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 12: @@ -9270,7 +9413,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9316,7 +9462,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -9370,12 +9516,16 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -9413,7 +9563,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9455,14 +9608,21 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::leftCorner, PaintSegment::rightCorner, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -9500,7 +9660,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9551,7 +9714,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -9601,12 +9764,16 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 8: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 9: @@ -9644,7 +9811,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9686,14 +9856,21 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4 | SEGMENT_B4 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_D0, + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide, PaintSegment::topCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 12: @@ -9731,7 +9908,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9777,7 +9957,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -9857,7 +10037,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -9898,7 +10078,7 @@ namespace HybridRC } WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -9948,7 +10128,7 @@ namespace HybridRC } WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -10002,7 +10182,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -10043,7 +10223,7 @@ namespace HybridRC } WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -10093,7 +10273,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_INVERTED_9); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -10157,7 +10337,11 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; case 1: @@ -10193,7 +10377,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); @@ -10249,7 +10436,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -10299,7 +10489,11 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; case 1: @@ -10337,7 +10531,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10391,7 +10588,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -10455,7 +10655,11 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -10494,7 +10698,11 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10538,7 +10746,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); @@ -10594,7 +10805,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -10644,7 +10858,11 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -10683,7 +10901,11 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10728,7 +10950,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -10782,7 +11007,10 @@ namespace HybridRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -10845,7 +11073,7 @@ namespace HybridRC { 0, 0, height }, { { 0, 32, height + 8 }, { 32, 1, 48 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -10886,7 +11114,7 @@ namespace HybridRC } WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -10931,7 +11159,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 16, TUNNEL_0); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -10954,7 +11182,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -10971,7 +11199,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -11012,7 +11240,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11042,7 +11270,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours, WoodenSupportTransitionType::FlatToUp60DegLongBaseSeq1); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -11072,7 +11300,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours, WoodenSupportTransitionType::FlatToUp60DegLongBaseSeq2); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -11111,7 +11339,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 24, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; } @@ -11154,7 +11382,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -11184,7 +11412,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours, WoodenSupportTransitionType::Up60DegToFlatLongBaseSeq1); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 2: @@ -11214,7 +11442,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours, WoodenSupportTransitionType::Up60DegToFlatLongBaseSeq2); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -11253,7 +11481,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; } @@ -11283,7 +11511,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -11297,7 +11525,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -11319,7 +11547,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -11368,7 +11596,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -11395,7 +11623,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11439,7 +11673,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -11494,7 +11728,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -11521,7 +11755,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11532,34 +11772,29 @@ namespace HybridRC session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_TURN_BANK_TRANSITION + 10), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetup( - session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; case 1: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_TURN_BANK_TRANSITION + 12), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetup( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, height, session.SupportColours); break; case 2: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_TURN_BANK_TRANSITION + 15), { 6, 0, height }, { 20, 34, 3 }); - WoodenASupportsPaintSetup( - session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; case 3: PaintAddImageAsParentRotated( session, direction, GetTrackColour(session).WithIndex(SPR_G2_HYBRID_TRACK_TURN_BANK_TRANSITION + 17), { 6, 0, height }, { 20, 32, 3 }); - WoodenASupportsPaintSetup( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, height, session.SupportColours); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionNext(direction), height, + session.SupportColours); switch (direction) { case 0: @@ -11569,7 +11804,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -11621,7 +11856,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -11648,7 +11883,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11699,7 +11940,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -11747,7 +11988,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -11774,7 +12015,13 @@ namespace HybridRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11821,7 +12068,7 @@ namespace HybridRC PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -11865,7 +12112,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -11896,7 +12143,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11928,14 +12175,14 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -11964,7 +12211,7 @@ namespace HybridRC { { 16, 0, height }, { 20, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -12011,7 +12258,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -12045,7 +12292,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -12079,14 +12326,14 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -12117,7 +12364,7 @@ namespace HybridRC { { 16, 16, height }, { 16, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -12157,7 +12404,7 @@ namespace HybridRC { { 0, 0, height }, { 16, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -12191,14 +12438,15 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: - WoodenASupportsPaintSetup( - session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, height + 16, session.SupportColours); + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, + session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -12232,7 +12480,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -12272,7 +12520,7 @@ namespace HybridRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -12312,7 +12560,7 @@ namespace HybridRC { { 0, 0, height }, { 16, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -12345,14 +12593,14 @@ namespace HybridRC } WoodenASupportsPaintSetup( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -12386,7 +12634,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -12424,7 +12672,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction + 1, height + 8, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -12480,7 +12728,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -12500,7 +12748,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -12516,7 +12764,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -12535,7 +12783,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -12557,7 +12805,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -12573,7 +12821,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -12593,7 +12841,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -12612,7 +12860,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -12634,7 +12882,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -12654,7 +12902,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -12670,7 +12918,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -12689,7 +12937,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -12711,7 +12959,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -12727,7 +12975,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -12747,7 +12995,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -12766,7 +13014,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -12816,7 +13064,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -12836,7 +13084,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -12852,7 +13100,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -12871,7 +13119,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -12893,7 +13141,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -12909,7 +13157,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -12929,7 +13177,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -12948,7 +13196,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -12970,7 +13218,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -12990,7 +13238,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -13006,7 +13254,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13025,7 +13273,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -13047,7 +13295,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13063,7 +13311,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -13083,7 +13331,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13102,7 +13350,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -13152,7 +13400,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13172,7 +13420,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -13188,7 +13436,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13207,7 +13455,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -13229,7 +13477,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13245,7 +13493,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -13265,7 +13513,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13284,7 +13532,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -13320,7 +13568,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -13340,7 +13588,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -13356,7 +13604,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -13375,7 +13623,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -13397,7 +13645,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -13413,7 +13661,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -13433,7 +13681,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -13452,7 +13700,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -13474,7 +13722,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13494,7 +13742,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -13510,7 +13758,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13529,7 +13777,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -13551,7 +13799,7 @@ namespace HybridRC { -16, -16, height }, { { -16, -16, height }, { 32, 32, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13567,7 +13815,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -13587,7 +13835,7 @@ namespace HybridRC WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13606,7 +13854,7 @@ namespace HybridRC case 3: break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -13681,7 +13929,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13715,7 +13963,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -13749,14 +13997,14 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -13787,7 +14035,7 @@ namespace HybridRC { 0, 0, height }, { { 16, 0, height }, { 20, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -13834,7 +14082,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13868,7 +14116,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -13902,14 +14150,14 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -13940,7 +14188,7 @@ namespace HybridRC { 0, 0, height }, { { 16, 16, height }, { 16, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -13984,7 +14232,7 @@ namespace HybridRC { 0, 0, height }, { { 0, 0, height }, { 16, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -14022,13 +14270,14 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: - WoodenASupportsPaintSetup( - session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, + session.SupportColours); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -14066,7 +14315,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -14108,7 +14357,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -14152,7 +14401,7 @@ namespace HybridRC { 0, 0, height }, { { 0, 0, height }, { 16, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -14189,14 +14438,14 @@ namespace HybridRC } WoodenASupportsPaintSetup( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -14234,7 +14483,7 @@ namespace HybridRC WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -14276,7 +14525,7 @@ namespace HybridRC { PaintUtilPushTunnelRotated(session, direction + 1, height + 8, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } diff --git a/src/openrct2/ride/coaster/InvertedHairpinCoaster.cpp b/src/openrct2/ride/coaster/InvertedHairpinCoaster.cpp index 97fb97ef8c..dbda4f1368 100644 --- a/src/openrct2/ride/coaster/InvertedHairpinCoaster.cpp +++ b/src/openrct2/ride/coaster/InvertedHairpinCoaster.cpp @@ -69,7 +69,10 @@ static void InvertedHairpinRCTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -104,7 +107,7 @@ static void InvertedHairpinRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::TubesInverted); TrackPaintUtilDrawStationInverted(session, ride, direction, height, trackElement, STATION_VARIANT_1); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -167,7 +170,10 @@ static void InvertedHairpinRCTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -272,7 +278,10 @@ static void InvertedHairpinRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -335,7 +344,10 @@ static void InvertedHairpinRCTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -452,7 +464,10 @@ static void InvertedHairpinRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -527,7 +542,10 @@ static void InvertedHairpinRCTrack60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -625,7 +643,10 @@ static void InvertedHairpinRCTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -745,7 +766,12 @@ static void InvertedHairpinRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 30, session.SupportColours); @@ -784,7 +810,13 @@ static void InvertedHairpinRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -813,7 +845,12 @@ static void InvertedHairpinRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 30, session.SupportColours); @@ -870,7 +907,12 @@ static void InvertedHairpinRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -909,7 +951,12 @@ static void InvertedHairpinRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -957,7 +1004,12 @@ static void InvertedHairpinRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -996,7 +1048,12 @@ static void InvertedHairpinRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -1063,7 +1120,12 @@ static void InvertedHairpinRCTrackLeftQuarterTurn1( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 30, session.SupportColours); @@ -1169,7 +1231,10 @@ static void InvertedHairpinRCTrackFlatTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } @@ -1244,7 +1309,10 @@ static void InvertedHairpinRCTrack60DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1318,7 +1386,10 @@ static void InvertedHairpinRCTrackBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -1351,7 +1422,10 @@ static void InvertedHairpinRCTrackBlockBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( diff --git a/src/openrct2/ride/coaster/InvertedImpulseCoaster.cpp b/src/openrct2/ride/coaster/InvertedImpulseCoaster.cpp index df30b6c977..06a2040611 100644 --- a/src/openrct2/ride/coaster/InvertedImpulseCoaster.cpp +++ b/src/openrct2/ride/coaster/InvertedImpulseCoaster.cpp @@ -40,7 +40,10 @@ static void InvertedImpulseRCTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -75,7 +78,7 @@ static void InvertedImpulseRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::TubesInverted); TrackPaintUtilDrawStationInverted(session, ride, direction, height, trackElement, STATION_VARIANT_TALL); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_INVERTED_9); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -109,7 +112,10 @@ static void InvertedImpulseRCTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -185,7 +191,10 @@ static void InvertedImpulseRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); } @@ -219,7 +228,10 @@ static void InvertedImpulseRCTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -298,7 +310,10 @@ static void InvertedImpulseRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); } @@ -345,7 +360,10 @@ static void InvertedImpulseRCTrack60DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); } @@ -379,7 +397,10 @@ static void InvertedImpulseRCTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -496,7 +517,10 @@ static void InvertedImpulseRCTrack90DegUp( } PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -549,7 +573,10 @@ static void InvertedImpulseRCTrack60DegUpTo90DegUp( } PaintUtilSetVerticalTunnel(session, height + 56); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -603,7 +630,10 @@ static void InvertedImpulseRCTrack90DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); } @@ -643,7 +673,10 @@ static void InvertedImpulseRCTrack60DegDownTo90DegDown( PaintUtilPushTunnelRotated(session, direction, height + 48, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -693,7 +726,10 @@ static void InvertedImpulseRCTrackLeftQuarterTurn190DegUp( } PaintUtilSetVerticalTunnel(session, height + 96); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -743,7 +779,10 @@ static void InvertedImpulseRCTrackRightQuarterTurn190DegUp( } PaintUtilSetVerticalTunnel(session, height + 96); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: diff --git a/src/openrct2/ride/coaster/InvertedRollerCoaster.cpp b/src/openrct2/ride/coaster/InvertedRollerCoaster.cpp index 645b6e84e2..e5b3f15601 100644 --- a/src/openrct2/ride/coaster/InvertedRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/InvertedRollerCoaster.cpp @@ -68,7 +68,10 @@ static void InvertedRCTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -103,7 +106,7 @@ static void InvertedRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Boxed); TrackPaintUtilDrawStationInverted(session, ride, direction, height, trackElement, STATION_VARIANT_TALL); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_INVERTED_9); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -166,7 +169,10 @@ static void InvertedRCTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -240,7 +246,10 @@ static void InvertedRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); } @@ -303,7 +312,10 @@ static void InvertedRCTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -383,7 +395,10 @@ static void InvertedRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); } @@ -423,7 +438,10 @@ static void InvertedRCTrack60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -519,7 +537,10 @@ static void InvertedRCTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -637,7 +658,12 @@ static void InvertedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -675,7 +701,11 @@ static void InvertedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -703,7 +733,13 @@ static void InvertedRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -733,7 +769,11 @@ static void InvertedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -763,7 +803,12 @@ static void InvertedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -822,8 +867,12 @@ static void InvertedRCTrackFlatToLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -865,8 +914,12 @@ static void InvertedRCTrackFlatToRightBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -908,8 +961,12 @@ static void InvertedRCTrackLeftBankToFlat( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -951,8 +1008,12 @@ static void InvertedRCTrackRightBankToFlat( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -996,7 +1057,12 @@ static void InvertedRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -1034,7 +1100,11 @@ static void InvertedRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1062,7 +1132,13 @@ static void InvertedRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -1092,7 +1168,11 @@ static void InvertedRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1122,7 +1202,12 @@ static void InvertedRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -1181,8 +1266,12 @@ static void InvertedRCTrackLeftBankTo25DegUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -1250,8 +1339,12 @@ static void InvertedRCTrackRightBankTo25DegUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -1319,8 +1412,12 @@ static void InvertedRCTrack25DegUpToLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -1388,8 +1485,12 @@ static void InvertedRCTrack25DegUpToRightBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -1489,8 +1590,12 @@ static void InvertedRCTrackLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, - 0); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -1538,7 +1643,12 @@ static void InvertedRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1574,7 +1684,11 @@ static void InvertedRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -1599,7 +1713,13 @@ static void InvertedRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 4: @@ -1627,7 +1747,11 @@ static void InvertedRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -1653,7 +1777,12 @@ static void InvertedRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1701,7 +1830,12 @@ static void InvertedRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1737,7 +1871,11 @@ static void InvertedRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -1762,7 +1900,12 @@ static void InvertedRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 4: @@ -1790,7 +1933,11 @@ static void InvertedRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -1816,7 +1963,12 @@ static void InvertedRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1886,7 +2038,13 @@ static void InvertedRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -1921,7 +2079,11 @@ static void InvertedRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1964,7 +2126,11 @@ static void InvertedRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2008,7 +2174,13 @@ static void InvertedRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -2059,7 +2231,13 @@ static void InvertedRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -2094,7 +2272,11 @@ static void InvertedRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2137,7 +2319,11 @@ static void InvertedRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2181,7 +2367,13 @@ static void InvertedRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -2234,7 +2426,10 @@ static void InvertedRCTrackLeftVerticalLoop( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); switch (direction) @@ -2291,7 +2486,7 @@ static void InvertedRCTrackLeftVerticalLoop( { { 29, 20, height + 29 }, { 2, 2, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -2319,7 +2514,13 @@ static void InvertedRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -2348,7 +2549,11 @@ static void InvertedRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -2384,7 +2589,11 @@ static void InvertedRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -2413,7 +2622,13 @@ static void InvertedRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -2440,7 +2655,7 @@ static void InvertedRCTrackLeftVerticalLoop( { { 0, 29, height + 29 }, { 32, 2, 63 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 9: @@ -2471,7 +2686,10 @@ static void InvertedRCTrackLeftVerticalLoop( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); switch (direction) @@ -2547,7 +2765,10 @@ static void InvertedRCTrackRightVerticalLoop( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); switch (direction) @@ -2604,7 +2825,7 @@ static void InvertedRCTrackRightVerticalLoop( { { 0, 29, height + 29 }, { 32, 2, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -2632,7 +2853,13 @@ static void InvertedRCTrackRightVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -2661,7 +2888,11 @@ static void InvertedRCTrackRightVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -2697,7 +2928,11 @@ static void InvertedRCTrackRightVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -2726,7 +2961,12 @@ static void InvertedRCTrackRightVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -2753,7 +2993,7 @@ static void InvertedRCTrackRightVerticalLoop( { { 0, 0, height + 29 }, { 32, 2, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 9: @@ -2784,7 +3024,10 @@ static void InvertedRCTrackRightVerticalLoop( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); switch (direction) @@ -2858,7 +3101,12 @@ static void InvertedRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -2896,7 +3144,13 @@ static void InvertedRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2925,7 +3179,12 @@ static void InvertedRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -2986,7 +3245,12 @@ static void InvertedRCTrackLeftQuarterTurn3Bank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -3025,7 +3289,13 @@ static void InvertedRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -3054,7 +3324,12 @@ static void InvertedRCTrackLeftQuarterTurn3Bank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -3111,7 +3386,12 @@ static void InvertedRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 52, session.SupportColours); @@ -3150,7 +3430,12 @@ static void InvertedRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 52, session.SupportColours); @@ -3198,7 +3483,12 @@ static void InvertedRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 52, session.SupportColours); @@ -3237,7 +3527,12 @@ static void InvertedRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 52, session.SupportColours); @@ -3304,7 +3599,11 @@ static void InvertedRCTrackLeftTwistDownToUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -3337,7 +3636,11 @@ static void InvertedRCTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3374,7 +3677,11 @@ static void InvertedRCTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3411,7 +3718,11 @@ static void InvertedRCTrackRightTwistDownToUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -3444,7 +3755,11 @@ static void InvertedRCTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3481,7 +3796,11 @@ static void InvertedRCTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3523,7 +3842,11 @@ static void InvertedRCTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3549,7 +3872,11 @@ static void InvertedRCTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3576,7 +3903,11 @@ static void InvertedRCTrackLeftTwistUpToDown( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -3630,7 +3961,11 @@ static void InvertedRCTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3656,7 +3991,11 @@ static void InvertedRCTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3683,7 +4022,11 @@ static void InvertedRCTrackRightTwistUpToDown( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -3735,7 +4078,10 @@ static void InvertedRCTrackHalfLoopUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -3790,7 +4136,7 @@ static void InvertedRCTrackHalfLoopUp( { { 29, 20, height + 29 }, { 2, 2, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -3819,7 +4165,11 @@ static void InvertedRCTrackHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -3852,7 +4202,10 @@ static void InvertedRCTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height + 32, TUNNEL_INVERTED_3); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -3901,7 +4254,10 @@ static void InvertedRCTrackLeftCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 50, session.SupportColours); @@ -3936,7 +4292,7 @@ static void InvertedRCTrackLeftCorkscrewUp( { { 6, 6, height + 24 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -3977,7 +4333,10 @@ static void InvertedRCTrackLeftCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -4019,7 +4378,10 @@ static void InvertedRCTrackRightCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 50, session.SupportColours); @@ -4054,7 +4416,7 @@ static void InvertedRCTrackRightCorkscrewUp( { { 6, 6, height + 24 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -4095,7 +4457,10 @@ static void InvertedRCTrackRightCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -4159,7 +4524,7 @@ static void InvertedRCTrackLeftQuarterTurn160DegUp( break; } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_INVERTED_4, +56, TUNNEL_INVERTED_5); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4204,7 +4569,7 @@ static void InvertedRCTrackRightQuarterTurn160DegUp( break; } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_INVERTED_4, +56, TUNNEL_INVERTED_5); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4246,7 +4611,10 @@ static void InvertedRCTrackBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -4290,7 +4658,12 @@ static void InvertedRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -4330,7 +4703,11 @@ static void InvertedRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4359,7 +4736,13 @@ static void InvertedRCTrackLeftQuarterBankedHelixLargeUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -4391,7 +4774,11 @@ static void InvertedRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4421,7 +4808,12 @@ static void InvertedRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 58, session.SupportColours); @@ -4473,7 +4865,12 @@ static void InvertedRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -4513,7 +4910,11 @@ static void InvertedRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4542,7 +4943,12 @@ static void InvertedRCTrackRightQuarterBankedHelixLargeUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -4574,7 +4980,11 @@ static void InvertedRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4604,7 +5014,12 @@ static void InvertedRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 58, session.SupportColours); @@ -4656,7 +5071,12 @@ static void InvertedRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 58, session.SupportColours); @@ -4696,7 +5116,11 @@ static void InvertedRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4725,7 +5149,13 @@ static void InvertedRCTrackLeftQuarterBankedHelixLargeDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -4757,7 +5187,11 @@ static void InvertedRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4787,7 +5221,12 @@ static void InvertedRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -4839,7 +5278,12 @@ static void InvertedRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 58, session.SupportColours); @@ -4879,7 +5323,11 @@ static void InvertedRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4908,7 +5356,12 @@ static void InvertedRCTrackRightQuarterBankedHelixLargeDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -4940,7 +5393,11 @@ static void InvertedRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -4970,7 +5427,12 @@ static void InvertedRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -5019,7 +5481,10 @@ static void InvertedRCTrack25DegUpLeftBanked( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -5086,7 +5551,10 @@ static void InvertedRCTrack25DegUpRightBanked( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -5155,7 +5623,7 @@ static void InvertedRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_INVERTED_3); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } @@ -5208,7 +5676,10 @@ static void InvertedRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -5244,7 +5715,11 @@ static void InvertedRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -5273,13 +5748,24 @@ static void InvertedRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -5309,7 +5795,11 @@ static void InvertedRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -5372,7 +5862,10 @@ static void InvertedRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -5408,7 +5901,11 @@ static void InvertedRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -5437,13 +5934,24 @@ static void InvertedRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -5473,7 +5981,11 @@ static void InvertedRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -5554,7 +6066,13 @@ static void InvertedRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -5590,7 +6108,11 @@ static void InvertedRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -5619,13 +6141,24 @@ static void InvertedRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -5656,7 +6189,10 @@ static void InvertedRCTrackLeftEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -5719,7 +6255,13 @@ static void InvertedRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -5755,7 +6297,11 @@ static void InvertedRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -5784,13 +6330,24 @@ static void InvertedRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -5821,7 +6378,10 @@ static void InvertedRCTrackRightEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -5900,7 +6460,13 @@ static void InvertedRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5927,7 +6493,12 @@ static void InvertedRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5954,7 +6525,13 @@ static void InvertedRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -5982,7 +6559,13 @@ static void InvertedRCTrackDiagFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6061,7 +6644,13 @@ static void InvertedRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6088,7 +6677,12 @@ static void InvertedRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6115,7 +6709,13 @@ static void InvertedRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6143,7 +6743,13 @@ static void InvertedRCTrackDiag25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6189,7 +6795,13 @@ static void InvertedRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 1: @@ -6202,7 +6814,12 @@ static void InvertedRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 2: @@ -6215,7 +6832,13 @@ static void InvertedRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 3: @@ -6229,7 +6852,13 @@ static void InvertedRCTrackDiag60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6290,7 +6919,13 @@ static void InvertedRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -6317,7 +6952,12 @@ static void InvertedRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -6344,7 +6984,13 @@ static void InvertedRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -6372,7 +7018,13 @@ static void InvertedRCTrackDiagFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6418,7 +7070,13 @@ static void InvertedRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -6431,7 +7089,12 @@ static void InvertedRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -6444,7 +7107,13 @@ static void InvertedRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -6458,7 +7127,13 @@ static void InvertedRCTrackDiag25DegUpTo60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6505,7 +7180,13 @@ static void InvertedRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -6518,7 +7199,12 @@ static void InvertedRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -6531,7 +7217,13 @@ static void InvertedRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -6545,7 +7237,13 @@ static void InvertedRCTrackDiag60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6606,7 +7304,13 @@ static void InvertedRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6633,7 +7337,12 @@ static void InvertedRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6660,7 +7369,13 @@ static void InvertedRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6688,7 +7403,13 @@ static void InvertedRCTrackDiag25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6748,7 +7469,13 @@ static void InvertedRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6775,7 +7502,12 @@ static void InvertedRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6802,7 +7534,13 @@ static void InvertedRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6830,7 +7568,13 @@ static void InvertedRCTrackDiag25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6876,7 +7620,13 @@ static void InvertedRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 1: @@ -6889,7 +7639,12 @@ static void InvertedRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 2: @@ -6902,7 +7657,13 @@ static void InvertedRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 3: @@ -6916,7 +7677,13 @@ static void InvertedRCTrackDiag60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6977,7 +7744,13 @@ static void InvertedRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -7003,7 +7776,12 @@ static void InvertedRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -7029,7 +7807,13 @@ static void InvertedRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -7056,7 +7840,13 @@ static void InvertedRCTrackDiagFlatTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7102,7 +7892,13 @@ static void InvertedRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -7115,7 +7911,12 @@ static void InvertedRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -7128,7 +7929,13 @@ static void InvertedRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -7142,7 +7949,13 @@ static void InvertedRCTrackDiag25DegDownTo60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7189,7 +8002,13 @@ static void InvertedRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -7202,7 +8021,12 @@ static void InvertedRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -7215,7 +8039,13 @@ static void InvertedRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -7229,7 +8059,13 @@ static void InvertedRCTrackDiag60DegDownTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7289,7 +8125,13 @@ static void InvertedRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -7316,7 +8158,12 @@ static void InvertedRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -7343,7 +8190,13 @@ static void InvertedRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -7371,7 +8224,13 @@ static void InvertedRCTrackDiag25DegDownToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7417,7 +8276,13 @@ static void InvertedRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7430,7 +8295,12 @@ static void InvertedRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7443,7 +8313,13 @@ static void InvertedRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7457,7 +8333,12 @@ static void InvertedRCTrackDiagFlatToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -7504,7 +8385,13 @@ static void InvertedRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7517,7 +8404,12 @@ static void InvertedRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7530,7 +8422,13 @@ static void InvertedRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7544,7 +8442,12 @@ static void InvertedRCTrackDiagFlatToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -7591,7 +8494,13 @@ static void InvertedRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7604,7 +8513,12 @@ static void InvertedRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7617,7 +8531,13 @@ static void InvertedRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7631,7 +8551,12 @@ static void InvertedRCTrackDiagLeftBankToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -7678,7 +8603,13 @@ static void InvertedRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7691,7 +8622,12 @@ static void InvertedRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7704,7 +8640,13 @@ static void InvertedRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7718,7 +8660,12 @@ static void InvertedRCTrackDiagRightBankToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -7765,7 +8712,13 @@ static void InvertedRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -7778,7 +8731,12 @@ static void InvertedRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -7791,7 +8749,13 @@ static void InvertedRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -7805,7 +8769,13 @@ static void InvertedRCTrackDiagLeftBankTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7851,7 +8821,13 @@ static void InvertedRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -7864,7 +8840,12 @@ static void InvertedRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -7877,7 +8858,13 @@ static void InvertedRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -7891,7 +8878,13 @@ static void InvertedRCTrackDiagRightBankTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7937,7 +8930,13 @@ static void InvertedRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7950,7 +8949,12 @@ static void InvertedRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7963,7 +8967,13 @@ static void InvertedRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7977,7 +8987,13 @@ static void InvertedRCTrackDiag25DegUpToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8023,7 +9039,13 @@ static void InvertedRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8036,7 +9058,12 @@ static void InvertedRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -8049,7 +9076,13 @@ static void InvertedRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -8063,7 +9096,13 @@ static void InvertedRCTrackDiag25DegUpToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8109,7 +9148,13 @@ static void InvertedRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8121,7 +9166,12 @@ static void InvertedRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8133,7 +9183,13 @@ static void InvertedRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8146,7 +9202,13 @@ static void InvertedRCTrackDiagLeftBankTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8192,7 +9254,13 @@ static void InvertedRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8204,7 +9272,12 @@ static void InvertedRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8216,7 +9289,13 @@ static void InvertedRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8229,7 +9308,13 @@ static void InvertedRCTrackDiagRightBankTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8275,7 +9360,13 @@ static void InvertedRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -8288,7 +9379,12 @@ static void InvertedRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -8301,7 +9397,13 @@ static void InvertedRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -8315,7 +9417,13 @@ static void InvertedRCTrackDiag25DegDownToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8361,7 +9469,13 @@ static void InvertedRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -8374,7 +9488,12 @@ static void InvertedRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -8387,7 +9506,13 @@ static void InvertedRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -8401,7 +9526,13 @@ static void InvertedRCTrackDiag25DegDownToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8447,7 +9578,13 @@ static void InvertedRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8460,7 +9597,12 @@ static void InvertedRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8473,7 +9615,13 @@ static void InvertedRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8487,7 +9635,12 @@ static void InvertedRCTrackDiagLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -8534,7 +9687,13 @@ static void InvertedRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8547,7 +9706,12 @@ static void InvertedRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8560,7 +9724,13 @@ static void InvertedRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8574,7 +9744,12 @@ static void InvertedRCTrackDiagRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -8640,7 +9815,10 @@ static void InvertedRCTrackLeftLargeHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_INVERTED_4); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8668,7 +9846,10 @@ static void InvertedRCTrackLeftLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -8697,7 +9878,11 @@ static void InvertedRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -8727,7 +9912,11 @@ static void InvertedRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -8756,7 +9945,13 @@ static void InvertedRCTrackLeftLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -8785,7 +9980,11 @@ static void InvertedRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -8827,7 +10026,11 @@ static void InvertedRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -8870,7 +10073,10 @@ static void InvertedRCTrackRightLargeHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_INVERTED_4); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8898,7 +10104,10 @@ static void InvertedRCTrackRightLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -8927,7 +10136,11 @@ static void InvertedRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -8957,7 +10170,11 @@ static void InvertedRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -8986,7 +10203,13 @@ static void InvertedRCTrackRightLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -9015,7 +10238,11 @@ static void InvertedRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -9057,7 +10284,11 @@ static void InvertedRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -9102,7 +10333,10 @@ static void InvertedRCTrackBlockBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -9142,7 +10376,12 @@ static void InvertedRCTrackLeftBankedQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 52, session.SupportColours); @@ -9181,7 +10420,12 @@ static void InvertedRCTrackLeftBankedQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 52, session.SupportColours); @@ -9229,7 +10473,12 @@ static void InvertedRCTrackRightBankedQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 52, session.SupportColours); @@ -9268,7 +10517,12 @@ static void InvertedRCTrackRightBankedQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 52, session.SupportColours); @@ -9334,7 +10588,12 @@ static void InvertedRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -9370,7 +10629,11 @@ static void InvertedRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -9395,7 +10658,13 @@ static void InvertedRCTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 4: @@ -9423,7 +10692,11 @@ static void InvertedRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -9449,7 +10722,12 @@ static void InvertedRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -9497,7 +10775,12 @@ static void InvertedRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -9533,7 +10816,11 @@ static void InvertedRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -9558,7 +10845,12 @@ static void InvertedRCTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 4: @@ -9586,7 +10878,11 @@ static void InvertedRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -9612,7 +10908,12 @@ static void InvertedRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -9679,7 +10980,10 @@ static void InvertedRCTrack25DegUpToLeftBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -9746,7 +11050,10 @@ static void InvertedRCTrack25DegUpToRightBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -9813,7 +11120,10 @@ static void InvertedRCTrackLeftBanked25DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -9880,7 +11190,10 @@ static void InvertedRCTrackRightBanked25DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -9979,7 +11292,10 @@ static void InvertedRCTrackLeftBankedFlatToLeftBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -10046,7 +11362,10 @@ static void InvertedRCTrackRightBankedFlatToRightBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -10113,7 +11432,10 @@ static void InvertedRCTrackLeftBanked25DegUpToLeftBankedFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -10180,7 +11502,10 @@ static void InvertedRCTrackRightBanked25DegUpToRightBankedFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -10279,7 +11604,10 @@ static void InvertedRCTrackFlatToLeftBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -10346,7 +11674,10 @@ static void InvertedRCTrackFlatToRightBanked25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -10413,7 +11744,10 @@ static void InvertedRCTrackLeftBanked25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -10480,7 +11814,10 @@ static void InvertedRCTrackRightBanked25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -10561,7 +11898,10 @@ static void InvertedRCTrackBooster( { { 0, 6, height + 29 }, { 32, 20, 1 } }); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( diff --git a/src/openrct2/ride/coaster/JuniorRollerCoaster.cpp b/src/openrct2/ride/coaster/JuniorRollerCoaster.cpp index e41536f1fd..ec3186b807 100644 --- a/src/openrct2/ride/coaster/JuniorRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/JuniorRollerCoaster.cpp @@ -1867,7 +1867,10 @@ static void JuniorRCPaintTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1927,7 +1930,7 @@ static void JuniorRCPaintStation( TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1951,7 +1954,10 @@ static void JuniorRCPaintTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -1981,7 +1987,10 @@ static void JuniorRCPaintTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -2023,7 +2032,10 @@ static void JuniorRCPaintTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -2082,27 +2094,52 @@ static void JuniorRCRightQuarterTurn5TilesPaintSetup( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::rightCorner), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre), + direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::leftCorner), + direction), + 0xFFFF, 0); break; } @@ -2166,7 +2203,10 @@ static void JuniorRCFlatToLeftBankPaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -2214,7 +2254,10 @@ static void JuniorRCFlatToRightBankPaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -2359,27 +2402,52 @@ static void JuniorRCBankedRightQuarterTurn5TilesPaintSetup( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::rightCorner), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre), + direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::leftCorner), + direction), + 0xFFFF, 0); break; } @@ -2451,7 +2519,10 @@ static void JuniorRCLeftBankTo25DegUpPaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -2511,7 +2582,10 @@ static void JuniorRCRightBankTo25DegUpPaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -2572,7 +2646,10 @@ static void JuniorRC25DegUpToLeftBankPaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -2633,7 +2710,10 @@ static void JuniorRC25DegUpToRightBankPaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -2721,7 +2801,10 @@ static void JuniorRCLeftBankPaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -2781,27 +2864,53 @@ static void JuniorRCPaintTrackLeftQuarterTurn5Tiles25DegUp( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::topCorner), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topCorner, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_BC | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::rightCorner, PaintSegment::topRightSide, + PaintSegment::centre), + direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_C0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomCorner), + direction), + 0xFFFF, 0); break; } if (trackSequence == 3) @@ -2860,27 +2969,52 @@ static void JuniorRCPaintTrackRightQuarterTurn5Tiles25DegUp( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::rightCorner), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre), + direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::leftCorner), + direction), + 0xFFFF, 0); break; } if (trackSequence == 3) @@ -3000,16 +3134,22 @@ static void JuniorRCSBendLeftPaintSetup( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::topCorner); break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::topCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, (direction & 1)), 0xFFFF, 0); @@ -3104,16 +3244,22 @@ static void JuniorRCSBendRightPaintSetup( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::topCorner); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, (direction & 1)), 0xFFFF, 0); @@ -3149,13 +3295,16 @@ static void JuniorRCRightQuarterTurn3TilesPaintSetup( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 3: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -3265,13 +3414,16 @@ static void JuniorRCRightQuarterTurn3TilesBankPaintSetup( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 3: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -3348,10 +3500,12 @@ static void JuniorRCPaintTrackRightQuarterTurn3Tiles25DegUp( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -3431,10 +3585,12 @@ static void JuniorRCPaintTrackRightQuarterTurn3Tiles25DegDown( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -3534,13 +3690,18 @@ static void JuniorRCRightHalfBankedHelixUpSmallPaintSetup( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner, + PaintSegment::bottomRightSide); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_C0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -3602,13 +3763,18 @@ static void JuniorRCRightHalfBankedHelixDownSmallPaintSetup( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner, + PaintSegment::bottomRightSide); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_C0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -3700,28 +3866,51 @@ static void JuniorRCRightHalfBankedHelixUpLargePaintSetup( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::rightCorner), + direction), 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre), + direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::leftCorner), + direction), 0xFFFF, 0); break; } @@ -3784,28 +3973,51 @@ static void JuniorRCRightHalfBankedHelixDownLargePaintSetup( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::rightCorner), + direction), 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre), + direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::leftCorner), + direction), 0xFFFF, 0); break; } @@ -3873,7 +4085,10 @@ static void JuniorRCBrakePaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3909,7 +4124,10 @@ static void JuniorRCBlockBrakePaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3959,19 +4177,26 @@ static void JuniorRCLeftEighthToDiagPaintSetup( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide); break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::topCorner); break; case 2: - blockedSegments = SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide, + PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_B8 | SEGMENT_C8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::leftCorner, PaintSegment::topLeftSide); break; case 4: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C8 | SEGMENT_C0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::topLeftSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } @@ -4025,19 +4250,26 @@ static void JuniorRCRightEighthToDiagPaintSetup( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide); break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, PaintSegment::topLeftSide, + PaintSegment::topCorner); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_C0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; case 4: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::bottomRightSide); break; } @@ -4192,19 +4424,26 @@ static void JuniorRCLeftEighthToDiagBankPaintSetup( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide); break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::topCorner); break; case 2: - blockedSegments = SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide, + PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_B8 | SEGMENT_C8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::leftCorner, PaintSegment::topLeftSide); break; case 4: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C8 | SEGMENT_C0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::topLeftSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } @@ -4339,19 +4578,26 @@ static void JuniorRCRightEighthToDiagBankPaintSetup( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide); break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, PaintSegment::topLeftSide, + PaintSegment::topCorner); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_C0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; case 4: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::bottomRightSide); break; } @@ -5119,7 +5365,10 @@ static void JuniorRCPaintTrack60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -5202,7 +5451,10 @@ static void JuniorRCPaintTrack25DegUpTo60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -5263,7 +5515,10 @@ static void JuniorRCPaintTrack60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -5520,7 +5775,10 @@ static void JuniorRCFlatTo60DegUpPaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -5579,7 +5837,10 @@ static void JuniorRC60DegUpToFlatPaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -5643,7 +5904,10 @@ static void JuniorRCBoosterPaintSetup( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -5661,7 +5925,7 @@ static void JuniorRCTrackOnRidePhoto( TrackPaintUtilOnridePhotoPaint(session, direction, height + 3 + photoCameraOffset, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48 + photoCameraOffset, 0x20); } diff --git a/src/openrct2/ride/coaster/LayDownRollerCoaster.cpp b/src/openrct2/ride/coaster/LayDownRollerCoaster.cpp index d675137923..47793932fe 100644 --- a/src/openrct2/ride/coaster/LayDownRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/LayDownRollerCoaster.cpp @@ -114,7 +114,10 @@ static void LayDownRCTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -152,7 +155,7 @@ static void LayDownRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::TubesInverted); TrackPaintUtilDrawStationInverted(session, ride, direction, height, trackElement, STATION_VARIANT_1); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_INVERTED_9); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -230,7 +233,10 @@ static void LayDownRCTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -315,7 +321,10 @@ static void LayDownRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } } @@ -387,7 +396,10 @@ static void LayDownRCTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -478,7 +490,10 @@ static void LayDownRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } } @@ -527,7 +542,10 @@ static void LayDownRCTrack60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -634,7 +652,10 @@ static void LayDownRCTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -763,7 +784,12 @@ static void LayDownRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, @@ -805,7 +831,10 @@ static void LayDownRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -834,7 +863,13 @@ static void LayDownRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -867,7 +902,10 @@ static void LayDownRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -897,7 +935,12 @@ static void LayDownRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, @@ -966,7 +1009,11 @@ static void LayDownRCTrackFlatToLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1018,7 +1065,11 @@ static void LayDownRCTrackFlatToRightBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1070,7 +1121,11 @@ static void LayDownRCTrackLeftBankToFlat( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1122,7 +1177,11 @@ static void LayDownRCTrackRightBankToFlat( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1176,7 +1235,12 @@ static void LayDownRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, @@ -1216,7 +1280,10 @@ static void LayDownRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1244,7 +1311,13 @@ static void LayDownRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1275,7 +1348,10 @@ static void LayDownRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1305,7 +1381,12 @@ static void LayDownRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, @@ -1374,7 +1455,11 @@ static void LayDownRCTrackLeftBankTo25DegUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1454,7 +1539,11 @@ static void LayDownRCTrackRightBankTo25DegUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1534,7 +1623,11 @@ static void LayDownRCTrack25DegUpToLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1614,7 +1707,11 @@ static void LayDownRCTrack25DegUpToRightBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1726,7 +1823,11 @@ static void LayDownRCTrackLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1784,7 +1885,12 @@ static void LayDownRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 43, @@ -1822,7 +1928,10 @@ static void LayDownRCTrackLeftQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1847,7 +1956,13 @@ static void LayDownRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1876,7 +1991,10 @@ static void LayDownRCTrackLeftQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1902,7 +2020,12 @@ static void LayDownRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 43, @@ -1960,7 +2083,12 @@ static void LayDownRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 43, @@ -1998,7 +2126,10 @@ static void LayDownRCTrackRightQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2023,7 +2154,13 @@ static void LayDownRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -2052,7 +2189,10 @@ static void LayDownRCTrackRightQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2078,7 +2218,12 @@ static void LayDownRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 43, @@ -2158,7 +2303,13 @@ static void LayDownRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -2197,7 +2348,10 @@ static void LayDownRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2243,7 +2397,10 @@ static void LayDownRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2287,7 +2444,13 @@ static void LayDownRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -2348,7 +2511,13 @@ static void LayDownRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -2387,7 +2556,10 @@ static void LayDownRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2433,7 +2605,10 @@ static void LayDownRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2477,7 +2652,13 @@ static void LayDownRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -2537,7 +2718,13 @@ static void LayDownRCTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2568,7 +2755,13 @@ static void LayDownRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2607,7 +2800,13 @@ static void LayDownRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2642,7 +2841,12 @@ static void LayDownRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, @@ -2682,7 +2886,13 @@ static void LayDownRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2711,7 +2921,12 @@ static void LayDownRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, @@ -2784,7 +2999,13 @@ static void LayDownRCTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2815,7 +3036,13 @@ static void LayDownRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2857,7 +3084,13 @@ static void LayDownRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2892,7 +3125,12 @@ static void LayDownRCTrackLeftQuarterTurn3Bank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, @@ -2932,7 +3170,13 @@ static void LayDownRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2961,7 +3205,12 @@ static void LayDownRCTrackLeftQuarterTurn3Bank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, @@ -3027,7 +3276,13 @@ static void LayDownRCTrackLeftQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3068,7 +3323,13 @@ static void LayDownRCTrackLeftQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3099,7 +3360,12 @@ static void LayDownRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 41, @@ -3139,7 +3405,12 @@ static void LayDownRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 41, @@ -3196,7 +3467,13 @@ static void LayDownRCTrackRightQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3247,7 +3524,13 @@ static void LayDownRCTrackRightQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3278,7 +3561,12 @@ static void LayDownRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 41, @@ -3318,7 +3606,12 @@ static void LayDownRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 41, @@ -3407,7 +3700,7 @@ static void LayDownRCTrackLeftQuarterTurn160DegUp( } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_1, +56, TUNNEL_2); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } } @@ -3463,7 +3756,7 @@ static void LayDownRCTrackRightQuarterTurn160DegUp( } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_1, +56, TUNNEL_2); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -3513,7 +3806,10 @@ static void LayDownRCTrackBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -3565,7 +3861,7 @@ static void LayDownRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } } @@ -3611,7 +3907,11 @@ static void LayDownRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -3649,7 +3949,10 @@ static void LayDownRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3678,13 +3981,24 @@ static void LayDownRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3715,7 +4029,10 @@ static void LayDownRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -3788,7 +4105,11 @@ static void LayDownRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -3826,7 +4147,10 @@ static void LayDownRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3855,13 +4179,24 @@ static void LayDownRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3892,7 +4227,10 @@ static void LayDownRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -3983,7 +4321,13 @@ static void LayDownRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -4021,7 +4365,10 @@ static void LayDownRCTrackLeftEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4050,13 +4397,24 @@ static void LayDownRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4087,7 +4445,11 @@ static void LayDownRCTrackLeftEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -4160,7 +4522,13 @@ static void LayDownRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -4198,7 +4566,10 @@ static void LayDownRCTrackRightEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4227,13 +4598,24 @@ static void LayDownRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4264,7 +4646,10 @@ static void LayDownRCTrackRightEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -4353,7 +4738,13 @@ static void LayDownRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4380,7 +4771,13 @@ static void LayDownRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4407,7 +4804,13 @@ static void LayDownRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4435,7 +4838,13 @@ static void LayDownRCTrackDiagFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -4583,7 +4992,13 @@ static void LayDownRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4610,7 +5025,13 @@ static void LayDownRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -4637,7 +5058,13 @@ static void LayDownRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4665,7 +5092,13 @@ static void LayDownRCTrackDiag25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -4721,7 +5154,13 @@ static void LayDownRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -4734,7 +5173,13 @@ static void LayDownRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -4747,7 +5192,13 @@ static void LayDownRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -4761,7 +5212,13 @@ static void LayDownRCTrackDiag60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -4831,7 +5288,13 @@ static void LayDownRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4858,7 +5321,13 @@ static void LayDownRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4885,7 +5354,13 @@ static void LayDownRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -4913,7 +5388,13 @@ static void LayDownRCTrackDiagFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -4969,7 +5450,13 @@ static void LayDownRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -4982,7 +5469,13 @@ static void LayDownRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -4995,7 +5488,13 @@ static void LayDownRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5009,7 +5508,13 @@ static void LayDownRCTrackDiag25DegUpTo60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -5065,7 +5570,13 @@ static void LayDownRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5078,7 +5589,13 @@ static void LayDownRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5091,7 +5608,13 @@ static void LayDownRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5105,7 +5628,13 @@ static void LayDownRCTrackDiag60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -5175,7 +5704,13 @@ static void LayDownRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5202,7 +5737,13 @@ static void LayDownRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5229,7 +5770,13 @@ static void LayDownRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5257,7 +5804,13 @@ static void LayDownRCTrackDiag25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -5313,7 +5866,13 @@ static void LayDownRCTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5326,7 +5885,13 @@ static void LayDownRCTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5339,7 +5904,13 @@ static void LayDownRCTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5353,7 +5924,13 @@ static void LayDownRCTrackDiag25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -5409,7 +5986,13 @@ static void LayDownRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -5422,7 +6005,13 @@ static void LayDownRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -5435,7 +6024,13 @@ static void LayDownRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -5449,7 +6044,13 @@ static void LayDownRCTrackDiag60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -5505,7 +6106,13 @@ static void LayDownRCTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -5517,7 +6124,13 @@ static void LayDownRCTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -5529,7 +6142,13 @@ static void LayDownRCTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -5542,7 +6161,13 @@ static void LayDownRCTrackDiagFlatTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -5598,7 +6223,13 @@ static void LayDownRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5611,7 +6242,13 @@ static void LayDownRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5624,7 +6261,13 @@ static void LayDownRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5638,7 +6281,13 @@ static void LayDownRCTrackDiag25DegDownTo60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -5694,7 +6343,13 @@ static void LayDownRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5707,7 +6362,13 @@ static void LayDownRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5720,7 +6381,13 @@ static void LayDownRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5734,7 +6401,13 @@ static void LayDownRCTrackDiag60DegDownTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -5790,7 +6463,13 @@ static void LayDownRCTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5803,7 +6482,13 @@ static void LayDownRCTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5816,7 +6501,13 @@ static void LayDownRCTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -5830,7 +6521,13 @@ static void LayDownRCTrackDiag25DegDownToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -5886,7 +6583,13 @@ static void LayDownRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5899,7 +6602,13 @@ static void LayDownRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5912,7 +6621,13 @@ static void LayDownRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5926,7 +6641,12 @@ static void LayDownRCTrackDiagFlatToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -5983,7 +6703,13 @@ static void LayDownRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5996,7 +6722,13 @@ static void LayDownRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6009,7 +6741,13 @@ static void LayDownRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6023,7 +6761,12 @@ static void LayDownRCTrackDiagFlatToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -6080,7 +6823,13 @@ static void LayDownRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6093,7 +6842,13 @@ static void LayDownRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6106,7 +6861,13 @@ static void LayDownRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6120,7 +6881,12 @@ static void LayDownRCTrackDiagLeftBankToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -6177,7 +6943,13 @@ static void LayDownRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6190,7 +6962,13 @@ static void LayDownRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6203,7 +6981,13 @@ static void LayDownRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6217,7 +7001,12 @@ static void LayDownRCTrackDiagRightBankToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -6274,7 +7063,13 @@ static void LayDownRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6287,7 +7082,13 @@ static void LayDownRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6300,7 +7101,13 @@ static void LayDownRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6314,7 +7121,13 @@ static void LayDownRCTrackDiagLeftBankTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6370,7 +7183,13 @@ static void LayDownRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6383,7 +7202,13 @@ static void LayDownRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6396,7 +7221,13 @@ static void LayDownRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6410,7 +7241,13 @@ static void LayDownRCTrackDiagRightBankTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6466,7 +7303,13 @@ static void LayDownRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6479,7 +7322,13 @@ static void LayDownRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6492,7 +7341,13 @@ static void LayDownRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6506,7 +7361,13 @@ static void LayDownRCTrackDiag25DegUpToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6562,7 +7423,13 @@ static void LayDownRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6575,7 +7442,13 @@ static void LayDownRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6588,7 +7461,13 @@ static void LayDownRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6602,7 +7481,13 @@ static void LayDownRCTrackDiag25DegUpToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6658,7 +7543,13 @@ static void LayDownRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -6670,7 +7561,13 @@ static void LayDownRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -6682,7 +7579,13 @@ static void LayDownRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -6695,7 +7598,13 @@ static void LayDownRCTrackDiagLeftBankTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6751,7 +7660,13 @@ static void LayDownRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -6763,7 +7678,13 @@ static void LayDownRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -6775,7 +7696,13 @@ static void LayDownRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -6788,7 +7715,13 @@ static void LayDownRCTrackDiagRightBankTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6844,7 +7777,13 @@ static void LayDownRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6857,7 +7796,13 @@ static void LayDownRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6870,7 +7815,13 @@ static void LayDownRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6884,7 +7835,13 @@ static void LayDownRCTrackDiag25DegDownToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -6940,7 +7897,13 @@ static void LayDownRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6953,7 +7916,13 @@ static void LayDownRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6966,7 +7935,13 @@ static void LayDownRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6980,7 +7955,13 @@ static void LayDownRCTrackDiag25DegDownToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7036,7 +8017,13 @@ static void LayDownRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7049,7 +8036,13 @@ static void LayDownRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7062,7 +8055,13 @@ static void LayDownRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7076,7 +8075,12 @@ static void LayDownRCTrackDiagLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -7133,7 +8137,13 @@ static void LayDownRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7146,7 +8156,13 @@ static void LayDownRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7159,7 +8175,13 @@ static void LayDownRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7173,7 +8195,12 @@ static void LayDownRCTrackDiagRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -7236,7 +8263,11 @@ static void LayDownRCTrackLeftFlyerTwistDown( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -7270,7 +8301,11 @@ static void LayDownRCTrackLeftFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7307,7 +8342,11 @@ static void LayDownRCTrackLeftFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7344,7 +8383,11 @@ static void LayDownRCTrackRightFlyerTwistDown( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -7377,7 +8420,11 @@ static void LayDownRCTrackRightFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7414,7 +8461,11 @@ static void LayDownRCTrackRightFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7453,7 +8504,10 @@ static void LayDownRCTrackFlyerHalfLoopDown( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7480,7 +8534,11 @@ static void LayDownRCTrackFlyerHalfLoopDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -7519,7 +8577,7 @@ static void LayDownRCTrackFlyerHalfLoopDown( session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7549,7 +8607,10 @@ static void LayDownRCTrackFlyerHalfLoopDown( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -7588,7 +8649,12 @@ static void LayDownRCTrackLeftFlyerCorkscrewDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); @@ -7623,7 +8689,7 @@ static void LayDownRCTrackLeftFlyerCorkscrewDown( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7662,7 +8728,12 @@ static void LayDownRCTrackLeftFlyerCorkscrewDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -7709,7 +8780,10 @@ static void LayDownRCTrackBlockBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -7753,7 +8827,12 @@ static void LayDownRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -7793,7 +8872,11 @@ static void LayDownRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -7822,7 +8905,13 @@ static void LayDownRCTrackLeftQuarterBankedHelixLargeUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -7854,7 +8943,11 @@ static void LayDownRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -7884,7 +8977,12 @@ static void LayDownRCTrackLeftQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 51, session.SupportColours); @@ -7935,7 +9033,12 @@ static void LayDownRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -7975,7 +9078,11 @@ static void LayDownRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -8004,7 +9111,12 @@ static void LayDownRCTrackRightQuarterBankedHelixLargeUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -8036,7 +9148,11 @@ static void LayDownRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -8066,7 +9182,12 @@ static void LayDownRCTrackRightQuarterBankedHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 51, session.SupportColours); @@ -8117,7 +9238,12 @@ static void LayDownRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 51, session.SupportColours); @@ -8157,7 +9283,11 @@ static void LayDownRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -8186,7 +9316,13 @@ static void LayDownRCTrackLeftQuarterBankedHelixLargeDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -8218,7 +9354,11 @@ static void LayDownRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -8248,7 +9388,12 @@ static void LayDownRCTrackLeftQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -8299,7 +9444,12 @@ static void LayDownRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 51, session.SupportColours); @@ -8339,7 +9489,11 @@ static void LayDownRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -8368,7 +9522,12 @@ static void LayDownRCTrackRightQuarterBankedHelixLargeDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -8400,7 +9559,11 @@ static void LayDownRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -8430,7 +9593,12 @@ static void LayDownRCTrackRightQuarterBankedHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 39, session.SupportColours); @@ -8481,7 +9649,10 @@ static void LayDownRCTrackHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8536,7 +9707,7 @@ static void LayDownRCTrackHalfLoopInvertedUp( { { 29, 20, height + 29 }, { 2, 2, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -8565,7 +9736,11 @@ static void LayDownRCTrackHalfLoopInvertedUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -8598,7 +9773,10 @@ static void LayDownRCTrackHalfLoopInvertedUp( PaintUtilPushTunnelRotated(session, direction, height + 32, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } diff --git a/src/openrct2/ride/coaster/LimLaunchedRollerCoaster.cpp b/src/openrct2/ride/coaster/LimLaunchedRollerCoaster.cpp index a0fe9a4391..90b1e98392 100644 --- a/src/openrct2/ride/coaster/LimLaunchedRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/LimLaunchedRollerCoaster.cpp @@ -61,7 +61,7 @@ static void LimLaunchedRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -106,7 +106,11 @@ static void LimLaunchedRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -132,7 +136,11 @@ static void LimLaunchedRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -161,7 +169,13 @@ static void LimLaunchedRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -186,7 +200,11 @@ static void LimLaunchedRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -218,7 +236,11 @@ static void LimLaunchedRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -247,7 +269,13 @@ static void LimLaunchedRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -272,7 +300,11 @@ static void LimLaunchedRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -315,7 +347,11 @@ static void LimLaunchedRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -591,7 +627,12 @@ static void LimLaunchedRCTrackLeftTwistDownToUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -633,7 +674,11 @@ static void LimLaunchedRCTrackLeftTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -683,7 +728,12 @@ static void LimLaunchedRCTrackLeftTwistDownToUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height, 0x20); break; @@ -740,7 +790,12 @@ static void LimLaunchedRCTrackRightTwistDownToUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -782,7 +837,11 @@ static void LimLaunchedRCTrackRightTwistDownToUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -832,7 +891,12 @@ static void LimLaunchedRCTrackRightTwistDownToUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height, 0x20); break; @@ -887,7 +951,12 @@ static void LimLaunchedRCTrackLeftTwistUpToDown( PaintUtilPushTunnelRotated(session, direction, height - 32, TUNNEL_INVERTED_3); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height, 0x20); break; @@ -929,7 +998,11 @@ static void LimLaunchedRCTrackLeftTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -981,7 +1054,12 @@ static void LimLaunchedRCTrackLeftTwistUpToDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1036,7 +1114,12 @@ static void LimLaunchedRCTrackRightTwistUpToDown( PaintUtilPushTunnelRotated(session, direction, height + 32, TUNNEL_INVERTED_3); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -1078,7 +1161,11 @@ static void LimLaunchedRCTrackRightTwistUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1130,7 +1217,12 @@ static void LimLaunchedRCTrackRightTwistUpToDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1201,7 +1293,7 @@ static void LimLaunchedRCTrackLeftCorkscrewUp( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -1230,7 +1322,12 @@ static void LimLaunchedRCTrackLeftCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); @@ -1287,7 +1384,12 @@ static void LimLaunchedRCTrackRightCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1315,7 +1417,7 @@ static void LimLaunchedRCTrackRightCorkscrewUp( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -1344,7 +1446,12 @@ static void LimLaunchedRCTrackRightCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); @@ -1406,7 +1513,10 @@ static void LimLaunchedRCTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1443,7 +1553,10 @@ static void LimLaunchedRCTrack90DegUp( } PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1496,7 +1609,10 @@ static void LimLaunchedRCTrack60DegUpTo90DegUp( } PaintUtilSetVerticalTunnel(session, height + 56); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -1550,7 +1666,10 @@ static void LimLaunchedRCTrack90DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); } @@ -1590,7 +1709,10 @@ static void LimLaunchedRCTrack60DegDownTo90DegDown( PaintUtilPushTunnelRotated(session, direction, height + 48, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -1630,7 +1752,10 @@ static void LimLaunchedRCTrack90DegToInvertedFlatQuarterLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -1658,7 +1783,10 @@ static void LimLaunchedRCTrack90DegToInvertedFlatQuarterLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -1690,7 +1818,10 @@ static void LimLaunchedRCTrack90DegToInvertedFlatQuarterLoopUp( PaintUtilPushTunnelRotated(session, direction, height + 16, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -1721,7 +1852,10 @@ static void LimLaunchedRCTrackBlockBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1763,7 +1897,10 @@ static void LimLaunchedRCTrackLeftQuarterTurn190DegUp( } PaintUtilSetVerticalTunnel(session, height + 96); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -1810,7 +1947,10 @@ static void LimLaunchedRCTrackRightQuarterTurn190DegUp( } PaintUtilSetVerticalTunnel(session, height + 96); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -1891,7 +2031,12 @@ static void LimLaunchedRCTrackLeftBarrelRollUpToDown( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1933,7 +2078,11 @@ static void LimLaunchedRCTrackLeftBarrelRollUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1983,7 +2132,12 @@ static void LimLaunchedRCTrackLeftBarrelRollUpToDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2047,7 +2201,12 @@ static void LimLaunchedRCTrackRightBarrelRollUpToDown( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2089,7 +2248,11 @@ static void LimLaunchedRCTrackRightBarrelRollUpToDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2139,7 +2302,12 @@ static void LimLaunchedRCTrackRightBarrelRollUpToDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2197,7 +2365,10 @@ static void LimLaunchedRCTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -2232,7 +2403,7 @@ static void LimLaunchedRCTrackHalfLoopUp( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 16, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -2261,7 +2432,11 @@ static void LimLaunchedRCTrackHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -2294,7 +2469,10 @@ static void LimLaunchedRCTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -2347,7 +2525,10 @@ static void LimLaunchedRCTrackFlatTo60DegUpLongBase( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2380,7 +2561,10 @@ static void LimLaunchedRCTrackFlatTo60DegUpLongBase( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 9, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2413,7 +2597,10 @@ static void LimLaunchedRCTrackFlatTo60DegUpLongBase( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 10, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -2455,7 +2642,10 @@ static void LimLaunchedRCTrackFlatTo60DegUpLongBase( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; } @@ -2500,7 +2690,10 @@ static void LimLaunchedRCTrack60DegUpToFlatLongBase( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -2533,7 +2726,10 @@ static void LimLaunchedRCTrack60DegUpToFlatLongBase( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 18, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 2: @@ -2566,7 +2762,10 @@ static void LimLaunchedRCTrack60DegUpToFlatLongBase( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 13, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -2608,7 +2807,10 @@ static void LimLaunchedRCTrack60DegUpToFlatLongBase( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; } @@ -2667,7 +2869,12 @@ static void LimLaunchedRCTrackLeftLargeCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -2707,7 +2914,11 @@ static void LimLaunchedRCTrackLeftLargeCorkscrewUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -2736,7 +2947,13 @@ static void LimLaunchedRCTrackLeftLargeCorkscrewUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2745,7 +2962,11 @@ static void LimLaunchedRCTrackLeftLargeCorkscrewUp( case 4: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2812,7 +3033,11 @@ static void LimLaunchedRCTrackLeftLargeCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2867,7 +3092,12 @@ static void LimLaunchedRCTrackRightLargeCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_BC | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::rightCorner, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -2907,7 +3137,11 @@ static void LimLaunchedRCTrackRightLargeCorkscrewUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::bottomRightSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -2936,7 +3170,13 @@ static void LimLaunchedRCTrackRightLargeCorkscrewUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2945,7 +3185,11 @@ static void LimLaunchedRCTrackRightLargeCorkscrewUp( case 4: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -3011,7 +3255,11 @@ static void LimLaunchedRCTrackRightLargeCorkscrewUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -3080,7 +3328,10 @@ static void LimLaunchedRCTrackLeftMediumHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -3110,7 +3361,11 @@ static void LimLaunchedRCTrackLeftMediumHalfLoopUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_B4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::topCorner), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -3149,7 +3404,13 @@ static void LimLaunchedRCTrackLeftMediumHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 3: @@ -3177,7 +3438,13 @@ static void LimLaunchedRCTrackLeftMediumHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::centre, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 4: @@ -3207,7 +3474,11 @@ static void LimLaunchedRCTrackLeftMediumHalfLoopUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_CC | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + direction), 0xFFFF, 0); if (direction == 0 || direction == 3) @@ -3258,7 +3529,10 @@ static void LimLaunchedRCTrackRightMediumHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -3288,7 +3562,11 @@ static void LimLaunchedRCTrackRightMediumHalfLoopUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_CC | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -3327,7 +3605,13 @@ static void LimLaunchedRCTrackRightMediumHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::centre, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 3: @@ -3356,7 +3640,13 @@ static void LimLaunchedRCTrackRightMediumHalfLoopUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 4: @@ -3386,7 +3676,11 @@ static void LimLaunchedRCTrackRightMediumHalfLoopUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_B4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::topCorner), + direction), 0xFFFF, 0); if (direction == 0 || direction == 3) { @@ -3461,7 +3755,10 @@ static void LimLaunchedRCTrackLeftZeroGRollUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; case 1: @@ -3490,7 +3787,11 @@ static void LimLaunchedRCTrackLeftZeroGRollUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3535,7 +3836,11 @@ static void LimLaunchedRCTrackLeftZeroGRollUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -3593,7 +3898,10 @@ static void LimLaunchedRCTrackRightZeroGRollUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; case 1: @@ -3622,7 +3930,11 @@ static void LimLaunchedRCTrackRightZeroGRollUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3667,7 +3979,11 @@ static void LimLaunchedRCTrackRightZeroGRollUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -3730,7 +4046,10 @@ static void LimLaunchedRCTrackLeftLargeZeroGRollUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -3761,7 +4080,10 @@ static void LimLaunchedRCTrackLeftLargeZeroGRollUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3793,14 +4115,22 @@ static void LimLaunchedRCTrackLeftLargeZeroGRollUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -3894,7 +4224,10 @@ static void LimLaunchedRCTrackRightLargeZeroGRollUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -3925,7 +4258,10 @@ static void LimLaunchedRCTrackRightLargeZeroGRollUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3958,14 +4294,22 @@ static void LimLaunchedRCTrackRightLargeZeroGRollUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -4073,7 +4417,13 @@ static void LimLaunchedRCTrackLeftBankToLeftQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -4118,7 +4468,13 @@ static void LimLaunchedRCTrackLeftBankToLeftQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -4164,7 +4520,13 @@ static void LimLaunchedRCTrackRightBankToRightQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -4209,7 +4571,13 @@ static void LimLaunchedRCTrackRightBankToRightQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -4252,7 +4620,13 @@ static void LimLaunchedRCTrackLeftQuarterTurn325DegDownToLeftBank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -4300,7 +4674,13 @@ static void LimLaunchedRCTrackLeftQuarterTurn325DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -4343,7 +4723,13 @@ static void LimLaunchedRCTrackRightQuarterTurn325DegDownToRightBank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -4391,7 +4777,13 @@ static void LimLaunchedRCTrackRightQuarterTurn325DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -4434,7 +4826,10 @@ static void LimLaunchedRCTrackLeftLargeHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4470,7 +4865,10 @@ static void LimLaunchedRCTrackLeftLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -4499,7 +4897,11 @@ static void LimLaunchedRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -4539,7 +4941,11 @@ static void LimLaunchedRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -4568,7 +4974,13 @@ static void LimLaunchedRCTrackLeftLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -4597,7 +5009,11 @@ static void LimLaunchedRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -4631,7 +5047,11 @@ static void LimLaunchedRCTrackLeftLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -4675,7 +5095,10 @@ static void LimLaunchedRCTrackRightLargeHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4711,7 +5134,10 @@ static void LimLaunchedRCTrackRightLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -4740,7 +5166,11 @@ static void LimLaunchedRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -4780,7 +5210,11 @@ static void LimLaunchedRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -4809,7 +5243,13 @@ static void LimLaunchedRCTrackRightLargeHalfLoopUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -4838,7 +5278,11 @@ static void LimLaunchedRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -4872,7 +5316,11 @@ static void LimLaunchedRCTrackRightLargeHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -4943,7 +5391,10 @@ static void LimLaunchedRCTrackFlatTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } @@ -4990,7 +5441,10 @@ static void LimLaunchedRCTrack60DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -5024,7 +5478,13 @@ static void LimLaunchedRCTrackDiagFlatTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -5037,7 +5497,12 @@ static void LimLaunchedRCTrackDiagFlatTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -5050,7 +5515,13 @@ static void LimLaunchedRCTrackDiagFlatTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -5077,7 +5548,13 @@ static void LimLaunchedRCTrackDiagFlatTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -5099,7 +5576,13 @@ static void LimLaunchedRCTrackDiag60DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5112,7 +5595,12 @@ static void LimLaunchedRCTrackDiag60DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5125,7 +5613,13 @@ static void LimLaunchedRCTrackDiag60DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5152,7 +5646,13 @@ static void LimLaunchedRCTrackDiag60DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5174,7 +5674,13 @@ static void LimLaunchedRCTrackDiagFlatTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5187,7 +5693,12 @@ static void LimLaunchedRCTrackDiagFlatTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5200,7 +5711,13 @@ static void LimLaunchedRCTrackDiagFlatTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5227,7 +5744,13 @@ static void LimLaunchedRCTrackDiagFlatTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5249,7 +5772,13 @@ static void LimLaunchedRCTrackDiag60DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -5262,7 +5791,12 @@ static void LimLaunchedRCTrackDiag60DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -5275,7 +5809,13 @@ static void LimLaunchedRCTrackDiag60DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -5302,7 +5842,13 @@ static void LimLaunchedRCTrackDiag60DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -5340,7 +5886,10 @@ static void LimLaunchedRCTrackBooster( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/LoopingRollerCoaster.cpp b/src/openrct2/ride/coaster/LoopingRollerCoaster.cpp index 9dc1ad95c5..671b679cd9 100644 --- a/src/openrct2/ride/coaster/LoopingRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/LoopingRollerCoaster.cpp @@ -91,7 +91,10 @@ static void LoopingRCTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -122,7 +125,7 @@ static void LoopingRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -202,7 +205,10 @@ static void LoopingRCTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -282,7 +288,10 @@ static void LoopingRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -362,7 +371,10 @@ static void LoopingRCTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -454,7 +466,10 @@ static void LoopingRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -546,7 +561,10 @@ static void LoopingRCTrack60DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -626,7 +644,10 @@ static void LoopingRCTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -716,7 +737,13 @@ static void LoopingRCTrackLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -748,7 +775,11 @@ static void LoopingRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -777,7 +808,13 @@ static void LoopingRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -809,7 +846,11 @@ static void LoopingRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -849,7 +890,13 @@ static void LoopingRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -905,7 +952,10 @@ static void LoopingRCTrackFlatToLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -950,7 +1000,10 @@ static void LoopingRCTrackFlatToRightBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -995,7 +1048,10 @@ static void LoopingRCTrackLeftBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1040,7 +1096,10 @@ static void LoopingRCTrackRightBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1085,7 +1144,13 @@ static void LoopingRCTrackBankedLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1117,7 +1182,11 @@ static void LoopingRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1146,7 +1215,13 @@ static void LoopingRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1178,7 +1253,11 @@ static void LoopingRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1221,7 +1300,13 @@ static void LoopingRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1284,7 +1369,10 @@ static void LoopingRCTrackLeftBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1336,7 +1424,10 @@ static void LoopingRCTrackRightBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1388,7 +1479,10 @@ static void LoopingRCTrack25DegUpToLeftBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1440,7 +1534,10 @@ static void LoopingRCTrack25DegUpToRightBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1511,7 +1608,10 @@ static void LoopingRCTrackLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1561,7 +1661,13 @@ static void LoopingRCTrackLeftQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1591,7 +1697,11 @@ static void LoopingRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1619,7 +1729,13 @@ static void LoopingRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1649,7 +1765,11 @@ static void LoopingRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1689,7 +1809,13 @@ static void LoopingRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -1733,7 +1859,13 @@ static void LoopingRCTrackRightQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1763,7 +1895,11 @@ static void LoopingRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1791,7 +1927,12 @@ static void LoopingRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1821,7 +1962,11 @@ static void LoopingRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1861,7 +2006,13 @@ static void LoopingRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -1923,7 +2074,13 @@ static void LoopingRCTrackSBendLeft( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1954,7 +2111,11 @@ static void LoopingRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1986,7 +2147,11 @@ static void LoopingRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2026,7 +2191,13 @@ static void LoopingRCTrackSBendLeft( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2070,7 +2241,13 @@ static void LoopingRCTrackSBendRight( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2102,7 +2279,11 @@ static void LoopingRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2135,7 +2316,11 @@ static void LoopingRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2175,7 +2360,13 @@ static void LoopingRCTrackSBendRight( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2214,7 +2405,11 @@ static void LoopingRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -2240,7 +2435,11 @@ static void LoopingRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2292,7 +2491,13 @@ static void LoopingRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -2317,7 +2522,11 @@ static void LoopingRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2349,7 +2558,11 @@ static void LoopingRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2401,7 +2614,13 @@ static void LoopingRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -2426,7 +2645,11 @@ static void LoopingRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2461,7 +2684,11 @@ static void LoopingRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -2767,7 +2994,13 @@ static void LoopingRCTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2798,7 +3031,13 @@ static void LoopingRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2837,7 +3076,13 @@ static void LoopingRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2893,7 +3138,13 @@ static void LoopingRCTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2924,7 +3175,13 @@ static void LoopingRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2966,7 +3223,13 @@ static void LoopingRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3015,7 +3278,13 @@ static void LoopingRCTrackLeftQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3056,7 +3325,13 @@ static void LoopingRCTrackLeftQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3096,7 +3371,13 @@ static void LoopingRCTrackRightQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3143,7 +3424,13 @@ static void LoopingRCTrackRightQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3208,7 +3495,12 @@ static void LoopingRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3240,7 +3532,13 @@ static void LoopingRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3282,7 +3580,12 @@ static void LoopingRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3325,7 +3628,12 @@ static void LoopingRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3357,7 +3665,13 @@ static void LoopingRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3394,7 +3708,12 @@ static void LoopingRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3442,7 +3761,12 @@ static void LoopingRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3474,7 +3798,13 @@ static void LoopingRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3516,7 +3846,12 @@ static void LoopingRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3559,7 +3894,12 @@ static void LoopingRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3591,7 +3931,13 @@ static void LoopingRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3628,7 +3974,12 @@ static void LoopingRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3704,7 +4055,12 @@ static void LoopingRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3737,7 +4093,11 @@ static void LoopingRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3766,7 +4126,13 @@ static void LoopingRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3798,7 +4164,11 @@ static void LoopingRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3841,7 +4211,12 @@ static void LoopingRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3884,7 +4259,12 @@ static void LoopingRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3917,7 +4297,11 @@ static void LoopingRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3946,7 +4330,12 @@ static void LoopingRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -3978,7 +4367,11 @@ static void LoopingRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4016,7 +4409,12 @@ static void LoopingRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4064,7 +4462,12 @@ static void LoopingRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4097,7 +4500,11 @@ static void LoopingRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4126,7 +4533,12 @@ static void LoopingRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4158,7 +4570,11 @@ static void LoopingRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4201,7 +4617,12 @@ static void LoopingRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4244,7 +4665,12 @@ static void LoopingRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4277,7 +4703,11 @@ static void LoopingRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4306,7 +4736,13 @@ static void LoopingRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -4338,7 +4774,11 @@ static void LoopingRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4376,7 +4816,12 @@ static void LoopingRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4452,7 +4897,7 @@ static void LoopingRCTrackLeftQuarterTurn160DegUp( break; } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_1, +56, TUNNEL_2); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4497,7 +4942,7 @@ static void LoopingRCTrackRightQuarterTurn160DegUp( break; } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_1, +56, TUNNEL_2); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4550,7 +4995,10 @@ static void LoopingRCTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -4596,7 +5044,10 @@ static void LoopingRCTrack25DegUpLeftBanked( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -4642,7 +5093,10 @@ static void LoopingRCTrack25DegUpRightBanked( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -4678,7 +5132,7 @@ static void LoopingRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -4736,7 +5190,10 @@ static void LoopingRCTrackLeftEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4765,7 +5222,11 @@ static void LoopingRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4794,13 +5255,24 @@ static void LoopingRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4837,7 +5309,11 @@ static void LoopingRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4882,7 +5358,10 @@ static void LoopingRCTrackRightEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4911,7 +5390,11 @@ static void LoopingRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4940,13 +5423,24 @@ static void LoopingRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4983,7 +5477,11 @@ static void LoopingRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5046,7 +5544,10 @@ static void LoopingRCTrackLeftEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5075,7 +5576,11 @@ static void LoopingRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5104,13 +5609,24 @@ static void LoopingRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5147,7 +5663,11 @@ static void LoopingRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5192,7 +5712,10 @@ static void LoopingRCTrackRightEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5221,7 +5744,11 @@ static void LoopingRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5250,13 +5777,24 @@ static void LoopingRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5293,7 +5831,11 @@ static void LoopingRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5349,7 +5891,13 @@ static void LoopingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5376,7 +5924,12 @@ static void LoopingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5403,7 +5956,13 @@ static void LoopingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5462,7 +6021,13 @@ static void LoopingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5493,7 +6058,7 @@ static void LoopingRCTrackDiagBrakes( session, MetalSupportType::Tubes, DiagSupportPlacement[direction], 0, height, session.SupportColours); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -5528,7 +6093,13 @@ static void LoopingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5555,7 +6126,12 @@ static void LoopingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5582,7 +6158,13 @@ static void LoopingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5641,7 +6223,13 @@ static void LoopingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -5678,7 +6266,13 @@ static void LoopingRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -5705,7 +6299,12 @@ static void LoopingRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -5732,7 +6331,13 @@ static void LoopingRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -5793,7 +6398,13 @@ static void LoopingRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -5830,7 +6441,13 @@ static void LoopingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5857,7 +6474,12 @@ static void LoopingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5884,7 +6506,13 @@ static void LoopingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -5943,7 +6571,13 @@ static void LoopingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -5980,7 +6614,13 @@ static void LoopingRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6007,7 +6647,12 @@ static void LoopingRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6034,7 +6679,13 @@ static void LoopingRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6095,7 +6746,13 @@ static void LoopingRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6132,7 +6789,13 @@ static void LoopingRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6159,7 +6822,12 @@ static void LoopingRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6186,7 +6854,13 @@ static void LoopingRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6247,7 +6921,13 @@ static void LoopingRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6284,7 +6964,13 @@ static void LoopingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6311,7 +6997,12 @@ static void LoopingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6338,7 +7029,13 @@ static void LoopingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6397,7 +7094,13 @@ static void LoopingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6434,7 +7137,13 @@ static void LoopingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6461,7 +7170,12 @@ static void LoopingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6488,7 +7202,13 @@ static void LoopingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6547,7 +7267,13 @@ static void LoopingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6584,7 +7310,13 @@ static void LoopingRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -6611,7 +7343,12 @@ static void LoopingRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -6638,7 +7375,13 @@ static void LoopingRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -6699,7 +7442,13 @@ static void LoopingRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -6736,7 +7485,13 @@ static void LoopingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -6762,7 +7517,12 @@ static void LoopingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -6788,7 +7548,13 @@ static void LoopingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -6846,7 +7612,13 @@ static void LoopingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -6884,7 +7656,13 @@ static void LoopingRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6911,7 +7689,12 @@ static void LoopingRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6938,7 +7721,13 @@ static void LoopingRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6999,7 +7788,13 @@ static void LoopingRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7036,7 +7831,13 @@ static void LoopingRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7063,7 +7864,12 @@ static void LoopingRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7090,7 +7896,13 @@ static void LoopingRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7149,7 +7961,13 @@ static void LoopingRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7186,7 +8004,13 @@ static void LoopingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7213,7 +8037,12 @@ static void LoopingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7240,7 +8069,13 @@ static void LoopingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7299,7 +8134,13 @@ static void LoopingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7322,7 +8163,13 @@ static void LoopingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7338,7 +8185,12 @@ static void LoopingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7351,7 +8203,13 @@ static void LoopingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7378,7 +8236,13 @@ static void LoopingRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7401,7 +8265,13 @@ static void LoopingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7414,7 +8284,12 @@ static void LoopingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7430,7 +8305,13 @@ static void LoopingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7457,7 +8338,13 @@ static void LoopingRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7480,7 +8367,13 @@ static void LoopingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7496,7 +8389,12 @@ static void LoopingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7509,7 +8407,13 @@ static void LoopingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7536,7 +8440,13 @@ static void LoopingRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7559,7 +8469,13 @@ static void LoopingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7572,7 +8488,12 @@ static void LoopingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7588,7 +8509,13 @@ static void LoopingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7615,7 +8542,13 @@ static void LoopingRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7638,7 +8571,13 @@ static void LoopingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7654,7 +8593,12 @@ static void LoopingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7667,7 +8611,13 @@ static void LoopingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7694,7 +8644,13 @@ static void LoopingRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7717,7 +8673,13 @@ static void LoopingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7730,7 +8692,12 @@ static void LoopingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7746,7 +8713,13 @@ static void LoopingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7773,7 +8746,13 @@ static void LoopingRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7796,7 +8775,13 @@ static void LoopingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -7812,7 +8797,12 @@ static void LoopingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -7825,7 +8815,13 @@ static void LoopingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7852,7 +8848,13 @@ static void LoopingRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -7875,7 +8877,13 @@ static void LoopingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -7888,7 +8896,12 @@ static void LoopingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -7904,7 +8917,13 @@ static void LoopingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7931,7 +8950,13 @@ static void LoopingRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -7954,7 +8979,13 @@ static void LoopingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -7969,7 +9000,12 @@ static void LoopingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -7981,7 +9017,13 @@ static void LoopingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8007,7 +9049,13 @@ static void LoopingRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -8031,7 +9079,13 @@ static void LoopingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8043,7 +9097,12 @@ static void LoopingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8058,7 +9117,13 @@ static void LoopingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8084,7 +9149,13 @@ static void LoopingRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -8108,7 +9179,13 @@ static void LoopingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8124,7 +9201,12 @@ static void LoopingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8137,7 +9219,13 @@ static void LoopingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8164,7 +9252,13 @@ static void LoopingRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8187,7 +9281,13 @@ static void LoopingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8200,7 +9300,12 @@ static void LoopingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8216,7 +9321,13 @@ static void LoopingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8243,7 +9354,13 @@ static void LoopingRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8266,7 +9383,13 @@ static void LoopingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8279,7 +9402,12 @@ static void LoopingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8292,7 +9420,13 @@ static void LoopingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8319,7 +9453,13 @@ static void LoopingRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8342,7 +9482,13 @@ static void LoopingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8355,7 +9501,12 @@ static void LoopingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8368,7 +9519,13 @@ static void LoopingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8395,7 +9552,13 @@ static void LoopingRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8434,7 +9597,10 @@ static void LoopingRCTrackBlockBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -8473,7 +9639,13 @@ static void LoopingRCTrackLeftBankedQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8516,7 +9688,13 @@ static void LoopingRCTrackLeftBankedQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8557,7 +9735,13 @@ static void LoopingRCTrackRightBankedQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8606,7 +9790,13 @@ static void LoopingRCTrackRightBankedQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8668,7 +9858,13 @@ static void LoopingRCTrackLeftBankedQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8699,7 +9895,11 @@ static void LoopingRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8727,7 +9927,13 @@ static void LoopingRCTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -8759,7 +9965,11 @@ static void LoopingRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8799,7 +10009,13 @@ static void LoopingRCTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8843,7 +10059,13 @@ static void LoopingRCTrackRightBankedQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8874,7 +10096,11 @@ static void LoopingRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8902,7 +10128,12 @@ static void LoopingRCTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -8934,7 +10165,11 @@ static void LoopingRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8974,7 +10209,13 @@ static void LoopingRCTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -9043,7 +10284,10 @@ static void LoopingRCTrack25DegUpToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -9092,7 +10336,10 @@ static void LoopingRCTrack25DegUpToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -9141,7 +10388,10 @@ static void LoopingRCTrackLeftBanked25DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -9190,7 +10440,10 @@ static void LoopingRCTrackRightBanked25DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -9268,7 +10521,10 @@ static void LoopingRCTrackLeftBankedFlatToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -9314,7 +10570,10 @@ static void LoopingRCTrackRightBankedFlatToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -9360,7 +10619,10 @@ static void LoopingRCTrackLeftBanked25DegUpToLeftBankedFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9406,7 +10668,10 @@ static void LoopingRCTrackRightBanked25DegUpToRightBankedFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9487,7 +10752,10 @@ static void LoopingRCTrackFlatToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -9536,7 +10804,10 @@ static void LoopingRCTrackFlatToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -9585,7 +10856,10 @@ static void LoopingRCTrackLeftBanked25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9634,7 +10908,10 @@ static void LoopingRCTrackRightBanked25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9696,7 +10973,10 @@ static void LoopingRCTrackBooster( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/MineRide.cpp b/src/openrct2/ride/coaster/MineRide.cpp index 98cd3c2956..0e496f6ae2 100644 --- a/src/openrct2/ride/coaster/MineRide.cpp +++ b/src/openrct2/ride/coaster/MineRide.cpp @@ -50,7 +50,10 @@ static void MineRideTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -74,7 +77,7 @@ static void MineRideTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStation2(session, ride, direction, height, trackElement, 9, 11); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -135,7 +138,10 @@ static void MineRideTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -196,7 +202,10 @@ static void MineRideTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -257,7 +266,10 @@ static void MineRideTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -329,7 +341,13 @@ static void MineRideTrackLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -361,7 +379,11 @@ static void MineRideTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -390,7 +412,13 @@ static void MineRideTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -422,7 +450,11 @@ static void MineRideTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -468,7 +500,13 @@ static void MineRideTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -539,7 +577,10 @@ static void MineRideTrackFlatToLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -599,7 +640,10 @@ static void MineRideTrackFlatToRightBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -659,7 +703,10 @@ static void MineRideTrackLeftBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -719,7 +766,10 @@ static void MineRideTrackRightBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -770,7 +820,13 @@ static void MineRideTrackBankedLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -802,7 +858,11 @@ static void MineRideTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -831,7 +891,13 @@ static void MineRideTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -863,7 +929,11 @@ static void MineRideTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -912,7 +982,13 @@ static void MineRideTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -990,7 +1066,10 @@ static void MineRideTrackLeftBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1057,7 +1136,10 @@ static void MineRideTrackRightBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1124,7 +1206,10 @@ static void MineRideTrack25DegUpToLeftBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1191,7 +1276,10 @@ static void MineRideTrack25DegUpToRightBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1277,7 +1365,10 @@ static void MineRideTrackLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1333,7 +1424,13 @@ static void MineRideTrackSBendLeft( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1364,7 +1461,11 @@ static void MineRideTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1396,7 +1497,11 @@ static void MineRideTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1442,7 +1547,13 @@ static void MineRideTrackSBendLeft( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1492,7 +1603,13 @@ static void MineRideTrackSBendRight( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1524,7 +1641,11 @@ static void MineRideTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1557,7 +1678,11 @@ static void MineRideTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1603,7 +1728,13 @@ static void MineRideTrackSBendRight( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1653,7 +1784,13 @@ static void MineRideTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1684,7 +1821,13 @@ static void MineRideTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1729,7 +1872,13 @@ static void MineRideTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1791,7 +1940,13 @@ static void MineRideTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1822,7 +1977,13 @@ static void MineRideTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1870,7 +2031,13 @@ static void MineRideTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1932,7 +2099,12 @@ static void MineRideTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1964,7 +2136,13 @@ static void MineRideTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2012,7 +2190,12 @@ static void MineRideTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2061,7 +2244,12 @@ static void MineRideTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2093,7 +2281,13 @@ static void MineRideTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -2136,7 +2330,12 @@ static void MineRideTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2190,7 +2389,12 @@ static void MineRideTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2222,7 +2426,13 @@ static void MineRideTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2270,7 +2480,12 @@ static void MineRideTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2319,7 +2534,12 @@ static void MineRideTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2351,7 +2571,13 @@ static void MineRideTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -2394,7 +2620,12 @@ static void MineRideTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2476,7 +2707,12 @@ static void MineRideTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2509,7 +2745,11 @@ static void MineRideTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2538,7 +2778,13 @@ static void MineRideTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -2570,7 +2816,11 @@ static void MineRideTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2619,7 +2869,12 @@ static void MineRideTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2668,7 +2923,12 @@ static void MineRideTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2701,7 +2961,11 @@ static void MineRideTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2730,7 +2994,12 @@ static void MineRideTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -2762,7 +3031,11 @@ static void MineRideTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2806,7 +3079,12 @@ static void MineRideTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2860,7 +3138,12 @@ static void MineRideTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2893,7 +3176,11 @@ static void MineRideTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2922,7 +3209,12 @@ static void MineRideTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -2954,7 +3246,11 @@ static void MineRideTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3003,7 +3299,12 @@ static void MineRideTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3052,7 +3353,12 @@ static void MineRideTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3085,7 +3391,11 @@ static void MineRideTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3114,7 +3424,13 @@ static void MineRideTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -3146,7 +3462,11 @@ static void MineRideTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3190,7 +3510,12 @@ static void MineRideTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3259,7 +3584,7 @@ static void MineRideTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -3307,7 +3632,10 @@ static void MineRideTrackLeftEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3336,7 +3664,11 @@ static void MineRideTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3365,13 +3697,24 @@ static void MineRideTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3408,7 +3751,11 @@ static void MineRideTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3459,7 +3806,10 @@ static void MineRideTrackRightEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3488,7 +3838,11 @@ static void MineRideTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3517,13 +3871,24 @@ static void MineRideTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3560,7 +3925,11 @@ static void MineRideTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3629,7 +3998,10 @@ static void MineRideTrackLeftEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3658,7 +4030,11 @@ static void MineRideTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3687,13 +4063,24 @@ static void MineRideTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3730,7 +4117,11 @@ static void MineRideTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3781,7 +4172,10 @@ static void MineRideTrackRightEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3810,7 +4204,11 @@ static void MineRideTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3839,13 +4237,24 @@ static void MineRideTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3882,7 +4291,11 @@ static void MineRideTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3924,7 +4337,13 @@ static void MineRideTrackDiagFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3937,7 +4356,12 @@ static void MineRideTrackDiagFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3950,7 +4374,13 @@ static void MineRideTrackDiagFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3977,7 +4407,13 @@ static void MineRideTrackDiagFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4000,7 +4436,13 @@ static void MineRideTrackDiag25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4013,7 +4455,12 @@ static void MineRideTrackDiag25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -4026,7 +4473,13 @@ static void MineRideTrackDiag25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4054,7 +4507,13 @@ static void MineRideTrackDiag25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -4077,7 +4536,13 @@ static void MineRideTrackDiagFlatTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4090,7 +4555,12 @@ static void MineRideTrackDiagFlatTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4103,7 +4573,13 @@ static void MineRideTrackDiagFlatTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -4130,7 +4606,13 @@ static void MineRideTrackDiagFlatTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -4153,7 +4635,13 @@ static void MineRideTrackDiag25DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4166,7 +4654,12 @@ static void MineRideTrackDiag25DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -4179,7 +4672,13 @@ static void MineRideTrackDiag25DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4207,7 +4706,13 @@ static void MineRideTrackDiag25DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -4230,7 +4735,13 @@ static void MineRideTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4243,7 +4754,12 @@ static void MineRideTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -4256,7 +4772,13 @@ static void MineRideTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4284,7 +4806,13 @@ static void MineRideTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -4307,7 +4835,13 @@ static void MineRideTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -4319,7 +4853,12 @@ static void MineRideTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -4331,7 +4870,13 @@ static void MineRideTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -4358,7 +4903,13 @@ static void MineRideTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -4382,7 +4933,13 @@ static void MineRideTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4395,7 +4952,12 @@ static void MineRideTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4408,7 +4970,13 @@ static void MineRideTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -4435,7 +5003,13 @@ static void MineRideTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -4458,7 +5032,13 @@ static void MineRideTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4474,7 +5054,12 @@ static void MineRideTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4487,7 +5072,13 @@ static void MineRideTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4514,7 +5105,13 @@ static void MineRideTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4537,7 +5134,13 @@ static void MineRideTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4550,7 +5153,12 @@ static void MineRideTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4566,7 +5174,13 @@ static void MineRideTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4593,7 +5207,13 @@ static void MineRideTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4616,7 +5236,13 @@ static void MineRideTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4632,7 +5258,12 @@ static void MineRideTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4645,7 +5276,13 @@ static void MineRideTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4672,7 +5309,13 @@ static void MineRideTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4695,7 +5338,13 @@ static void MineRideTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4708,7 +5357,12 @@ static void MineRideTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4724,7 +5378,13 @@ static void MineRideTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4751,7 +5411,13 @@ static void MineRideTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4774,7 +5440,13 @@ static void MineRideTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4790,7 +5462,12 @@ static void MineRideTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4803,7 +5480,13 @@ static void MineRideTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -4830,7 +5513,13 @@ static void MineRideTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -4853,7 +5542,13 @@ static void MineRideTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4866,7 +5561,12 @@ static void MineRideTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4882,7 +5582,13 @@ static void MineRideTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -4909,7 +5615,13 @@ static void MineRideTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -4932,7 +5644,13 @@ static void MineRideTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4948,7 +5666,12 @@ static void MineRideTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -4961,7 +5684,13 @@ static void MineRideTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4989,7 +5718,13 @@ static void MineRideTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -5012,7 +5747,13 @@ static void MineRideTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5025,7 +5766,12 @@ static void MineRideTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5041,7 +5787,13 @@ static void MineRideTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5069,7 +5821,13 @@ static void MineRideTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -5092,7 +5850,13 @@ static void MineRideTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -5107,7 +5871,12 @@ static void MineRideTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -5119,7 +5888,13 @@ static void MineRideTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -5146,7 +5921,13 @@ static void MineRideTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -5170,7 +5951,13 @@ static void MineRideTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -5182,7 +5969,12 @@ static void MineRideTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -5197,7 +5989,13 @@ static void MineRideTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -5224,7 +6022,13 @@ static void MineRideTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -5248,7 +6052,13 @@ static void MineRideTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5264,7 +6074,12 @@ static void MineRideTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5277,7 +6092,13 @@ static void MineRideTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -5304,7 +6125,13 @@ static void MineRideTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -5327,7 +6154,13 @@ static void MineRideTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5340,7 +6173,12 @@ static void MineRideTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5356,7 +6194,13 @@ static void MineRideTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -5383,7 +6227,13 @@ static void MineRideTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -5406,7 +6256,13 @@ static void MineRideTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5419,7 +6275,12 @@ static void MineRideTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5432,7 +6293,13 @@ static void MineRideTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5459,7 +6326,13 @@ static void MineRideTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5482,7 +6355,13 @@ static void MineRideTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5495,7 +6374,12 @@ static void MineRideTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5508,7 +6392,13 @@ static void MineRideTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5535,7 +6425,13 @@ static void MineRideTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } diff --git a/src/openrct2/ride/coaster/MineTrainCoaster.cpp b/src/openrct2/ride/coaster/MineTrainCoaster.cpp index b6e51bc7aa..c3f7c17f3c 100644 --- a/src/openrct2/ride/coaster/MineTrainCoaster.cpp +++ b/src/openrct2/ride/coaster/MineTrainCoaster.cpp @@ -124,7 +124,7 @@ static void MineTrainRCTrackFlat( } } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -159,7 +159,7 @@ static void MineTrainRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Boxed); TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -233,7 +233,7 @@ static void MineTrainRCTrack25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -278,7 +278,7 @@ static void MineTrainRCTrack60DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -352,7 +352,7 @@ static void MineTrainRCTrackFlatTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -403,7 +403,7 @@ static void MineTrainRCTrack25DegUpTo60DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -454,7 +454,7 @@ static void MineTrainRCTrack60DegUpTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -528,7 +528,7 @@ static void MineTrainRCTrack25DegUpToFlat( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -623,12 +623,16 @@ static void MineTrainRCTrackLeftQuarterTurn5( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -663,7 +667,11 @@ static void MineTrainRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -701,14 +709,21 @@ static void MineTrainRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -743,7 +758,11 @@ static void MineTrainRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -788,7 +807,7 @@ static void MineTrainRCTrackLeftQuarterTurn5( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -846,7 +865,7 @@ static void MineTrainRCTrackFlatToLeftBank( break; } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -893,7 +912,7 @@ static void MineTrainRCTrackFlatToRightBank( break; } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -940,7 +959,7 @@ static void MineTrainRCTrackLeftBankToFlat( break; } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -987,7 +1006,7 @@ static void MineTrainRCTrackRightBankToFlat( break; } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1037,12 +1056,16 @@ static void MineTrainRCTrackBankedLeftQuarterTurn5( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1078,7 +1101,11 @@ static void MineTrainRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1119,14 +1146,21 @@ static void MineTrainRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -1162,7 +1196,11 @@ static void MineTrainRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1210,7 +1248,7 @@ static void MineTrainRCTrackBankedLeftQuarterTurn5( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1272,7 +1310,7 @@ static void MineTrainRCTrackLeftBankTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1323,7 +1361,7 @@ static void MineTrainRCTrackRightBankTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1374,7 +1412,7 @@ static void MineTrainRCTrack25DegUpToLeftBank( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1425,7 +1463,7 @@ static void MineTrainRCTrack25DegUpToRightBank( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1498,7 +1536,7 @@ static void MineTrainRCTrackLeftBank( break; } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1550,12 +1588,16 @@ static void MineTrainRCTrackLeftQuarterTurn525DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -1592,7 +1634,11 @@ static void MineTrainRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1631,14 +1677,21 @@ static void MineTrainRCTrackLeftQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 5: @@ -1675,7 +1728,11 @@ static void MineTrainRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1724,7 +1781,7 @@ static void MineTrainRCTrackLeftQuarterTurn525DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -1770,12 +1827,15 @@ static void MineTrainRCTrackRightQuarterTurn525DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -1812,7 +1872,11 @@ static void MineTrainRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1851,14 +1915,20 @@ static void MineTrainRCTrackRightQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 5: @@ -1895,7 +1965,11 @@ static void MineTrainRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1944,7 +2018,7 @@ static void MineTrainRCTrackRightQuarterTurn525DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2011,7 +2085,7 @@ static void MineTrainRCTrackSBendLeft( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2046,7 +2120,11 @@ static void MineTrainRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2082,7 +2160,11 @@ static void MineTrainRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2127,7 +2209,7 @@ static void MineTrainRCTrackSBendLeft( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2176,7 +2258,7 @@ static void MineTrainRCTrackSBendRight( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2211,7 +2293,11 @@ static void MineTrainRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2247,7 +2333,11 @@ static void MineTrainRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2292,7 +2382,7 @@ static void MineTrainRCTrackSBendRight( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2341,7 +2431,7 @@ static void MineTrainRCTrackLeftQuarterTurn3( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2374,7 +2464,13 @@ static void MineTrainRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2418,7 +2514,7 @@ static void MineTrainRCTrackLeftQuarterTurn3( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2479,7 +2575,7 @@ static void MineTrainRCTrackLeftQuarterTurn3Bank( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2513,7 +2609,13 @@ static void MineTrainRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2560,7 +2662,7 @@ static void MineTrainRCTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2614,7 +2716,7 @@ static void MineTrainRCTrackLeftQuarterTurn325DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2625,7 +2727,13 @@ static void MineTrainRCTrackLeftQuarterTurn325DegUp( break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -2665,7 +2773,7 @@ static void MineTrainRCTrackLeftQuarterTurn325DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2710,7 +2818,7 @@ static void MineTrainRCTrackRightQuarterTurn325DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2721,7 +2829,13 @@ static void MineTrainRCTrackRightQuarterTurn325DegUp( break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -2761,7 +2875,7 @@ static void MineTrainRCTrackRightQuarterTurn325DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2832,9 +2946,20 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2869,7 +2994,13 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2917,9 +3048,20 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2968,9 +3110,20 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3004,7 +3157,13 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3047,9 +3206,20 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3103,9 +3273,20 @@ static void MineTrainRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3140,7 +3321,13 @@ static void MineTrainRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3188,9 +3375,20 @@ static void MineTrainRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3239,9 +3437,20 @@ static void MineTrainRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3276,7 +3485,13 @@ static void MineTrainRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3319,9 +3534,20 @@ static void MineTrainRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3403,15 +3629,30 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3448,7 +3689,11 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3488,14 +3733,30 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_D0, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -3535,7 +3796,11 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3584,9 +3849,20 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3635,15 +3911,29 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 8: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 9: @@ -3680,7 +3970,11 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3720,14 +4014,28 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 12: @@ -3767,7 +4075,11 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3811,9 +4123,20 @@ static void MineTrainRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3867,15 +4190,29 @@ static void MineTrainRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3912,7 +4249,11 @@ static void MineTrainRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3949,14 +4290,28 @@ static void MineTrainRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -3993,7 +4348,11 @@ static void MineTrainRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4042,9 +4401,20 @@ static void MineTrainRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4093,15 +4463,30 @@ static void MineTrainRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 8: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 9: @@ -4138,7 +4523,11 @@ static void MineTrainRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4175,14 +4564,30 @@ static void MineTrainRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_D0, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 12: @@ -4219,7 +4624,11 @@ static void MineTrainRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4263,9 +4672,20 @@ static void MineTrainRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4325,7 +4745,7 @@ static void MineTrainRCTrackBrakes( break; } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -4367,7 +4787,7 @@ static void MineTrainRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 2, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -4414,7 +4834,7 @@ static void MineTrainRCTrackLeftEighthToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4449,7 +4869,7 @@ static void MineTrainRCTrackLeftEighthToDiag( session, WoodenSupportType::Mine, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4484,14 +4904,14 @@ static void MineTrainRCTrackLeftEighthToDiag( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner3, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4518,7 +4938,7 @@ static void MineTrainRCTrackLeftEighthToDiag( { { 16, 0, height }, { 16, 16, 1 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4567,7 +4987,7 @@ static void MineTrainRCTrackRightEighthToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4602,7 +5022,7 @@ static void MineTrainRCTrackRightEighthToDiag( session, WoodenSupportType::Mine, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4637,14 +5057,14 @@ static void MineTrainRCTrackRightEighthToDiag( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4671,7 +5091,7 @@ static void MineTrainRCTrackRightEighthToDiag( { { 16, 16, height }, { 16, 16, 1 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4738,7 +5158,7 @@ static void MineTrainRCTrackLeftEighthBankToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4773,7 +5193,7 @@ static void MineTrainRCTrackLeftEighthBankToDiag( session, WoodenSupportType::Mine, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4808,14 +5228,14 @@ static void MineTrainRCTrackLeftEighthBankToDiag( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner3, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4842,7 +5262,7 @@ static void MineTrainRCTrackLeftEighthBankToDiag( { { 16, 0, height }, { 16, 16, 1 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4891,7 +5311,7 @@ static void MineTrainRCTrackRightEighthBankToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4926,7 +5346,7 @@ static void MineTrainRCTrackRightEighthBankToDiag( session, WoodenSupportType::Mine, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4961,14 +5381,14 @@ static void MineTrainRCTrackRightEighthBankToDiag( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4995,7 +5415,7 @@ static void MineTrainRCTrackRightEighthBankToDiag( { { 16, 16, height }, { 16, 16, 1 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5035,7 +5455,7 @@ static void MineTrainRCTrackDiagFlat( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5050,7 +5470,7 @@ static void MineTrainRCTrackDiagFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5065,7 +5485,7 @@ static void MineTrainRCTrackDiagFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5077,7 +5497,7 @@ static void MineTrainRCTrackDiagFlat( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5097,7 +5517,7 @@ static void MineTrainRCTrackDiagBrakes( session, WoodenSupportType::Mine, MineTrainRCDiagonalSupports[trackSequence][0], height, session.SupportColours); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -5117,7 +5537,7 @@ static void MineTrainRCTrackDiagBlockBrakes( session.SupportColours); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -5137,7 +5557,7 @@ static void MineTrainRCTrackDiag25DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5153,7 +5573,7 @@ static void MineTrainRCTrackDiag25DegUp( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5169,7 +5589,7 @@ static void MineTrainRCTrackDiag25DegUp( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5181,7 +5601,7 @@ static void MineTrainRCTrackDiag25DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -5201,7 +5621,7 @@ static void MineTrainRCTrackDiag60DegUp( session, direction, session.TrackColours.WithIndex(20385), { -16, -16, height }, { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -5216,7 +5636,7 @@ static void MineTrainRCTrackDiag60DegUp( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -5231,7 +5651,7 @@ static void MineTrainRCTrackDiag60DegUp( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -5242,7 +5662,7 @@ static void MineTrainRCTrackDiag60DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -5264,7 +5684,7 @@ static void MineTrainRCTrackDiagFlatTo25DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5279,7 +5699,7 @@ static void MineTrainRCTrackDiagFlatTo25DegUp( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5294,7 +5714,7 @@ static void MineTrainRCTrackDiagFlatTo25DegUp( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -5306,7 +5726,7 @@ static void MineTrainRCTrackDiagFlatTo25DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -5327,7 +5747,7 @@ static void MineTrainRCTrackDiag25DegUpTo60DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5342,7 +5762,7 @@ static void MineTrainRCTrackDiag25DegUpTo60DegUp( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5357,7 +5777,7 @@ static void MineTrainRCTrackDiag25DegUpTo60DegUp( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5368,7 +5788,7 @@ static void MineTrainRCTrackDiag25DegUpTo60DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5390,7 +5810,7 @@ static void MineTrainRCTrackDiag60DegUpTo25DegUp( { { -16, -16, height }, { 32, 32, 1 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5405,7 +5825,7 @@ static void MineTrainRCTrackDiag60DegUpTo25DegUp( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5420,7 +5840,7 @@ static void MineTrainRCTrackDiag60DegUpTo25DegUp( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5431,7 +5851,7 @@ static void MineTrainRCTrackDiag60DegUpTo25DegUp( { { 0, 0, height }, { 16, 16, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5453,7 +5873,7 @@ static void MineTrainRCTrackDiag25DegUpToFlat( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5469,7 +5889,7 @@ static void MineTrainRCTrackDiag25DegUpToFlat( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5485,7 +5905,7 @@ static void MineTrainRCTrackDiag25DegUpToFlat( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5497,7 +5917,7 @@ static void MineTrainRCTrackDiag25DegUpToFlat( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -5519,7 +5939,7 @@ static void MineTrainRCTrackDiag25DegDown( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5535,7 +5955,7 @@ static void MineTrainRCTrackDiag25DegDown( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5551,7 +5971,7 @@ static void MineTrainRCTrackDiag25DegDown( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5563,7 +5983,7 @@ static void MineTrainRCTrackDiag25DegDown( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -5584,7 +6004,7 @@ static void MineTrainRCTrackDiag60DegDown( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -5599,7 +6019,7 @@ static void MineTrainRCTrackDiag60DegDown( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -5614,7 +6034,7 @@ static void MineTrainRCTrackDiag60DegDown( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -5625,7 +6045,7 @@ static void MineTrainRCTrackDiag60DegDown( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -5647,7 +6067,7 @@ static void MineTrainRCTrackDiagFlatTo25DegDown( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; case 1: if (direction == 0) @@ -5662,7 +6082,7 @@ static void MineTrainRCTrackDiagFlatTo25DegDown( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; case 2: if (direction == 2) @@ -5677,7 +6097,7 @@ static void MineTrainRCTrackDiagFlatTo25DegDown( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; case 3: if (direction == 1) @@ -5688,7 +6108,7 @@ static void MineTrainRCTrackDiagFlatTo25DegDown( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; } @@ -5710,7 +6130,7 @@ static void MineTrainRCTrackDiag25DegDownTo60DegDown( { { 0, 0, height }, { 16, 16, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5725,7 +6145,7 @@ static void MineTrainRCTrackDiag25DegDownTo60DegDown( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5740,7 +6160,7 @@ static void MineTrainRCTrackDiag25DegDownTo60DegDown( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5751,7 +6171,7 @@ static void MineTrainRCTrackDiag25DegDownTo60DegDown( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5772,7 +6192,7 @@ static void MineTrainRCTrackDiag60DegDownTo25DegDown( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5787,7 +6207,7 @@ static void MineTrainRCTrackDiag60DegDownTo25DegDown( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5802,7 +6222,7 @@ static void MineTrainRCTrackDiag60DegDownTo25DegDown( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5813,7 +6233,7 @@ static void MineTrainRCTrackDiag60DegDownTo25DegDown( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5835,7 +6255,7 @@ static void MineTrainRCTrackDiag25DegDownToFlat( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5850,7 +6270,7 @@ static void MineTrainRCTrackDiag25DegDownToFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5865,7 +6285,7 @@ static void MineTrainRCTrackDiag25DegDownToFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -5877,7 +6297,7 @@ static void MineTrainRCTrackDiag25DegDownToFlat( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -5898,7 +6318,7 @@ static void MineTrainRCTrackDiagFlatToLeftBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5915,7 +6335,7 @@ static void MineTrainRCTrackDiagFlatToLeftBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5929,7 +6349,7 @@ static void MineTrainRCTrackDiagFlatToLeftBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5940,7 +6360,7 @@ static void MineTrainRCTrackDiagFlatToLeftBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5961,7 +6381,7 @@ static void MineTrainRCTrackDiagFlatToRightBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5975,7 +6395,7 @@ static void MineTrainRCTrackDiagFlatToRightBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5992,7 +6412,7 @@ static void MineTrainRCTrackDiagFlatToRightBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6003,7 +6423,7 @@ static void MineTrainRCTrackDiagFlatToRightBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6024,7 +6444,7 @@ static void MineTrainRCTrackDiagLeftBankToFlat( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6041,7 +6461,7 @@ static void MineTrainRCTrackDiagLeftBankToFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6055,7 +6475,7 @@ static void MineTrainRCTrackDiagLeftBankToFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6066,7 +6486,7 @@ static void MineTrainRCTrackDiagLeftBankToFlat( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6087,7 +6507,7 @@ static void MineTrainRCTrackDiagRightBankToFlat( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6101,7 +6521,7 @@ static void MineTrainRCTrackDiagRightBankToFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6118,7 +6538,7 @@ static void MineTrainRCTrackDiagRightBankToFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6129,7 +6549,7 @@ static void MineTrainRCTrackDiagRightBankToFlat( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6150,7 +6570,7 @@ static void MineTrainRCTrackDiagLeftBankTo25DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6167,7 +6587,7 @@ static void MineTrainRCTrackDiagLeftBankTo25DegUp( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6181,7 +6601,7 @@ static void MineTrainRCTrackDiagLeftBankTo25DegUp( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6192,7 +6612,7 @@ static void MineTrainRCTrackDiagLeftBankTo25DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -6213,7 +6633,7 @@ static void MineTrainRCTrackDiagRightBankTo25DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6227,7 +6647,7 @@ static void MineTrainRCTrackDiagRightBankTo25DegUp( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6244,7 +6664,7 @@ static void MineTrainRCTrackDiagRightBankTo25DegUp( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6255,7 +6675,7 @@ static void MineTrainRCTrackDiagRightBankTo25DegUp( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -6276,7 +6696,7 @@ static void MineTrainRCTrackDiag25DegUpToLeftBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6294,7 +6714,7 @@ static void MineTrainRCTrackDiag25DegUpToLeftBank( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6309,7 +6729,7 @@ static void MineTrainRCTrackDiag25DegUpToLeftBank( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6320,7 +6740,7 @@ static void MineTrainRCTrackDiag25DegUpToLeftBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6342,7 +6762,7 @@ static void MineTrainRCTrackDiag25DegUpToRightBank( { { -16, -16, height }, { 32, 32, 1 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6357,7 +6777,7 @@ static void MineTrainRCTrackDiag25DegUpToRightBank( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6375,7 +6795,7 @@ static void MineTrainRCTrackDiag25DegUpToRightBank( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6386,7 +6806,7 @@ static void MineTrainRCTrackDiag25DegUpToRightBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6449,7 +6869,7 @@ static void MineTrainRCTrackDiagLeftBankTo25DegDown( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -6509,7 +6929,7 @@ static void MineTrainRCTrackDiagRightBankTo25DegDown( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -6528,7 +6948,7 @@ static void MineTrainRCTrackDiag25DegDownToLeftBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6545,7 +6965,7 @@ static void MineTrainRCTrackDiag25DegDownToLeftBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6559,7 +6979,7 @@ static void MineTrainRCTrackDiag25DegDownToLeftBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6570,7 +6990,7 @@ static void MineTrainRCTrackDiag25DegDownToLeftBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -6591,7 +7011,7 @@ static void MineTrainRCTrackDiag25DegDownToRightBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6605,7 +7025,7 @@ static void MineTrainRCTrackDiag25DegDownToRightBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6622,7 +7042,7 @@ static void MineTrainRCTrackDiag25DegDownToRightBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6633,7 +7053,7 @@ static void MineTrainRCTrackDiag25DegDownToRightBank( { { -16, -16, height }, { 32, 32, 1 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -6655,7 +7075,13 @@ static void MineTrainRCTrackDiagLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6670,7 +7096,12 @@ static void MineTrainRCTrackDiagLeftBank( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6685,7 +7116,13 @@ static void MineTrainRCTrackDiagLeftBank( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6697,7 +7134,13 @@ static void MineTrainRCTrackDiagLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6719,7 +7162,13 @@ static void MineTrainRCTrackDiagRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6734,7 +7183,12 @@ static void MineTrainRCTrackDiagRightBank( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner0, direction, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6749,7 +7203,13 @@ static void MineTrainRCTrackDiagRightBank( session, WoodenSupportType::Mine, WoodenSupportSubType::Corner2, direction, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6761,7 +7221,13 @@ static void MineTrainRCTrackDiagRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6779,7 +7245,7 @@ static void MineTrainRCTrackBlockBrakes( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Mine, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/MiniRollerCoaster.cpp b/src/openrct2/ride/coaster/MiniRollerCoaster.cpp index 149f7d049b..650b0b2ca6 100644 --- a/src/openrct2/ride/coaster/MiniRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/MiniRollerCoaster.cpp @@ -111,7 +111,10 @@ static void MiniRCTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -145,7 +148,7 @@ static void MiniRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStation2(session, ride, direction, height, trackElement, 9, 11); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -255,7 +258,10 @@ static void MiniRCTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -316,7 +322,10 @@ static void MiniRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -426,7 +435,10 @@ static void MiniRCTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -493,7 +505,10 @@ static void MiniRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -560,7 +575,10 @@ static void MiniRCTrack60DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -670,7 +688,10 @@ static void MiniRCTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -766,7 +787,13 @@ static void MiniRCTrackLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -798,7 +825,11 @@ static void MiniRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -827,7 +858,13 @@ static void MiniRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -859,7 +896,11 @@ static void MiniRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -905,7 +946,13 @@ static void MiniRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -976,7 +1023,10 @@ static void MiniRCTrackFlatToLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1036,7 +1086,10 @@ static void MiniRCTrackFlatToRightBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1096,7 +1149,10 @@ static void MiniRCTrackLeftBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1156,7 +1212,10 @@ static void MiniRCTrackRightBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1207,7 +1266,13 @@ static void MiniRCTrackBankedLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1239,7 +1304,11 @@ static void MiniRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1268,7 +1337,13 @@ static void MiniRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1300,7 +1375,11 @@ static void MiniRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1349,7 +1428,13 @@ static void MiniRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1427,7 +1512,10 @@ static void MiniRCTrackLeftBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1494,7 +1582,10 @@ static void MiniRCTrackRightBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1561,7 +1652,10 @@ static void MiniRCTrack25DegUpToLeftBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1628,7 +1722,10 @@ static void MiniRCTrack25DegUpToRightBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1714,7 +1811,10 @@ static void MiniRCTrackLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1770,7 +1870,13 @@ static void MiniRCTrackLeftQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1800,7 +1906,11 @@ static void MiniRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1828,7 +1938,13 @@ static void MiniRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1858,7 +1974,11 @@ static void MiniRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1904,7 +2024,13 @@ static void MiniRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -1954,7 +2080,13 @@ static void MiniRCTrackRightQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1984,7 +2116,11 @@ static void MiniRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2012,7 +2148,12 @@ static void MiniRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -2042,7 +2183,11 @@ static void MiniRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2088,7 +2233,13 @@ static void MiniRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2156,7 +2307,13 @@ static void MiniRCTrackSBendLeft( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2187,7 +2344,11 @@ static void MiniRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2219,7 +2380,11 @@ static void MiniRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2265,7 +2430,13 @@ static void MiniRCTrackSBendLeft( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2315,7 +2486,13 @@ static void MiniRCTrackSBendRight( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2347,7 +2524,11 @@ static void MiniRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2380,7 +2561,11 @@ static void MiniRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2426,7 +2611,13 @@ static void MiniRCTrackSBendRight( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2476,7 +2667,13 @@ static void MiniRCTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2507,7 +2704,13 @@ static void MiniRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2552,7 +2755,13 @@ static void MiniRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2614,7 +2823,13 @@ static void MiniRCTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2645,7 +2860,13 @@ static void MiniRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2693,7 +2914,13 @@ static void MiniRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2748,7 +2975,13 @@ static void MiniRCTrackLeftQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2795,7 +3028,13 @@ static void MiniRCTrackLeftQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2841,7 +3080,13 @@ static void MiniRCTrackRightQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2888,7 +3133,13 @@ static void MiniRCTrackRightQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2959,7 +3210,12 @@ static void MiniRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2991,7 +3247,13 @@ static void MiniRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3039,7 +3301,12 @@ static void MiniRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3088,7 +3355,12 @@ static void MiniRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3120,7 +3392,13 @@ static void MiniRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3163,7 +3441,12 @@ static void MiniRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3217,7 +3500,12 @@ static void MiniRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3249,7 +3537,13 @@ static void MiniRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3297,7 +3591,12 @@ static void MiniRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3346,7 +3645,12 @@ static void MiniRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3378,7 +3682,13 @@ static void MiniRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3421,7 +3731,12 @@ static void MiniRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3503,7 +3818,12 @@ static void MiniRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3536,7 +3856,11 @@ static void MiniRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3565,7 +3889,13 @@ static void MiniRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3597,7 +3927,11 @@ static void MiniRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3646,7 +3980,12 @@ static void MiniRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3695,7 +4034,12 @@ static void MiniRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3728,7 +4072,11 @@ static void MiniRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3757,7 +4105,12 @@ static void MiniRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -3789,7 +4142,11 @@ static void MiniRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3833,7 +4190,12 @@ static void MiniRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3887,7 +4249,12 @@ static void MiniRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3920,7 +4287,11 @@ static void MiniRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3949,7 +4320,12 @@ static void MiniRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -3981,7 +4357,11 @@ static void MiniRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4030,7 +4410,12 @@ static void MiniRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4079,7 +4464,12 @@ static void MiniRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4112,7 +4502,11 @@ static void MiniRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4141,7 +4535,13 @@ static void MiniRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -4173,7 +4573,11 @@ static void MiniRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4217,7 +4621,12 @@ static void MiniRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4293,7 +4702,7 @@ static void MiniRCTrackLeftQuarterTurn160DegUp( break; } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4338,7 +4747,7 @@ static void MiniRCTrackRightQuarterTurn160DegUp( break; } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -4390,7 +4799,10 @@ static void MiniRCTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -4451,7 +4863,10 @@ static void MiniRCTrack25DegUpLeftBanked( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -4512,7 +4927,10 @@ static void MiniRCTrack25DegUpRightBanked( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -4550,7 +4968,7 @@ static void MiniRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -4614,7 +5032,10 @@ static void MiniRCTrackLeftEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4643,7 +5064,11 @@ static void MiniRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4672,13 +5097,24 @@ static void MiniRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4715,7 +5151,11 @@ static void MiniRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4766,7 +5206,10 @@ static void MiniRCTrackRightEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4795,7 +5238,11 @@ static void MiniRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4824,13 +5271,24 @@ static void MiniRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4867,7 +5325,11 @@ static void MiniRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4936,7 +5398,10 @@ static void MiniRCTrackLeftEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4965,7 +5430,11 @@ static void MiniRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4994,13 +5463,24 @@ static void MiniRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5037,7 +5517,11 @@ static void MiniRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5088,7 +5572,10 @@ static void MiniRCTrackRightEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5117,7 +5604,11 @@ static void MiniRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5146,13 +5637,24 @@ static void MiniRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5189,7 +5691,11 @@ static void MiniRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5245,7 +5751,13 @@ static void MiniRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5272,7 +5784,12 @@ static void MiniRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5299,7 +5816,13 @@ static void MiniRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5358,7 +5881,13 @@ static void MiniRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5395,7 +5924,13 @@ static void MiniRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5422,7 +5957,12 @@ static void MiniRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5449,7 +5989,13 @@ static void MiniRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5510,7 +6056,13 @@ static void MiniRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -5533,7 +6085,13 @@ static void MiniRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -5546,7 +6104,12 @@ static void MiniRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -5559,7 +6122,13 @@ static void MiniRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -5587,7 +6156,13 @@ static void MiniRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -5624,7 +6199,13 @@ static void MiniRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5651,7 +6232,12 @@ static void MiniRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5678,7 +6264,13 @@ static void MiniRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -5737,7 +6329,13 @@ static void MiniRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -5760,7 +6358,13 @@ static void MiniRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5773,7 +6377,12 @@ static void MiniRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5786,7 +6395,13 @@ static void MiniRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5814,7 +6429,13 @@ static void MiniRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5837,7 +6458,13 @@ static void MiniRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5850,7 +6477,12 @@ static void MiniRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -5863,7 +6495,13 @@ static void MiniRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -5891,7 +6529,13 @@ static void MiniRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -5928,7 +6572,13 @@ static void MiniRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5955,7 +6605,12 @@ static void MiniRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5982,7 +6637,13 @@ static void MiniRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6043,7 +6704,13 @@ static void MiniRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6080,7 +6747,13 @@ static void MiniRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6107,7 +6780,12 @@ static void MiniRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6134,7 +6812,13 @@ static void MiniRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6195,7 +6879,13 @@ static void MiniRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6218,7 +6908,13 @@ static void MiniRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -6231,7 +6927,12 @@ static void MiniRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -6244,7 +6945,13 @@ static void MiniRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -6272,7 +6979,13 @@ static void MiniRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -6309,7 +7022,13 @@ static void MiniRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -6335,7 +7054,12 @@ static void MiniRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -6361,7 +7085,13 @@ static void MiniRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -6421,7 +7151,13 @@ static void MiniRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -6445,7 +7181,13 @@ static void MiniRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6458,7 +7200,12 @@ static void MiniRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6471,7 +7218,13 @@ static void MiniRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6499,7 +7252,13 @@ static void MiniRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6522,7 +7281,13 @@ static void MiniRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6535,7 +7300,12 @@ static void MiniRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6548,7 +7318,13 @@ static void MiniRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6576,7 +7352,13 @@ static void MiniRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6613,7 +7395,13 @@ static void MiniRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6640,7 +7428,12 @@ static void MiniRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6667,7 +7460,13 @@ static void MiniRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6726,7 +7525,13 @@ static void MiniRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -6749,7 +7554,13 @@ static void MiniRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6765,7 +7576,12 @@ static void MiniRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6778,7 +7594,13 @@ static void MiniRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6805,7 +7627,13 @@ static void MiniRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6828,7 +7656,13 @@ static void MiniRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6841,7 +7675,12 @@ static void MiniRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6857,7 +7696,13 @@ static void MiniRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6884,7 +7729,13 @@ static void MiniRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6907,7 +7758,13 @@ static void MiniRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6923,7 +7780,12 @@ static void MiniRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6936,7 +7798,13 @@ static void MiniRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -6963,7 +7831,13 @@ static void MiniRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6986,7 +7860,13 @@ static void MiniRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6999,7 +7879,12 @@ static void MiniRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7015,7 +7900,13 @@ static void MiniRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7042,7 +7933,13 @@ static void MiniRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7065,7 +7962,13 @@ static void MiniRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7081,7 +7984,12 @@ static void MiniRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7094,7 +8002,13 @@ static void MiniRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7121,7 +8035,13 @@ static void MiniRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7144,7 +8064,13 @@ static void MiniRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7157,7 +8083,12 @@ static void MiniRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7173,7 +8104,13 @@ static void MiniRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7200,7 +8137,13 @@ static void MiniRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7223,7 +8166,13 @@ static void MiniRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -7239,7 +8188,12 @@ static void MiniRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -7252,7 +8206,13 @@ static void MiniRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7280,7 +8240,13 @@ static void MiniRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -7303,7 +8269,13 @@ static void MiniRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -7316,7 +8288,12 @@ static void MiniRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -7332,7 +8309,13 @@ static void MiniRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7360,7 +8343,13 @@ static void MiniRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -7383,7 +8372,13 @@ static void MiniRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -7398,7 +8393,12 @@ static void MiniRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -7410,7 +8410,13 @@ static void MiniRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -7437,7 +8443,13 @@ static void MiniRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -7461,7 +8473,13 @@ static void MiniRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -7473,7 +8491,12 @@ static void MiniRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -7488,7 +8511,13 @@ static void MiniRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -7515,7 +8544,13 @@ static void MiniRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -7539,7 +8574,13 @@ static void MiniRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7555,7 +8596,12 @@ static void MiniRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7568,7 +8614,13 @@ static void MiniRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7595,7 +8647,13 @@ static void MiniRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7618,7 +8676,13 @@ static void MiniRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7631,7 +8695,12 @@ static void MiniRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7647,7 +8716,13 @@ static void MiniRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7674,7 +8749,13 @@ static void MiniRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7697,7 +8778,13 @@ static void MiniRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7710,7 +8797,12 @@ static void MiniRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7723,7 +8815,13 @@ static void MiniRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7750,7 +8848,13 @@ static void MiniRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7773,7 +8877,13 @@ static void MiniRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7786,7 +8896,12 @@ static void MiniRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7799,7 +8914,13 @@ static void MiniRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7826,7 +8947,13 @@ static void MiniRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7862,7 +8989,10 @@ static void MiniRCTrackBlockBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -7907,7 +9037,13 @@ static void MiniRCTrackLeftBankedQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7956,7 +9092,13 @@ static void MiniRCTrackLeftBankedQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8003,7 +9145,13 @@ static void MiniRCTrackRightBankedQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8052,7 +9200,13 @@ static void MiniRCTrackRightBankedQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8120,7 +9274,13 @@ static void MiniRCTrackLeftBankedQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8151,7 +9311,11 @@ static void MiniRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8179,7 +9343,13 @@ static void MiniRCTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -8211,7 +9381,11 @@ static void MiniRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8257,7 +9431,13 @@ static void MiniRCTrackLeftBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8307,7 +9487,13 @@ static void MiniRCTrackRightBankedQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8338,7 +9524,11 @@ static void MiniRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8366,7 +9556,12 @@ static void MiniRCTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -8398,7 +9593,11 @@ static void MiniRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8444,7 +9643,13 @@ static void MiniRCTrackRightBankedQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8528,7 +9733,10 @@ static void MiniRCTrack25DegUpToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -8592,7 +9800,10 @@ static void MiniRCTrack25DegUpToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -8656,7 +9867,10 @@ static void MiniRCTrackLeftBanked25DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -8720,7 +9934,10 @@ static void MiniRCTrackRightBanked25DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -8813,7 +10030,10 @@ static void MiniRCTrackLeftBankedFlatToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -8874,7 +10094,10 @@ static void MiniRCTrackRightBankedFlatToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -8935,7 +10158,10 @@ static void MiniRCTrackLeftBanked25DegUpToLeftBankedFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -8996,7 +10222,10 @@ static void MiniRCTrackRightBanked25DegUpToRightBankedFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9092,7 +10321,10 @@ static void MiniRCTrackFlatToLeftBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -9156,7 +10388,10 @@ static void MiniRCTrackFlatToRightBanked25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -9220,7 +10455,10 @@ static void MiniRCTrackLeftBanked25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9284,7 +10522,10 @@ static void MiniRCTrackRightBanked25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -9359,7 +10600,13 @@ static void MiniRCTrackLeftCurvedLiftHill( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -9406,7 +10653,13 @@ static void MiniRCTrackLeftCurvedLiftHill( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -9451,7 +10704,13 @@ static void MiniRCTrackRightCurvedLiftHill( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -9498,7 +10757,13 @@ static void MiniRCTrackRightCurvedLiftHill( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -9535,7 +10800,10 @@ static void MiniRCTrackBooster( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/MiniSuspendedCoaster.cpp b/src/openrct2/ride/coaster/MiniSuspendedCoaster.cpp index fad5193241..76c5b93f6e 100644 --- a/src/openrct2/ride/coaster/MiniSuspendedCoaster.cpp +++ b/src/openrct2/ride/coaster/MiniSuspendedCoaster.cpp @@ -57,7 +57,10 @@ static void MiniSuspendedRCTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -102,7 +105,7 @@ static void MiniSuspendedRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Boxed); TrackPaintUtilDrawStationInverted(session, ride, direction, height, trackElement, STATION_VARIANT_1); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -165,7 +168,10 @@ static void MiniSuspendedRCTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -260,7 +266,10 @@ static void MiniSuspendedRCTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -355,7 +364,10 @@ static void MiniSuspendedRCTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -444,7 +456,12 @@ static void MiniSuspendedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -491,7 +508,11 @@ static void MiniSuspendedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -516,7 +537,13 @@ static void MiniSuspendedRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -544,7 +571,11 @@ static void MiniSuspendedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -570,7 +601,12 @@ static void MiniSuspendedRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -638,7 +674,13 @@ static void MiniSuspendedRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -682,7 +724,11 @@ static void MiniSuspendedRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -723,7 +769,11 @@ static void MiniSuspendedRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -763,7 +813,13 @@ static void MiniSuspendedRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -821,7 +877,13 @@ static void MiniSuspendedRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -865,7 +927,11 @@ static void MiniSuspendedRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -906,7 +972,11 @@ static void MiniSuspendedRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -946,7 +1016,13 @@ static void MiniSuspendedRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1004,7 +1080,12 @@ static void MiniSuspendedRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1050,7 +1131,13 @@ static void MiniSuspendedRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1075,7 +1162,12 @@ static void MiniSuspendedRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1147,7 +1239,13 @@ static void MiniSuspendedRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1194,7 +1292,11 @@ static void MiniSuspendedRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1223,13 +1325,24 @@ static void MiniSuspendedRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -1260,7 +1373,10 @@ static void MiniSuspendedRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1323,7 +1439,13 @@ static void MiniSuspendedRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1370,7 +1492,11 @@ static void MiniSuspendedRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1399,13 +1525,24 @@ static void MiniSuspendedRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -1436,7 +1573,10 @@ static void MiniSuspendedRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1515,7 +1655,13 @@ static void MiniSuspendedRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -1542,7 +1688,12 @@ static void MiniSuspendedRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -1569,7 +1720,13 @@ static void MiniSuspendedRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -1597,7 +1754,13 @@ static void MiniSuspendedRCTrackDiagFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1657,7 +1820,13 @@ static void MiniSuspendedRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1684,7 +1853,12 @@ static void MiniSuspendedRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -1711,7 +1885,13 @@ static void MiniSuspendedRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -1739,7 +1919,13 @@ static void MiniSuspendedRCTrackDiag25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1799,7 +1985,13 @@ static void MiniSuspendedRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -1826,7 +2018,12 @@ static void MiniSuspendedRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -1853,7 +2050,13 @@ static void MiniSuspendedRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -1881,7 +2084,13 @@ static void MiniSuspendedRCTrackDiagFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1941,7 +2150,13 @@ static void MiniSuspendedRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1968,7 +2183,12 @@ static void MiniSuspendedRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -1995,7 +2215,13 @@ static void MiniSuspendedRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -2023,7 +2249,13 @@ static void MiniSuspendedRCTrackDiag25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -2083,7 +2315,13 @@ static void MiniSuspendedRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2110,7 +2348,12 @@ static void MiniSuspendedRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -2137,7 +2380,13 @@ static void MiniSuspendedRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -2165,7 +2414,13 @@ static void MiniSuspendedRCTrackDiag25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -2225,7 +2480,13 @@ static void MiniSuspendedRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -2251,7 +2512,12 @@ static void MiniSuspendedRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -2277,7 +2543,13 @@ static void MiniSuspendedRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -2304,7 +2576,13 @@ static void MiniSuspendedRCTrackDiagFlatTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -2364,7 +2642,13 @@ static void MiniSuspendedRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -2391,7 +2675,12 @@ static void MiniSuspendedRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -2418,7 +2707,13 @@ static void MiniSuspendedRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -2446,7 +2741,13 @@ static void MiniSuspendedRCTrackDiag25DegDownToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: diff --git a/src/openrct2/ride/coaster/MultiDimensionRollerCoaster.cpp b/src/openrct2/ride/coaster/MultiDimensionRollerCoaster.cpp index 5cee391fd7..dc8fa18a2b 100644 --- a/src/openrct2/ride/coaster/MultiDimensionRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/MultiDimensionRollerCoaster.cpp @@ -133,7 +133,7 @@ static void MultiDimensionRCTrackFlat( } } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -155,7 +155,10 @@ static void MultiDimensionRCTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -221,7 +224,7 @@ static void MultiDimensionRCTrackStation( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -302,7 +305,7 @@ static void MultiDimensionRCTrack25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } else @@ -332,7 +335,10 @@ static void MultiDimensionRCTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -415,7 +421,7 @@ static void MultiDimensionRCTrack60DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } else @@ -452,7 +458,10 @@ static void MultiDimensionRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } } @@ -534,7 +543,7 @@ static void MultiDimensionRCTrackFlatTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -564,7 +573,10 @@ static void MultiDimensionRCTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -653,7 +665,7 @@ static void MultiDimensionRCTrack25DegUpTo60DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } else @@ -696,7 +708,10 @@ static void MultiDimensionRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } } @@ -750,7 +765,7 @@ static void MultiDimensionRCTrack60DegUpTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } else @@ -786,7 +801,10 @@ static void MultiDimensionRCTrack60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -903,7 +921,7 @@ static void MultiDimensionRCTrack25DegUpToFlat( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } else @@ -933,7 +951,10 @@ static void MultiDimensionRCTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -1060,7 +1081,7 @@ static void MultiDimensionRCTrackLeftQuarterTurn5( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1093,7 +1114,10 @@ static void MultiDimensionRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1122,7 +1146,13 @@ static void MultiDimensionRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1155,7 +1185,10 @@ static void MultiDimensionRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1195,7 +1228,13 @@ static void MultiDimensionRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1230,7 +1269,12 @@ static void MultiDimensionRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, @@ -1272,7 +1316,10 @@ static void MultiDimensionRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1301,7 +1348,13 @@ static void MultiDimensionRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1334,7 +1387,10 @@ static void MultiDimensionRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1364,7 +1420,12 @@ static void MultiDimensionRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, @@ -1436,7 +1497,7 @@ static void MultiDimensionRCTrackFlatToLeftBank( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -1467,7 +1528,11 @@ static void MultiDimensionRCTrackFlatToLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1522,7 +1587,7 @@ static void MultiDimensionRCTrackFlatToRightBank( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -1553,7 +1618,11 @@ static void MultiDimensionRCTrackFlatToRightBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1608,7 +1677,7 @@ static void MultiDimensionRCTrackLeftBankToFlat( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -1639,7 +1708,11 @@ static void MultiDimensionRCTrackLeftBankToFlat( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1694,7 +1767,7 @@ static void MultiDimensionRCTrackRightBankToFlat( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -1725,7 +1798,11 @@ static void MultiDimensionRCTrackRightBankToFlat( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -1780,7 +1857,7 @@ static void MultiDimensionRCTrackBankedLeftQuarterTurn5( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1813,7 +1890,10 @@ static void MultiDimensionRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1842,7 +1922,13 @@ static void MultiDimensionRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1875,7 +1961,10 @@ static void MultiDimensionRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1918,7 +2007,13 @@ static void MultiDimensionRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1953,7 +2048,12 @@ static void MultiDimensionRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, @@ -1993,7 +2093,10 @@ static void MultiDimensionRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2021,7 +2124,13 @@ static void MultiDimensionRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -2052,7 +2161,10 @@ static void MultiDimensionRCTrackBankedLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2082,7 +2194,12 @@ static void MultiDimensionRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, @@ -2161,7 +2278,7 @@ static void MultiDimensionRCTrackLeftBankTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -2192,7 +2309,11 @@ static void MultiDimensionRCTrackLeftBankTo25DegUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -2282,7 +2403,7 @@ static void MultiDimensionRCTrackRightBankTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -2313,7 +2434,11 @@ static void MultiDimensionRCTrackRightBankTo25DegUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -2403,7 +2528,7 @@ static void MultiDimensionRCTrack25DegUpToLeftBank( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } else @@ -2434,7 +2559,11 @@ static void MultiDimensionRCTrack25DegUpToLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -2524,7 +2653,7 @@ static void MultiDimensionRCTrack25DegUpToRightBank( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } else @@ -2555,7 +2684,11 @@ static void MultiDimensionRCTrack25DegUpToRightBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -2664,7 +2797,7 @@ static void MultiDimensionRCTrackLeftBank( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -2695,7 +2828,11 @@ static void MultiDimensionRCTrackLeftBank( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { @@ -2755,7 +2892,7 @@ static void MultiDimensionRCTrackSBendLeft( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2786,7 +2923,7 @@ static void MultiDimensionRCTrackSBendLeft( { { 0, 6, height }, { 32, 26, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -2817,7 +2954,7 @@ static void MultiDimensionRCTrackSBendLeft( session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2855,7 +2992,7 @@ static void MultiDimensionRCTrackSBendLeft( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2890,7 +3027,13 @@ static void MultiDimensionRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -2929,7 +3072,10 @@ static void MultiDimensionRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2975,7 +3121,10 @@ static void MultiDimensionRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -3019,7 +3168,13 @@ static void MultiDimensionRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -3078,7 +3233,7 @@ static void MultiDimensionRCTrackSBendRight( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3109,7 +3264,7 @@ static void MultiDimensionRCTrackSBendRight( session, direction, session.TrackColours.WithIndex(15830), { 0, 0, height }, { 32, 26, 3 }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3140,7 +3295,7 @@ static void MultiDimensionRCTrackSBendRight( session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3178,7 +3333,7 @@ static void MultiDimensionRCTrackSBendRight( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3213,7 +3368,13 @@ static void MultiDimensionRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -3252,7 +3413,10 @@ static void MultiDimensionRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -3298,7 +3462,10 @@ static void MultiDimensionRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -3342,7 +3509,13 @@ static void MultiDimensionRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -3401,7 +3574,7 @@ static void MultiDimensionRCTrackLeftQuarterTurn3( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3432,7 +3605,13 @@ static void MultiDimensionRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3471,7 +3650,13 @@ static void MultiDimensionRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3506,7 +3691,12 @@ static void MultiDimensionRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, @@ -3546,7 +3736,13 @@ static void MultiDimensionRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3575,7 +3771,12 @@ static void MultiDimensionRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, @@ -3647,7 +3848,7 @@ static void MultiDimensionRCTrackLeftQuarterTurn3Bank( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3678,7 +3879,13 @@ static void MultiDimensionRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3720,7 +3927,13 @@ static void MultiDimensionRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3755,7 +3968,12 @@ static void MultiDimensionRCTrackLeftQuarterTurn3Bank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, @@ -3795,7 +4013,13 @@ static void MultiDimensionRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3824,7 +4048,12 @@ static void MultiDimensionRCTrackLeftQuarterTurn3Bank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, @@ -3894,7 +4123,7 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpSmall( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3925,7 +4154,13 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3967,7 +4202,12 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4009,7 +4249,7 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -4040,7 +4280,13 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -4076,7 +4322,7 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpSmall( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4122,7 +4368,7 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpSmall( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4153,7 +4399,13 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4194,7 +4446,7 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4236,7 +4488,12 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4268,7 +4525,13 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -4304,7 +4567,7 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpSmall( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4378,7 +4641,7 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpLarge( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4410,7 +4673,11 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4439,7 +4706,13 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4471,7 +4744,11 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4514,7 +4791,12 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4556,7 +4838,7 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 8: @@ -4588,7 +4870,11 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4617,7 +4903,12 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -4649,7 +4940,11 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4686,7 +4981,7 @@ static void MultiDimensionRCTrackLeftHalfBankedHelixUpLarge( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4732,7 +5027,7 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpLarge( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4764,7 +5059,11 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4793,7 +5092,12 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4825,7 +5129,11 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4867,7 +5175,7 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -4909,7 +5217,12 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4942,7 +5255,11 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4971,7 +5288,13 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -5003,7 +5326,11 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5040,7 +5367,7 @@ static void MultiDimensionRCTrackRightHalfBankedHelixUpLarge( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5102,7 +5429,7 @@ static void MultiDimensionRCTrackBrakes( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -5124,7 +5451,10 @@ static void MultiDimensionRCTrackBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -5170,7 +5500,7 @@ static void MultiDimensionRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } else @@ -5232,7 +5562,7 @@ static void MultiDimensionRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } } @@ -5272,7 +5602,11 @@ static void MultiDimensionRCTrack90DegUp( } PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5309,7 +5643,11 @@ static void MultiDimensionRCTrack90DegUp( } PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5365,7 +5703,11 @@ static void MultiDimensionRCTrack60DegUpTo90DegUp( } PaintUtilSetVerticalTunnel(session, height + 56); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5406,7 +5748,11 @@ static void MultiDimensionRCTrack60DegUpTo90DegUp( } PaintUtilSetVerticalTunnel(session, height + 56); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -5463,7 +5809,10 @@ static void MultiDimensionRCTrack90DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); } else @@ -5501,7 +5850,10 @@ static void MultiDimensionRCTrack90DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); } } @@ -5544,7 +5896,11 @@ static void MultiDimensionRCTrack60DegDownTo90DegDown( PaintUtilPushTunnelRotated(session, direction, height + 48, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -5584,7 +5940,11 @@ static void MultiDimensionRCTrack60DegDownTo90DegDown( PaintUtilPushTunnelRotated(session, direction, height + 48, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -5632,7 +5992,7 @@ static void MultiDimensionRCTrackLeftEighthToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5659,7 +6019,7 @@ static void MultiDimensionRCTrackLeftEighthToDiag( { { 0, 16, height }, { 32, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5687,13 +6047,24 @@ static void MultiDimensionRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5732,7 +6103,7 @@ static void MultiDimensionRCTrackLeftEighthToDiag( session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5767,7 +6138,11 @@ static void MultiDimensionRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -5805,7 +6180,10 @@ static void MultiDimensionRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5834,13 +6212,24 @@ static void MultiDimensionRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5871,7 +6260,10 @@ static void MultiDimensionRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -5942,7 +6334,7 @@ static void MultiDimensionRCTrackRightEighthToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5969,7 +6361,7 @@ static void MultiDimensionRCTrackRightEighthToDiag( { { 0, 0, height }, { 32, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5997,13 +6389,24 @@ static void MultiDimensionRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -6042,7 +6445,7 @@ static void MultiDimensionRCTrackRightEighthToDiag( session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6077,7 +6480,11 @@ static void MultiDimensionRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -6115,7 +6522,10 @@ static void MultiDimensionRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6144,13 +6554,24 @@ static void MultiDimensionRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -6181,7 +6602,10 @@ static void MultiDimensionRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -6270,7 +6694,7 @@ static void MultiDimensionRCTrackLeftEighthBankToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6297,7 +6721,7 @@ static void MultiDimensionRCTrackLeftEighthBankToDiag( { { 0, 16, height }, { 32, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6325,13 +6749,24 @@ static void MultiDimensionRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -6370,7 +6805,7 @@ static void MultiDimensionRCTrackLeftEighthBankToDiag( session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6405,7 +6840,13 @@ static void MultiDimensionRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -6443,7 +6884,10 @@ static void MultiDimensionRCTrackLeftEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6472,13 +6916,24 @@ static void MultiDimensionRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -6509,7 +6964,11 @@ static void MultiDimensionRCTrackLeftEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -6580,7 +7039,7 @@ static void MultiDimensionRCTrackRightEighthBankToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6607,7 +7066,7 @@ static void MultiDimensionRCTrackRightEighthBankToDiag( { { 0, 0, height }, { 32, 16, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6635,13 +7094,24 @@ static void MultiDimensionRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -6680,7 +7150,7 @@ static void MultiDimensionRCTrackRightEighthBankToDiag( session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -6715,7 +7185,13 @@ static void MultiDimensionRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -6753,7 +7229,10 @@ static void MultiDimensionRCTrackRightEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6782,13 +7261,24 @@ static void MultiDimensionRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -6819,7 +7309,10 @@ static void MultiDimensionRCTrackRightEighthBankToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -6902,7 +7395,13 @@ static void MultiDimensionRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -6929,7 +7428,13 @@ static void MultiDimensionRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6956,7 +7461,13 @@ static void MultiDimensionRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7019,7 +7530,13 @@ static void MultiDimensionRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7052,7 +7569,13 @@ static void MultiDimensionRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7079,7 +7602,13 @@ static void MultiDimensionRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7106,7 +7635,13 @@ static void MultiDimensionRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7134,7 +7669,13 @@ static void MultiDimensionRCTrackDiagFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7276,7 +7817,13 @@ static void MultiDimensionRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -7303,7 +7850,13 @@ static void MultiDimensionRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -7330,7 +7883,13 @@ static void MultiDimensionRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7393,7 +7952,13 @@ static void MultiDimensionRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -7426,7 +7991,13 @@ static void MultiDimensionRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -7453,7 +8024,13 @@ static void MultiDimensionRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -7480,7 +8057,13 @@ static void MultiDimensionRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -7508,7 +8091,13 @@ static void MultiDimensionRCTrackDiag25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7558,7 +8147,13 @@ static void MultiDimensionRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -7571,7 +8166,13 @@ static void MultiDimensionRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -7584,7 +8185,13 @@ static void MultiDimensionRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -7615,7 +8222,13 @@ static void MultiDimensionRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -7634,7 +8247,13 @@ static void MultiDimensionRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -7647,7 +8266,13 @@ static void MultiDimensionRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -7660,7 +8285,13 @@ static void MultiDimensionRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -7674,7 +8305,13 @@ static void MultiDimensionRCTrackDiag60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -7738,7 +8375,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7765,7 +8408,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7792,7 +8441,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7855,7 +8510,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7888,7 +8549,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7915,7 +8582,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7942,7 +8615,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7970,7 +8649,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8020,7 +8705,13 @@ static void MultiDimensionRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8033,7 +8724,13 @@ static void MultiDimensionRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -8046,7 +8743,13 @@ static void MultiDimensionRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -8077,7 +8780,13 @@ static void MultiDimensionRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8096,7 +8805,13 @@ static void MultiDimensionRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8109,7 +8824,13 @@ static void MultiDimensionRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -8122,7 +8843,13 @@ static void MultiDimensionRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -8136,7 +8863,13 @@ static void MultiDimensionRCTrackDiag25DegUpTo60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8186,7 +8919,13 @@ static void MultiDimensionRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8199,7 +8938,13 @@ static void MultiDimensionRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -8212,7 +8957,13 @@ static void MultiDimensionRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -8243,7 +8994,13 @@ static void MultiDimensionRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8262,7 +9019,13 @@ static void MultiDimensionRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8275,7 +9038,13 @@ static void MultiDimensionRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -8288,7 +9057,13 @@ static void MultiDimensionRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -8302,7 +9077,13 @@ static void MultiDimensionRCTrackDiag60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8366,7 +9147,13 @@ static void MultiDimensionRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8393,7 +9180,13 @@ static void MultiDimensionRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -8420,7 +9213,13 @@ static void MultiDimensionRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -8483,7 +9282,13 @@ static void MultiDimensionRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -8516,7 +9321,13 @@ static void MultiDimensionRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8543,7 +9354,13 @@ static void MultiDimensionRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -8570,7 +9387,13 @@ static void MultiDimensionRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -8598,7 +9421,13 @@ static void MultiDimensionRCTrackDiag25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8662,7 +9491,13 @@ static void MultiDimensionRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8689,7 +9524,13 @@ static void MultiDimensionRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -8716,7 +9557,13 @@ static void MultiDimensionRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -8779,7 +9626,13 @@ static void MultiDimensionRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -8798,7 +9651,13 @@ static void MultiDimensionRCTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8811,7 +9670,13 @@ static void MultiDimensionRCTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -8824,7 +9689,13 @@ static void MultiDimensionRCTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -8838,7 +9709,13 @@ static void MultiDimensionRCTrackDiag25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -8888,7 +9765,13 @@ static void MultiDimensionRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -8901,7 +9784,13 @@ static void MultiDimensionRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -8914,7 +9803,13 @@ static void MultiDimensionRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -8945,7 +9840,13 @@ static void MultiDimensionRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -8964,7 +9865,13 @@ static void MultiDimensionRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -8977,7 +9884,13 @@ static void MultiDimensionRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -8990,7 +9903,13 @@ static void MultiDimensionRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -9004,7 +9923,13 @@ static void MultiDimensionRCTrackDiag60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -9068,7 +9993,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -9094,7 +10025,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -9120,7 +10057,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -9182,7 +10125,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } } @@ -9200,7 +10149,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -9213,7 +10168,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -9226,7 +10187,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -9240,7 +10207,13 @@ static void MultiDimensionRCTrackDiagFlatTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -9290,7 +10263,13 @@ static void MultiDimensionRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -9303,7 +10282,13 @@ static void MultiDimensionRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -9316,7 +10301,13 @@ static void MultiDimensionRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -9347,7 +10338,13 @@ static void MultiDimensionRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -9366,7 +10363,13 @@ static void MultiDimensionRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -9379,7 +10382,13 @@ static void MultiDimensionRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -9392,7 +10401,13 @@ static void MultiDimensionRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -9406,7 +10421,13 @@ static void MultiDimensionRCTrackDiag25DegDownTo60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -9456,7 +10477,13 @@ static void MultiDimensionRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -9469,7 +10496,13 @@ static void MultiDimensionRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -9482,7 +10515,13 @@ static void MultiDimensionRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -9513,7 +10552,13 @@ static void MultiDimensionRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -9532,7 +10577,13 @@ static void MultiDimensionRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -9545,7 +10596,13 @@ static void MultiDimensionRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -9558,7 +10615,13 @@ static void MultiDimensionRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -9572,7 +10635,13 @@ static void MultiDimensionRCTrackDiag60DegDownTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -9636,7 +10705,13 @@ static void MultiDimensionRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -9663,7 +10738,13 @@ static void MultiDimensionRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -9690,7 +10771,13 @@ static void MultiDimensionRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -9753,7 +10840,13 @@ static void MultiDimensionRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -9772,7 +10865,13 @@ static void MultiDimensionRCTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -9785,7 +10884,13 @@ static void MultiDimensionRCTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -9798,7 +10903,13 @@ static void MultiDimensionRCTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -9812,7 +10923,13 @@ static void MultiDimensionRCTrackDiag25DegDownToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -9862,7 +10979,13 @@ static void MultiDimensionRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -9878,7 +11001,13 @@ static void MultiDimensionRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -9891,7 +11020,13 @@ static void MultiDimensionRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -9922,7 +11057,13 @@ static void MultiDimensionRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -9941,7 +11082,13 @@ static void MultiDimensionRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -9954,7 +11101,13 @@ static void MultiDimensionRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -9967,7 +11120,13 @@ static void MultiDimensionRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -9981,7 +11140,12 @@ static void MultiDimensionRCTrackDiagFlatToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -10032,7 +11196,13 @@ static void MultiDimensionRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -10045,7 +11215,13 @@ static void MultiDimensionRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -10061,7 +11237,13 @@ static void MultiDimensionRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -10092,7 +11274,13 @@ static void MultiDimensionRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -10111,7 +11299,13 @@ static void MultiDimensionRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -10124,7 +11318,13 @@ static void MultiDimensionRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -10137,7 +11337,13 @@ static void MultiDimensionRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -10151,7 +11357,12 @@ static void MultiDimensionRCTrackDiagFlatToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -10202,7 +11413,13 @@ static void MultiDimensionRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -10218,7 +11435,13 @@ static void MultiDimensionRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -10231,7 +11454,13 @@ static void MultiDimensionRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -10262,7 +11491,13 @@ static void MultiDimensionRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -10281,7 +11516,13 @@ static void MultiDimensionRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -10294,7 +11535,13 @@ static void MultiDimensionRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -10307,7 +11554,13 @@ static void MultiDimensionRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -10321,7 +11574,12 @@ static void MultiDimensionRCTrackDiagLeftBankToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -10372,7 +11630,13 @@ static void MultiDimensionRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -10385,7 +11649,13 @@ static void MultiDimensionRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -10401,7 +11671,13 @@ static void MultiDimensionRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -10432,7 +11708,13 @@ static void MultiDimensionRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -10451,7 +11733,13 @@ static void MultiDimensionRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -10464,7 +11752,13 @@ static void MultiDimensionRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -10477,7 +11771,13 @@ static void MultiDimensionRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -10491,7 +11791,12 @@ static void MultiDimensionRCTrackDiagRightBankToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -10542,7 +11847,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -10558,7 +11869,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -10571,7 +11888,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -10602,7 +11925,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -10621,7 +11950,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -10634,7 +11969,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -10647,7 +11988,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -10661,7 +12008,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -10711,7 +12064,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -10724,7 +12083,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -10740,7 +12105,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -10771,7 +12142,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -10790,7 +12167,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -10803,7 +12186,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -10816,7 +12205,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -10830,7 +12225,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -10880,7 +12281,13 @@ static void MultiDimensionRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -10896,7 +12303,13 @@ static void MultiDimensionRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -10909,7 +12322,13 @@ static void MultiDimensionRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -10940,7 +12359,13 @@ static void MultiDimensionRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -10959,7 +12384,13 @@ static void MultiDimensionRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -10972,7 +12403,13 @@ static void MultiDimensionRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -10985,7 +12422,13 @@ static void MultiDimensionRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -10999,7 +12442,13 @@ static void MultiDimensionRCTrackDiag25DegUpToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -11049,7 +12498,13 @@ static void MultiDimensionRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -11062,7 +12517,13 @@ static void MultiDimensionRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -11078,7 +12539,13 @@ static void MultiDimensionRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -11109,7 +12576,13 @@ static void MultiDimensionRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -11128,7 +12601,13 @@ static void MultiDimensionRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -11141,7 +12620,13 @@ static void MultiDimensionRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -11154,7 +12639,13 @@ static void MultiDimensionRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -11168,7 +12659,13 @@ static void MultiDimensionRCTrackDiag25DegUpToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -11218,7 +12715,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -11233,7 +12736,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -11245,7 +12754,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -11275,7 +12790,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } } @@ -11293,7 +12814,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -11305,7 +12832,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -11317,7 +12850,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -11330,7 +12869,13 @@ static void MultiDimensionRCTrackDiagLeftBankTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -11380,7 +12925,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -11392,7 +12943,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -11407,7 +12964,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -11437,7 +13000,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } } @@ -11455,7 +13024,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -11467,7 +13042,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -11479,7 +13060,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -11492,7 +13079,13 @@ static void MultiDimensionRCTrackDiagRightBankTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -11542,7 +13135,13 @@ static void MultiDimensionRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11558,7 +13157,13 @@ static void MultiDimensionRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -11571,7 +13176,13 @@ static void MultiDimensionRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11602,7 +13213,13 @@ static void MultiDimensionRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -11621,7 +13238,13 @@ static void MultiDimensionRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11634,7 +13257,13 @@ static void MultiDimensionRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -11647,7 +13276,13 @@ static void MultiDimensionRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11661,7 +13296,13 @@ static void MultiDimensionRCTrackDiag25DegDownToLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -11711,7 +13352,13 @@ static void MultiDimensionRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11724,7 +13371,13 @@ static void MultiDimensionRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -11740,7 +13393,13 @@ static void MultiDimensionRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11771,7 +13430,13 @@ static void MultiDimensionRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -11790,7 +13455,13 @@ static void MultiDimensionRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11803,7 +13474,13 @@ static void MultiDimensionRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -11816,7 +13493,13 @@ static void MultiDimensionRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11830,7 +13513,13 @@ static void MultiDimensionRCTrackDiag25DegDownToRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -11880,7 +13569,13 @@ static void MultiDimensionRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -11893,7 +13588,13 @@ static void MultiDimensionRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -11906,7 +13607,13 @@ static void MultiDimensionRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -11937,7 +13644,13 @@ static void MultiDimensionRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -11956,7 +13669,13 @@ static void MultiDimensionRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -11969,7 +13688,13 @@ static void MultiDimensionRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -11982,7 +13707,13 @@ static void MultiDimensionRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -11996,7 +13727,12 @@ static void MultiDimensionRCTrackDiagLeftBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -12047,7 +13783,13 @@ static void MultiDimensionRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12060,7 +13802,13 @@ static void MultiDimensionRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12073,7 +13821,13 @@ static void MultiDimensionRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12104,7 +13858,13 @@ static void MultiDimensionRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -12123,7 +13883,13 @@ static void MultiDimensionRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12136,7 +13902,13 @@ static void MultiDimensionRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12149,7 +13921,13 @@ static void MultiDimensionRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12163,7 +13941,12 @@ static void MultiDimensionRCTrackDiagRightBank( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -12230,7 +14013,11 @@ static void MultiDimensionRCTrackLeftFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12257,7 +14044,11 @@ static void MultiDimensionRCTrackLeftFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12285,7 +14076,11 @@ static void MultiDimensionRCTrackLeftFlyerTwistUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -12339,7 +14134,11 @@ static void MultiDimensionRCTrackRightFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12365,7 +14164,11 @@ static void MultiDimensionRCTrackRightFlyerTwistUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12392,7 +14195,11 @@ static void MultiDimensionRCTrackRightFlyerTwistUp( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -12442,7 +14249,11 @@ static void MultiDimensionRCTrackLeftFlyerTwistDown( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -12476,7 +14287,11 @@ static void MultiDimensionRCTrackLeftFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12513,7 +14328,11 @@ static void MultiDimensionRCTrackLeftFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12550,7 +14369,11 @@ static void MultiDimensionRCTrackRightFlyerTwistDown( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height + 36, session.SupportColours); @@ -12583,7 +14406,11 @@ static void MultiDimensionRCTrackRightFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12620,7 +14447,11 @@ static void MultiDimensionRCTrackRightFlyerTwistDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -12665,7 +14496,11 @@ static void MultiDimensionRCTrackMultidimInvertedFlatTo90DegQuarterLoopDown( PaintUtilPushTunnelRotated(session, direction, height + 32, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -12693,7 +14528,11 @@ static void MultiDimensionRCTrackMultidimInvertedFlatTo90DegQuarterLoopDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 2: @@ -12721,7 +14560,11 @@ static void MultiDimensionRCTrackMultidimInvertedFlatTo90DegQuarterLoopDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -12761,7 +14604,11 @@ static void MultiDimensionRCTrackMultidimInvertedFlatTo90DegQuarterLoopDown( PaintUtilPushTunnelRotated(session, direction, height + 16, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -12789,7 +14636,11 @@ static void MultiDimensionRCTrackMultidimInvertedFlatTo90DegQuarterLoopDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -12817,7 +14668,11 @@ static void MultiDimensionRCTrackMultidimInvertedFlatTo90DegQuarterLoopDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -12848,7 +14703,7 @@ static void MultiDimensionRCTrackBlockBrakes( MetalASupportsPaintSetup( session, MetalSupportType::TubesInverted, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } else @@ -12865,7 +14720,10 @@ static void MultiDimensionRCTrackBlockBrakes( { { 0, 6, height + 24 }, { 32, 20, 3 } }); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -12911,7 +14769,11 @@ static void MultiDimensionRCTrackMultidim90DegUpToInvertedFlatQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -12939,7 +14801,11 @@ static void MultiDimensionRCTrackMultidim90DegUpToInvertedFlatQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -12971,7 +14837,11 @@ static void MultiDimensionRCTrackMultidim90DegUpToInvertedFlatQuarterLoop( PaintUtilPushTunnelRotated(session, direction, height + 16, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -13005,7 +14875,11 @@ static void MultiDimensionRCTrackMultidim90DegUpToInvertedFlatQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13033,7 +14907,11 @@ static void MultiDimensionRCTrackMultidim90DegUpToInvertedFlatQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -13065,7 +14943,11 @@ static void MultiDimensionRCTrackMultidim90DegUpToInvertedFlatQuarterLoop( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -13110,7 +14992,11 @@ static void MultiDimensionRCTrackMultidimFlatTo90DegDownQuarterLoop( PaintUtilPushTunnelRotated(session, direction, height + 32, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -13138,7 +15024,11 @@ static void MultiDimensionRCTrackMultidimFlatTo90DegDownQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 2: @@ -13166,7 +15056,11 @@ static void MultiDimensionRCTrackMultidimFlatTo90DegDownQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -13206,7 +15100,11 @@ static void MultiDimensionRCTrackMultidimFlatTo90DegDownQuarterLoop( PaintUtilPushTunnelRotated(session, direction, height + 16, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -13234,7 +15132,11 @@ static void MultiDimensionRCTrackMultidimFlatTo90DegDownQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -13262,7 +15164,11 @@ static void MultiDimensionRCTrackMultidimFlatTo90DegDownQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -13305,7 +15211,11 @@ static void MultiDimensionRCTrackMultidimInverted90DegUpToFlatQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -13333,7 +15243,11 @@ static void MultiDimensionRCTrackMultidimInverted90DegUpToFlatQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -13365,7 +15279,11 @@ static void MultiDimensionRCTrackMultidimInverted90DegUpToFlatQuarterLoop( PaintUtilPushTunnelRotated(session, direction, height + 16, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -13399,7 +15317,11 @@ static void MultiDimensionRCTrackMultidimInverted90DegUpToFlatQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13427,7 +15349,11 @@ static void MultiDimensionRCTrackMultidimInverted90DegUpToFlatQuarterLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -13459,7 +15385,11 @@ static void MultiDimensionRCTrackMultidimInverted90DegUpToFlatQuarterLoop( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } diff --git a/src/openrct2/ride/coaster/ReverseFreefallCoaster.cpp b/src/openrct2/ride/coaster/ReverseFreefallCoaster.cpp index b6bac5439b..35ed6c1575 100644 --- a/src/openrct2/ride/coaster/ReverseFreefallCoaster.cpp +++ b/src/openrct2/ride/coaster/ReverseFreefallCoaster.cpp @@ -214,7 +214,7 @@ static void PaintReverseFreefallRCFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -255,7 +255,7 @@ static void PaintReverseFreefallRCStation( TrackPaintUtilDrawNarrowStationPlatform(session, ride, direction, height, 5, trackElement); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -309,7 +309,7 @@ static void PaintReverseFreefallRCSlope( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + supportHeights[trackSequence], 0x20); break; case 5: @@ -336,7 +336,7 @@ static void PaintReverseFreefallRCSlope( session, direction, supportsImageId, { 0, 0, height }, { { isDirection03 ? 3 : 11, 3, height }, { isDirection03 ? 26 : 18, 26, 126 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + supportHeights[trackSequence], 0x20); break; case 6: @@ -356,7 +356,7 @@ static void PaintReverseFreefallRCSlope( } WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + supportHeights[trackSequence], 0x20); break; } @@ -372,7 +372,7 @@ static void PaintReverseFreefallRCVertical( case 0: supportsImageId = session.SupportColours.WithIndex(reverse_freefall_rc_track_pieces_vertical_supports[direction]); PaintAddImageAsParent(session, supportsImageId, { 0, 0, height }, { { 3, 3, height }, { 26, 26, 79 } }); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -388,7 +388,7 @@ static void PaintReverseFreefallRCVertical( session, direction, trackImageId, { 0, 0, height }, { { 30, 6, height }, { 2, 20, 79 } }); } PaintUtilSetVerticalTunnel(session, height + 80); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; } @@ -422,7 +422,7 @@ static void PaintReverseFreefallRCOnridePhoto( TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/ReverserRollerCoaster.cpp b/src/openrct2/ride/coaster/ReverserRollerCoaster.cpp index 6cf0e81e0e..2d6d65f8f5 100644 --- a/src/openrct2/ride/coaster/ReverserRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/ReverserRollerCoaster.cpp @@ -95,7 +95,7 @@ static void ReverserRCTrackFlat( } } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -120,7 +120,7 @@ static void ReverserRCTrackStation( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); TrackPaintUtilDrawStation2(session, ride, direction, height, trackElement, 9, 11); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -213,7 +213,7 @@ static void ReverserRCTrack25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -306,7 +306,7 @@ static void ReverserRCTrackFlatTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -399,7 +399,7 @@ static void ReverserRCTrack25DegUpToFlat( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -466,12 +466,16 @@ static void ReverserRCTrackLeftQuarterTurn5( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -504,7 +508,11 @@ static void ReverserRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -539,14 +547,21 @@ static void ReverserRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -579,7 +594,11 @@ static void ReverserRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -620,7 +639,7 @@ static void ReverserRCTrackLeftQuarterTurn5( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -678,7 +697,7 @@ static void ReverserRCTrackSBendLeft( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -715,7 +734,11 @@ static void ReverserRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -753,7 +776,11 @@ static void ReverserRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -798,7 +825,7 @@ static void ReverserRCTrackSBendLeft( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -847,7 +874,7 @@ static void ReverserRCTrackSBendRight( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -884,7 +911,11 @@ static void ReverserRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -922,7 +953,11 @@ static void ReverserRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -967,7 +1002,7 @@ static void ReverserRCTrackSBendRight( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1016,7 +1051,7 @@ static void ReverserRCTrackLeftQuarterTurn3( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1047,7 +1082,13 @@ static void ReverserRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1091,7 +1132,7 @@ static void ReverserRCTrackLeftQuarterTurn3( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1131,7 +1172,7 @@ static void ReverserRCTrackBrakes( break; } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1178,7 +1219,7 @@ static void ReverserRCTrackLeftReverser( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1213,7 +1254,7 @@ static void ReverserRCTrackLeftReverser( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1248,7 +1289,7 @@ static void ReverserRCTrackLeftReverser( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1283,7 +1324,7 @@ static void ReverserRCTrackLeftReverser( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1318,7 +1359,7 @@ static void ReverserRCTrackLeftReverser( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -1362,7 +1403,7 @@ static void ReverserRCTrackLeftReverser( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1411,7 +1452,7 @@ static void ReverserRCTrackRightReverser( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1446,7 +1487,7 @@ static void ReverserRCTrackRightReverser( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1481,7 +1522,7 @@ static void ReverserRCTrackRightReverser( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1516,7 +1557,7 @@ static void ReverserRCTrackRightReverser( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1551,7 +1592,7 @@ static void ReverserRCTrackRightReverser( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -1595,7 +1636,7 @@ static void ReverserRCTrackRightReverser( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } diff --git a/src/openrct2/ride/coaster/SideFrictionRollerCoaster.cpp b/src/openrct2/ride/coaster/SideFrictionRollerCoaster.cpp index 4989e79b3f..377e8a3501 100644 --- a/src/openrct2/ride/coaster/SideFrictionRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/SideFrictionRollerCoaster.cpp @@ -145,7 +145,7 @@ static void SideFrictionRCTrackFlat( } } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -168,7 +168,7 @@ static void SideFrictionRCTrackStation( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); TrackPaintUtilDrawStation2(session, ride, direction, height, trackElement, 9, 11); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -285,7 +285,7 @@ static void SideFrictionRCTrack25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -402,7 +402,7 @@ static void SideFrictionRCTrackFlatTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -519,7 +519,7 @@ static void SideFrictionRCTrack25DegUpToFlat( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -598,12 +598,16 @@ static void SideFrictionRCTrackLeftQuarterTurn5( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -648,7 +652,11 @@ static void SideFrictionRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -695,14 +703,21 @@ static void SideFrictionRCTrackLeftQuarterTurn5( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -747,7 +762,11 @@ static void SideFrictionRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -800,7 +819,7 @@ static void SideFrictionRCTrackLeftQuarterTurn5( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -870,7 +889,7 @@ static void SideFrictionRCTrackSBendLeft( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -919,7 +938,11 @@ static void SideFrictionRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -969,7 +992,11 @@ static void SideFrictionRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1026,7 +1053,7 @@ static void SideFrictionRCTrackSBendLeft( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1087,7 +1114,7 @@ static void SideFrictionRCTrackSBendRight( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1136,7 +1163,11 @@ static void SideFrictionRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1186,7 +1217,11 @@ static void SideFrictionRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1243,7 +1278,7 @@ static void SideFrictionRCTrackSBendRight( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1304,7 +1339,7 @@ static void SideFrictionRCTrackLeftQuarterTurn3( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1347,7 +1382,13 @@ static void SideFrictionRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1403,7 +1444,7 @@ static void SideFrictionRCTrackLeftQuarterTurn3( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1449,7 +1490,7 @@ static void SideFrictionRCTrackBrakes( break; } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1508,7 +1549,7 @@ static void SideFrictionRCTrackLeftEighthToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1555,7 +1596,7 @@ static void SideFrictionRCTrackLeftEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1602,7 +1643,7 @@ static void SideFrictionRCTrackLeftEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1625,7 +1666,7 @@ static void SideFrictionRCTrackLeftEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1664,7 +1705,7 @@ static void SideFrictionRCTrackLeftEighthToDiag( { { 16, 0, height + 27 }, { 16, 16, 0 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1725,7 +1766,7 @@ static void SideFrictionRCTrackRightEighthToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1772,7 +1813,7 @@ static void SideFrictionRCTrackRightEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1819,7 +1860,7 @@ static void SideFrictionRCTrackRightEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1842,7 +1883,7 @@ static void SideFrictionRCTrackRightEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1881,7 +1922,7 @@ static void SideFrictionRCTrackRightEighthToDiag( { { 16, 16, height + 27 }, { 16, 16, 0 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1935,7 +1976,7 @@ static void SideFrictionRCTrackDiagFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1995,7 +2036,7 @@ static void SideFrictionRCTrackDiagFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -2055,7 +2096,7 @@ static void SideFrictionRCTrackDiagFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2081,7 +2122,7 @@ static void SideFrictionRCTrackDiagFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2117,7 +2158,7 @@ static void SideFrictionRCTrackDiag25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -2154,7 +2195,7 @@ static void SideFrictionRCTrackDiag25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -2191,7 +2232,7 @@ static void SideFrictionRCTrackDiag25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -2217,7 +2258,7 @@ static void SideFrictionRCTrackDiag25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -2253,7 +2294,7 @@ static void SideFrictionRCTrackDiagFlatTo25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2313,7 +2354,7 @@ static void SideFrictionRCTrackDiagFlatTo25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2373,7 +2414,7 @@ static void SideFrictionRCTrackDiagFlatTo25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2399,7 +2440,7 @@ static void SideFrictionRCTrackDiagFlatTo25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -2435,7 +2476,7 @@ static void SideFrictionRCTrackDiag25DegUpToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -2472,7 +2513,7 @@ static void SideFrictionRCTrackDiag25DegUpToFlat( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -2509,7 +2550,7 @@ static void SideFrictionRCTrackDiag25DegUpToFlat( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -2535,7 +2576,7 @@ static void SideFrictionRCTrackDiag25DegUpToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -2571,7 +2612,7 @@ static void SideFrictionRCTrackDiag25DegDown( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -2608,7 +2649,7 @@ static void SideFrictionRCTrackDiag25DegDown( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -2645,7 +2686,7 @@ static void SideFrictionRCTrackDiag25DegDown( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -2671,7 +2712,7 @@ static void SideFrictionRCTrackDiag25DegDown( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -2804,7 +2845,7 @@ static void SideFrictionRCTrackDiagFlatTo25DegDown( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -2838,7 +2879,7 @@ static void SideFrictionRCTrackDiag25DegDownToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2898,7 +2939,7 @@ static void SideFrictionRCTrackDiag25DegDownToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2958,7 +2999,7 @@ static void SideFrictionRCTrackDiag25DegDownToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2984,7 +3025,7 @@ static void SideFrictionRCTrackDiag25DegDownToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -3053,7 +3094,7 @@ static void SideFrictionRCTrack60DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -3124,7 +3165,7 @@ static void SideFrictionRCTrack25DegUpTo60DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3195,7 +3236,7 @@ static void SideFrictionRCTrack60DegUpTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3221,7 +3262,7 @@ static void SideFrictionRCTrackDiag60DegUp( { -16, -16, height }, { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -3241,7 +3282,7 @@ static void SideFrictionRCTrackDiag60DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -3261,7 +3302,7 @@ static void SideFrictionRCTrackDiag60DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -3274,7 +3315,7 @@ static void SideFrictionRCTrackDiag60DegUp( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -3303,7 +3344,7 @@ static void SideFrictionRCTrackDiag60DegUpTo25DegUp( { -16, -16, height }, { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3325,7 +3366,7 @@ static void SideFrictionRCTrackDiag60DegUpTo25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3347,7 +3388,7 @@ static void SideFrictionRCTrackDiag60DegUpTo25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3360,7 +3401,7 @@ static void SideFrictionRCTrackDiag60DegUpTo25DegUp( { -16, -16, height }, { { 0, 0, height }, { 16, 16, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3389,7 +3430,7 @@ static void SideFrictionRCTrackDiag25DegUpTo60DegUp( { -16 + 4, -16 + 2, height }, { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3410,7 +3451,7 @@ static void SideFrictionRCTrackDiag25DegUpTo60DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -3431,7 +3472,7 @@ static void SideFrictionRCTrackDiag25DegUpTo60DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3444,7 +3485,7 @@ static void SideFrictionRCTrackDiag25DegUpTo60DegUp( { -16, -16, height }, { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } diff --git a/src/openrct2/ride/coaster/SingleRailRollerCoaster.cpp b/src/openrct2/ride/coaster/SingleRailRollerCoaster.cpp index 5a45542689..58cbb86ee4 100644 --- a/src/openrct2/ride/coaster/SingleRailRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/SingleRailRollerCoaster.cpp @@ -86,7 +86,10 @@ namespace SingleRailRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -119,7 +122,7 @@ namespace SingleRailRC DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStation2(session, ride, direction, height, trackElement, 4, 7); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -198,7 +201,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -277,7 +283,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -356,7 +365,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -447,7 +459,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -538,7 +553,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -617,7 +635,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -695,7 +716,11 @@ namespace SingleRailRC } PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -751,7 +776,11 @@ namespace SingleRailRC } PaintUtilSetVerticalTunnel(session, height + 56); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -803,7 +832,10 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); } @@ -842,7 +874,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 48, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -887,7 +923,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -918,7 +960,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -957,7 +1005,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1008,7 +1062,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1041,7 +1101,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1070,7 +1133,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1103,7 +1172,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1143,7 +1215,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1194,7 +1272,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1224,7 +1306,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1253,13 +1338,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1299,7 +1395,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1343,7 +1442,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1373,7 +1476,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1402,13 +1508,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1448,7 +1565,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1503,7 +1623,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1532,7 +1658,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1561,7 +1693,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1626,7 +1764,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1648,7 +1792,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1661,7 +1811,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1674,7 +1830,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1703,7 +1865,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1726,7 +1894,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1740,7 +1914,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1754,7 +1934,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1784,7 +1970,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1822,7 +2014,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -1851,7 +2049,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -1880,7 +2084,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -1945,7 +2155,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -1983,7 +2199,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -2012,7 +2234,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -2041,7 +2269,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -2106,7 +2340,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -2144,7 +2384,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2173,7 +2419,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2202,7 +2454,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2267,7 +2525,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -2305,7 +2569,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -2334,7 +2604,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -2363,7 +2639,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -2428,7 +2710,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -2466,7 +2754,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -2494,7 +2788,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -2522,7 +2822,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -2586,7 +2892,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -2625,7 +2937,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2654,7 +2972,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2683,7 +3007,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2748,7 +3078,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -2786,7 +3122,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -2815,7 +3157,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -2844,7 +3192,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -2909,7 +3263,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -2947,7 +3307,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -2976,7 +3342,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3005,7 +3377,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -3070,7 +3448,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3108,7 +3492,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3137,7 +3527,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3166,7 +3562,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -3231,7 +3633,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3269,7 +3677,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -3298,7 +3712,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -3327,7 +3747,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -3392,7 +3818,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -3430,7 +3862,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3459,7 +3897,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3488,7 +3932,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -3553,7 +4003,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3591,7 +4047,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3620,7 +4082,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3649,7 +4117,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -3714,7 +4188,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3760,7 +4240,10 @@ namespace SingleRailRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3804,7 +4287,10 @@ namespace SingleRailRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -3869,7 +4355,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -3920,7 +4409,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -3971,7 +4463,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -4022,7 +4517,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -4088,7 +4586,10 @@ namespace SingleRailRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -4116,7 +4617,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4134,7 +4641,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4148,7 +4661,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4178,7 +4697,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4201,7 +4726,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4215,7 +4746,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4233,7 +4770,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4263,7 +4806,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4286,7 +4835,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4304,7 +4859,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4318,7 +4879,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4348,7 +4915,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4371,7 +4944,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4385,7 +4964,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -4403,7 +4988,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4433,7 +5024,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4456,7 +5053,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4474,7 +5077,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4488,7 +5097,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -4518,7 +5133,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -4541,7 +5162,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4555,7 +5182,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4573,7 +5206,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -4603,7 +5242,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -4626,7 +5271,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4644,7 +5295,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -4658,7 +5315,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4688,7 +5351,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -4711,7 +5380,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -4725,7 +5400,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -4743,7 +5424,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4773,7 +5460,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -4796,7 +5489,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -4813,7 +5512,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -4826,7 +5531,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -4855,7 +5566,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -4879,7 +5596,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -4892,7 +5615,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -4909,7 +5638,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -4938,7 +5673,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -4962,7 +5703,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -4980,7 +5727,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -4994,7 +5747,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -5024,7 +5783,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -5047,7 +5812,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -5061,7 +5832,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -5079,7 +5856,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -5109,7 +5892,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -5132,7 +5921,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5146,7 +5941,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5160,7 +5961,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5190,7 +5997,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5213,7 +6026,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5227,7 +6046,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5241,7 +6066,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5271,7 +6102,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5322,7 +6159,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5357,7 +6200,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5404,7 +6253,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5463,7 +6318,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5500,7 +6361,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5533,7 +6397,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5570,7 +6440,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5618,7 +6491,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5673,7 +6552,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5707,7 +6590,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5740,13 +6626,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5790,7 +6687,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5838,7 +6738,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5872,7 +6776,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5905,13 +6812,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5955,7 +6873,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6019,7 +6940,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6068,7 +6995,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6115,7 +7048,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6170,7 +7109,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6233,7 +7178,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6270,7 +7221,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -6303,7 +7257,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -6340,7 +7300,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -6384,7 +7347,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6431,7 +7400,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6468,7 +7443,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -6501,7 +7479,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -6538,7 +7522,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -6582,7 +7569,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6644,7 +7637,7 @@ namespace SingleRailRC break; } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_1, +56, TUNNEL_2); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -6688,7 +7681,7 @@ namespace SingleRailRC break; } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_1, +56, TUNNEL_2); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -6744,7 +7737,11 @@ namespace SingleRailRC } PaintUtilSetVerticalTunnel(session, height + 96); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -6790,7 +7787,11 @@ namespace SingleRailRC } PaintUtilSetVerticalTunnel(session, height + 96); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); break; case 1: @@ -6856,7 +7857,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -6904,7 +7908,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -6952,7 +7959,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -7000,7 +8010,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -7073,7 +8086,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -7118,7 +8134,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -7163,7 +8182,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -7208,7 +8230,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -7281,7 +8306,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -7326,7 +8354,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -7388,7 +8419,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -7436,7 +8470,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -7484,7 +8521,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -7532,7 +8572,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -7605,7 +8648,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7654,7 +8703,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7701,7 +8756,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7756,7 +8817,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7819,7 +8886,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7856,7 +8929,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -7889,7 +8965,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -7926,7 +9008,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -7970,7 +9055,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8017,7 +9108,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -8054,7 +9151,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8087,7 +9187,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -8124,7 +9230,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -8168,7 +9277,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -8227,7 +9342,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8263,7 +9384,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8300,7 +9424,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8340,7 +9467,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8383,7 +9516,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8419,7 +9558,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8456,7 +9598,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8496,7 +9641,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8542,7 +9693,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8574,7 +9730,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8616,7 +9778,12 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8659,7 +9826,12 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8691,7 +9863,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -8728,7 +9906,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8775,7 +9958,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8807,7 +9995,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8849,7 +10043,12 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8892,7 +10091,12 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -8924,7 +10128,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -8961,7 +10171,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9034,7 +10249,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9068,7 +10288,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9097,7 +10320,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -9130,7 +10359,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9173,7 +10405,12 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9216,7 +10453,12 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9250,7 +10492,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9279,7 +10524,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -9312,7 +10563,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9350,7 +10604,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9396,7 +10655,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9430,7 +10694,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9459,7 +10726,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -9492,7 +10765,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9541,7 +10817,12 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9584,7 +10865,12 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9618,7 +10904,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9647,7 +10936,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -9680,7 +10975,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9724,7 +11022,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9815,7 +11118,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -9858,7 +11166,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -9908,7 +11219,12 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -9973,7 +11289,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -10016,7 +11337,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10066,7 +11390,12 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10124,7 +11453,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -10159,7 +11492,7 @@ namespace SingleRailRC session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 16, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10189,7 +11522,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -10222,7 +11558,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -10261,7 +11601,10 @@ namespace SingleRailRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -10296,7 +11639,7 @@ namespace SingleRailRC } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -10340,7 +11683,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -10373,7 +11720,11 @@ namespace SingleRailRC session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 9, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -10406,7 +11757,11 @@ namespace SingleRailRC session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 10, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -10448,7 +11803,11 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; } @@ -10493,7 +11852,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 1: @@ -10526,7 +11889,11 @@ namespace SingleRailRC session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 18, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 2: @@ -10559,7 +11926,11 @@ namespace SingleRailRC session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 13, height, session.SupportColours); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -10601,7 +11972,11 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; } @@ -10647,7 +12022,10 @@ namespace SingleRailRC } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -10690,7 +12068,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10718,7 +12101,7 @@ namespace SingleRailRC { 0, 0, height }, { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10747,7 +12130,12 @@ namespace SingleRailRC } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -10803,7 +12191,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -10831,7 +12224,7 @@ namespace SingleRailRC { 0, 0, height }, { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10860,7 +12253,12 @@ namespace SingleRailRC } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 33, session.SupportColours); @@ -10932,7 +12330,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -10975,7 +12378,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -11004,7 +12410,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11014,7 +12426,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -11082,7 +12497,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -11137,7 +12555,12 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_BC | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::rightCorner, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -11180,7 +12603,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::bottomRightSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -11209,7 +12635,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11219,7 +12651,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -11286,7 +12721,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -11357,7 +12795,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11390,7 +12832,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_B4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::topCorner), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -11433,7 +12878,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 3: @@ -11463,7 +12914,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::centre, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 4: @@ -11496,7 +12953,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_CC | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, direction), + EnumsToFlags( + PaintSegment::topRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + direction), 0xFFFF, 0); if (direction == 0 || direction == 3) @@ -11551,7 +13011,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11586,7 +13050,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_CC | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, direction), + EnumsToFlags( + PaintSegment::topRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -11631,7 +13098,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::centre, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 3: @@ -11664,7 +13137,13 @@ namespace SingleRailRC } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 144, 0x20); break; case 4: @@ -11699,7 +13178,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_B4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::topCorner), + direction), 0xFFFF, 0); if (direction == 0 || direction == 3) { @@ -11774,7 +13256,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; case 1: @@ -11804,7 +13290,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -11850,7 +13339,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -11908,7 +13400,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; case 1: @@ -11938,7 +13434,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -11984,7 +13483,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 38, session.SupportColours); @@ -12052,7 +13554,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -12088,7 +13594,11 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -12126,7 +13636,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -12134,7 +13647,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -12238,7 +13754,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -12274,7 +13794,11 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -12313,7 +13837,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; @@ -12321,7 +13848,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -12425,7 +13955,11 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -12453,7 +13987,11 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -12485,7 +14023,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -12543,7 +14085,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -12592,7 +14140,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -12643,7 +14197,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -12692,7 +14252,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -12739,7 +14305,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -12792,7 +14364,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -12839,7 +14417,13 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -12892,7 +14476,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -12935,7 +14525,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -12971,7 +14565,11 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -13001,7 +14599,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -13044,7 +14645,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -13073,7 +14677,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -13103,7 +14713,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -13138,7 +14751,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -13182,7 +14798,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -13218,7 +14838,11 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -13248,7 +14872,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -13291,7 +14918,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -13320,7 +14950,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); break; case 5: @@ -13350,7 +14986,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 224, 0x20); break; @@ -13385,7 +15024,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); break; @@ -13505,7 +15147,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } @@ -13596,7 +15241,10 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -13646,7 +15294,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -13675,7 +15329,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -13704,7 +15364,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -13769,7 +15435,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -13807,7 +15479,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13836,7 +15514,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -13865,7 +15549,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -13930,7 +15620,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -13968,7 +15664,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13997,7 +15699,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -14026,7 +15734,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -14091,7 +15805,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -14129,7 +15849,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -14158,7 +15884,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -14187,7 +15919,13 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -14252,13 +15990,21 @@ namespace SingleRailRC } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } } - // SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4; + // EnumsToFlags(PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + // PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + // PaintSegment::bottomRightSide); // b4 // c8 cc // b8 c4 bc @@ -14315,7 +16061,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -14349,7 +16099,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14382,13 +16135,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -14432,7 +16196,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14480,7 +16247,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -14514,7 +16285,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14547,13 +16321,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -14597,7 +16382,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14651,7 +16439,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14684,13 +16475,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -14724,7 +16526,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14765,7 +16570,11 @@ namespace SingleRailRC } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -14818,7 +16627,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14851,13 +16663,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -14891,7 +16714,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14930,7 +16756,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction + 1, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -14987,7 +16817,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -15005,7 +16841,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -15019,7 +16861,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -15049,7 +16897,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -15072,7 +16926,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -15086,7 +16946,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -15104,7 +16970,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -15134,7 +17006,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -15157,7 +17035,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15175,7 +17059,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15189,7 +17079,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15219,7 +17115,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15242,7 +17144,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15256,7 +17164,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15274,7 +17188,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15304,7 +17224,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15355,7 +17281,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -15369,7 +17301,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -15383,7 +17321,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -15413,7 +17357,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -15436,7 +17386,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -15450,7 +17406,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -15464,7 +17426,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -15494,7 +17462,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -15517,7 +17491,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15531,7 +17511,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15545,7 +17531,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15575,7 +17567,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15598,7 +17596,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15612,7 +17616,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15626,7 +17636,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15656,7 +17672,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15707,7 +17729,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15721,7 +17749,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15735,7 +17769,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15766,7 +17806,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15789,7 +17835,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -15803,7 +17855,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -15817,7 +17875,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -15848,7 +17912,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -15885,7 +17955,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -15903,7 +17979,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -15917,7 +17999,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -15947,7 +18035,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -15970,7 +18064,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -15984,7 +18084,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -16002,7 +18108,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -16032,7 +18144,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -16055,7 +18173,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -16073,7 +18197,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -16087,7 +18217,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -16117,7 +18253,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -16140,7 +18282,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -16154,7 +18302,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -16172,7 +18326,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -16202,7 +18362,13 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -16277,7 +18443,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -16311,7 +18481,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16344,13 +18517,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -16394,7 +18578,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16442,7 +18629,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -16476,7 +18667,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16509,13 +18703,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 4: @@ -16559,7 +18764,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16613,7 +18821,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16646,13 +18857,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -16686,7 +18908,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16725,7 +18950,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -16778,7 +19007,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16811,13 +19043,24 @@ namespace SingleRailRC break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -16851,7 +19094,10 @@ namespace SingleRailRC PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -16890,7 +19136,11 @@ namespace SingleRailRC PaintUtilPushTunnelRotated(session, direction + 1, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } diff --git a/src/openrct2/ride/coaster/StandUpRollerCoaster.cpp b/src/openrct2/ride/coaster/StandUpRollerCoaster.cpp index a1d6373763..8a82ebffe0 100644 --- a/src/openrct2/ride/coaster/StandUpRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/StandUpRollerCoaster.cpp @@ -107,7 +107,10 @@ static void StandUpRCTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -142,7 +145,7 @@ static void StandUpRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStation2(session, ride, direction, height, trackElement, 9, 11); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -214,7 +217,10 @@ static void StandUpRCTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -290,7 +296,10 @@ static void StandUpRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -362,7 +371,10 @@ static void StandUpRCTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -450,7 +462,10 @@ static void StandUpRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -538,7 +553,10 @@ static void StandUpRCTrack60DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -610,7 +628,10 @@ static void StandUpRCTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -696,7 +717,13 @@ static void StandUpRCTrackLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -724,7 +751,11 @@ static void StandUpRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -749,7 +780,13 @@ static void StandUpRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -777,7 +814,11 @@ static void StandUpRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -813,7 +854,13 @@ static void StandUpRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -859,7 +906,10 @@ static void StandUpRCTrackFlatToLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -894,7 +944,10 @@ static void StandUpRCTrackFlatToRightBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -929,7 +982,10 @@ static void StandUpRCTrackLeftBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -964,7 +1020,10 @@ static void StandUpRCTrackRightBankToFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1009,7 +1068,13 @@ static void StandUpRCTrackBankedLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1041,7 +1106,11 @@ static void StandUpRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1070,7 +1139,13 @@ static void StandUpRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1102,7 +1177,11 @@ static void StandUpRCTrackBankedLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1145,7 +1224,13 @@ static void StandUpRCTrackBankedLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1198,7 +1283,10 @@ static void StandUpRCTrackLeftBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1240,7 +1328,10 @@ static void StandUpRCTrackRightBankTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -1282,7 +1373,10 @@ static void StandUpRCTrack25DegUpToLeftBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1324,7 +1418,10 @@ static void StandUpRCTrack25DegUpToRightBank( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1391,7 +1488,10 @@ static void StandUpRCTrackLeftBank( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1464,7 +1564,13 @@ static void StandUpRCTrackLeftQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1517,7 +1623,11 @@ static void StandUpRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1567,7 +1677,13 @@ static void StandUpRCTrackLeftQuarterTurn525DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1620,7 +1736,11 @@ static void StandUpRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1683,7 +1803,13 @@ static void StandUpRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -1750,7 +1876,13 @@ static void StandUpRCTrackRightQuarterTurn525DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1803,7 +1935,11 @@ static void StandUpRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1853,7 +1989,12 @@ static void StandUpRCTrackRightQuarterTurn525DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: @@ -1906,7 +2047,11 @@ static void StandUpRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -1969,7 +2114,13 @@ static void StandUpRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2027,7 +2178,13 @@ static void StandUpRCTrackSBendLeft( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2056,7 +2213,11 @@ static void StandUpRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2086,7 +2247,11 @@ static void StandUpRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2122,7 +2287,13 @@ static void StandUpRCTrackSBendLeft( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2162,7 +2333,13 @@ static void StandUpRCTrackSBendRight( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2192,7 +2369,11 @@ static void StandUpRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2223,7 +2404,11 @@ static void StandUpRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -2259,7 +2444,13 @@ static void StandUpRCTrackSBendRight( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2300,7 +2491,11 @@ static void StandUpRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -2334,7 +2529,11 @@ static void StandUpRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2359,7 +2558,13 @@ static void StandUpRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -2384,7 +2589,11 @@ static void StandUpRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2416,7 +2625,11 @@ static void StandUpRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2441,7 +2654,13 @@ static void StandUpRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -2474,7 +2693,11 @@ static void StandUpRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2511,7 +2734,11 @@ static void StandUpRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -2779,7 +3006,13 @@ static void StandUpRCTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2806,7 +3039,13 @@ static void StandUpRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2841,7 +3080,13 @@ static void StandUpRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -2897,7 +3142,13 @@ static void StandUpRCTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -2928,7 +3179,13 @@ static void StandUpRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -2970,7 +3227,13 @@ static void StandUpRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3046,7 +3309,13 @@ static void StandUpRCTrackLeftQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3114,7 +3383,13 @@ static void StandUpRCTrackLeftQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3181,7 +3456,13 @@ static void StandUpRCTrackRightQuarterTurn325DegUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3261,7 +3542,13 @@ static void StandUpRCTrackRightQuarterTurn325DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3319,7 +3606,10 @@ static void StandUpRCTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -3352,7 +3642,7 @@ static void StandUpRCTrackHalfLoopUp( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 16, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3378,7 +3668,11 @@ static void StandUpRCTrackHalfLoopUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; @@ -3407,7 +3701,10 @@ static void StandUpRCTrackHalfLoopUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -3485,7 +3782,7 @@ static void StandUpRCTrackLeftCorkscrewUp( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3514,7 +3811,12 @@ static void StandUpRCTrackLeftCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); @@ -3571,7 +3873,12 @@ static void StandUpRCTrackRightCorkscrewUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3599,7 +3906,7 @@ static void StandUpRCTrackRightCorkscrewUp( { { 6, 6, height + 10 }, { 20, 20, 3 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3628,7 +3935,12 @@ static void StandUpRCTrackRightCorkscrewUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 35, session.SupportColours); @@ -3704,7 +4016,12 @@ static void StandUpRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3736,7 +4053,13 @@ static void StandUpRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -3778,7 +4101,12 @@ static void StandUpRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3821,7 +4149,12 @@ static void StandUpRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3853,7 +4186,13 @@ static void StandUpRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -3890,7 +4229,12 @@ static void StandUpRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3938,7 +4282,12 @@ static void StandUpRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3970,7 +4319,13 @@ static void StandUpRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4012,7 +4367,12 @@ static void StandUpRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4055,7 +4415,12 @@ static void StandUpRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4087,7 +4452,13 @@ static void StandUpRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -4124,7 +4495,12 @@ static void StandUpRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4200,7 +4576,12 @@ static void StandUpRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4233,7 +4614,11 @@ static void StandUpRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4262,7 +4647,13 @@ static void StandUpRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4294,7 +4685,11 @@ static void StandUpRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4337,7 +4732,12 @@ static void StandUpRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4380,7 +4780,12 @@ static void StandUpRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4413,7 +4818,11 @@ static void StandUpRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4442,7 +4851,12 @@ static void StandUpRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -4474,7 +4888,11 @@ static void StandUpRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4512,7 +4930,12 @@ static void StandUpRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4560,7 +4983,12 @@ static void StandUpRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4593,7 +5021,11 @@ static void StandUpRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4622,7 +5054,12 @@ static void StandUpRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -4654,7 +5091,11 @@ static void StandUpRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4697,7 +5138,12 @@ static void StandUpRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4740,7 +5186,12 @@ static void StandUpRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4773,7 +5224,11 @@ static void StandUpRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4802,7 +5257,13 @@ static void StandUpRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: @@ -4834,7 +5295,11 @@ static void StandUpRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4872,7 +5337,12 @@ static void StandUpRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4932,7 +5402,10 @@ static void StandUpRCTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -4968,7 +5441,7 @@ static void StandUpRCTrackOnRidePhoto( } TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -5010,7 +5483,10 @@ static void StandUpRCTrackLeftEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5039,7 +5515,11 @@ static void StandUpRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5068,13 +5548,24 @@ static void StandUpRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5111,7 +5602,11 @@ static void StandUpRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5156,7 +5651,10 @@ static void StandUpRCTrackRightEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5185,7 +5683,11 @@ static void StandUpRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5214,13 +5716,24 @@ static void StandUpRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5257,7 +5770,11 @@ static void StandUpRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5320,7 +5837,10 @@ static void StandUpRCTrackLeftEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5349,7 +5869,11 @@ static void StandUpRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5378,13 +5902,24 @@ static void StandUpRCTrackLeftEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5421,7 +5956,11 @@ static void StandUpRCTrackLeftEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5466,7 +6005,10 @@ static void StandUpRCTrackRightEighthBankToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5495,7 +6037,11 @@ static void StandUpRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5524,13 +6070,24 @@ static void StandUpRCTrackRightEighthBankToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -5567,7 +6124,11 @@ static void StandUpRCTrackRightEighthBankToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5623,7 +6184,13 @@ static void StandUpRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -5650,7 +6217,12 @@ static void StandUpRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5677,7 +6249,13 @@ static void StandUpRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5736,7 +6314,13 @@ static void StandUpRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -5811,7 +6395,13 @@ static void StandUpRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -5838,7 +6428,12 @@ static void StandUpRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -5865,7 +6460,13 @@ static void StandUpRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -5924,7 +6525,13 @@ static void StandUpRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -5961,7 +6568,13 @@ static void StandUpRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -5988,7 +6601,12 @@ static void StandUpRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -6015,7 +6633,13 @@ static void StandUpRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -6076,7 +6700,13 @@ static void StandUpRCTrackDiag60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -6113,7 +6743,13 @@ static void StandUpRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -6140,7 +6776,12 @@ static void StandUpRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -6167,7 +6808,13 @@ static void StandUpRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -6226,7 +6873,13 @@ static void StandUpRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -6263,7 +6916,13 @@ static void StandUpRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6290,7 +6949,12 @@ static void StandUpRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6317,7 +6981,13 @@ static void StandUpRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6378,7 +7048,13 @@ static void StandUpRCTrackDiag25DegUpTo60DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6415,7 +7091,13 @@ static void StandUpRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -6442,7 +7124,12 @@ static void StandUpRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -6469,7 +7156,13 @@ static void StandUpRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -6530,7 +7223,13 @@ static void StandUpRCTrackDiag60DegUpTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -6567,7 +7266,13 @@ static void StandUpRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6594,7 +7299,12 @@ static void StandUpRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6621,7 +7331,13 @@ static void StandUpRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6680,7 +7396,13 @@ static void StandUpRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6717,7 +7439,13 @@ static void StandUpRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -6744,7 +7472,12 @@ static void StandUpRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -6771,7 +7504,13 @@ static void StandUpRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -6830,7 +7569,13 @@ static void StandUpRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -6867,7 +7612,13 @@ static void StandUpRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -6894,7 +7645,12 @@ static void StandUpRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -6921,7 +7677,13 @@ static void StandUpRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -6982,7 +7744,13 @@ static void StandUpRCTrackDiag60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -7019,7 +7787,13 @@ static void StandUpRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -7045,7 +7819,12 @@ static void StandUpRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -7071,7 +7850,13 @@ static void StandUpRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -7129,7 +7914,13 @@ static void StandUpRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -7167,7 +7958,13 @@ static void StandUpRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7194,7 +7991,12 @@ static void StandUpRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7221,7 +8023,13 @@ static void StandUpRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7282,7 +8090,13 @@ static void StandUpRCTrackDiag25DegDownTo60DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7319,7 +8133,13 @@ static void StandUpRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -7346,7 +8166,12 @@ static void StandUpRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -7373,7 +8198,13 @@ static void StandUpRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -7432,7 +8263,13 @@ static void StandUpRCTrackDiag60DegDownTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -7469,7 +8306,13 @@ static void StandUpRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7496,7 +8339,12 @@ static void StandUpRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7523,7 +8371,13 @@ static void StandUpRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7582,7 +8436,13 @@ static void StandUpRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -7605,7 +8465,13 @@ static void StandUpRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7621,7 +8487,12 @@ static void StandUpRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7634,7 +8505,13 @@ static void StandUpRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7661,7 +8538,13 @@ static void StandUpRCTrackDiagFlatToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7684,7 +8567,13 @@ static void StandUpRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7697,7 +8586,12 @@ static void StandUpRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7713,7 +8607,13 @@ static void StandUpRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7740,7 +8640,13 @@ static void StandUpRCTrackDiagFlatToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7763,7 +8669,13 @@ static void StandUpRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7779,7 +8691,12 @@ static void StandUpRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7792,7 +8709,13 @@ static void StandUpRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7819,7 +8742,13 @@ static void StandUpRCTrackDiagLeftBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7842,7 +8771,13 @@ static void StandUpRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -7855,7 +8790,12 @@ static void StandUpRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -7871,7 +8811,13 @@ static void StandUpRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -7898,7 +8844,13 @@ static void StandUpRCTrackDiagRightBankToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -7921,7 +8873,13 @@ static void StandUpRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7937,7 +8895,12 @@ static void StandUpRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7950,7 +8913,13 @@ static void StandUpRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7977,7 +8946,13 @@ static void StandUpRCTrackDiagLeftBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8000,7 +8975,13 @@ static void StandUpRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8013,7 +8994,12 @@ static void StandUpRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8029,7 +9015,13 @@ static void StandUpRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8056,7 +9048,13 @@ static void StandUpRCTrackDiagRightBankTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8079,7 +9077,13 @@ static void StandUpRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8095,7 +9099,12 @@ static void StandUpRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -8108,7 +9117,13 @@ static void StandUpRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -8135,7 +9150,13 @@ static void StandUpRCTrackDiag25DegUpToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -8158,7 +9179,13 @@ static void StandUpRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -8171,7 +9198,12 @@ static void StandUpRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -8187,7 +9219,13 @@ static void StandUpRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -8214,7 +9252,13 @@ static void StandUpRCTrackDiag25DegUpToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -8237,7 +9281,13 @@ static void StandUpRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8252,7 +9302,12 @@ static void StandUpRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8264,7 +9319,13 @@ static void StandUpRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8290,7 +9351,13 @@ static void StandUpRCTrackDiagLeftBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -8314,7 +9381,13 @@ static void StandUpRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -8326,7 +9399,12 @@ static void StandUpRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -8341,7 +9419,13 @@ static void StandUpRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -8367,7 +9451,13 @@ static void StandUpRCTrackDiagRightBankTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -8391,7 +9481,13 @@ static void StandUpRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8407,7 +9503,12 @@ static void StandUpRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8420,7 +9521,13 @@ static void StandUpRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8447,7 +9554,13 @@ static void StandUpRCTrackDiag25DegDownToLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8470,7 +9583,13 @@ static void StandUpRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -8483,7 +9602,12 @@ static void StandUpRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -8499,7 +9623,13 @@ static void StandUpRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -8526,7 +9656,13 @@ static void StandUpRCTrackDiag25DegDownToRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8549,7 +9685,13 @@ static void StandUpRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8562,7 +9704,12 @@ static void StandUpRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8575,7 +9722,13 @@ static void StandUpRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8602,7 +9755,13 @@ static void StandUpRCTrackDiagLeftBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8625,7 +9784,13 @@ static void StandUpRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8638,7 +9803,12 @@ static void StandUpRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8651,7 +9821,13 @@ static void StandUpRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8678,7 +9854,13 @@ static void StandUpRCTrackDiagRightBank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8701,7 +9883,10 @@ static void StandUpRCTrackBlockBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/Steeplechase.cpp b/src/openrct2/ride/coaster/Steeplechase.cpp index c8c3114c32..5648ba1b18 100644 --- a/src/openrct2/ride/coaster/Steeplechase.cpp +++ b/src/openrct2/ride/coaster/Steeplechase.cpp @@ -72,7 +72,10 @@ static void SteeplechaseTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -96,7 +99,7 @@ static void SteeplechaseTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Boxed); TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -174,7 +177,10 @@ static void SteeplechaseTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -252,7 +258,10 @@ static void SteeplechaseTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -330,7 +339,10 @@ static void SteeplechaseTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -398,7 +410,13 @@ static void SteeplechaseTrackLeftQuarterTurn5( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -426,7 +444,11 @@ static void SteeplechaseTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -451,7 +473,13 @@ static void SteeplechaseTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -479,7 +507,11 @@ static void SteeplechaseTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -521,7 +553,13 @@ static void SteeplechaseTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -576,7 +614,13 @@ static void SteeplechaseTrackSBendLeft( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -606,7 +650,11 @@ static void SteeplechaseTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -637,7 +685,11 @@ static void SteeplechaseTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -679,7 +731,13 @@ static void SteeplechaseTrackSBendLeft( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -725,7 +783,13 @@ static void SteeplechaseTrackSBendRight( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -756,7 +820,11 @@ static void SteeplechaseTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -788,7 +856,11 @@ static void SteeplechaseTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -830,7 +902,13 @@ static void SteeplechaseTrackSBendRight( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -876,7 +954,13 @@ static void SteeplechaseTrackLeftQuarterTurn3( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -903,7 +987,13 @@ static void SteeplechaseTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -944,7 +1034,13 @@ static void SteeplechaseTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -983,7 +1079,10 @@ static void SteeplechaseTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1031,7 +1130,10 @@ static void SteeplechaseTrackLeftEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1060,7 +1162,11 @@ static void SteeplechaseTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1089,13 +1195,24 @@ static void SteeplechaseTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1132,7 +1249,11 @@ static void SteeplechaseTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1183,7 +1304,10 @@ static void SteeplechaseTrackRightEighthToDiag( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1212,7 +1336,11 @@ static void SteeplechaseTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1241,13 +1369,24 @@ static void SteeplechaseTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -1285,7 +1424,11 @@ static void SteeplechaseTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -1341,7 +1484,13 @@ static void SteeplechaseTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -1368,7 +1517,12 @@ static void SteeplechaseTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -1395,7 +1549,13 @@ static void SteeplechaseTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -1456,7 +1616,13 @@ static void SteeplechaseTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -1512,7 +1678,13 @@ static void SteeplechaseTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -1539,7 +1711,12 @@ static void SteeplechaseTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -1566,7 +1743,13 @@ static void SteeplechaseTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -1627,7 +1810,13 @@ static void SteeplechaseTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -1664,7 +1853,13 @@ static void SteeplechaseTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -1691,7 +1886,12 @@ static void SteeplechaseTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -1718,7 +1918,13 @@ static void SteeplechaseTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -1779,7 +1985,13 @@ static void SteeplechaseTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -1816,7 +2028,13 @@ static void SteeplechaseTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -1843,7 +2061,12 @@ static void SteeplechaseTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -1870,7 +2093,13 @@ static void SteeplechaseTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -1931,7 +2160,13 @@ static void SteeplechaseTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -1968,7 +2203,13 @@ static void SteeplechaseTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -1995,7 +2236,12 @@ static void SteeplechaseTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -2022,7 +2268,13 @@ static void SteeplechaseTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -2083,7 +2335,13 @@ static void SteeplechaseTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -2120,7 +2378,13 @@ static void SteeplechaseTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -2146,7 +2410,12 @@ static void SteeplechaseTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -2172,7 +2441,13 @@ static void SteeplechaseTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -2232,7 +2507,13 @@ static void SteeplechaseTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -2270,7 +2551,13 @@ static void SteeplechaseTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2297,7 +2584,12 @@ static void SteeplechaseTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -2324,7 +2616,13 @@ static void SteeplechaseTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -2385,7 +2683,13 @@ static void SteeplechaseTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -2415,7 +2719,10 @@ static void SteeplechaseTrackBlockBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/SuspendedSwingingCoaster.cpp b/src/openrct2/ride/coaster/SuspendedSwingingCoaster.cpp index 5f4a5b60b5..fe6a58c665 100644 --- a/src/openrct2/ride/coaster/SuspendedSwingingCoaster.cpp +++ b/src/openrct2/ride/coaster/SuspendedSwingingCoaster.cpp @@ -61,7 +61,10 @@ static void SuspendedSwingingRCTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -96,7 +99,7 @@ static void SuspendedSwingingRCTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Tubes); TrackPaintUtilDrawStationInverted(session, ride, direction, height, trackElement, STATION_VARIANT_TALL); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_INVERTED_9); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -159,7 +162,10 @@ static void SuspendedSwingingRCTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -233,7 +239,10 @@ static void SuspendedSwingingRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); } @@ -296,7 +305,10 @@ static void SuspendedSwingingRCTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -376,7 +388,10 @@ static void SuspendedSwingingRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_INVERTED_5); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); } @@ -451,7 +466,10 @@ static void SuspendedSwingingRCTrack60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -547,7 +565,10 @@ static void SuspendedSwingingRCTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -665,7 +686,12 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -703,7 +729,11 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -731,7 +761,13 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -761,7 +797,11 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -791,7 +831,12 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -848,7 +893,12 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -884,7 +934,11 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -909,7 +963,13 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 4: @@ -938,7 +998,11 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -964,7 +1028,12 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1012,7 +1081,12 @@ static void SuspendedSwingingRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1048,7 +1122,11 @@ static void SuspendedSwingingRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -1073,7 +1151,12 @@ static void SuspendedSwingingRCTrackRightQuarterTurn525DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 80, 0x20); break; case 4: @@ -1102,7 +1185,11 @@ static void SuspendedSwingingRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; @@ -1128,7 +1215,12 @@ static void SuspendedSwingingRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1194,7 +1286,13 @@ static void SuspendedSwingingRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -1227,7 +1325,11 @@ static void SuspendedSwingingRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1268,7 +1370,11 @@ static void SuspendedSwingingRCTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1308,7 +1414,13 @@ static void SuspendedSwingingRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -1355,7 +1467,13 @@ static void SuspendedSwingingRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -1388,7 +1506,11 @@ static void SuspendedSwingingRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1429,7 +1551,11 @@ static void SuspendedSwingingRCTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1469,7 +1595,13 @@ static void SuspendedSwingingRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -1520,7 +1652,12 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -1558,7 +1695,13 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -1587,7 +1730,12 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -1644,7 +1792,12 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1683,7 +1836,12 @@ static void SuspendedSwingingRCTrackLeftQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1731,7 +1889,12 @@ static void SuspendedSwingingRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1770,7 +1933,12 @@ static void SuspendedSwingingRCTrackRightQuarterTurn325DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 54, session.SupportColours); @@ -1829,7 +1997,10 @@ static void SuspendedSwingingRCTrackBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -1873,7 +2044,12 @@ static void SuspendedSwingingRCTrackLeftQuarterHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -1913,7 +2089,11 @@ static void SuspendedSwingingRCTrackLeftQuarterHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1942,7 +2122,13 @@ static void SuspendedSwingingRCTrackLeftQuarterHelixLargeUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -1974,7 +2160,11 @@ static void SuspendedSwingingRCTrackLeftQuarterHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2004,7 +2194,12 @@ static void SuspendedSwingingRCTrackLeftQuarterHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 58, session.SupportColours); @@ -2056,7 +2251,12 @@ static void SuspendedSwingingRCTrackRightQuarterHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -2096,7 +2296,11 @@ static void SuspendedSwingingRCTrackRightQuarterHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2125,7 +2329,12 @@ static void SuspendedSwingingRCTrackRightQuarterHelixLargeUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -2157,7 +2366,11 @@ static void SuspendedSwingingRCTrackRightQuarterHelixLargeUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2187,7 +2400,12 @@ static void SuspendedSwingingRCTrackRightQuarterHelixLargeUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 58, session.SupportColours); @@ -2239,7 +2457,12 @@ static void SuspendedSwingingRCTrackLeftQuarterHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 58, session.SupportColours); @@ -2279,7 +2502,11 @@ static void SuspendedSwingingRCTrackLeftQuarterHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2308,7 +2535,13 @@ static void SuspendedSwingingRCTrackLeftQuarterHelixLargeDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -2340,7 +2573,11 @@ static void SuspendedSwingingRCTrackLeftQuarterHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2370,7 +2607,12 @@ static void SuspendedSwingingRCTrackLeftQuarterHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -2422,7 +2664,12 @@ static void SuspendedSwingingRCTrackRightQuarterHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 58, session.SupportColours); @@ -2462,7 +2709,11 @@ static void SuspendedSwingingRCTrackRightQuarterHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2491,7 +2742,12 @@ static void SuspendedSwingingRCTrackRightQuarterHelixLargeDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -2523,7 +2779,11 @@ static void SuspendedSwingingRCTrackRightQuarterHelixLargeDown( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2553,7 +2813,12 @@ static void SuspendedSwingingRCTrackRightQuarterHelixLargeDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 46, session.SupportColours); @@ -2605,7 +2870,13 @@ static void SuspendedSwingingRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -2641,7 +2912,11 @@ static void SuspendedSwingingRCTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2670,13 +2945,24 @@ static void SuspendedSwingingRCTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -2707,7 +2993,10 @@ static void SuspendedSwingingRCTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2770,7 +3059,13 @@ static void SuspendedSwingingRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height + 44, session.SupportColours); @@ -2806,7 +3101,11 @@ static void SuspendedSwingingRCTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -2835,13 +3134,24 @@ static void SuspendedSwingingRCTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -2872,7 +3182,10 @@ static void SuspendedSwingingRCTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -2951,7 +3264,13 @@ static void SuspendedSwingingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -2978,7 +3297,12 @@ static void SuspendedSwingingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -3005,7 +3329,13 @@ static void SuspendedSwingingRCTrackDiagFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -3033,7 +3363,13 @@ static void SuspendedSwingingRCTrackDiagFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -3093,7 +3429,13 @@ static void SuspendedSwingingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3120,7 +3462,12 @@ static void SuspendedSwingingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3147,7 +3494,13 @@ static void SuspendedSwingingRCTrackDiag25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -3175,7 +3528,13 @@ static void SuspendedSwingingRCTrackDiag25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -3221,7 +3580,13 @@ static void SuspendedSwingingRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 1: @@ -3234,7 +3599,12 @@ static void SuspendedSwingingRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 2: @@ -3247,7 +3617,13 @@ static void SuspendedSwingingRCTrackDiag60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 3: @@ -3261,7 +3637,13 @@ static void SuspendedSwingingRCTrackDiag60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -3322,7 +3704,13 @@ static void SuspendedSwingingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -3349,7 +3737,12 @@ static void SuspendedSwingingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -3376,7 +3769,13 @@ static void SuspendedSwingingRCTrackDiagFlatTo25DegUp( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -3404,7 +3803,13 @@ static void SuspendedSwingingRCTrackDiagFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -3450,7 +3855,13 @@ static void SuspendedSwingingRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -3463,7 +3874,12 @@ static void SuspendedSwingingRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -3476,7 +3892,13 @@ static void SuspendedSwingingRCTrackDiag25DegUpTo60DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -3490,7 +3912,13 @@ static void SuspendedSwingingRCTrackDiag25DegUpTo60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -3537,7 +3965,13 @@ static void SuspendedSwingingRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -3550,7 +3984,12 @@ static void SuspendedSwingingRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -3563,7 +4002,13 @@ static void SuspendedSwingingRCTrackDiag60DegUpTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -3577,7 +4022,13 @@ static void SuspendedSwingingRCTrackDiag60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -3638,7 +4089,13 @@ static void SuspendedSwingingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3665,7 +4122,12 @@ static void SuspendedSwingingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3692,7 +4154,13 @@ static void SuspendedSwingingRCTrackDiag25DegUpToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -3720,7 +4188,13 @@ static void SuspendedSwingingRCTrackDiag25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -3780,7 +4254,13 @@ static void SuspendedSwingingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -3807,7 +4287,12 @@ static void SuspendedSwingingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -3834,7 +4319,13 @@ static void SuspendedSwingingRCTrackDiag25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -3862,7 +4353,13 @@ static void SuspendedSwingingRCTrackDiag25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -3908,7 +4405,13 @@ static void SuspendedSwingingRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 1: @@ -3921,7 +4424,12 @@ static void SuspendedSwingingRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 2: @@ -3934,7 +4442,13 @@ static void SuspendedSwingingRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; case 3: @@ -3947,7 +4461,13 @@ static void SuspendedSwingingRCTrackDiag60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 120, 0x20); break; } @@ -3984,7 +4504,13 @@ static void SuspendedSwingingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: if (trackElement.HasChain()) @@ -4010,7 +4536,12 @@ static void SuspendedSwingingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: if (trackElement.HasChain()) @@ -4036,7 +4567,13 @@ static void SuspendedSwingingRCTrackDiagFlatTo25DegDown( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: if (trackElement.HasChain()) @@ -4063,7 +4600,13 @@ static void SuspendedSwingingRCTrackDiagFlatTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -4109,7 +4652,13 @@ static void SuspendedSwingingRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -4122,7 +4671,12 @@ static void SuspendedSwingingRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -4135,7 +4689,13 @@ static void SuspendedSwingingRCTrackDiag25DegDownTo60DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -4149,7 +4709,13 @@ static void SuspendedSwingingRCTrackDiag25DegDownTo60DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -4196,7 +4762,13 @@ static void SuspendedSwingingRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 1: @@ -4209,7 +4781,12 @@ static void SuspendedSwingingRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 2: @@ -4222,7 +4799,13 @@ static void SuspendedSwingingRCTrackDiag60DegDownTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 88, 0x20); break; case 3: @@ -4236,7 +4819,13 @@ static void SuspendedSwingingRCTrackDiag60DegDownTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -4296,7 +4885,13 @@ static void SuspendedSwingingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -4323,7 +4918,12 @@ static void SuspendedSwingingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -4350,7 +4950,13 @@ static void SuspendedSwingingRCTrackDiag25DegDownToFlat( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -4378,7 +4984,13 @@ static void SuspendedSwingingRCTrackDiag25DegDownToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -4429,7 +5041,10 @@ static void SuspendedSwingingRCTrackBlockBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( diff --git a/src/openrct2/ride/coaster/VirginiaReel.cpp b/src/openrct2/ride/coaster/VirginiaReel.cpp index baaeab5211..8150f29c92 100644 --- a/src/openrct2/ride/coaster/VirginiaReel.cpp +++ b/src/openrct2/ride/coaster/VirginiaReel.cpp @@ -245,7 +245,7 @@ static void PaintVirginiaReelTrackFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -305,7 +305,7 @@ static void PaintVirginiaReelTrack25DegUp( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -360,7 +360,7 @@ static void PaintVirginiaReelTrackFlatTo25DegUp( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -420,7 +420,7 @@ static void PaintVirginiaReelTrack25DegUpToFlat( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -480,7 +480,7 @@ static void PaintVirginiaReelStation( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -498,13 +498,19 @@ static void PaintVirginiaReelTrackLeftQuarterTurn3Tiles( { case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner), + direction), + 0xFFFF, 0); break; case 0: case 3: WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(SEGMENTS_ALL, direction), 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(kSegmentsAll, direction), 0xFFFF, 0); break; } @@ -559,7 +565,7 @@ static void PaintVirginiaReelTrackLeftQuarterTurn1Tile( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/WildMouse.cpp b/src/openrct2/ride/coaster/WildMouse.cpp index 588daa88ad..5c2ca3838e 100644 --- a/src/openrct2/ride/coaster/WildMouse.cpp +++ b/src/openrct2/ride/coaster/WildMouse.cpp @@ -185,7 +185,10 @@ static void WildMouseTrackFlat( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -220,7 +223,7 @@ static void WildMouseTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Boxed); TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -253,7 +256,10 @@ static void WildMouseTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -301,7 +307,10 @@ static void WildMouseTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -334,7 +343,10 @@ static void WildMouseTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -382,7 +394,10 @@ static void WildMouseTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -430,7 +445,10 @@ static void WildMouseTrack60DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -463,7 +481,10 @@ static void WildMouseTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -558,13 +579,16 @@ static void WildMouseTrackRightQuarterTurn3( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0; + blockedSegments = EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide); break; case 2: - blockedSegments = SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide); break; case 3: - blockedSegments = SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -619,10 +643,12 @@ static void WildMouseTrackRightQuarterTurn325DegDown( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0; + blockedSegments = EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide); break; case 3: - blockedSegments = SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -697,10 +723,12 @@ static void WildMouseTrackRightQuarterTurn325DegUp( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0; + blockedSegments = EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide); break; case 3: - blockedSegments = SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -755,7 +783,12 @@ static void WildMouseTrackLeftQuarterTurn1( MetalASupportsPaintSetup(session, MetalSupportType::Tubes, MetalSupportPlace::Centre, -1, height, session.SupportColours); TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, 0, TUNNEL_0, 0, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -811,7 +844,10 @@ static void WildMouseTrackFlatTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } @@ -867,7 +903,10 @@ static void WildMouseTrack60DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -901,7 +940,10 @@ static void WildMouseTrackBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -926,7 +968,10 @@ static void WildMouseTrackRotationControlToggle( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -945,7 +990,10 @@ static void WildMouseTrackBlockBrakes( } PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/WoodenRollerCoaster.cpp b/src/openrct2/ride/coaster/WoodenRollerCoaster.cpp index a2814c3439..264ff23bf0 100644 --- a/src/openrct2/ride/coaster/WoodenRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/WoodenRollerCoaster.cpp @@ -502,7 +502,7 @@ static void WoodenRCTrackFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -536,7 +536,7 @@ static void WoodenRCTrackStation( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); TrackPaintUtilDrawStation2(session, ride, direction, height, trackElement, 9, 11); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -624,7 +624,7 @@ static void WoodenRCTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -692,7 +692,7 @@ static void WoodenRCTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -780,7 +780,7 @@ static void WoodenRCTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -893,7 +893,7 @@ static void WoodenRCTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -1007,7 +1007,7 @@ static void WoodenRCTrack60DegUpTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -1095,7 +1095,7 @@ static void WoodenRCTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1471,27 +1471,32 @@ static void WoodenRCTrackRightQuarterTurn5( switch (trackSequence) { case 0: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; case 1: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 2: - blockedSegments = SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide); break; case 3: - blockedSegments = SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 - | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide); break; case 4: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 5: - blockedSegments = SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide); break; case 6: - blockedSegments = SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC - | SEGMENT_D0 | SEGMENT_D4; + blockedSegments = kSegmentsAll; break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -1552,7 +1557,7 @@ static void WoodenRCTrackFlatToLeftBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1601,7 +1606,7 @@ static void WoodenRCTrackFlatToRightBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1941,27 +1946,32 @@ static void WoodenRCTrackBankedRightQuarterTurn5( switch (trackSequence) { case 0: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; case 1: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 2: - blockedSegments = SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide); break; case 3: - blockedSegments = SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 - | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide); break; case 4: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 5: - blockedSegments = SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide); break; case 6: - blockedSegments = SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC - | SEGMENT_D0 | SEGMENT_D4; + blockedSegments = kSegmentsAll; break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -2030,7 +2040,7 @@ static void WoodenRCTrackLeftBankTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -2087,7 +2097,7 @@ static void WoodenRCTrackRightBankTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -2144,7 +2154,7 @@ static void WoodenRCTrack25DegUpToLeftBank( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -2201,7 +2211,7 @@ static void WoodenRCTrack25DegUpToRightBank( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -2260,7 +2270,7 @@ static void WoodenRCTrackLeftBank( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -2339,12 +2349,16 @@ static void WoodenRCTrackLeftQuarterTurn525DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -2405,7 +2419,11 @@ static void WoodenRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2468,14 +2486,21 @@ static void WoodenRCTrackLeftQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 5: @@ -2542,7 +2567,11 @@ static void WoodenRCTrackLeftQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2556,10 +2585,6 @@ static void WoodenRCTrackLeftQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(24651), { 0, 0, height }, { { 2, 0, height }, { 27, 32, 2 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, - (direction + 3) % NumOrthogonalDirections, height, session.SupportColours, - WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( @@ -2574,10 +2599,6 @@ static void WoodenRCTrackLeftQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(24682), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, - (direction + 3) % NumOrthogonalDirections, height, session.SupportColours, - WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( @@ -2592,10 +2613,6 @@ static void WoodenRCTrackLeftQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(24684), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, - (direction + 3) % NumOrthogonalDirections, height, session.SupportColours, - WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( @@ -2610,12 +2627,11 @@ static void WoodenRCTrackLeftQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(24688), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, - (direction + 3) % NumOrthogonalDirections, height, session.SupportColours, - WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionPrev(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 2: @@ -2625,7 +2641,7 @@ static void WoodenRCTrackLeftQuarterTurn525DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -2697,12 +2713,15 @@ static void WoodenRCTrackRightQuarterTurn525DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -2763,7 +2782,11 @@ static void WoodenRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2826,14 +2849,20 @@ static void WoodenRCTrackRightQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 5: @@ -2900,7 +2929,11 @@ static void WoodenRCTrackRightQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -2920,9 +2953,7 @@ static void WoodenRCTrackRightQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(24670), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); + break; case 1: PaintAddImageAsParentRotated( @@ -2937,9 +2968,6 @@ static void WoodenRCTrackRightQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(24672), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( @@ -2954,9 +2982,6 @@ static void WoodenRCTrackRightQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(24677), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( @@ -2965,11 +2990,11 @@ static void WoodenRCTrackRightQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(24646), { 0, 0, height }, { { 2, 0, height }, { 27, 32, 2 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionNext(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 0: @@ -2979,7 +3004,7 @@ static void WoodenRCTrackRightQuarterTurn525DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -3073,7 +3098,7 @@ static void WoodenRCTrackSBendLeft( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3134,7 +3159,11 @@ static void WoodenRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3196,7 +3225,11 @@ static void WoodenRCTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3265,7 +3298,7 @@ static void WoodenRCTrackSBendLeft( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3339,7 +3372,7 @@ static void WoodenRCTrackSBendRight( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -3400,7 +3433,11 @@ static void WoodenRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3462,7 +3499,11 @@ static void WoodenRCTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -3531,7 +3572,7 @@ static void WoodenRCTrackSBendRight( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -3573,7 +3614,11 @@ static void WoodenRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -3607,7 +3652,11 @@ static void WoodenRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -3636,7 +3685,13 @@ static void WoodenRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 3: @@ -3665,7 +3720,11 @@ static void WoodenRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3701,7 +3760,11 @@ static void WoodenRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -3730,7 +3793,13 @@ static void WoodenRCTrackLeftVerticalLoop( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 168, 0x20); break; case 8: @@ -3763,7 +3832,11 @@ static void WoodenRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -3800,7 +3873,11 @@ static void WoodenRCTrackLeftVerticalLoop( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; @@ -4119,7 +4196,7 @@ static void WoodenRCTrackLeftQuarterTurn3( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4174,7 +4251,13 @@ static void WoodenRCTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4242,7 +4325,7 @@ static void WoodenRCTrackLeftQuarterTurn3( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4332,7 +4415,7 @@ static void WoodenRCTrackLeftQuarterTurn3Bank( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -4393,7 +4476,13 @@ static void WoodenRCTrackLeftQuarterTurn3Bank( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -4467,7 +4556,7 @@ static void WoodenRCTrackLeftQuarterTurn3Bank( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -4551,7 +4640,7 @@ static void WoodenRCTrackLeftQuarterTurn325DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -4559,7 +4648,13 @@ static void WoodenRCTrackLeftQuarterTurn325DegUp( break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4633,7 +4728,7 @@ static void WoodenRCTrackLeftQuarterTurn325DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -4707,7 +4802,7 @@ static void WoodenRCTrackRightQuarterTurn325DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -4715,7 +4810,13 @@ static void WoodenRCTrackRightQuarterTurn325DegUp( break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -4789,7 +4890,7 @@ static void WoodenRCTrackRightQuarterTurn325DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -4890,9 +4991,20 @@ static void WoodenRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -4973,7 +5085,13 @@ static void WoodenRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5048,9 +5166,20 @@ static void WoodenRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5126,9 +5255,20 @@ static void WoodenRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5209,7 +5349,13 @@ static void WoodenRCTrackLeftHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -5279,9 +5425,20 @@ static void WoodenRCTrackLeftHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5363,9 +5520,20 @@ static void WoodenRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5446,7 +5614,13 @@ static void WoodenRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -5521,9 +5695,20 @@ static void WoodenRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5599,9 +5784,20 @@ static void WoodenRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5681,7 +5877,13 @@ static void WoodenRCTrackRightHalfBankedHelixUpSmall( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 7: @@ -5751,9 +5953,20 @@ static void WoodenRCTrackRightHalfBankedHelixUpSmall( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5860,15 +6073,30 @@ static void WoodenRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -5929,7 +6157,11 @@ static void WoodenRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -5990,14 +6222,30 @@ static void WoodenRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_D0, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -6058,7 +6306,11 @@ static void WoodenRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6128,9 +6380,20 @@ static void WoodenRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6200,15 +6463,29 @@ static void WoodenRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 8: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 9: @@ -6269,7 +6546,11 @@ static void WoodenRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6330,14 +6611,28 @@ static void WoodenRCTrackLeftHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 12: @@ -6398,7 +6693,11 @@ static void WoodenRCTrackLeftHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6463,9 +6762,20 @@ static void WoodenRCTrackLeftHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6541,15 +6851,29 @@ static void WoodenRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -6610,7 +6934,11 @@ static void WoodenRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6671,14 +6999,28 @@ static void WoodenRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 5: @@ -6739,7 +7081,11 @@ static void WoodenRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6809,9 +7155,20 @@ static void WoodenRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -6881,15 +7238,30 @@ static void WoodenRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_CC, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, + PaintSegment::topRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 8: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 9: @@ -6950,7 +7322,11 @@ static void WoodenRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7011,14 +7387,30 @@ static void WoodenRCTrackRightHalfBankedHelixUpLarge( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_D0, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 11: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 12: @@ -7079,7 +7471,11 @@ static void WoodenRCTrackRightHalfBankedHelixUpLarge( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7144,9 +7540,20 @@ static void WoodenRCTrackRightHalfBankedHelixUpLarge( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_FLAT); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_D4, direction), 48, 0x20); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide), + direction), + 48, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; @@ -7250,7 +7657,7 @@ static void WoodenRCTrackLeftQuarterTurn160DegUp( break; } TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -7320,7 +7727,7 @@ static void WoodenRCTrackRightQuarterTurn160DegUp( break; } TrackPaintUtilRightQuarterTurn1TileTunnel(session, direction, height, -8, TUNNEL_SQUARE_7, +56, TUNNEL_SQUARE_8); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -7361,7 +7768,7 @@ static void WoodenRCTrackBrakes( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -7438,7 +7845,7 @@ static void WoodenRCTrack25DegUpLeftBanked( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -7515,7 +7922,7 @@ static void WoodenRCTrack25DegUpRightBanked( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -7564,7 +7971,7 @@ static void WoodenRCTrackOnRidePhoto( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); TrackPaintUtilOnridePhotoSmallPaint(session, direction, height + 16, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_INVERTED_9); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -7701,7 +8108,7 @@ static void WoodenRCTrackWaterSplash( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height + 16, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -7806,7 +8213,7 @@ static void WoodenRCTrackWaterSplash( } WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -7865,7 +8272,7 @@ static void WoodenRCTrackWaterSplash( } WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -7970,7 +8377,7 @@ static void WoodenRCTrackWaterSplash( } WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -8076,7 +8483,7 @@ static void WoodenRCTrackWaterSplash( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height + 16, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -8150,7 +8557,7 @@ static void WoodenRCTrackLeftEighthToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8209,7 +8616,7 @@ static void WoodenRCTrackLeftEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8268,7 +8675,7 @@ static void WoodenRCTrackLeftEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8291,7 +8698,7 @@ static void WoodenRCTrackLeftEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8342,7 +8749,7 @@ static void WoodenRCTrackLeftEighthToDiag( { { 16, 0, height + 27 }, { 16, 16, 0 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8416,7 +8823,7 @@ static void WoodenRCTrackRightEighthToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8475,7 +8882,7 @@ static void WoodenRCTrackRightEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8534,7 +8941,7 @@ static void WoodenRCTrackRightEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8557,7 +8964,7 @@ static void WoodenRCTrackRightEighthToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8608,7 +9015,7 @@ static void WoodenRCTrackRightEighthToDiag( { { 16, 16, height }, { 16, 16, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8702,7 +9109,7 @@ static void WoodenRCTrackLeftEighthBankToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -8761,7 +9168,7 @@ static void WoodenRCTrackLeftEighthBankToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -8820,7 +9227,7 @@ static void WoodenRCTrackLeftEighthBankToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -8843,7 +9250,7 @@ static void WoodenRCTrackLeftEighthBankToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -8894,7 +9301,7 @@ static void WoodenRCTrackLeftEighthBankToDiag( { { 16, 0, height + 27 }, { 16, 16, 0 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -8968,7 +9375,7 @@ static void WoodenRCTrackRightEighthBankToDiag( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -9027,7 +9434,7 @@ static void WoodenRCTrackRightEighthBankToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -9086,7 +9493,7 @@ static void WoodenRCTrackRightEighthBankToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -9109,7 +9516,7 @@ static void WoodenRCTrackRightEighthBankToDiag( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 4: @@ -9160,7 +9567,7 @@ static void WoodenRCTrackRightEighthBankToDiag( { { 16, 16, height }, { 16, 16, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -9638,7 +10045,7 @@ static void WoodenRCTrackDiagFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -9710,7 +10117,7 @@ static void WoodenRCTrackDiagFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -9782,7 +10189,7 @@ static void WoodenRCTrackDiagFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -9814,7 +10221,7 @@ static void WoodenRCTrackDiagFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -9857,7 +10264,7 @@ static void WoodenRCTrackDiag25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -9907,7 +10314,7 @@ static void WoodenRCTrackDiag25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -9956,7 +10363,7 @@ static void WoodenRCTrackDiag25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -9988,7 +10395,7 @@ static void WoodenRCTrackDiag25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -10014,7 +10421,7 @@ static void WoodenRCTrackDiag60DegUp( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -10038,7 +10445,7 @@ static void WoodenRCTrackDiag60DegUp( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -10064,7 +10471,7 @@ static void WoodenRCTrackDiag60DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -10079,7 +10486,7 @@ static void WoodenRCTrackDiag60DegUp( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -10122,7 +10529,7 @@ static void WoodenRCTrackDiagFlatTo25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -10194,7 +10601,7 @@ static void WoodenRCTrackDiagFlatTo25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -10266,7 +10673,7 @@ static void WoodenRCTrackDiagFlatTo25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -10298,7 +10705,7 @@ static void WoodenRCTrackDiagFlatTo25DegUp( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -10324,7 +10731,7 @@ static void WoodenRCTrackDiag25DegUpTo60DegUp( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -10348,7 +10755,7 @@ static void WoodenRCTrackDiag25DegUpTo60DegUp( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10374,7 +10781,7 @@ static void WoodenRCTrackDiag25DegUpTo60DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -10389,7 +10796,7 @@ static void WoodenRCTrackDiag25DegUpTo60DegUp( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -10415,7 +10822,7 @@ static void WoodenRCTrackDiag60DegUpTo25DegUp( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -10439,7 +10846,7 @@ static void WoodenRCTrackDiag60DegUpTo25DegUp( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -10463,7 +10870,7 @@ static void WoodenRCTrackDiag60DegUpTo25DegUp( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -10478,7 +10885,7 @@ static void WoodenRCTrackDiag60DegUpTo25DegUp( { { 0, 0, height }, { 16, 16, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -10521,7 +10928,7 @@ static void WoodenRCTrackDiag25DegUpToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -10571,7 +10978,7 @@ static void WoodenRCTrackDiag25DegUpToFlat( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -10620,7 +11027,7 @@ static void WoodenRCTrackDiag25DegUpToFlat( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -10652,7 +11059,7 @@ static void WoodenRCTrackDiag25DegUpToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -10695,7 +11102,7 @@ static void WoodenRCTrackDiag25DegDown( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -10745,7 +11152,7 @@ static void WoodenRCTrackDiag25DegDown( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -10794,7 +11201,7 @@ static void WoodenRCTrackDiag25DegDown( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -10826,7 +11233,7 @@ static void WoodenRCTrackDiag25DegDown( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -10852,7 +11259,7 @@ static void WoodenRCTrackDiag60DegDown( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 1: @@ -10876,7 +11283,7 @@ static void WoodenRCTrackDiag60DegDown( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 2: @@ -10900,7 +11307,7 @@ static void WoodenRCTrackDiag60DegDown( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; case 3: @@ -10915,7 +11322,7 @@ static void WoodenRCTrackDiag60DegDown( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); break; } @@ -11086,7 +11493,7 @@ static void WoodenRCTrackDiagFlatTo25DegDown( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -11110,7 +11517,7 @@ static void WoodenRCTrackDiag25DegDownTo60DegDown( { { 0, 0, height }, { 16, 16, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -11134,7 +11541,7 @@ static void WoodenRCTrackDiag25DegDownTo60DegDown( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11158,7 +11565,7 @@ static void WoodenRCTrackDiag25DegDownTo60DegDown( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -11173,7 +11580,7 @@ static void WoodenRCTrackDiag25DegDownTo60DegDown( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -11199,7 +11606,7 @@ static void WoodenRCTrackDiag60DegDownTo25DegDown( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -11223,7 +11630,7 @@ static void WoodenRCTrackDiag60DegDownTo25DegDown( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -11247,7 +11654,7 @@ static void WoodenRCTrackDiag60DegDownTo25DegDown( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -11262,7 +11669,7 @@ static void WoodenRCTrackDiag60DegDownTo25DegDown( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -11305,7 +11712,7 @@ static void WoodenRCTrackDiag25DegDownToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11377,7 +11784,7 @@ static void WoodenRCTrackDiag25DegDownToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -11449,7 +11856,7 @@ static void WoodenRCTrackDiag25DegDownToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -11481,7 +11888,7 @@ static void WoodenRCTrackDiag25DegDownToFlat( break; } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -11507,7 +11914,7 @@ static void WoodenRCTrackDiagFlatToLeftBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -11542,7 +11949,7 @@ static void WoodenRCTrackDiagFlatToLeftBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -11577,7 +11984,7 @@ static void WoodenRCTrackDiagFlatToLeftBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -11592,7 +11999,7 @@ static void WoodenRCTrackDiagFlatToLeftBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -11618,7 +12025,7 @@ static void WoodenRCTrackDiagFlatToRightBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -11653,7 +12060,7 @@ static void WoodenRCTrackDiagFlatToRightBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -11688,7 +12095,7 @@ static void WoodenRCTrackDiagFlatToRightBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -11703,7 +12110,7 @@ static void WoodenRCTrackDiagFlatToRightBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -11729,7 +12136,7 @@ static void WoodenRCTrackDiagLeftBankToFlat( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -11764,7 +12171,7 @@ static void WoodenRCTrackDiagLeftBankToFlat( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -11799,7 +12206,7 @@ static void WoodenRCTrackDiagLeftBankToFlat( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -11814,7 +12221,7 @@ static void WoodenRCTrackDiagLeftBankToFlat( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -11840,7 +12247,7 @@ static void WoodenRCTrackDiagRightBankToFlat( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -11875,7 +12282,7 @@ static void WoodenRCTrackDiagRightBankToFlat( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -11910,7 +12317,7 @@ static void WoodenRCTrackDiagRightBankToFlat( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -11925,7 +12332,7 @@ static void WoodenRCTrackDiagRightBankToFlat( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -11951,7 +12358,7 @@ static void WoodenRCTrackDiagLeftBankTo25DegUp( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -11986,7 +12393,7 @@ static void WoodenRCTrackDiagLeftBankTo25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -12021,7 +12428,7 @@ static void WoodenRCTrackDiagLeftBankTo25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -12036,7 +12443,7 @@ static void WoodenRCTrackDiagLeftBankTo25DegUp( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -12062,7 +12469,7 @@ static void WoodenRCTrackDiagRightBankTo25DegUp( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -12097,7 +12504,7 @@ static void WoodenRCTrackDiagRightBankTo25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -12132,7 +12539,7 @@ static void WoodenRCTrackDiagRightBankTo25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -12147,7 +12554,7 @@ static void WoodenRCTrackDiagRightBankTo25DegUp( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -12173,7 +12580,7 @@ static void WoodenRCTrackDiag25DegUpToLeftBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -12197,7 +12604,7 @@ static void WoodenRCTrackDiag25DegUpToLeftBank( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -12221,7 +12628,7 @@ static void WoodenRCTrackDiag25DegUpToLeftBank( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -12236,7 +12643,7 @@ static void WoodenRCTrackDiag25DegUpToLeftBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -12262,7 +12669,7 @@ static void WoodenRCTrackDiag25DegUpToRightBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 1: @@ -12286,7 +12693,7 @@ static void WoodenRCTrackDiag25DegUpToRightBank( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner0, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 2: @@ -12310,7 +12717,7 @@ static void WoodenRCTrackDiag25DegUpToRightBank( WoodenBSupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner2, direction, height + 16, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -12325,7 +12732,7 @@ static void WoodenRCTrackDiag25DegUpToRightBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; } @@ -12413,7 +12820,7 @@ static void WoodenRCTrackDiagLeftBankTo25DegDown( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -12497,7 +12904,7 @@ static void WoodenRCTrackDiagRightBankTo25DegDown( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -12521,7 +12928,7 @@ static void WoodenRCTrackDiag25DegDownToLeftBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -12556,7 +12963,7 @@ static void WoodenRCTrackDiag25DegDownToLeftBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -12591,7 +12998,7 @@ static void WoodenRCTrackDiag25DegDownToLeftBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -12606,7 +13013,7 @@ static void WoodenRCTrackDiag25DegDownToLeftBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -12632,7 +13039,7 @@ static void WoodenRCTrackDiag25DegDownToRightBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -12667,7 +13074,7 @@ static void WoodenRCTrackDiag25DegDownToRightBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -12702,7 +13109,7 @@ static void WoodenRCTrackDiag25DegDownToRightBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -12717,7 +13124,7 @@ static void WoodenRCTrackDiag25DegDownToRightBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; } @@ -12743,7 +13150,7 @@ static void WoodenRCTrackDiagLeftBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12778,7 +13185,7 @@ static void WoodenRCTrackDiagLeftBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12813,7 +13220,7 @@ static void WoodenRCTrackDiagLeftBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12828,7 +13235,7 @@ static void WoodenRCTrackDiagLeftBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -12854,7 +13261,7 @@ static void WoodenRCTrackDiagRightBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 1: @@ -12889,7 +13296,7 @@ static void WoodenRCTrackDiagRightBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 2: @@ -12924,7 +13331,7 @@ static void WoodenRCTrackDiagRightBank( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner1, height, session.SupportColours); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; case 3: @@ -12939,7 +13346,7 @@ static void WoodenRCTrackDiagRightBank( { { -16, -16, height }, { 32, 32, 2 } }); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); break; } @@ -13013,7 +13420,7 @@ static void WoodenRCTrackLeftBankToLeftQuarterTurn325DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -13021,7 +13428,13 @@ static void WoodenRCTrackLeftBankToLeftQuarterTurn325DegUp( break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -13095,7 +13508,7 @@ static void WoodenRCTrackLeftBankToLeftQuarterTurn325DegUp( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -13169,7 +13582,7 @@ static void WoodenRCTrackRightBankToRightQuarterTurn325DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -13177,7 +13590,13 @@ static void WoodenRCTrackRightBankToRightQuarterTurn325DegUp( break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -13251,7 +13670,7 @@ static void WoodenRCTrackRightBankToRightQuarterTurn325DegUp( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -13331,7 +13750,7 @@ static void WoodenRCTrackLeftQuarterTurn325DegDownToLeftBank( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -13339,7 +13758,13 @@ static void WoodenRCTrackLeftQuarterTurn325DegDownToLeftBank( break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -13407,7 +13832,7 @@ static void WoodenRCTrackLeftQuarterTurn325DegDownToLeftBank( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -13487,7 +13912,7 @@ static void WoodenRCTrackRightQuarterTurn325DegDownToRightBank( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -13495,7 +13920,13 @@ static void WoodenRCTrackRightQuarterTurn325DegDownToRightBank( break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -13563,7 +13994,7 @@ static void WoodenRCTrackRightQuarterTurn325DegDownToRightBank( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; } @@ -13583,7 +14014,7 @@ static void WoodenRCTrackBlockBrakes( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -13655,7 +14086,7 @@ static void WoodenRCTrackLeftBankedQuarterTurn325DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13663,7 +14094,13 @@ static void WoodenRCTrackLeftBankedQuarterTurn325DegUp( break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13737,7 +14174,7 @@ static void WoodenRCTrackLeftBankedQuarterTurn325DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -13811,7 +14248,7 @@ static void WoodenRCTrackRightBankedQuarterTurn325DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -13819,7 +14256,13 @@ static void WoodenRCTrackRightBankedQuarterTurn325DegUp( break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); break; case 3: @@ -13893,7 +14336,7 @@ static void WoodenRCTrackRightBankedQuarterTurn325DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -13987,12 +14430,16 @@ static void WoodenRCTrackLeftBankedQuarterTurn525DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -14053,7 +14500,11 @@ static void WoodenRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14116,14 +14567,21 @@ static void WoodenRCTrackLeftBankedQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 5: @@ -14190,7 +14648,11 @@ static void WoodenRCTrackLeftBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14204,9 +14666,6 @@ static void WoodenRCTrackLeftBankedQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(25191), { 0, 0, height }, { { 2, 0, height }, { 27, 32, 2 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( @@ -14221,9 +14680,6 @@ static void WoodenRCTrackLeftBankedQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(25222), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( @@ -14238,9 +14694,6 @@ static void WoodenRCTrackLeftBankedQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(25224), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( @@ -14255,11 +14708,11 @@ static void WoodenRCTrackLeftBankedQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(25228), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionPrev(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 2: @@ -14269,7 +14722,7 @@ static void WoodenRCTrackLeftBankedQuarterTurn525DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -14341,12 +14794,15 @@ static void WoodenRCTrackRightBankedQuarterTurn525DegUp( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -14407,7 +14863,11 @@ static void WoodenRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14470,14 +14930,20 @@ static void WoodenRCTrackRightBankedQuarterTurn525DegUp( PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 5: @@ -14544,7 +15010,11 @@ static void WoodenRCTrackRightBankedQuarterTurn525DegUp( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; @@ -14564,9 +15034,6 @@ static void WoodenRCTrackRightBankedQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(25210), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 1: PaintAddImageAsParentRotated( @@ -14581,9 +15048,6 @@ static void WoodenRCTrackRightBankedQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(25212), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 2: PaintAddImageAsParentRotated( @@ -14598,9 +15062,6 @@ static void WoodenRCTrackRightBankedQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(25217), { 0, 0, height }, { { 2, 0, height + 67 }, { 27, 32, 0 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; case 3: PaintAddImageAsParentRotated( @@ -14609,11 +15070,11 @@ static void WoodenRCTrackRightBankedQuarterTurn525DegUp( PaintAddImageAsChildRotated( session, direction, WoodenRCGetRailsColour(session).WithIndex(25186), { 0, 0, height }, { { 2, 0, height }, { 27, 32, 2 } }); - WoodenASupportsPaintSetupRotated( - session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, - session.SupportColours, WoodenSupportTransitionType::Up25Deg); break; } + WoodenASupportsPaintSetupRotated( + session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, DirectionNext(direction), height, + session.SupportColours, WoodenSupportTransitionType::Up25Deg); switch (direction) { case 0: @@ -14623,7 +15084,7 @@ static void WoodenRCTrackRightBankedQuarterTurn525DegUp( PaintUtilPushTunnelLeft(session, height + 8, TUNNEL_SQUARE_8); break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; } @@ -14712,7 +15173,7 @@ static void WoodenRCTrack25DegUpToLeftBanked25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -14777,7 +15238,7 @@ static void WoodenRCTrack25DegUpToRightBanked25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -14842,7 +15303,7 @@ static void WoodenRCTrackLeftBanked25DegUpTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -14907,7 +15368,7 @@ static void WoodenRCTrackRightBanked25DegUpTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -15022,7 +15483,7 @@ static void WoodenRCTrackLeftBankedFlatToLeftBanked25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -15099,7 +15560,7 @@ static void WoodenRCTrackRightBankedFlatToRightBanked25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -15176,7 +15637,7 @@ static void WoodenRCTrackLeftBanked25DegUpToLeftBankedFlat( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -15253,7 +15714,7 @@ static void WoodenRCTrackRightBanked25DegUpToRightBankedFlat( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -15370,7 +15831,7 @@ static void WoodenRCTrackFlatToLeftBanked25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -15447,7 +15908,7 @@ static void WoodenRCTrackFlatToRightBanked25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -15524,7 +15985,7 @@ static void WoodenRCTrackLeftBanked25DegUpToFlat( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -15601,7 +16062,7 @@ static void WoodenRCTrackRightBanked25DegUpToFlat( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -15665,7 +16126,7 @@ static void WoodenRCTrackBooster( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/coaster/WoodenWildMouse.cpp b/src/openrct2/ride/coaster/WoodenWildMouse.cpp index 320ae7afe6..bda02109a2 100644 --- a/src/openrct2/ride/coaster/WoodenWildMouse.cpp +++ b/src/openrct2/ride/coaster/WoodenWildMouse.cpp @@ -139,10 +139,17 @@ static void WoodenWildMouseTrackFlat( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_D4, direction), height, - 0x20); + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomCorner, + PaintSegment::topLeftSide, PaintSegment::bottomRightSide), + direction), + height, 0x20); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -167,7 +174,7 @@ static void WoodenWildMouseTrackStation( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -208,7 +215,7 @@ static void WoodenWildMouseTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -257,7 +264,7 @@ static void WoodenWildMouseTrack60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -298,7 +305,7 @@ static void WoodenWildMouseTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -351,7 +358,7 @@ static void WoodenWildMouseTrack25DegUpTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -403,7 +410,7 @@ static void WoodenWildMouseTrack60DegTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -444,7 +451,7 @@ static void WoodenWildMouseTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -539,13 +546,14 @@ static void WoodenWildMouseTrackRightQuarterTurn3( switch (trackSequence) { case 0: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; case 2: - blockedSegments = SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide); break; case 3: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -590,7 +598,7 @@ static void WoodenWildMouseTrackLeftQuarterTurn1( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::Corner3, direction, height, session.SupportColours); TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, 0, TUNNEL_0, 0, TUNNEL_0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -650,7 +658,7 @@ static void WoodenWildMouseTrackFlatTo60DegUp( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } @@ -702,7 +710,7 @@ static void WoodenWildMouseTrack60DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_0); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } diff --git a/src/openrct2/ride/coaster/meta/ClassicStandUpRollerCoaster.h b/src/openrct2/ride/coaster/meta/ClassicStandUpRollerCoaster.h new file mode 100644 index 0000000000..2807d3068e --- /dev/null +++ b/src/openrct2/ride/coaster/meta/ClassicStandUpRollerCoaster.h @@ -0,0 +1,87 @@ +/***************************************************************************** + * Copyright (c) 2014-2024 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include "../../../sprites.h" +#include "../../RideData.h" +#include "../../ShopItem.h" +#include "../../Track.h" + +// clang-format off +constexpr RideTypeDescriptor ClassicStandUpRollerCoasterRTD = +{ + .AlternateType = RIDE_TYPE_NULL, + .Category = RIDE_CATEGORY_ROLLERCOASTER, + .EnabledTrackPieces = {TRACK_STRAIGHT, TRACK_STATION_END, TRACK_LIFT_HILL, TRACK_FLAT_ROLL_BANKING, TRACK_VERTICAL_LOOP, TRACK_SLOPE, TRACK_SLOPE_STEEP_UP, TRACK_SLOPE_STEEP_DOWN, TRACK_SLOPE_CURVE, TRACK_S_BEND, TRACK_CURVE_SMALL, TRACK_CURVE, TRACK_CURVE_LARGE, TRACK_HALF_LOOP, TRACK_CORKSCREW, TRACK_BRAKES, TRACK_ON_RIDE_PHOTO, TRACK_BLOCK_BRAKES, TRACK_DIAG_BRAKES, TRACK_DIAG_BLOCK_BRAKES}, + .ExtraTrackPieces = {}, + .CoveredTrackPieces = {}, + .StartTrackPiece = TrackElemType::EndStation, + .TrackPaintFunctions = TrackDrawerDescriptor(GetTrackPaintFunctionClassicStandUpRC), + .Flags = RIDE_TYPE_FLAGS_TRACK_HAS_3_COLOURS | RIDE_TYPE_FLAG_HAS_LEAVE_WHEN_ANOTHER_VEHICLE_ARRIVES_AT_STATION | + RIDE_TYPE_FLAGS_COMMON_COASTER | RIDE_TYPE_FLAGS_COMMON_COASTER_NON_ALT | + RIDE_TYPE_FLAG_PEEP_CHECK_GFORCES | RIDE_TYPE_FLAG_ALLOW_MULTIPLE_CIRCUITS | + RIDE_TYPE_FLAG_ALLOW_REVERSED_TRAINS, + .RideModes = EnumsToFlags(RideMode::ContinuousCircuit, RideMode::ContinuousCircuitBlockSectioned, RideMode::ReverseInclineLaunchedShuttle, RideMode::PoweredLaunchPasstrough, RideMode::PoweredLaunch), + .DefaultMode = RideMode::ContinuousCircuit, + .OperatingSettings = { 7, 27, 0, 0, 0, 0 }, + .Naming = { STR_RIDE_NAME_CLASSIC_STAND_UP_ROLLER_COASTER, STR_RIDE_DESCRIPTION_CLASSIC_STAND_UP_ROLLER_COASTER }, + .NameConvention = { RideComponentType::Train, RideComponentType::Track, RideComponentType::Station }, + .EnumName = nameof(RIDE_TYPE_CLASSIC_STAND_UP_ROLLER_COASTER), + .AvailableBreakdowns = (1 << BREAKDOWN_SAFETY_CUT_OUT) | (1 << BREAKDOWN_RESTRAINTS_STUCK_CLOSED) | (1 << BREAKDOWN_RESTRAINTS_STUCK_OPEN) | (1 << BREAKDOWN_VEHICLE_MALFUNCTION) | (1 << BREAKDOWN_BRAKES_FAILURE), + .Heights = { 30, 24, 9, 11, }, + .MaxMass = 18, + .LiftData = { OpenRCT2::Audio::SoundId::LiftClassic, 4, 6 }, + .RatingsMultipliers = { 50, 30, 10 }, + .UpkeepCosts = { 40, 20, 80, 10, 3, 10 }, + .BuildCosts = { 50.00_GBP, 2.50_GBP, 50, }, + .DefaultPrices = { 20, 20 }, + .DefaultMusic = MUSIC_OBJECT_TECHNO, + .PhotoItem = ShopItem::Photo, + .BonusValue = 90, + .ColourPresets = TRACK_COLOUR_PRESETS( + { COLOUR_BRIGHT_RED, COLOUR_BRIGHT_RED, COLOUR_BLACK }, + { COLOUR_BLACK, COLOUR_LIGHT_BLUE, COLOUR_BLACK }, + { COLOUR_LIGHT_ORANGE, COLOUR_WHITE, COLOUR_LIGHT_ORANGE }, + { COLOUR_BORDEAUX_RED, COLOUR_YELLOW, COLOUR_BORDEAUX_RED }, + { COLOUR_MOSS_GREEN, COLOUR_MOSS_GREEN, COLOUR_WHITE }, + { COLOUR_SATURATED_BROWN, COLOUR_LIGHT_ORANGE, COLOUR_SATURATED_BROWN }, + ), + .ColourPreview = { SPR_RIDE_DESIGN_PREVIEW_STAND_UP_ROLLER_COASTER_TRACK, SPR_RIDE_DESIGN_PREVIEW_STAND_UP_ROLLER_COASTER_SUPPORTS }, + .ColourKey = RideColourKey::Ride, + .Name = "classic_stand_up_rc", + .RatingsData = + { + RatingsCalculationType::Normal, + { RIDE_RATING(2, 50), RIDE_RATING(3, 00), RIDE_RATING(3, 00) }, + 17, + -1, + false, + { + { RatingsModifierType::BonusLength, 6000, 764, 0, 0 }, + { RatingsModifierType::BonusSynchronisation, 0, RIDE_RATING(0, 40), RIDE_RATING(0, 10), 0 }, + { RatingsModifierType::BonusTrainLength, 0, 187245, 0, 0 }, + { RatingsModifierType::BonusMaxSpeed, 0, 44281, 123987, 35424 }, + { RatingsModifierType::BonusAverageSpeed, 0, 291271, 436906, 0 }, + { RatingsModifierType::BonusDuration, 150, 26214, 0, 0 }, + { RatingsModifierType::BonusGForces, 0, 24576, 35746, 59578 }, + { RatingsModifierType::BonusTurns, 0, 26749, 34767, 45749 }, + { RatingsModifierType::BonusDrops, 0, 34952, 46811, 49152 }, + { RatingsModifierType::BonusSheltered, 0, 12850, 28398, 30427 }, + { RatingsModifierType::BonusReversedTrains, 0, 2, 20, 30 }, + { RatingsModifierType::BonusProximity, 0, 17893, 0, 0 }, + { RatingsModifierType::BonusScenery, 0, 5577, 0, 0 }, + { RatingsModifierType::RequirementDropHeight, 12, 2, 2, 2 }, + { RatingsModifierType::RequirementMaxSpeed, 0xA0000, 2, 2, 2 }, + { RatingsModifierType::RequirementNegativeGs, FIXED_2DP(0, 50), 2, 2, 2 }, + { RatingsModifierType::PenaltyLateralGs, 0, 24576, 35746, 59578 }, + }, + }, +}; +// clang-format on diff --git a/src/openrct2/ride/coaster/meta/StandUpRollerCoaster.h b/src/openrct2/ride/coaster/meta/StandUpRollerCoaster.h index 7436991e68..31042f6a15 100644 --- a/src/openrct2/ride/coaster/meta/StandUpRollerCoaster.h +++ b/src/openrct2/ride/coaster/meta/StandUpRollerCoaster.h @@ -28,7 +28,7 @@ constexpr RideTypeDescriptor StandUpRollerCoasterRTD = RIDE_TYPE_FLAGS_COMMON_COASTER | RIDE_TYPE_FLAGS_COMMON_COASTER_NON_ALT | RIDE_TYPE_FLAG_PEEP_CHECK_GFORCES | RIDE_TYPE_FLAG_ALLOW_MULTIPLE_CIRCUITS | RIDE_TYPE_FLAG_ALLOW_REVERSED_TRAINS, - .RideModes = EnumsToFlags(RideMode::ContinuousCircuit, RideMode::ContinuousCircuitBlockSectioned, RideMode::ReverseInclineLaunchedShuttle, RideMode::PoweredLaunchPasstrough, RideMode::PoweredLaunch), + .RideModes = EnumsToFlags(RideMode::ContinuousCircuit, RideMode::ContinuousCircuitBlockSectioned), .DefaultMode = RideMode::ContinuousCircuit, .OperatingSettings = { 7, 27, 0, 0, 0, 0 }, .Naming = { STR_RIDE_NAME_STAND_UP_ROLLER_COASTER, STR_RIDE_DESCRIPTION_STAND_UP_ROLLER_COASTER }, diff --git a/src/openrct2/ride/gentle/CarRide.cpp b/src/openrct2/ride/gentle/CarRide.cpp index 593d5d306b..cc9a5e40d1 100644 --- a/src/openrct2/ride/gentle/CarRide.cpp +++ b/src/openrct2/ride/gentle/CarRide.cpp @@ -183,7 +183,10 @@ static void PaintCarRideTrackFlat( MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -221,7 +224,10 @@ static void PaintCarRideTrack25DegUp( MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 8, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -259,7 +265,10 @@ static void PaintCarRideTrackFlatTo25DegUp( MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 3, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -297,7 +306,10 @@ static void PaintCarRideTrack25DegUpToFlat( MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 6, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -366,7 +378,7 @@ static void PaintCarRideStation( TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -393,13 +405,16 @@ static void PaintCarRideTrackRightQuarterTurn3Tiles( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 3: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -446,7 +461,7 @@ static void PaintCarRideTrackLeftQuarterTurn1Tile( TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, 0, TUNNEL_0, 0, TUNNEL_0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -489,7 +504,7 @@ static void PaintCarRideTrackSpinningTunnel( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, GetStationColourScheme(session, trackElement)); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -539,7 +554,10 @@ static void PaintCarRideTrack60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -596,7 +614,10 @@ static void PaintCarRideTrack25DegUpTo60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -653,7 +674,10 @@ static void PaintCarRideTrack60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -708,7 +732,10 @@ static void PaintCarRideTrackLogBumps( MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/gentle/Circus.cpp b/src/openrct2/ride/gentle/Circus.cpp index be6463a0ca..f10145abb4 100644 --- a/src/openrct2/ride/gentle/Circus.cpp +++ b/src/openrct2/ride/gentle/Circus.cpp @@ -94,24 +94,25 @@ static void PaintCircus( { case 1: // Top - cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + cornerSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 3: // Right - cornerSegments = SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; + cornerSegments = EnumsToFlags(PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide); break; case 6: // Left - cornerSegments = SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0; + cornerSegments = EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide); break; case 7: // Bottom - cornerSegments = SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4; + cornerSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, cornerSegments, height + 2, 0x20); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~cornerSegments, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); } diff --git a/src/openrct2/ride/gentle/CrookedHouse.cpp b/src/openrct2/ride/gentle/CrookedHouse.cpp index aac85a1f2f..c1e18e5ced 100644 --- a/src/openrct2/ride/gentle/CrookedHouse.cpp +++ b/src/openrct2/ride/gentle/CrookedHouse.cpp @@ -118,24 +118,25 @@ static void PaintCrookedHouse( { case 1: // Top - cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + cornerSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 3: // Right - cornerSegments = SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; + cornerSegments = EnumsToFlags(PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide); break; case 6: // Left - cornerSegments = SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0; + cornerSegments = EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide); break; case 7: // Bottom - cornerSegments = SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4; + cornerSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, cornerSegments, height + 2, 0x20); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~cornerSegments, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); } diff --git a/src/openrct2/ride/gentle/Dodgems.cpp b/src/openrct2/ride/gentle/Dodgems.cpp index 0cf4622c72..c88892523a 100644 --- a/src/openrct2/ride/gentle/Dodgems.cpp +++ b/src/openrct2/ride/gentle/Dodgems.cpp @@ -98,7 +98,7 @@ static void PaintDodgems( } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, height + 36, 0x20); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, height + 36, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } diff --git a/src/openrct2/ride/gentle/FerrisWheel.cpp b/src/openrct2/ride/gentle/FerrisWheel.cpp index 29935dbe11..394276eeba 100644 --- a/src/openrct2/ride/gentle/FerrisWheel.cpp +++ b/src/openrct2/ride/gentle/FerrisWheel.cpp @@ -165,7 +165,7 @@ static void PaintFerrisWheel( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 176, 0x20); } diff --git a/src/openrct2/ride/gentle/FlyingSaucers.cpp b/src/openrct2/ride/gentle/FlyingSaucers.cpp index 33b8344bbd..f2ab1973b6 100644 --- a/src/openrct2/ride/gentle/FlyingSaucers.cpp +++ b/src/openrct2/ride/gentle/FlyingSaucers.cpp @@ -58,7 +58,7 @@ static void PaintFlyingSaucers( session, edges, session.MapPosition, trackElement, ride, session.TrackColours, height, FlyingSaucersFenceSprites, session.CurrentRotation); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } diff --git a/src/openrct2/ride/gentle/GhostTrain.cpp b/src/openrct2/ride/gentle/GhostTrain.cpp index b7dcf5b02c..353e16aec4 100644 --- a/src/openrct2/ride/gentle/GhostTrain.cpp +++ b/src/openrct2/ride/gentle/GhostTrain.cpp @@ -195,7 +195,10 @@ static void PaintGhostTrainTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -233,7 +236,10 @@ static void PaintGhostTrainTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -282,7 +288,10 @@ static void PaintGhostTrainTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -303,7 +312,10 @@ static void PaintGhostTrainTrack25DegUpToFlatShared( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -397,7 +409,7 @@ static void PaintGhostTrainStation( TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -428,13 +440,16 @@ static void PaintGhostTrainTrackRightQuarterTurn3Tiles( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 3: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -474,7 +489,7 @@ static void PaintGhostTrainTrackLeftQuarterTurn1Tile( TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, 0, tunnelStartImage, 0, tunnelEndImage); MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -504,7 +519,7 @@ static void PaintGhostTrainTrackSpinningTunnel( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, GetStationColourScheme(session, trackElement)); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -527,7 +542,10 @@ static void PaintGhostTrainTrackBrakes( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/gentle/HauntedHouse.cpp b/src/openrct2/ride/gentle/HauntedHouse.cpp index 68016ed68c..75de00cb64 100644 --- a/src/openrct2/ride/gentle/HauntedHouse.cpp +++ b/src/openrct2/ride/gentle/HauntedHouse.cpp @@ -99,24 +99,25 @@ static void PaintHauntedHouse( { case 1: // top - cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + cornerSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 3: // right - cornerSegments = SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; + cornerSegments = EnumsToFlags(PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide); break; case 6: // left - cornerSegments = SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0; + cornerSegments = EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide); break; case 7: // bottom - cornerSegments = SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4; + cornerSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, cornerSegments, height + 2, 0x20); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~cornerSegments, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); } diff --git a/src/openrct2/ride/gentle/Maze.cpp b/src/openrct2/ride/gentle/Maze.cpp index b7d8137ff2..3ae4473084 100644 --- a/src/openrct2/ride/gentle/Maze.cpp +++ b/src/openrct2/ride/gentle/Maze.cpp @@ -68,7 +68,7 @@ static void MazePaintSetup( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, rotation, height, GetShopSupportColourScheme(session, trackElement)); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~SEGMENT_C4, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~EnumToFlag(PaintSegment::centre), 0xFFFF, 0); int32_t baseImageId = 0; switch (ride.track_colour[0].supports) @@ -178,7 +178,7 @@ static void MazePaintSetup( imageId = baseImage.WithIndexOffset(SprMazeOffsetColumnCentre); PaintAddImageAsParent(session, imageId, { 14, 14, height }, { { 15, 15, height + 2 }, { 2, 2, 8 } }); - PaintUtilSetSegmentSupportHeight(session, SEGMENT_C4, height + 12, 0x20); + PaintUtilSetSegmentSupportHeight(session, EnumToFlag(PaintSegment::centre), height + 12, 0x20); } PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); diff --git a/src/openrct2/ride/gentle/MerryGoRound.cpp b/src/openrct2/ride/gentle/MerryGoRound.cpp index b6bf4dbb69..881d3ad259 100644 --- a/src/openrct2/ride/gentle/MerryGoRound.cpp +++ b/src/openrct2/ride/gentle/MerryGoRound.cpp @@ -149,24 +149,25 @@ static void PaintMerryGoRound( { case 1: // top - cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + cornerSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 3: // right - cornerSegments = SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; + cornerSegments = EnumsToFlags(PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide); break; case 6: // left - cornerSegments = SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0; + cornerSegments = EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide); break; case 7: // bottom - cornerSegments = SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4; + cornerSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, cornerSegments, height + 2, 0x20); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~cornerSegments, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } diff --git a/src/openrct2/ride/gentle/MiniGolf.cpp b/src/openrct2/ride/gentle/MiniGolf.cpp index c37a9232b7..f9491cc8b4 100644 --- a/src/openrct2/ride/gentle/MiniGolf.cpp +++ b/src/openrct2/ride/gentle/MiniGolf.cpp @@ -489,7 +489,10 @@ static void PaintMiniGolfTrackFlat( MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); if (MiniGolfPaintUtilShouldDrawFence(session, trackElement)) { @@ -526,7 +529,10 @@ static void PaintMiniGolfTrack25DegUp( MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 8, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); imageId = GetStationColourScheme(session, trackElement).WithIndex(MiniGolfTrackSprites25DegUp[direction][1]); PaintAddImageAsParentRotated(session, direction, imageId, { 0, 0, height }, { { 0, 10, height + 2 }, { 32, 1, 15 } }); @@ -565,7 +571,10 @@ static void PaintMiniGolfTrackFlatTo25DegUp( MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); imageId = GetStationColourScheme(session, trackElement).WithIndex(MiniGolfTrackSpritesFlatTo25DegUp[direction][1]); PaintAddImageAsParentRotated(session, direction, imageId, { 0, 0, height }, { { 0, 10, height + 2 }, { 32, 1, 11 } }); @@ -604,7 +613,10 @@ static void PaintMiniGolfTrack25DegUpToFlat( MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 8, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); imageId = GetStationColourScheme(session, trackElement).WithIndex(MiniGolfTrackSprites25DegUpToFlat[direction][1]); PaintAddImageAsParentRotated(session, direction, imageId, { 0, 0, height }, { { 0, 10, height + 2 }, { 32, 1, 11 } }); @@ -716,7 +728,7 @@ static void PaintMiniGolfStation( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -733,7 +745,12 @@ static void PaintMiniGolfTrackLeftQuarterTurn1Tile( MetalASupportsPaintSetup(session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); const bool shouldDrawFence = MiniGolfPaintUtilShouldDrawFence(session, trackElement); @@ -817,7 +834,7 @@ static void PaintMiniGolfHoleAb( bool drewSupports = WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); if ((direction == 0 && trackSequence == 0) || (direction == 2 && trackSequence == 1)) @@ -890,7 +907,7 @@ static void PaintMiniGolfHoleC( bool drewSupports = WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); if ((direction == 0 && trackSequence == 0) || (direction == 2 && trackSequence == 1)) @@ -962,7 +979,7 @@ static void PaintMiniGolfHoleD( bool drewSupports = WoodenASupportsPaintSetup( session, WoodenSupportType::Truss, supportType, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); switch ((direction << 4) | trackSequence) @@ -1056,7 +1073,7 @@ static void PaintMiniGolfHoleE( bool drewSupports = WoodenASupportsPaintSetup( session, WoodenSupportType::Truss, supportType, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); switch ((direction << 4) | trackSequence) diff --git a/src/openrct2/ride/gentle/MiniHelicopters.cpp b/src/openrct2/ride/gentle/MiniHelicopters.cpp index 0cd89a0cf8..5a98c68c45 100644 --- a/src/openrct2/ride/gentle/MiniHelicopters.cpp +++ b/src/openrct2/ride/gentle/MiniHelicopters.cpp @@ -46,7 +46,7 @@ static void PaintMiniHelicoptersTrackStation( TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -78,7 +78,10 @@ static void PaintMiniHelicoptersTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -120,7 +123,10 @@ static void PaintMiniHelicoptersTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -162,7 +168,10 @@ static void PaintMiniHelicoptersTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -204,7 +213,10 @@ static void PaintMiniHelicoptersTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -248,17 +260,35 @@ static void PaintMiniHelicoptersTrackLeftQuarterTurn3Tiles( MetalASupportsPaintSetup( session, MetalSupportType::Stick, MetalSupportPlace::Centre, -1, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::topCorner), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner), + direction), + 0xFFFF, 0); break; case 3: MetalASupportsPaintSetup( session, MetalSupportType::Stick, MetalSupportPlace::Centre, -1, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::bottomCorner), + direction), + 0xFFFF, 0); break; } @@ -291,7 +321,12 @@ static void PaintMiniHelicoptersTrackLeftQuarterTurn1Tile( TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height, 0, TUNNEL_0, 0, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -326,7 +361,7 @@ static void PaintMiniHelicoptersTrackSpinningTunnel( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, GetStationColourScheme(session, trackElement)); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/gentle/MonorailCycles.cpp b/src/openrct2/ride/gentle/MonorailCycles.cpp index ebc56a0e7d..9f8f4efc3b 100644 --- a/src/openrct2/ride/gentle/MonorailCycles.cpp +++ b/src/openrct2/ride/gentle/MonorailCycles.cpp @@ -181,7 +181,10 @@ static void PaintMonorailCyclesTrackFlat( session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -214,7 +217,7 @@ static void PaintMonorailCyclesStation( TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -233,17 +236,35 @@ static void PaintMonorailCyclesTrackLeftQuarterTurn3Tiles( MetalASupportsPaintSetup( session, MetalSupportType::Stick, MetalSupportPlace::Centre, -1, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::topCorner), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner), + direction), + 0xFFFF, 0); break; case 3: MetalASupportsPaintSetup( session, MetalSupportType::Stick, MetalSupportPlace::Centre, -1, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::bottomCorner), + direction), + 0xFFFF, 0); break; } @@ -365,27 +386,52 @@ static void PaintMonorailCyclesTrackRightQuarterTurn5Tiles( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::rightCorner), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre), + direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::leftCorner), + direction), + 0xFFFF, 0); break; } @@ -479,25 +525,43 @@ static void PaintMonorailCyclesTrackSBendLeft( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4, direction & 1), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::topCorner), + direction & 1), + 0xFFFF, 0); break; case 1: PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4, direction & 1), + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner), + direction & 1), 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, direction & 1), + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + direction & 1), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0, direction & 1), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomCorner), + direction & 1), + 0xFFFF, 0); break; } PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); @@ -582,25 +646,43 @@ static void PaintMonorailCyclesTrackSBendRight( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction & 1), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::rightCorner), + direction & 1), + 0xFFFF, 0); break; case 1: PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, direction & 1), + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide, PaintSegment::rightCorner), + direction & 1), 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4, direction & 1), + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner), + direction & 1), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8, direction & 1), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::leftCorner), + direction & 1), + 0xFFFF, 0); break; } PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); diff --git a/src/openrct2/ride/gentle/ObservationTower.cpp b/src/openrct2/ride/gentle/ObservationTower.cpp index 368123a237..3efe30f862 100644 --- a/src/openrct2/ride/gentle/ObservationTower.cpp +++ b/src/openrct2/ride/gentle/ObservationTower.cpp @@ -112,7 +112,7 @@ static void PaintObservationTowerBase( PaintAddImageAsParent(session, imageId, { 0, 0, height + 64 }, { { 8, 8, height + 64 }, { 2, 2, 30 } }); PaintUtilSetVerticalTunnel(session, height + 96); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); @@ -123,32 +123,41 @@ static void PaintObservationTowerBase( switch (trackSequence) { case 1: - blockedSegments = SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, PaintSegment::topRightSide, + PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide, + PaintSegment::bottomCorner); break; case 4: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; case 5: - blockedSegments = SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 6: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner); break; case 7: - blockedSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 8: - blockedSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; + blockedSegments = EnumsToFlags(PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner); break; } PaintUtilSetSegmentSupportHeight(session, blockedSegments, 0xFFFF, 0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~blockedSegments, height + 2, 0x20); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~blockedSegments, height + 2, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -172,7 +181,7 @@ static void PaintObservationTowerSection( PaintAddImageAsChild(session, imageId, { 0, 0, height }, { { 8, 8, height }, { 2, 2, 30 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); diff --git a/src/openrct2/ride/gentle/SpaceRings.cpp b/src/openrct2/ride/gentle/SpaceRings.cpp index 125f6e0a8e..e15c4822c5 100644 --- a/src/openrct2/ride/gentle/SpaceRings.cpp +++ b/src/openrct2/ride/gentle/SpaceRings.cpp @@ -145,32 +145,40 @@ static void PaintSpaceRings( cornerSegments = 0; break; case 1: - cornerSegments = SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; + cornerSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, PaintSegment::topRightSide, + PaintSegment::rightCorner); break; case 2: - cornerSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; + cornerSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 3: - cornerSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; + cornerSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide, + PaintSegment::bottomCorner); break; case 4: - cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8; + cornerSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; case 5: - cornerSegments = SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; + cornerSegments = EnumsToFlags(PaintSegment::rightCorner, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 6: - cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; + cornerSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner); break; case 7: - cornerSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + cornerSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 8: - cornerSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; + cornerSegments = EnumsToFlags(PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner); break; } PaintUtilSetSegmentSupportHeight(session, cornerSegments, height + 2, 0x20); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~cornerSegments, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } diff --git a/src/openrct2/ride/gentle/SpiralSlide.cpp b/src/openrct2/ride/gentle/SpiralSlide.cpp index 25e42e43d1..67333cb2d0 100644 --- a/src/openrct2/ride/gentle/SpiralSlide.cpp +++ b/src/openrct2/ride/gentle/SpiralSlide.cpp @@ -242,7 +242,7 @@ static void PaintSpiralSlide( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); } diff --git a/src/openrct2/ride/shops/Facility.cpp b/src/openrct2/ride/shops/Facility.cpp index 66a0bf1ed9..6243f18a52 100644 --- a/src/openrct2/ride/shops/Facility.cpp +++ b/src/openrct2/ride/shops/Facility.cpp @@ -66,7 +66,7 @@ static void PaintFacility( PaintAddImageAsParent(session, imageId.WithIndexOffset(4), offset, { { 2, 28, height }, { 28, 2, 29 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); if (direction == 1 || direction == 2) diff --git a/src/openrct2/ride/shops/Shop.cpp b/src/openrct2/ride/shops/Shop.cpp index 6372598339..5360956c9e 100644 --- a/src/openrct2/ride/shops/Shop.cpp +++ b/src/openrct2/ride/shops/Shop.cpp @@ -52,7 +52,7 @@ static void PaintShop( PaintAddImageAsParent(session, imageFlags.WithIndex(imageIndex), offset, bb); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); if (direction == 1 || direction == 2) diff --git a/src/openrct2/ride/thrill/3dCinema.cpp b/src/openrct2/ride/thrill/3dCinema.cpp index 3f07430e45..ff0497831e 100644 --- a/src/openrct2/ride/thrill/3dCinema.cpp +++ b/src/openrct2/ride/thrill/3dCinema.cpp @@ -95,24 +95,25 @@ static void Paint3dCinema( { case 1: // top - cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + cornerSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 3: // right - cornerSegments = SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; + cornerSegments = EnumsToFlags(PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide); break; case 6: // left - cornerSegments = SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0; + cornerSegments = EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide); break; case 7: // bottom - cornerSegments = SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4; + cornerSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, cornerSegments, height + 2, 0x20); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~cornerSegments, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); } diff --git a/src/openrct2/ride/thrill/Enterprise.cpp b/src/openrct2/ride/thrill/Enterprise.cpp index f5b25ca126..a2dc273011 100644 --- a/src/openrct2/ride/thrill/Enterprise.cpp +++ b/src/openrct2/ride/thrill/Enterprise.cpp @@ -152,20 +152,21 @@ static void PaintEnterprise( switch (trackSequence) { case 0: - cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + cornerSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 3: - cornerSegments = SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; + cornerSegments = EnumsToFlags(PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide); break; case 12: - cornerSegments = SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0; + cornerSegments = EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide); break; case 15: - cornerSegments = SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4; + cornerSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, cornerSegments, height + 2, 0x20); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~cornerSegments, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 160, 0x20); } diff --git a/src/openrct2/ride/thrill/GoKarts.cpp b/src/openrct2/ride/thrill/GoKarts.cpp index 3529db59fe..ce4b70b20d 100644 --- a/src/openrct2/ride/thrill/GoKarts.cpp +++ b/src/openrct2/ride/thrill/GoKarts.cpp @@ -154,7 +154,7 @@ static void PaintGoKartsTrackFlat( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -208,7 +208,7 @@ static void PaintGoKartsTrack25DegUp( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -262,7 +262,7 @@ static void PaintGoKartsTrackFlatTo25DegUp( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -317,7 +317,7 @@ static void PaintGoKartsTrack25DegUpToFlat( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -452,7 +452,7 @@ static void PaintGoKartsStation( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -523,7 +523,7 @@ static void PaintGoKartsTrackLeftQuarterTurn1Tile( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/thrill/LaunchedFreefall.cpp b/src/openrct2/ride/thrill/LaunchedFreefall.cpp index fb75df6822..57b0517f53 100644 --- a/src/openrct2/ride/thrill/LaunchedFreefall.cpp +++ b/src/openrct2/ride/thrill/LaunchedFreefall.cpp @@ -129,35 +129,44 @@ static void PaintLaunchedFreefallBase( switch (trackSequence) { case 0: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; case 1: - blockedSegments = SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, PaintSegment::topRightSide, + PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide, + PaintSegment::bottomCorner); break; case 4: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; case 5: - blockedSegments = SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 6: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner); break; case 7: - blockedSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 8: - blockedSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; + blockedSegments = EnumsToFlags(PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner); break; } PaintUtilSetSegmentSupportHeight(session, blockedSegments, 0xFFFF, 0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~blockedSegments, height + 2, 0x20); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~blockedSegments, height + 2, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -181,7 +190,7 @@ static void PaintLaunchedFreefallTowerSection( PaintAddImageAsChild(session, imageId, { 0, 0, height }, { { 8, 8, height }, { 2, 2, 30 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); diff --git a/src/openrct2/ride/thrill/MagicCarpet.cpp b/src/openrct2/ride/thrill/MagicCarpet.cpp index 3641edc309..d0ad5b2150 100644 --- a/src/openrct2/ride/thrill/MagicCarpet.cpp +++ b/src/openrct2/ride/thrill/MagicCarpet.cpp @@ -260,7 +260,7 @@ static void PaintMagicCarpet( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 176, 0x20); } diff --git a/src/openrct2/ride/thrill/MotionSimulator.cpp b/src/openrct2/ride/thrill/MotionSimulator.cpp index 9fc7a2e9fb..b1a8e0bd53 100644 --- a/src/openrct2/ride/thrill/MotionSimulator.cpp +++ b/src/openrct2/ride/thrill/MotionSimulator.cpp @@ -133,7 +133,7 @@ static void PaintMotionSimulator( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 128, 0x20); } diff --git a/src/openrct2/ride/thrill/RotoDrop.cpp b/src/openrct2/ride/thrill/RotoDrop.cpp index ec68353f13..94cff1b347 100644 --- a/src/openrct2/ride/thrill/RotoDrop.cpp +++ b/src/openrct2/ride/thrill/RotoDrop.cpp @@ -134,7 +134,7 @@ static void PaintRotoDropBase( PaintAddImageAsParent(session, imageId, { 0, 0, height + 64 }, { { 8, 8, height + 64 }, { 2, 2, 30 } }); PaintUtilSetVerticalTunnel(session, height + 96); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); @@ -145,32 +145,41 @@ static void PaintRotoDropBase( switch (trackSequence) { case 1: - blockedSegments = SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, PaintSegment::topRightSide, + PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide, + PaintSegment::bottomCorner); break; case 4: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; case 5: - blockedSegments = SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 6: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner); break; case 7: - blockedSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 8: - blockedSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; + blockedSegments = EnumsToFlags(PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner); break; } PaintUtilSetSegmentSupportHeight(session, blockedSegments, 0xFFFF, 0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~blockedSegments, height + 2, 0x20); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~blockedSegments, height + 2, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -202,7 +211,7 @@ static void PaintRotoDropTowerSection( PaintAddImageAsChild(session, imageId, { 0, 0, height }, { { 8, 8, height }, { 2, 2, 30 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); diff --git a/src/openrct2/ride/thrill/SwingingInverterShip.cpp b/src/openrct2/ride/thrill/SwingingInverterShip.cpp index 7340d1e6f1..4c497b8ab8 100644 --- a/src/openrct2/ride/thrill/SwingingInverterShip.cpp +++ b/src/openrct2/ride/thrill/SwingingInverterShip.cpp @@ -193,7 +193,7 @@ static void PaintSwingingInverterShip( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 176, 0x20); } diff --git a/src/openrct2/ride/thrill/SwingingShip.cpp b/src/openrct2/ride/thrill/SwingingShip.cpp index a030d9a157..0ffa116d77 100644 --- a/src/openrct2/ride/thrill/SwingingShip.cpp +++ b/src/openrct2/ride/thrill/SwingingShip.cpp @@ -192,7 +192,7 @@ static void PaintSwingingShip( } } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); if (stationObject != nullptr && !(stationObject->Flags & STATION_OBJECT_FLAGS::NO_PLATFORMS)) { diff --git a/src/openrct2/ride/thrill/TopSpin.cpp b/src/openrct2/ride/thrill/TopSpin.cpp index 84c9700206..9764b3b417 100644 --- a/src/openrct2/ride/thrill/TopSpin.cpp +++ b/src/openrct2/ride/thrill/TopSpin.cpp @@ -225,24 +225,25 @@ static void PaintTopSpin( { case 1: // top - cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + cornerSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 3: // right - cornerSegments = SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; + cornerSegments = EnumsToFlags(PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide); break; case 6: // left - cornerSegments = SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0; + cornerSegments = EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide); break; case 7: // bottom - cornerSegments = SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4; + cornerSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, cornerSegments, height + 2, 0x20); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~cornerSegments, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 112, 0x20); } diff --git a/src/openrct2/ride/thrill/Twist.cpp b/src/openrct2/ride/thrill/Twist.cpp index af20b093b7..53ab126904 100644 --- a/src/openrct2/ride/thrill/Twist.cpp +++ b/src/openrct2/ride/thrill/Twist.cpp @@ -145,21 +145,22 @@ static void PaintTwist( switch (trackSequence) { case 1: - cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + cornerSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 3: - cornerSegments = SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; + cornerSegments = EnumsToFlags(PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide); break; case 6: - cornerSegments = SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0; + cornerSegments = EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide); break; case 7: - cornerSegments = SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4; + cornerSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } PaintUtilSetSegmentSupportHeight(session, cornerSegments, height + 2, 0x20); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~cornerSegments, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); } diff --git a/src/openrct2/ride/transport/Chairlift.cpp b/src/openrct2/ride/transport/Chairlift.cpp index 85c6f1a26d..acaa3affce 100644 --- a/src/openrct2/ride/transport/Chairlift.cpp +++ b/src/openrct2/ride/transport/Chairlift.cpp @@ -266,7 +266,7 @@ static void ChairliftPaintStationNeSw( session, imageId, { 30, 16, height + 2 }, { { 1, 16, height + 2 }, { 1, 1, 7 } }); // bound offset x is wrong? } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -363,7 +363,7 @@ static void ChairliftPaintStationSeNw( PaintUtilPushTunnelRight(session, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -400,7 +400,7 @@ static void ChairliftPaintFlat( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -438,7 +438,7 @@ static void ChairliftPaint25DegUp( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -492,8 +492,8 @@ static void ChairliftPaintFlatTo25DegUp( break; } - ChairliftPaintUtilDrawSupports(session, SEGMENT_C4, height); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + ChairliftPaintUtilDrawSupports(session, EnumToFlag(PaintSegment::centre), height); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -547,8 +547,8 @@ static void ChairliftPaint25DegUpToFlat( break; } - ChairliftPaintUtilDrawSupports(session, SEGMENT_C4, height); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + ChairliftPaintUtilDrawSupports(session, EnumToFlag(PaintSegment::centre), height); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -637,9 +637,11 @@ static void ChairliftPaintLeftQuarterTurn1Tile( break; } - ChairliftPaintUtilDrawSupports(session, PaintUtilRotateSegments(SEGMENT_C8 | SEGMENT_D0, direction), height); + ChairliftPaintUtilDrawSupports( + session, PaintUtilRotateSegments(EnumsToFlags(PaintSegment::topLeftSide, PaintSegment::bottomLeftSide), direction), + height); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/transport/Lift.cpp b/src/openrct2/ride/transport/Lift.cpp index f7158dee74..2c063be35a 100644 --- a/src/openrct2/ride/transport/Lift.cpp +++ b/src/openrct2/ride/transport/Lift.cpp @@ -61,7 +61,7 @@ static void PaintLiftBase( PaintLiftCage(session, -1, session.TrackColours, height + 64, session.CurrentRotation); PaintUtilSetVerticalTunnel(session, height + 96); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 96, 0x20); @@ -81,32 +81,41 @@ static void PaintLiftBase( switch (trackSequence) { case 1: - blockedSegments = SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::topCorner, PaintSegment::topRightSide, + PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topRightSide, PaintSegment::rightCorner, PaintSegment::bottomRightSide, + PaintSegment::bottomCorner); break; case 4: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; case 5: - blockedSegments = SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 6: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::leftCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomCorner); break; case 7: - blockedSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 8: - blockedSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; + blockedSegments = EnumsToFlags(PaintSegment::leftCorner, PaintSegment::bottomLeftSide, PaintSegment::bottomCorner); break; } PaintUtilSetSegmentSupportHeight(session, blockedSegments, 0xFFFF, 0); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL & ~blockedSegments, height + 2, 0x20); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll & ~blockedSegments, height + 2, 0x20); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -122,7 +131,7 @@ static void PaintLiftTowerSection( PaintLiftCage(session, -1, session.TrackColours, height, session.CurrentRotation); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetVerticalTunnel(session, height + 32); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); diff --git a/src/openrct2/ride/transport/MiniatureRailway.cpp b/src/openrct2/ride/transport/MiniatureRailway.cpp index 0e84fdbff7..1a36221067 100644 --- a/src/openrct2/ride/transport/MiniatureRailway.cpp +++ b/src/openrct2/ride/transport/MiniatureRailway.cpp @@ -695,7 +695,7 @@ static void PaintMiniatureRailwayTrackFlat( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -720,7 +720,7 @@ static void PaintMiniatureRailwayStation( TrackPaintUtilDrawStation3(session, ride, direction, height + 2, height, trackElement); // covers shouldn't be offset by +2 - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 30, 0x20); } @@ -753,7 +753,7 @@ static void PaintMiniatureRailwayTrack25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours, WoodenSupportTransitionType::Up25DegRailway); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -786,7 +786,7 @@ static void PaintMiniatureRailwayTrackFlatTo25DegUp( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours, WoodenSupportTransitionType::FlatToUp25DegRailway); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -819,7 +819,7 @@ static void PaintMiniatureRailwayTrack25DegUpToFlat( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours, WoodenSupportTransitionType::Up25DegToFlatRailway); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -1048,26 +1048,32 @@ static void PaintMiniatureRailwayTrackRightQuarterTurn5Tiles( switch (trackSequence) { case 0: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; case 1: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::bottomCorner, PaintSegment::topRightSide); break; case 3: - blockedSegments = SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 - | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::centre, + PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide); break; case 4: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide); break; case 5: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::leftCorner, + PaintSegment::bottomCorner, PaintSegment::topLeftSide); break; case 6: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; } @@ -1175,16 +1181,20 @@ static void PaintMiniatureRailwayTrackSBendLeft( switch (trackSequence) { case 0: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::topCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction & 1), 0xFFFF, 0); @@ -1283,16 +1293,20 @@ static void PaintMiniatureRailwayTrackSBendRight( switch (trackSequence) { case 0: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::topCorner); break; case 3: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction & 1), 0xFFFF, 0); @@ -1397,13 +1411,14 @@ static void PaintMiniatureRailwayTrackRightQuarterTurn3Tiles( switch (trackSequence) { case 0: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 3: - blockedSegments = SEGMENTS_ALL; + blockedSegments = kSegmentsAll; break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -1586,7 +1601,7 @@ static void PaintMiniatureRailwayTrackLeftEighthToDiag( PaintUtilPushTunnelRight(session, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1753,7 +1768,7 @@ static void PaintMiniatureRailwayTrackRightEighthToDiag( PaintUtilPushTunnelRight(session, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1852,7 +1867,7 @@ static void MiniatureRailwayTrackDiagFlat( session, session.TrackColours.WithIndex(imageId), { -16, -16, height }, { { -16, -16, height }, { 32, 32, 2 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -1933,7 +1948,7 @@ static void MiniatureRailwayTrackDiag25DegUp( { { -16, -16, height + offsetB[direction] }, { 32, 32, 2 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -1984,7 +1999,7 @@ static void MiniatureRailwayTrackDiagFlatTo25DegUp( session, session.TrackColours.WithIndex(imageId), { -16, -16, height }, { { -16, -16, height }, { 32, 32, 2 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -2063,7 +2078,7 @@ static void MiniatureRailwayTrackDiag25DegUpToFlat( { { -16, -16, height + railOffsets[direction] }, { 32, 32, 2 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -2141,7 +2156,7 @@ static void MiniatureRailwayTrackDiag25DegDown( { { -16, -16, height + railOffsets[direction] }, { 32, 32, 2 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -2218,7 +2233,7 @@ static void MiniatureRailwayTrackDiagFlatTo25DegDown( { { -16, -16, height + railOffsets[direction] }, { 32, 32, 2 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -2267,7 +2282,7 @@ static void MiniatureRailwayTrackDiag25DegDownToFlat( session, session.TrackColours.WithIndex(imageId), { -16, -16, height }, { { -16, -16, height }, { 32, 32, 2 } }); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } diff --git a/src/openrct2/ride/transport/Monorail.cpp b/src/openrct2/ride/transport/Monorail.cpp index 2980e64823..856019b25d 100644 --- a/src/openrct2/ride/transport/Monorail.cpp +++ b/src/openrct2/ride/transport/Monorail.cpp @@ -415,7 +415,10 @@ static void PaintMonorailTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -466,7 +469,7 @@ static void PaintMonorailStation( TrackPaintUtilDrawStation(session, ride, direction, height, trackElement); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -509,7 +512,10 @@ static void PaintMonorailTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -552,7 +558,10 @@ static void PaintMonorailTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -595,7 +604,10 @@ static void PaintMonorailTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -665,19 +677,26 @@ static void PaintMonorailTrackRightQuarterTurn5Tiles( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::bottomCorner, PaintSegment::topRightSide); break; case 3: - blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4; + blockedSegments = EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre); break; case 5: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, PaintSegment::leftCorner, + PaintSegment::bottomCorner, PaintSegment::topLeftSide); break; case 6: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; } @@ -775,16 +794,22 @@ static void PaintMonorailTrackSBendLeft( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::topCorner); break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::topCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction & 1), 0xFFFF, 0); @@ -869,16 +894,22 @@ static void PaintMonorailTrackSBendRight( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::topCorner); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction & 1), 0xFFFF, 0); @@ -909,13 +940,16 @@ static void PaintMonorailTrackRightQuarterTurn3Tiles( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 3: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); @@ -986,19 +1020,26 @@ static void PaintMonorailTrackLeftEighthToDiag( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide); break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::topCorner); break; case 2: - blockedSegments = SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, PaintSegment::bottomRightSide, + PaintSegment::rightCorner); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_B8 | SEGMENT_C8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::leftCorner, PaintSegment::topLeftSide); break; case 4: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C8 | SEGMENT_C0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::topLeftSide, + PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; } @@ -1056,19 +1097,26 @@ static void PaintMonorailTrackRightEighthToDiag( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC; + blockedSegments = EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide); break; case 1: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomCorner, + PaintSegment::bottomRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; + blockedSegments = EnumsToFlags( + PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, PaintSegment::topLeftSide, + PaintSegment::topCorner); break; case 3: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_C0 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomCorner, PaintSegment::bottomRightSide); break; case 4: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_D4; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::leftCorner, + PaintSegment::topLeftSide, PaintSegment::bottomRightSide); break; } diff --git a/src/openrct2/ride/transport/SuspendedMonorail.cpp b/src/openrct2/ride/transport/SuspendedMonorail.cpp index ef2ac05141..1ad1713012 100644 --- a/src/openrct2/ride/transport/SuspendedMonorail.cpp +++ b/src/openrct2/ride/transport/SuspendedMonorail.cpp @@ -41,7 +41,10 @@ static void SuspendedMonorailTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { MetalASupportsPaintSetup( @@ -76,7 +79,7 @@ static void SuspendedMonorailTrackStation( DrawSupportsSideBySide(session, direction, height, session.SupportColours, MetalSupportType::Boxed); TrackPaintUtilDrawStationInverted(session, ride, direction, height, trackElement, STATION_VARIANT_TALL); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_INVERTED_9); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -110,7 +113,10 @@ static void SuspendedMonorailTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -177,7 +183,10 @@ static void SuspendedMonorailTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -244,7 +253,10 @@ static void SuspendedMonorailTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); if (TrackPaintUtilShouldPaintSupports(session.MapPosition)) { switch (direction) @@ -338,7 +350,12 @@ static void SuspendedMonorailTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -376,7 +393,11 @@ static void SuspendedMonorailTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -404,7 +425,13 @@ static void SuspendedMonorailTrackLeftQuarterTurn5( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -434,7 +461,11 @@ static void SuspendedMonorailTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -464,7 +495,12 @@ static void SuspendedMonorailTrackLeftQuarterTurn5( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -525,7 +561,13 @@ static void SuspendedMonorailTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -560,7 +602,11 @@ static void SuspendedMonorailTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -603,7 +649,11 @@ static void SuspendedMonorailTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -647,7 +697,13 @@ static void SuspendedMonorailTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -698,7 +754,13 @@ static void SuspendedMonorailTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -733,7 +795,11 @@ static void SuspendedMonorailTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -776,7 +842,11 @@ static void SuspendedMonorailTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); switch (direction) { @@ -820,7 +890,13 @@ static void SuspendedMonorailTrackSBendRight( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -871,7 +947,12 @@ static void SuspendedMonorailTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -909,7 +990,13 @@ static void SuspendedMonorailTrackLeftQuarterTurn3( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -938,7 +1025,12 @@ static void SuspendedMonorailTrackLeftQuarterTurn3( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -999,7 +1091,10 @@ static void SuspendedMonorailTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -1035,7 +1130,11 @@ static void SuspendedMonorailTrackLeftEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1064,13 +1163,24 @@ static void SuspendedMonorailTrackLeftEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -1100,7 +1210,11 @@ static void SuspendedMonorailTrackLeftEighthToDiag( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1163,7 +1277,10 @@ static void SuspendedMonorailTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height + 42, session.SupportColours); @@ -1199,7 +1316,11 @@ static void SuspendedMonorailTrackRightEighthToDiag( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; @@ -1228,13 +1349,24 @@ static void SuspendedMonorailTrackRightEighthToDiag( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide), + direction), 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 4: @@ -1264,7 +1396,11 @@ static void SuspendedMonorailTrackRightEighthToDiag( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); switch (direction) { @@ -1329,7 +1465,13 @@ static void SuspendedMonorailTrackDiagFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 1: @@ -1342,7 +1484,12 @@ static void SuspendedMonorailTrackDiagFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 2: @@ -1355,7 +1502,13 @@ static void SuspendedMonorailTrackDiagFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); break; case 3: @@ -1369,7 +1522,13 @@ static void SuspendedMonorailTrackDiagFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1415,7 +1574,13 @@ static void SuspendedMonorailTrackDiag25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1428,7 +1593,12 @@ static void SuspendedMonorailTrackDiag25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -1441,7 +1611,13 @@ static void SuspendedMonorailTrackDiag25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -1455,7 +1631,13 @@ static void SuspendedMonorailTrackDiag25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1501,7 +1683,13 @@ static void SuspendedMonorailTrackDiagFlatTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -1514,7 +1702,12 @@ static void SuspendedMonorailTrackDiagFlatTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -1527,7 +1720,13 @@ static void SuspendedMonorailTrackDiagFlatTo25DegUp( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -1541,7 +1740,13 @@ static void SuspendedMonorailTrackDiagFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1587,7 +1792,13 @@ static void SuspendedMonorailTrackDiag25DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1600,7 +1811,12 @@ static void SuspendedMonorailTrackDiag25DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -1613,7 +1829,13 @@ static void SuspendedMonorailTrackDiag25DegUpToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -1627,7 +1849,13 @@ static void SuspendedMonorailTrackDiag25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1673,7 +1901,13 @@ static void SuspendedMonorailTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 1: @@ -1686,7 +1920,12 @@ static void SuspendedMonorailTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 2: @@ -1699,7 +1938,13 @@ static void SuspendedMonorailTrackDiag25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); break; case 3: @@ -1713,7 +1958,13 @@ static void SuspendedMonorailTrackDiag25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1759,7 +2010,13 @@ static void SuspendedMonorailTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 1: switch (direction) @@ -1771,7 +2028,12 @@ static void SuspendedMonorailTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); break; case 2: switch (direction) @@ -1783,7 +2045,13 @@ static void SuspendedMonorailTrackDiagFlatTo25DegDown( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: switch (direction) @@ -1796,7 +2064,13 @@ static void SuspendedMonorailTrackDiagFlatTo25DegDown( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: @@ -1842,7 +2116,13 @@ static void SuspendedMonorailTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 1: @@ -1855,7 +2135,12 @@ static void SuspendedMonorailTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::topRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 2: @@ -1868,7 +2153,13 @@ static void SuspendedMonorailTrackDiag25DegDownToFlat( break; } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 64, 0x20); break; case 3: @@ -1882,7 +2173,13 @@ static void SuspendedMonorailTrackDiag25DegDownToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); switch (direction) { case 0: diff --git a/src/openrct2/ride/water/BoatHire.cpp b/src/openrct2/ride/water/BoatHire.cpp index 0c72e16c79..77afdc4587 100644 --- a/src/openrct2/ride/water/BoatHire.cpp +++ b/src/openrct2/ride/water/BoatHire.cpp @@ -57,7 +57,10 @@ static void PaintBoatHireTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 16, 0x20); } @@ -81,7 +84,7 @@ static void PaintBoatHireStation( session, ride, stationObj, session.MapPosition, direction, height, trackElement, session.CurrentRotation); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -125,7 +128,10 @@ static void PaintBoatHireTrackLeftQuarterTurn1Tile( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_C8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 16, 0x20); } diff --git a/src/openrct2/ride/water/DinghySlide.cpp b/src/openrct2/ride/water/DinghySlide.cpp index 4f13eff459..b9c94ca63d 100644 --- a/src/openrct2/ride/water/DinghySlide.cpp +++ b/src/openrct2/ride/water/DinghySlide.cpp @@ -238,7 +238,10 @@ static void DinghySlideTrackFlat( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -266,7 +269,7 @@ static void DinghySlideTrackStation( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -312,7 +315,10 @@ static void DinghySlideTrack25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -349,7 +355,10 @@ static void DinghySlideTrack60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -395,7 +404,10 @@ static void DinghySlideTrackFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -432,7 +444,10 @@ static void DinghySlideTrack25DegUpTo60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -469,7 +484,10 @@ static void DinghySlideTrack60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -515,7 +533,10 @@ static void DinghySlideTrack25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -652,27 +673,52 @@ static void DinghySlideTrackRightQuarterTurn5( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::rightCorner), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre), + direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::leftCorner), + direction), + 0xFFFF, 0); break; } @@ -738,7 +784,13 @@ static void DinghySlideTrackSBendLeft( MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; case 1: bboy = (direction == 0 || direction == 1) ? 0 : 6; @@ -753,7 +805,11 @@ static void DinghySlideTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); break; case 2: @@ -769,7 +825,11 @@ static void DinghySlideTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); break; case 3: @@ -779,7 +839,13 @@ static void DinghySlideTrackSBendLeft( MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -845,7 +911,13 @@ static void DinghySlideTrackSBendRight( MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; case 1: bboy = (direction == 2 || direction == 3) ? 0 : 6; @@ -860,7 +932,11 @@ static void DinghySlideTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); break; case 2: @@ -876,7 +952,11 @@ static void DinghySlideTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); break; case 3: @@ -886,7 +966,13 @@ static void DinghySlideTrackSBendRight( MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -974,13 +1060,16 @@ static void DinghySlideTrackRightQuarterTurn3( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 3: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); diff --git a/src/openrct2/ride/water/DinghySlideCovered.cpp b/src/openrct2/ride/water/DinghySlideCovered.cpp index 9e9102d5ac..84b51152ab 100644 --- a/src/openrct2/ride/water/DinghySlideCovered.cpp +++ b/src/openrct2/ride/water/DinghySlideCovered.cpp @@ -194,7 +194,10 @@ static void DinghySlideTrackCoveredFlat( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -231,7 +234,10 @@ static void DinghySlideTrackCovered25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -268,7 +274,10 @@ static void DinghySlideTrackCovered60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -305,7 +314,10 @@ static void DinghySlideTrackCoveredFlatTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -342,7 +354,10 @@ static void DinghySlideTrackCovered25DegUpTo60DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -379,7 +394,10 @@ static void DinghySlideTrackCovered60DegUpTo25DegUp( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -416,7 +434,10 @@ static void DinghySlideTrackCovered25DegUpToFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -553,27 +574,52 @@ static void DinghySlideTrackCoveredRightQuarterTurn5( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::rightCorner), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre), + direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::leftCorner), + direction), + 0xFFFF, 0); break; } @@ -632,7 +678,13 @@ static void DinghySlideTrackCoveredSBendLeft( MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; case 1: bboy = (direction == 0 || direction == 1) ? 0 : 6; @@ -647,7 +699,11 @@ static void DinghySlideTrackCoveredSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); break; case 2: @@ -663,7 +719,11 @@ static void DinghySlideTrackCoveredSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); break; case 3: @@ -673,7 +733,13 @@ static void DinghySlideTrackCoveredSBendLeft( MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -739,7 +805,13 @@ static void DinghySlideTrackCoveredSBendRight( MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; case 1: bboy = (direction == 2 || direction == 3) ? 0 : 6; @@ -754,7 +826,11 @@ static void DinghySlideTrackCoveredSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); break; case 2: @@ -770,7 +846,11 @@ static void DinghySlideTrackCoveredSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); break; case 3: @@ -780,7 +860,13 @@ static void DinghySlideTrackCoveredSBendRight( MetalASupportsPaintSetup( session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -868,13 +954,16 @@ static void DinghySlideTrackCoveredRightQuarterTurn3( switch (trackSequence) { case 0: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::rightCorner); break; case 2: - blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0; + blockedSegments = EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, PaintSegment::bottomCorner); break; case 3: - blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; + blockedSegments = EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::topLeftSide, PaintSegment::leftCorner); break; } PaintUtilSetSegmentSupportHeight(session, PaintUtilRotateSegments(blockedSegments, direction), 0xFFFF, 0); diff --git a/src/openrct2/ride/water/LogFlume.cpp b/src/openrct2/ride/water/LogFlume.cpp index f317be8a34..97dfd921c3 100644 --- a/src/openrct2/ride/water/LogFlume.cpp +++ b/src/openrct2/ride/water/LogFlume.cpp @@ -179,7 +179,10 @@ static void PaintLogFlumeTrackFlat( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -207,7 +210,7 @@ static void PaintLogFlumeTrackStation( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -243,7 +246,10 @@ static void PaintLogFlumeTrack25DegUp( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -279,7 +285,10 @@ static void PaintLogFlumeTrackFlatTo25DegUp( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -315,7 +324,10 @@ static void PaintLogFlumeTrack25DegUpToFlat( PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_12); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -351,7 +363,10 @@ static void PaintLogFlumeTrack25DegDown( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_1); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -387,7 +402,10 @@ static void PaintLogFlumeTrackFlatTo25DegDown( PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -423,7 +441,10 @@ static void PaintLogFlumeTrack25DegDownToFlat( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -471,7 +492,13 @@ static void PaintLogFlumeTrackSBendLeft( MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; case 1: bboy = (direction == 0 || direction == 1) ? 0 : 6; @@ -486,7 +513,11 @@ static void PaintLogFlumeTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); break; case 2: @@ -502,7 +533,11 @@ static void PaintLogFlumeTrackSBendLeft( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); break; case 3: @@ -512,7 +547,13 @@ static void PaintLogFlumeTrackSBendLeft( MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -578,7 +619,13 @@ static void PaintLogFlumeTrackSBendRight( MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; case 1: bboy = (direction == 2 || direction == 3) ? 0 : 6; @@ -593,7 +640,11 @@ static void PaintLogFlumeTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); break; case 2: @@ -609,7 +660,11 @@ static void PaintLogFlumeTrackSBendRight( } PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); break; case 3: @@ -619,7 +674,13 @@ static void PaintLogFlumeTrackSBendRight( MetalASupportsPaintSetup( session, MetalSupportType::Boxed, MetalSupportPlace::Centre, 0, height, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; } @@ -705,15 +766,33 @@ static void PaintLogFlumeTrackLeftQuarterTurn3Tiles( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; } @@ -784,15 +863,33 @@ static void PaintLogFlumeTrackRightQuarterTurn3Tiles( { case 0: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; } @@ -814,7 +911,7 @@ static void PaintLogFlumeTrackOnRidePhoto( TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -839,7 +936,10 @@ static void PaintLogFlumeTrackReverser( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -883,7 +983,10 @@ static void LogFlumeTrack25Down60( PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_2); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -925,7 +1028,10 @@ static void LogFlumeTrack60Down( PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -967,7 +1073,10 @@ static void LogFlumeTrack60Down25( } } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::bottomLeftSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } diff --git a/src/openrct2/ride/water/RiverRapids.cpp b/src/openrct2/ride/water/RiverRapids.cpp index 6a97d50850..b74c93cea5 100644 --- a/src/openrct2/ride/water/RiverRapids.cpp +++ b/src/openrct2/ride/water/RiverRapids.cpp @@ -308,7 +308,7 @@ static void PaintRiverRapidsTrackFlat( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -384,7 +384,7 @@ static void PaintRiverRapidsTrack25Deg(PaintSession& session, uint8_t direction, break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -452,7 +452,7 @@ static void PaintRiverRapidsTrack25DegToFlatA( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -519,7 +519,7 @@ static void PaintRiverRapidsTrack25DegToFlatB( break; } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -624,7 +624,7 @@ static void PaintRiverRapidsTrackLeftQuarterTurn1Tile( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -682,7 +682,7 @@ static void PaintRiverRapidsTrackRightQuarterTurn1Tile( WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NwSe, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -753,7 +753,7 @@ static void PaintRiverRapidsTrackWaterfall( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_INVERTED_9); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -795,7 +795,7 @@ static void PaintRiverRapidsTrackRapids( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -865,7 +865,7 @@ static void PaintRiverRapidsTrackWhirlpool( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } diff --git a/src/openrct2/ride/water/SplashBoats.cpp b/src/openrct2/ride/water/SplashBoats.cpp index 26c777febc..07b01abd73 100644 --- a/src/openrct2/ride/water/SplashBoats.cpp +++ b/src/openrct2/ride/water/SplashBoats.cpp @@ -496,7 +496,7 @@ static void PaintSplashBoatsTrack25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -523,7 +523,7 @@ static void PaintSplashBoatsTrack60DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 56, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 104, 0x20); } @@ -549,7 +549,7 @@ static void PaintSplashBoatsTrackFlatTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -575,7 +575,7 @@ static void PaintSplashBoatsTrack25DegUpToFlat( { PaintUtilPushTunnelRotated(session, direction, height + 8, TUNNEL_14); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -602,7 +602,7 @@ static void PaintSplashBoatsTrack25DegUpTo60DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -629,7 +629,7 @@ static void PaintSplashBoatsTrack60DegUpTo25DegUp( { PaintUtilPushTunnelRotated(session, direction, height + 24, TUNNEL_SQUARE_8); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 72, 0x20); } @@ -655,7 +655,7 @@ static void PaintSplashBoatsTrack25DegDown( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_7); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 56, 0x20); } @@ -688,7 +688,7 @@ static void PaintSplashBoatsTrackFlatTo25DegDown( { PaintUtilPushTunnelRotated(session, direction, height - 8, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 40, 0x20); } @@ -728,7 +728,7 @@ static void PaintSplashBoatsTrack25DegDownToFlat( { PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } @@ -773,7 +773,7 @@ static void PaintSplashBoatsTrackFlat( PaintUtilPushTunnelLeft(session, height, TUNNEL_SQUARE_FLAT); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -808,7 +808,7 @@ static void PaintSplashBoatsStation( PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -870,38 +870,57 @@ static void PaintSplashBoatsTrackLeftQuarterTurn5Tiles( switch (trackSequence) { case 0: - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4 | SEGMENT_B8 | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::topRightSide, PaintSegment::topCorner, + PaintSegment::leftCorner, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_CC | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C4 | SEGMENT_B4 | SEGMENT_C0 | SEGMENT_C8 | SEGMENT_D0, + EnumsToFlags( + PaintSegment::topRightSide, PaintSegment::bottomRightSide, PaintSegment::rightCorner, + PaintSegment::centre, PaintSegment::topCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide, + PaintSegment::bottomLeftSide), direction), 0xFFFF, 0); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::rightCorner, PaintSegment::topRightSide, PaintSegment::bottomRightSide), + direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_B8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomCorner, PaintSegment::leftCorner), + direction), 0xFFFF, 0); break; case 6: - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; } @@ -982,38 +1001,55 @@ static void PaintSplashBoatsTrackRightQuarterTurn5Tiles( switch (trackSequence) { case 0: - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; case 1: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::topRightSide), + direction), 0xFFFF, 0); break; case 3: PaintUtilSetSegmentSupportHeight( session, PaintUtilRotateSegments( - SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_D0 | SEGMENT_D4, + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide, PaintSegment::centre, + PaintSegment::leftCorner, PaintSegment::rightCorner, PaintSegment::bottomLeftSide, + PaintSegment::bottomRightSide), direction), 0xFFFF, 0); break; case 4: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::topCorner, PaintSegment::topLeftSide, PaintSegment::topRightSide), direction), + 0xFFFF, 0); break; case 5: PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomRightSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner, PaintSegment::bottomCorner, PaintSegment::topLeftSide), + direction), 0xFFFF, 0); break; case 6: - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; } @@ -1080,7 +1116,7 @@ static void PaintSplashBoatsTrackSBendLeft( session, direction, frontImageId, { 0, 0, height }, { { 0, 2, height + 27 }, { 32, 27, 0 } }); WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; case 1: bboy = (direction == 0 || direction == 1) ? 0 : 6; @@ -1093,7 +1129,11 @@ static void PaintSplashBoatsTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); break; case 2: @@ -1107,7 +1147,11 @@ static void PaintSplashBoatsTrackSBendLeft( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); break; case 3: @@ -1116,7 +1160,7 @@ static void PaintSplashBoatsTrackSBendLeft( session, direction, frontImageId, { 0, 0, height }, { { 0, 2, height + 27 }, { 32, 27, 0 } }); WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; } @@ -1182,7 +1226,7 @@ static void PaintSplashBoatsTrackSBendRight( session, direction, frontImageId, { 0, 0, height }, { { 0, 2, height + 27 }, { 32, 27, 0 } }); WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; case 1: bboy = (direction == 2 || direction == 3) ? 0 : 6; @@ -1195,7 +1239,11 @@ static void PaintSplashBoatsTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::rightCorner, PaintSegment::bottomCorner, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::bottomLeftSide, PaintSegment::bottomRightSide), + direction), 0xFFFF, 0); break; case 2: @@ -1209,7 +1257,11 @@ static void PaintSplashBoatsTrackSBendRight( PaintUtilSetSegmentSupportHeight( session, - PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topCorner, PaintSegment::leftCorner, PaintSegment::centre, PaintSegment::topLeftSide, + PaintSegment::topRightSide, PaintSegment::bottomLeftSide), + direction), 0xFFFF, 0); break; case 3: @@ -1218,7 +1270,7 @@ static void PaintSplashBoatsTrackSBendRight( session, direction, frontImageId, { 0, 0, height }, { { 0, 2, height + 27 }, { 32, 27, 0 } }); WoodenASupportsPaintSetupRotated( session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, height, session.SupportColours); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); break; } @@ -1268,7 +1320,7 @@ static void PaintSplashBoatsTrackOnRidePhoto( TrackPaintUtilOnridePhotoPaint(session, direction, height + 3, trackElement); PaintUtilPushTunnelRotated(session, direction, height, TUNNEL_SQUARE_FLAT); - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20); } diff --git a/src/openrct2/ride/water/SubmarineRide.cpp b/src/openrct2/ride/water/SubmarineRide.cpp index a9c10d903c..95f48f484a 100644 --- a/src/openrct2/ride/water/SubmarineRide.cpp +++ b/src/openrct2/ride/water/SubmarineRide.cpp @@ -91,7 +91,7 @@ static void SubmarineRidePaintTrackStation( session, ride, stationObj, session.MapPosition, direction, height, trackElement, session.CurrentRotation); } - PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); + PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 32, 0x20); } @@ -123,7 +123,10 @@ static void SubmarineRidePaintTrackFlat( } PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags(PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide), direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 16, 0x20); } @@ -142,17 +145,35 @@ static void SubmarineRidePaintTrackLeftQuarterTurn3Tiles( MetalASupportsPaintSetup( session, MetalSupportType::Stick, MetalSupportPlace::Centre, -1, height - 16, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::bottomLeftSide, PaintSegment::centre, PaintSegment::topRightSide, + PaintSegment::topCorner), + direction), + 0xFFFF, 0); break; case 2: PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomLeftSide, + PaintSegment::leftCorner), + direction), + 0xFFFF, 0); break; case 3: MetalASupportsPaintSetup( session, MetalSupportType::Stick, MetalSupportPlace::Centre, -1, height - 16, session.SupportColours); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomRightSide, + PaintSegment::bottomCorner), + direction), + 0xFFFF, 0); break; } @@ -182,7 +203,12 @@ static void SubmarineRidePaintTrackLeftQuarterTurn1Tile( TrackPaintUtilLeftQuarterTurn1TileTunnel(session, direction, height - 16, 0, TUNNEL_0, 0, TUNNEL_0); PaintUtilSetSegmentSupportHeight( - session, PaintUtilRotateSegments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + session, + PaintUtilRotateSegments( + EnumsToFlags( + PaintSegment::leftCorner, PaintSegment::topLeftSide, PaintSegment::centre, PaintSegment::bottomLeftSide), + direction), + 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 16, 0x20); } diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 1c141a8bbb..b46897c785 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -104,7 +104,7 @@ void ScenarioReset(GameState_t& gameState) gameState.ParkRating = park.CalculateParkRating(); gameState.ParkValue = park.CalculateParkValue(); gameState.CompanyValue = park.CalculateCompanyValue(); - gHistoricalProfit = gameState.InitialCash - gameState.BankLoan; + gameState.HistoricalProfit = gameState.InitialCash - gameState.BankLoan; gameState.Cash = gameState.InitialCash; { @@ -156,15 +156,15 @@ void ScenarioReset(GameState_t& gameState) Staff::ResetStats(); auto& objManager = GetContext()->GetObjectManager(); - gLastEntranceStyle = objManager.GetLoadedObjectEntryIndex("rct2.station.plain"); - if (gLastEntranceStyle == OBJECT_ENTRY_INDEX_NULL) + gameState.LastEntranceStyle = objManager.GetLoadedObjectEntryIndex("rct2.station.plain"); + if (gameState.LastEntranceStyle == OBJECT_ENTRY_INDEX_NULL) { // Fall back to first entrance object - gLastEntranceStyle = 0; + gameState.LastEntranceStyle = 0; } gMarketingCampaigns.clear(); - gParkRatingCasualtyPenalty = 0; + gameState.ParkRatingCasualtyPenalty = 0; // Open park with free entry when there is no money if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) @@ -256,7 +256,7 @@ static void ScenarioCheckEntranceFeeTooHigh() void ScenarioAutosaveCheck() { - if (gLastAutoSaveUpdate == AUTOSAVE_PAUSE) + if (gLastAutoSaveUpdate == kAutosavePause) return; // Milliseconds since last save @@ -284,7 +284,7 @@ void ScenarioAutosaveCheck() if (shouldSave) { - gLastAutoSaveUpdate = AUTOSAVE_PAUSE; + gLastAutoSaveUpdate = kAutosavePause; GameAutosave(); } } @@ -309,8 +309,8 @@ static void ScenarioDayUpdate(GameState_t& gameState) } // Lower the casualty penalty - uint16_t casualtyPenaltyModifier = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) ? 40 : 7; - gParkRatingCasualtyPenalty = std::max(0, gParkRatingCasualtyPenalty - casualtyPenaltyModifier); + uint16_t casualtyPenaltyModifier = (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) ? 40 : 7; + gameState.ParkRatingCasualtyPenalty = std::max(0, gameState.ParkRatingCasualtyPenalty - casualtyPenaltyModifier); auto intent = Intent(INTENT_ACTION_UPDATE_DATE); ContextBroadcastIntent(&intent); @@ -743,7 +743,7 @@ ObjectiveStatus Objective::CheckGuestsAndRating() const ObjectiveStatus Objective::CheckMonthlyRideIncome() const { - money64 lastMonthRideIncome = gExpenditureTable[1][static_cast(ExpenditureType::ParkRideTickets)]; + money64 lastMonthRideIncome = GetGameState().ExpenditureTable[1][EnumValue(ExpenditureType::ParkRideTickets)]; if (lastMonthRideIncome >= Currency) { return ObjectiveStatus::Success; @@ -831,11 +831,11 @@ ObjectiveStatus Objective::CheckRepayLoanAndParkValue() const ObjectiveStatus Objective::CheckMonthlyFoodIncome() const { - const auto* lastMonthExpenditure = gExpenditureTable[1]; - auto lastMonthProfit = lastMonthExpenditure[static_cast(ExpenditureType::ShopSales)] - + lastMonthExpenditure[static_cast(ExpenditureType::ShopStock)] - + lastMonthExpenditure[static_cast(ExpenditureType::FoodDrinkSales)] - + lastMonthExpenditure[static_cast(ExpenditureType::FoodDrinkStock)]; + const auto* lastMonthExpenditure = GetGameState().ExpenditureTable[1]; + auto lastMonthProfit = lastMonthExpenditure[EnumValue(ExpenditureType::ShopSales)] + + lastMonthExpenditure[EnumValue(ExpenditureType::ShopStock)] + + lastMonthExpenditure[EnumValue(ExpenditureType::FoodDrinkSales)] + + lastMonthExpenditure[EnumValue(ExpenditureType::FoodDrinkStock)]; if (lastMonthProfit >= Currency) { diff --git a/src/openrct2/scenario/Scenario.h b/src/openrct2/scenario/Scenario.h index fe6c61fe95..ce82e5d489 100644 --- a/src/openrct2/scenario/Scenario.h +++ b/src/openrct2/scenario/Scenario.h @@ -43,9 +43,6 @@ enum S6_TYPE_SCENARIO }; -#define S6_RCT2_VERSION 120001 -#define S6_MAGIC_NUMBER 0x00031144 - enum SCENARIO_CATEGORY { // RCT2 categories (keep order) @@ -151,8 +148,8 @@ enum AUTOSAVE_NEVER }; -#define AUTOSAVE_PAUSE 0 -#define DEFAULT_NUM_AUTOSAVES_TO_KEEP 10 +constexpr uint8_t kAutosavePause = 0; +constexpr uint8_t kDefaultNumAutosavesToKeep = 10; static constexpr money64 COMPANY_VALUE_ON_FAILED_OBJECTIVE = 0x8000000000000001; diff --git a/src/openrct2/scenario/ScenarioSources.cpp b/src/openrct2/scenario/ScenarioSources.cpp index fb361d91f0..e9bbee8360 100644 --- a/src/openrct2/scenario/ScenarioSources.cpp +++ b/src/openrct2/scenario/ScenarioSources.cpp @@ -201,10 +201,10 @@ namespace ScenarioSources { SC_OCTAGON_PARK, "Octagon Park", SCENARIO_CATEGORY_CHALLENGING }, { SC_PLEASURE_ISLAND, "Pleasure Island", SCENARIO_CATEGORY_CHALLENGING }, { SC_ICICLE_WORLDS, "Icicle Worlds", SCENARIO_CATEGORY_CHALLENGING }, - { SC_SOUTHERN_SANDS, "Southern Sands", SCENARIO_CATEGORY_CHALLENGING }, - { SC_TINY_TOWERS, "Tiny Towers", SCENARIO_CATEGORY_CHALLENGING }, - { SC_NEVERMORE_PARK, "Nevermore Park", SCENARIO_CATEGORY_CHALLENGING }, - { SC_PACIFICA, "Pacifica", SCENARIO_CATEGORY_CHALLENGING }, + { SC_SOUTHERN_SANDS, "Southern Sands", SCENARIO_CATEGORY_EXPERT }, + { SC_TINY_TOWERS, "Tiny Towers", SCENARIO_CATEGORY_EXPERT }, + { SC_NEVERMORE_PARK, "Nevermore Park", SCENARIO_CATEGORY_EXPERT }, + { SC_PACIFICA, "Pacifica", SCENARIO_CATEGORY_EXPERT }, { SC_URBAN_JUNGLE, "Urban Jungle", SCENARIO_CATEGORY_EXPERT }, { SC_TERROR_TOWN, "Terror Town", SCENARIO_CATEGORY_EXPERT }, { SC_MEGAWORLD_PARK, "Megaworld Park", SCENARIO_CATEGORY_EXPERT }, @@ -235,23 +235,23 @@ namespace ScenarioSources // RCT2: Wacky Worlds static constexpr ScenarioTitleDescriptor ScenarioTitlesRCT2WW[] = { - { SC_UNIDENTIFIED, "Africa - Victoria Falls", SCENARIO_CATEGORY_BEGINNER }, - { SC_UNIDENTIFIED, "Asia - Great Wall of China Tourism Enhancement", SCENARIO_CATEGORY_BEGINNER }, { SC_UNIDENTIFIED, "North America - Grand Canyon", SCENARIO_CATEGORY_BEGINNER }, - { SC_UNIDENTIFIED, "South America - Rio Carnival", SCENARIO_CATEGORY_BEGINNER }, - { SC_UNIDENTIFIED, "Africa - African Diamond Mine", SCENARIO_CATEGORY_CHALLENGING }, + { SC_UNIDENTIFIED, "Asia - Great Wall of China Tourism Enhancement", SCENARIO_CATEGORY_BEGINNER }, + { SC_UNIDENTIFIED, "Africa - African Diamond Mine", SCENARIO_CATEGORY_BEGINNER }, + { SC_UNIDENTIFIED, "Australasia - Ayers Rock", SCENARIO_CATEGORY_BEGINNER }, + { SC_UNIDENTIFIED, "North America - Rollercoaster Heaven", SCENARIO_CATEGORY_BEGINNER }, + { SC_UNIDENTIFIED, "Africa - Oasis", SCENARIO_CATEGORY_CHALLENGING }, + { SC_UNIDENTIFIED, "South America - Rio Carnival", SCENARIO_CATEGORY_CHALLENGING }, { SC_UNIDENTIFIED, "Asia - Maharaja Palace", SCENARIO_CATEGORY_CHALLENGING }, - { SC_UNIDENTIFIED, "Australasia - Ayers Rock", SCENARIO_CATEGORY_CHALLENGING }, - { SC_UNIDENTIFIED, "Europe - European Cultural Festival", SCENARIO_CATEGORY_CHALLENGING }, - { SC_UNIDENTIFIED, "North America - Rollercoaster Heaven", SCENARIO_CATEGORY_CHALLENGING }, - { SC_UNIDENTIFIED, "South America - Inca Lost City", SCENARIO_CATEGORY_CHALLENGING }, - { SC_UNIDENTIFIED, "Africa - Oasis", SCENARIO_CATEGORY_EXPERT }, + { SC_UNIDENTIFIED, "Africa - Victoria Falls", SCENARIO_CATEGORY_CHALLENGING }, + { SC_UNIDENTIFIED, "N. America - Extreme Hawaiian Island", SCENARIO_CATEGORY_CHALLENGING }, + { SC_UNIDENTIFIED, "South America - Rain Forest Plateau", SCENARIO_CATEGORY_CHALLENGING }, + { SC_UNIDENTIFIED, "Europe - Renovation", SCENARIO_CATEGORY_CHALLENGING }, { SC_UNIDENTIFIED, "Antarctic - Ecological Salvage", SCENARIO_CATEGORY_EXPERT }, - { SC_UNIDENTIFIED, "Asia - Japanese Coastal Reclaim", SCENARIO_CATEGORY_EXPERT }, + { SC_UNIDENTIFIED, "Europe - European Cultural Festival", SCENARIO_CATEGORY_EXPERT }, { SC_UNIDENTIFIED, "Australasia - Fun at the Beach", SCENARIO_CATEGORY_EXPERT }, - { SC_UNIDENTIFIED, "Europe - Renovation", SCENARIO_CATEGORY_EXPERT }, - { SC_UNIDENTIFIED, "N. America - Extreme Hawaiian Island", SCENARIO_CATEGORY_EXPERT }, - { SC_UNIDENTIFIED, "South America - Rain Forest Plateau", SCENARIO_CATEGORY_EXPERT }, + { SC_UNIDENTIFIED, "South America - Inca Lost City", SCENARIO_CATEGORY_EXPERT }, + { SC_UNIDENTIFIED, "Asia - Japanese Coastal Reclaim", SCENARIO_CATEGORY_EXPERT }, }; // RCT2: Time Twister diff --git a/src/openrct2/scripting/ScriptEngine.h b/src/openrct2/scripting/ScriptEngine.h index ba37b88962..dcc7019303 100644 --- a/src/openrct2/scripting/ScriptEngine.h +++ b/src/openrct2/scripting/ScriptEngine.h @@ -47,7 +47,7 @@ namespace OpenRCT2 namespace OpenRCT2::Scripting { - static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 83; + static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 84; // Versions marking breaking changes. static constexpr int32_t API_VERSION_33_PEEP_DEPRECATION = 33; diff --git a/src/openrct2/scripting/bindings/entity/ScGuest.cpp b/src/openrct2/scripting/bindings/entity/ScGuest.cpp index c865e2c136..f6072f989d 100644 --- a/src/openrct2/scripting/bindings/entity/ScGuest.cpp +++ b/src/openrct2/scripting/bindings/entity/ScGuest.cpp @@ -830,7 +830,7 @@ namespace OpenRCT2::Scripting // format string with arguments auto ft = Formatter(); PeepThoughtSetFormatArgs(&_backing, ft); - return FormatStringID(STR_STRINGID, ft.Data()); + return FormatStringIDLegacy(STR_STRINGID, ft.Data()); } } // namespace OpenRCT2::Scripting diff --git a/src/openrct2/scripting/bindings/entity/ScVehicle.cpp b/src/openrct2/scripting/bindings/entity/ScVehicle.cpp index 41ace4a6c3..abd7a939fb 100644 --- a/src/openrct2/scripting/bindings/entity/ScVehicle.cpp +++ b/src/openrct2/scripting/bindings/entity/ScVehicle.cpp @@ -155,7 +155,7 @@ namespace OpenRCT2::Scripting uint8_t ScVehicle::numSeats_get() const { auto vehicle = GetVehicle(); - return vehicle != nullptr ? vehicle->num_seats & VEHICLE_SEAT_NUM_MASK : 0; + return vehicle != nullptr ? vehicle->num_seats & kVehicleSeatNumMask : 0; } void ScVehicle::numSeats_set(uint8_t value) { @@ -163,8 +163,8 @@ namespace OpenRCT2::Scripting auto vehicle = GetVehicle(); if (vehicle != nullptr) { - vehicle->num_seats &= ~VEHICLE_SEAT_NUM_MASK; - vehicle->num_seats |= value & VEHICLE_SEAT_NUM_MASK; + vehicle->num_seats &= ~kVehicleSeatNumMask; + vehicle->num_seats |= value & kVehicleSeatNumMask; } } diff --git a/src/openrct2/scripting/bindings/game/ScCheats.hpp b/src/openrct2/scripting/bindings/game/ScCheats.hpp index f80f7ee622..4ba6849a8b 100644 --- a/src/openrct2/scripting/bindings/game/ScCheats.hpp +++ b/src/openrct2/scripting/bindings/game/ScCheats.hpp @@ -12,6 +12,7 @@ #ifdef ENABLE_SCRIPTING # include "../../../Cheats.h" +# include "../../../GameState.h" # include "../../Duktape.hpp" # include "../../ScriptEngine.h" @@ -78,266 +79,266 @@ namespace OpenRCT2::Scripting private: bool allowArbitraryRideTypeChanges_get() { - return gCheatsAllowArbitraryRideTypeChanges; + return GetGameState().Cheats.AllowArbitraryRideTypeChanges; } void allowArbitraryRideTypeChanges_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsAllowArbitraryRideTypeChanges = value; + GetGameState().Cheats.AllowArbitraryRideTypeChanges = value; } bool allowTrackPlaceInvalidHeights_get() { - return gCheatsAllowTrackPlaceInvalidHeights; + return GetGameState().Cheats.AllowTrackPlaceInvalidHeights; } void allowTrackPlaceInvalidHeights_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsAllowTrackPlaceInvalidHeights = value; + GetGameState().Cheats.AllowTrackPlaceInvalidHeights = value; } bool buildInPauseMode_get() { - return gCheatsBuildInPauseMode; + return GetGameState().Cheats.BuildInPauseMode; } void buildInPauseMode_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsBuildInPauseMode = value; + GetGameState().Cheats.BuildInPauseMode = value; } bool disableAllBreakdowns_get() { - return gCheatsDisableAllBreakdowns; + return GetGameState().Cheats.DisableAllBreakdowns; } void disableAllBreakdowns_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsDisableAllBreakdowns = value; + GetGameState().Cheats.DisableAllBreakdowns = value; } bool disableBrakesFailure_get() { - return gCheatsDisableBrakesFailure; + return GetGameState().Cheats.DisableBrakesFailure; } void disableBrakesFailure_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsDisableBrakesFailure = value; + GetGameState().Cheats.DisableBrakesFailure = value; } bool disableClearanceChecks_get() { - return gCheatsDisableClearanceChecks; + return GetGameState().Cheats.DisableClearanceChecks; } void disableClearanceChecks_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsDisableClearanceChecks = value; + GetGameState().Cheats.DisableClearanceChecks = value; } bool disableLittering_get() { - return gCheatsDisableLittering; + return GetGameState().Cheats.DisableLittering; } void disableLittering_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsDisableLittering = value; + GetGameState().Cheats.DisableLittering = value; } bool disablePlantAging_get() { - return gCheatsDisablePlantAging; + return GetGameState().Cheats.DisablePlantAging; } void disablePlantAging_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsDisablePlantAging = value; + GetGameState().Cheats.DisablePlantAging = value; } bool allowRegularPathAsQueue_get() { - return gCheatsAllowRegularPathAsQueue; + return GetGameState().Cheats.AllowRegularPathAsQueue; } void allowRegularPathAsQueue_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsAllowRegularPathAsQueue = value; + GetGameState().Cheats.AllowRegularPathAsQueue = value; } bool allowSpecialColourSchemes_get() { - return gCheatsAllowSpecialColourSchemes; + return GetGameState().Cheats.AllowSpecialColourSchemes; } void allowSpecialColourSchemes_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsAllowSpecialColourSchemes = value; + GetGameState().Cheats.AllowSpecialColourSchemes = value; } bool disableRideValueAging_get() { - return gCheatsDisableRideValueAging; + return GetGameState().Cheats.DisableRideValueAging; } void disableRideValueAging_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsDisableRideValueAging = value; + GetGameState().Cheats.DisableRideValueAging = value; } bool disableSupportLimits_get() { - return gCheatsDisableSupportLimits; + return GetGameState().Cheats.DisableSupportLimits; } void disableSupportLimits_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsDisableSupportLimits = value; + GetGameState().Cheats.DisableSupportLimits = value; } bool disableTrainLengthLimit_get() { - return gCheatsDisableTrainLengthLimit; + return GetGameState().Cheats.DisableTrainLengthLimit; } void disableTrainLengthLimit_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsDisableTrainLengthLimit = value; + GetGameState().Cheats.DisableTrainLengthLimit = value; } bool disableVandalism_get() { - return gCheatsDisableVandalism; + return GetGameState().Cheats.DisableVandalism; } void disableVandalism_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsDisableVandalism = value; + GetGameState().Cheats.DisableVandalism = value; } bool enableAllDrawableTrackPieces_get() { - return gCheatsEnableAllDrawableTrackPieces; + return GetGameState().Cheats.EnableAllDrawableTrackPieces; } void enableAllDrawableTrackPieces_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsEnableAllDrawableTrackPieces = value; + GetGameState().Cheats.EnableAllDrawableTrackPieces = value; } bool enableChainLiftOnAllTrack_get() { - return gCheatsEnableChainLiftOnAllTrack; + return GetGameState().Cheats.EnableChainLiftOnAllTrack; } void enableChainLiftOnAllTrack_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsEnableChainLiftOnAllTrack = value; + GetGameState().Cheats.EnableChainLiftOnAllTrack = value; } bool fastLiftHill_get() { - return gCheatsUnlockOperatingLimits; + return GetGameState().Cheats.UnlockOperatingLimits; } void fastLiftHill_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsUnlockOperatingLimits = value; + GetGameState().Cheats.UnlockOperatingLimits = value; } bool freezeWeather_get() { - return gCheatsFreezeWeather; + return GetGameState().Cheats.FreezeWeather; } void freezeWeather_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsFreezeWeather = value; + GetGameState().Cheats.FreezeWeather = value; } bool ignoreResearchStatus_get() { - return gCheatsIgnoreResearchStatus; + return GetGameState().Cheats.IgnoreResearchStatus; } void ignoreResearchStatus_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsIgnoreResearchStatus = value; + GetGameState().Cheats.IgnoreResearchStatus = value; } bool ignoreRideIntensity_get() { - return gCheatsIgnoreRideIntensity; + return GetGameState().Cheats.IgnoreRideIntensity; } void ignoreRideIntensity_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsIgnoreRideIntensity = value; + GetGameState().Cheats.IgnoreRideIntensity = value; } bool neverendingMarketing_get() { - return gCheatsNeverendingMarketing; + return GetGameState().Cheats.NeverendingMarketing; } void neverendingMarketing_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsNeverendingMarketing = value; + GetGameState().Cheats.NeverendingMarketing = value; } bool sandboxMode_get() { - return gCheatsSandboxMode; + return GetGameState().Cheats.SandboxMode; } void sandboxMode_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsSandboxMode = value; + GetGameState().Cheats.SandboxMode = value; } bool showAllOperatingModes_get() { - return gCheatsShowAllOperatingModes; + return GetGameState().Cheats.ShowAllOperatingModes; } void showAllOperatingModes_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsShowAllOperatingModes = value; + GetGameState().Cheats.ShowAllOperatingModes = value; } bool showVehiclesFromOtherTrackTypes_get() { - return gCheatsShowVehiclesFromOtherTrackTypes; + return GetGameState().Cheats.ShowVehiclesFromOtherTrackTypes; } void showVehiclesFromOtherTrackTypes_set(bool value) { ThrowIfGameStateNotMutable(); - gCheatsShowVehiclesFromOtherTrackTypes = value; + GetGameState().Cheats.ShowVehiclesFromOtherTrackTypes = value; } }; } // namespace OpenRCT2::Scripting diff --git a/src/openrct2/scripting/bindings/ride/ScTrackIterator.cpp b/src/openrct2/scripting/bindings/ride/ScTrackIterator.cpp index c797ac7639..6f9cd60626 100644 --- a/src/openrct2/scripting/bindings/ride/ScTrackIterator.cpp +++ b/src/openrct2/scripting/bindings/ride/ScTrackIterator.cpp @@ -23,6 +23,8 @@ using namespace OpenRCT2::TrackMetaData; std::shared_ptr ScTrackIterator::FromElement(const CoordsXY& position, int32_t elementIndex) { auto el = MapGetNthElementAt(position, elementIndex); + if (el == nullptr) + return nullptr; auto origin = GetTrackSegmentOrigin(CoordsXYE(position, el)); if (!origin) return nullptr; diff --git a/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp b/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp index 56421b7982..64df591cd9 100644 --- a/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp +++ b/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp @@ -189,8 +189,7 @@ std::vector ScTrackSegment::getSubpositions(uint8_t trackSubposition, for (auto idx = 0; idx < size; idx++) { - result.push_back( - ToDuk(ctx, gTrackVehicleInfo[static_cast(trackSubposition)][typeAndDirection]->info[idx])); + result.push_back(ToDuk(ctx, gTrackVehicleInfo[trackSubposition][typeAndDirection]->info[idx])); } return result; } diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index 58b7e59cea..ae849cb189 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -243,12 +243,12 @@ namespace OpenRCT2::Scripting money64 ScPark::landPrice_get() const { - return gLandPrice; + return GetGameState().LandPrice; } void ScPark::landPrice_set(money64 value) { ThrowIfGameStateNotMutable(); - gLandPrice = value; + GetGameState().LandPrice = value; } money64 ScPark::constructionRightsPrice_get() const @@ -263,12 +263,12 @@ namespace OpenRCT2::Scripting int16_t ScPark::casualtyPenalty_get() const { - return gParkRatingCasualtyPenalty; + return GetGameState().ParkRatingCasualtyPenalty; } void ScPark::casualtyPenalty_set(int16_t value) { ThrowIfGameStateNotMutable(); - gParkRatingCasualtyPenalty = value; + GetGameState().ParkRatingCasualtyPenalty = value; } uint16_t ScPark::parkSize_get() const diff --git a/src/openrct2/scripting/bindings/world/ScTileElement.cpp b/src/openrct2/scripting/bindings/world/ScTileElement.cpp index 53c5111eef..2d90305dbf 100644 --- a/src/openrct2/scripting/bindings/world/ScTileElement.cpp +++ b/src/openrct2/scripting/bindings/world/ScTileElement.cpp @@ -1153,6 +1153,12 @@ namespace OpenRCT2::Scripting duk_push_int(ctx, el->GetEntranceType()); break; } + case TileElementType::Banner: + { + auto* el = _element->AsBanner(); + duk_push_int(ctx, el->GetBanner()->type); + break; + } default: { duk_push_null(ctx); @@ -1207,6 +1213,13 @@ namespace OpenRCT2::Scripting Invalidate(); break; } + case TileElementType::Banner: + { + auto* el = _element->AsBanner(); + el->GetBanner()->type = index; + Invalidate(); + break; + } default: break; } @@ -1314,6 +1327,12 @@ namespace OpenRCT2::Scripting duk_push_int(ctx, el->GetPrimaryColour()); break; } + case TileElementType::Banner: + { + auto* el = _element->AsBanner(); + duk_push_int(ctx, el->GetBanner()->colour); + break; + } default: { duk_push_null(ctx); @@ -1348,6 +1367,13 @@ namespace OpenRCT2::Scripting Invalidate(); break; } + case TileElementType::Banner: + { + auto* el = _element->AsBanner(); + el->GetBanner()->colour = value; + Invalidate(); + break; + } default: break; } @@ -1377,6 +1403,12 @@ namespace OpenRCT2::Scripting duk_push_int(ctx, el->GetSecondaryColour()); break; } + case TileElementType::Banner: + { + auto* el = _element->AsBanner(); + duk_push_int(ctx, el->GetBanner()->text_colour); + break; + } default: { duk_push_null(ctx); @@ -1411,6 +1443,13 @@ namespace OpenRCT2::Scripting Invalidate(); break; } + case TileElementType::Banner: + { + auto* el = _element->AsBanner(); + el->GetBanner()->text_colour = value; + Invalidate(); + break; + } default: break; } @@ -2040,13 +2079,75 @@ namespace OpenRCT2::Scripting duk_push_uint(ctx, _element->GetOwner()); return DukValue::take_from_stack(ctx); } - void ScTileElement::owner_set(uint8_t value) { ThrowIfGameStateNotMutable(); _element->SetOwner(value); } + DukValue ScTileElement::bannerText_get() const + { + auto& scriptEngine = GetContext()->GetScriptEngine(); + auto* ctx = scriptEngine.GetContext(); + BannerIndex idx = _element->GetBannerIndex(); + if (idx == BannerIndex::GetNull()) + duk_push_null(ctx); + else + duk_push_string(ctx, GetBanner(idx)->GetText().c_str()); + return DukValue::take_from_stack(ctx); + } + void ScTileElement::bannerText_set(std::string value) + { + ThrowIfGameStateNotMutable(); + BannerIndex idx = _element->GetBannerIndex(); + if (idx != BannerIndex::GetNull()) + { + auto banner = GetBanner(idx); + banner->text = value; + if (_element->GetType() != TileElementType::Banner) + { + if (value.empty()) + banner->ride_index = BannerGetClosestRideIndex({ banner->position.ToCoordsXY(), 16 }); + else + banner->ride_index = RideId::GetNull(); + + if (banner->ride_index.IsNull()) + banner->flags &= ~BANNER_FLAG_LINKED_TO_RIDE; + else + banner->flags |= BANNER_FLAG_LINKED_TO_RIDE; + } + } + } + + DukValue ScTileElement::isNoEntry_get() const + { + auto& scriptEngine = GetContext()->GetScriptEngine(); + auto* ctx = scriptEngine.GetContext(); + auto* el = _element->AsBanner(); + if (el != nullptr) + duk_push_boolean(ctx, (el->GetBanner()->flags & BANNER_FLAG_NO_ENTRY) != 0); + else + duk_push_null(ctx); + return DukValue::take_from_stack(ctx); + } + void ScTileElement::isNoEntry_set(bool value) + { + ThrowIfGameStateNotMutable(); + auto* el = _element->AsBanner(); + if (el != nullptr) + { + if (value) + { + el->GetBanner()->flags |= BANNER_FLAG_NO_ENTRY; + } + else + { + el->GetBanner()->flags &= ~BANNER_FLAG_NO_ENTRY; + } + Invalidate(); + } + } + void ScTileElement::Invalidate() { MapInvalidateTileFull(_coords); @@ -2070,17 +2171,20 @@ namespace OpenRCT2::Scripting // Track | Small Scenery | Wall | Entrance | Large Scenery | Banner dukglue_register_property(ctx, &ScTileElement::direction_get, &ScTileElement::direction_set, "direction"); - // Path | Small Scenery | Wall | Entrance | Large Scenery + // Path | Small Scenery | Wall | Entrance | Large Scenery | Banner dukglue_register_property(ctx, &ScTileElement::object_get, &ScTileElement::object_set, "object"); - // Small Scenery | Wall | Large Scenery + // Small Scenery | Wall | Large Scenery | Banner dukglue_register_property(ctx, &ScTileElement::primaryColour_get, &ScTileElement::primaryColour_set, "primaryColour"); dukglue_register_property( ctx, &ScTileElement::secondaryColour_get, &ScTileElement::secondaryColour_set, "secondaryColour"); + + // Small Scenery | Wall | Large Scenery dukglue_register_property( ctx, &ScTileElement::tertiaryColour_get, &ScTileElement::tertiaryColour_set, "tertiaryColour"); // Wall | Large Scenery | Banner + dukglue_register_property(ctx, &ScTileElement::bannerText_get, &ScTileElement::bannerText_set, "bannerText"); dukglue_register_property(ctx, &ScTileElement::bannerIndex_get, &ScTileElement::bannerIndex_set, "bannerIndex"); // Path | Track | Entrance @@ -2152,6 +2256,9 @@ namespace OpenRCT2::Scripting ctx, &ScTileElement::footpathObject_get, &ScTileElement::footpathObject_set, "footpathObject"); dukglue_register_property( ctx, &ScTileElement::footpathSurfaceObject_get, &ScTileElement::footpathSurfaceObject_set, "footpathSurfaceObject"); + + // Banner only + dukglue_register_property(ctx, &ScTileElement::isNoEntry_get, &ScTileElement::isNoEntry_set, "isNoEntry"); } } // namespace OpenRCT2::Scripting diff --git a/src/openrct2/scripting/bindings/world/ScTileElement.hpp b/src/openrct2/scripting/bindings/world/ScTileElement.hpp index 4c0ad05c03..31499a24d4 100644 --- a/src/openrct2/scripting/bindings/world/ScTileElement.hpp +++ b/src/openrct2/scripting/bindings/world/ScTileElement.hpp @@ -205,6 +205,12 @@ namespace OpenRCT2::Scripting DukValue owner_get() const; void owner_set(uint8_t value); + DukValue bannerText_get() const; + void bannerText_set(std::string value); + + DukValue isNoEntry_get() const; + void isNoEntry_set(bool value); + void Invalidate(); public: diff --git a/src/openrct2/title/Command/LoadScenario.h b/src/openrct2/title/Command/LoadScenario.h index 4a7840300d..a8caaf9ae5 100644 --- a/src/openrct2/title/Command/LoadScenario.h +++ b/src/openrct2/title/Command/LoadScenario.h @@ -13,7 +13,7 @@ #include -#define TITLE_COMMAND_SCENARIO_LENGTH 64 +constexpr uint8_t kTitleCommandScenarioLength = 64; namespace OpenRCT2::Title { @@ -22,7 +22,7 @@ namespace OpenRCT2::Title static constexpr const char* Name = "Load Scenario Command"; static constexpr const char* ScriptingName = "loadsc"; - utf8 Scenario[TITLE_COMMAND_SCENARIO_LENGTH]{}; + utf8 Scenario[kTitleCommandScenarioLength]{}; int16_t operator()(int16_t timer); }; diff --git a/src/openrct2/title/Command/RotateView.cpp b/src/openrct2/title/Command/RotateView.cpp index a4e6ac7263..b49cf5b313 100644 --- a/src/openrct2/title/Command/RotateView.cpp +++ b/src/openrct2/title/Command/RotateView.cpp @@ -9,19 +9,16 @@ #include "RotateView.h" +#include "../../interface/Viewport.h" #include "../../interface/Window.h" namespace OpenRCT2::Title { int16_t RotateViewCommand::operator()(int16_t timer) { - WindowBase* w = WindowGetMain(); - if (w != nullptr) + for (uint_fast8_t i = 0; i < Rotations; i++) { - for (uint_fast8_t i = 0; i < Rotations; i++) - { - WindowRotateCamera(*w, 1); - } + ViewportRotateAll(1); } return 0; diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index 42192b387d..790663cd98 100644 --- a/src/openrct2/title/TitleScreen.cpp +++ b/src/openrct2/title/TitleScreen.cpp @@ -258,9 +258,9 @@ void TitleScreen::TitleInitialise() int32_t random = 0; bool safeSequence = false; - const std::string RCT1String = FormatStringID(STR_TITLE_SEQUENCE_RCT1, nullptr); - const std::string RCT1AAString = FormatStringID(STR_TITLE_SEQUENCE_RCT1_AA, nullptr); - const std::string RCT1LLString = FormatStringID(STR_TITLE_SEQUENCE_RCT1_AA_LL, nullptr); + const std::string RCT1String = LanguageGetString(STR_TITLE_SEQUENCE_RCT1); + const std::string RCT1AAString = LanguageGetString(STR_TITLE_SEQUENCE_RCT1_AA); + const std::string RCT1LLString = LanguageGetString(STR_TITLE_SEQUENCE_RCT1_AA_LL); // Ensure the random sequence chosen isn't from RCT1 or expansion if the player doesn't have it installed while (!safeSequence) diff --git a/src/openrct2/windows/Intent.h b/src/openrct2/windows/Intent.h index ae2a699fd9..96e635c82e 100644 --- a/src/openrct2/windows/Intent.h +++ b/src/openrct2/windows/Intent.h @@ -43,6 +43,7 @@ enum IntentAction INTENT_ACTION_UPDATE_CASH, INTENT_ACTION_UPDATE_BANNER, INTENT_ACTION_UPDATE_RESEARCH, + INTENT_ACTION_UPDATE_VEHICLE_SOUNDS, INTENT_ACTION_TRACK_DESIGN_REMOVE_PROVISIONAL, INTENT_ACTION_TRACK_DESIGN_RESTORE_PROVISIONAL, INTENT_ACTION_SET_MAP_TOOLTIP, diff --git a/src/openrct2/windows/_legacy.cpp b/src/openrct2/windows/_legacy.cpp index c42066c62e..f2d78f4cea 100644 --- a/src/openrct2/windows/_legacy.cpp +++ b/src/openrct2/windows/_legacy.cpp @@ -10,6 +10,7 @@ #include "../Cheats.h" #include "../Context.h" #include "../Game.h" +#include "../GameState.h" #include "../Input.h" #include "../actions/MazeSetTrackAction.h" #include "../actions/TrackPlaceAction.h" @@ -30,6 +31,7 @@ #include #include +using namespace OpenRCT2; using namespace OpenRCT2::TrackMetaData; bool gDisableErrorWindowSound = false; @@ -307,7 +309,7 @@ bool WindowRideConstructionUpdateState( if (alternativeType != TrackElemType::None && (availablePieces.get(trackType))) { trackType = alternativeType; - if (!gCheatsEnableChainLiftOnAllTrack) + if (!GetGameState().Cheats.EnableChainLiftOnAllTrack) liftHillAndInvertedState &= ~CONSTRUCTION_LIFT_HILL_SELECTED; } } @@ -357,7 +359,7 @@ bool WindowRideConstructionUpdateState( turnOffLiftHill = true; } - if (turnOffLiftHill && !gCheatsEnableChainLiftOnAllTrack) + if (turnOffLiftHill && !GetGameState().Cheats.EnableChainLiftOnAllTrack) { liftHillAndInvertedState &= ~CONSTRUCTION_LIFT_HILL_SELECTED; _currentTrackLiftHill &= ~CONSTRUCTION_LIFT_HILL_SELECTED; diff --git a/src/openrct2/world/Banner.cpp b/src/openrct2/world/Banner.cpp index 6ae2f8c285..d116973d67 100644 --- a/src/openrct2/world/Banner.cpp +++ b/src/openrct2/world/Banner.cpp @@ -43,7 +43,7 @@ std::string Banner::GetText() const { Formatter ft; FormatTextTo(ft); - return FormatStringID(STR_STRINGID, ft.Data()); + return FormatStringIDLegacy(STR_STRINGID, ft.Data()); } void Banner::FormatTextTo(Formatter& ft, bool addColour) const diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index 3b7f1c78ce..469a9b5f86 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -91,7 +91,7 @@ void ClimateReset(ClimateType climate) auto& gameState = GetGameState(); auto weather = WeatherType::PartiallyCloudy; int32_t month = GetDate().GetMonth(); - const WeatherTransition* transition = &ClimateTransitions[static_cast(climate)][month]; + const WeatherTransition* transition = &ClimateTransitions[EnumValue(climate)][month]; const WeatherState* weatherState = &ClimateWeatherData[EnumValue(weather)]; gameState.Climate = climate; @@ -126,7 +126,7 @@ void ClimateUpdate() if (gScreenFlags & (~SCREEN_FLAGS_PLAYING)) return; - if (!gCheatsFreezeWeather) + if (!GetGameState().Cheats.FreezeWeather) { if (gameState.ClimateUpdateTimer) { @@ -202,7 +202,7 @@ void ClimateForceWeather(WeatherType weather) { auto& gameState = GetGameState(); int32_t month = GetDate().GetMonth(); - const WeatherTransition* transition = &ClimateTransitions[static_cast(gameState.Climate)][month]; + const WeatherTransition* transition = &ClimateTransitions[EnumValue(gameState.Climate)][month]; const auto weatherState = &ClimateWeatherData[EnumValue(weather)]; gameState.ClimateCurrent.Weather = weather; @@ -306,7 +306,7 @@ static void ClimateDetermineFutureWeather(int32_t randomDistribution) // Generate a random variable with values 0 up to DistributionSize-1 and chose weather from the distribution table // accordingly - const WeatherTransition* transition = &ClimateTransitions[static_cast(gameState.Climate)][month]; + const WeatherTransition* transition = &ClimateTransitions[EnumValue(gameState.Climate)][month]; WeatherType nextWeather = (transition->Distribution[((randomDistribution & 0xFF) * transition->DistributionSize) >> 8]); gameState.ClimateNext.Weather = nextWeather; diff --git a/src/openrct2/world/ConstructionClearance.cpp b/src/openrct2/world/ConstructionClearance.cpp index aa3cc35b88..8fc716aaaa 100644 --- a/src/openrct2/world/ConstructionClearance.cpp +++ b/src/openrct2/world/ConstructionClearance.cpp @@ -137,7 +137,7 @@ GameActions::Result MapCanConstructWithClearAt( return res; } - if (gCheatsDisableClearanceChecks) + if (GetGameState().Cheats.DisableClearanceChecks) { res.SetData(ConstructClearResult{ groundFlags }); return res; diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index d5b105bb07..69f02d8560 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -10,6 +10,7 @@ #include "../Cheats.h" #include "../Context.h" #include "../Game.h" +#include "../GameState.h" #include "../Identifiers.h" #include "../OpenRCT2.h" #include "../actions/FootpathPlaceAction.h" @@ -288,7 +289,7 @@ CoordsXY FootpathGetCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32 { z = TileElementHeight(position); } - position = ViewportPosToMapPos(start_vp_pos, z); + position = ViewportPosToMapPos(start_vp_pos, z, viewport->rotation); position.x = std::clamp(position.x, minPosition.x, maxPosition.x); position.y = std::clamp(position.y, minPosition.y, maxPosition.y); } @@ -825,7 +826,7 @@ static void Loc6A6D7E( FootpathNeighbourList* neighbourList) { auto targetPos = CoordsXY{ initialTileElementPos } + CoordsDirectionDelta[direction]; - if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && MapIsEdge(targetPos)) + if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || OpenRCT2::GetGameState().Cheats.SandboxMode) && MapIsEdge(targetPos)) { if (query) { @@ -886,7 +887,7 @@ static void Loc6A6D7E( { return; } - uint16_t dx = DirectionReverse((direction - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK); + uint16_t dx = DirectionReverse((direction - tileElement->GetDirection()) & kTileElementDirectionMask); if (!(ted.SequenceProperties[trackSequence] & (1 << dx))) { @@ -972,7 +973,7 @@ static void Loc6A6C85( { return; } - uint16_t dx = (direction - tileElementPos.element->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK; + uint16_t dx = (direction - tileElementPos.element->GetDirection()) & kTileElementDirectionMask; if (!(ted.SequenceProperties[trackSequence] & (1 << dx))) { return; @@ -2214,7 +2215,7 @@ bool TileElementWantsPathConnectionTowards(const TileCoordsXYZD& coords, const T const auto& ted = GetTrackElementDescriptor(trackType); if (ted.SequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH) { - uint16_t dx = ((coords.direction - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK); + uint16_t dx = ((coords.direction - tileElement->GetDirection()) & kTileElementDirectionMask); if (ted.SequenceProperties[trackSequence] & (1 << dx)) { // Track element has the flags required for the given direction @@ -2353,7 +2354,7 @@ void FootpathRemoveEdgesAt(const CoordsXY& footpathPos, TileElement* tileElement static ObjectEntryIndex FootpathGetDefaultSurface(bool queue) { - bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode); + bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || OpenRCT2::GetGameState().Cheats.SandboxMode); for (ObjectEntryIndex i = 0; i < MAX_FOOTPATH_SURFACE_OBJECTS; i++) { auto pathEntry = GetPathSurfaceEntry(i); @@ -2377,7 +2378,7 @@ static bool FootpathIsSurfaceEntryOkay(ObjectEntryIndex index, bool queue) auto pathEntry = GetPathSurfaceEntry(index); if (pathEntry != nullptr) { - bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode); + bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || OpenRCT2::GetGameState().Cheats.SandboxMode); if (!showEditorPaths && (pathEntry->Flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR)) { return false; @@ -2405,7 +2406,7 @@ static ObjectEntryIndex FootpathGetDefaultRailings() static bool FootpathIsLegacyPathEntryOkay(ObjectEntryIndex index) { - bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode); + bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || OpenRCT2::GetGameState().Cheats.SandboxMode); auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); auto footpathObj = static_cast(objManager.GetLoadedObject(ObjectType::Paths, index)); if (footpathObj != nullptr) diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 4bf4c6c66f..048420be30 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -88,11 +88,7 @@ CoordsXY gMapSelectPositionB; CoordsXYZ gMapSelectArrowPosition; uint8_t gMapSelectArrowDirection; -TileCoordsXY gWidePathTileLoopPosition; -uint16_t gGrassSceneryTileLoopPosition; - std::vector gMapSelectionTiles; -std::vector gPeepSpawns; bool gLandMountainMode; bool gLandPaintMode; @@ -111,7 +107,6 @@ static std::vector _tileElementsStash; static size_t _tileElementsInUse; static size_t _tileElementsInUseStash; static TileCoordsXY _mapSizeStash; -static int32_t _currentRotationStash; void StashMap() { @@ -119,7 +114,6 @@ void StashMap() _tileIndexStash = std::move(_tileIndex); _tileElementsStash = std::move(gameState.TileElements); _mapSizeStash = GetGameState().MapSize; - _currentRotationStash = gCurrentRotation; _tileElementsInUseStash = _tileElementsInUse; } @@ -129,7 +123,6 @@ void UnstashMap() _tileIndex = std::move(_tileIndexStash); gameState.TileElements = std::move(_tileElementsStash); GetGameState().MapSize = _mapSizeStash; - gCurrentRotation = _currentRotationStash; _tileElementsInUse = _tileElementsInUseStash; } @@ -159,7 +152,7 @@ void SetTileElements(std::vector&& tileElements) auto& gameState = GetGameState(); gameState.TileElements = std::move(tileElements); _tileIndex = TilePointerIndex( - MAXIMUM_MAP_SIZE_TECHNICAL, gameState.TileElements.data(), gameState.TileElements.size()); + kMaximumMapSizeTechnical, gameState.TileElements.data(), gameState.TileElements.size()); _tileElementsInUse = gameState.TileElements.size(); } @@ -184,9 +177,9 @@ std::vector GetReorganisedTileElementsWithoutGhosts() { std::vector newElements; newElements.reserve(std::max(MIN_TILE_ELEMENTS, GetGameState().TileElements.size())); - for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) + for (int32_t y = 0; y < kMaximumMapSizeTechnical; y++) { - for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) + for (int32_t x = 0; x < kMaximumMapSizeTechnical; x++) { auto oldSize = newElements.size(); @@ -224,9 +217,9 @@ static void ReorganiseTileElements(size_t capacity) std::vector newElements; newElements.reserve(std::max(MIN_TILE_ELEMENTS, capacity)); - for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) + for (int32_t y = 0; y < kMaximumMapSizeTechnical; y++) { - for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) + for (int32_t x = 0; x < kMaximumMapSizeTechnical; x++) { const auto* element = MapGetFirstElementAt(TileCoordsXY{ x, y }); if (element == nullptr) @@ -343,8 +336,8 @@ void TileElementIteratorRestartForTile(TileElementIterator* it) static bool IsTileLocationValid(const TileCoordsXY& coords) { - const bool is_x_valid = coords.x < MAXIMUM_MAP_SIZE_TECHNICAL && coords.x >= 0; - const bool is_y_valid = coords.y < MAXIMUM_MAP_SIZE_TECHNICAL && coords.y >= 0; + const bool is_x_valid = coords.x < kMaximumMapSizeTechnical && coords.x >= 0; + const bool is_y_valid = coords.y < kMaximumMapSizeTechnical && coords.y >= 0; return is_x_valid && is_y_valid; } @@ -461,13 +454,13 @@ BannerElement* MapGetBannerElementAt(const CoordsXYZ& bannerPos, uint8_t positio */ void MapInit(const TileCoordsXY& size) { - auto numTiles = MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL; + auto numTiles = kMaximumMapSizeTechnical * kMaximumMapSizeTechnical; SetTileElements(std::vector(numTiles, GetDefaultSurfaceElement())); auto& gameState = GetGameState(); - gGrassSceneryTileLoopPosition = 0; - gWidePathTileLoopPosition = {}; + gameState.GrassSceneryTileLoopPosition = 0; + gameState.WidePathTileLoopPosition = {}; gameState.MapSize = size; MapRemoveOutOfRangeElements(); MapAnimationAutoCreate(); @@ -765,26 +758,23 @@ void MapUpdatePathWideFlags() // Presumably update_path_wide_flags is too computationally expensive to call for every // tile every update, so gWidePathTileLoopX and gWidePathTileLoopY store the x and y // progress. A maximum of 128 calls is done per update. - auto x = gWidePathTileLoopPosition.x; - auto y = gWidePathTileLoopPosition.y; + CoordsXY& loopPosition = GetGameState().WidePathTileLoopPosition; for (int32_t i = 0; i < 128; i++) { - FootpathUpdatePathWideFlags({ x, y }); + FootpathUpdatePathWideFlags(loopPosition); // Next x, y tile - x += COORDS_XY_STEP; - if (x >= MAXIMUM_MAP_SIZE_BIG) + loopPosition.x += COORDS_XY_STEP; + if (loopPosition.x >= MAXIMUM_MAP_SIZE_BIG) { - x = 0; - y += COORDS_XY_STEP; - if (y >= MAXIMUM_MAP_SIZE_BIG) + loopPosition.x = 0; + loopPosition.y += COORDS_XY_STEP; + if (loopPosition.y >= MAXIMUM_MAP_SIZE_BIG) { - y = 0; + loopPosition.y = 0; } } } - gWidePathTileLoopPosition.x = x; - gWidePathTileLoopPosition.y = y; } /** @@ -827,7 +817,7 @@ bool MapCanBuildAt(const CoordsXYZ& loc) { if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) return true; - if (gCheatsSandboxMode) + if (GetGameState().Cheats.SandboxMode) return true; if (MapIsLocationOwned(loc)) return true; @@ -963,7 +953,7 @@ uint8_t MapGetLowestLandHeight(const MapRange& range) if (surfaceElement != nullptr && min_height > surfaceElement->BaseHeight) { - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(CoordsXY{ xi, yi })) { @@ -992,7 +982,7 @@ uint8_t MapGetHighestLandHeight(const MapRange& range) auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ xi, yi }); if (surfaceElement != nullptr) { - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) { if (!MapIsLocationInPark(CoordsXY{ xi, yi })) { @@ -1270,7 +1260,7 @@ void MapUpdateTiles() int32_t x = 0; int32_t y = 0; - uint16_t interleaved_xy = gGrassSceneryTileLoopPosition; + uint16_t interleaved_xy = gameState.GrassSceneryTileLoopPosition; for (int32_t i = 0; i < 8; i++) { x = (x << 1) | (interleaved_xy & 1); @@ -1297,7 +1287,7 @@ void MapUpdateTiles() } } - gGrassSceneryTileLoopPosition++; + gameState.GrassSceneryTileLoopPosition++; } } @@ -1362,8 +1352,8 @@ void MapRemoveOutOfRangeElements() // NOTE: This is only a workaround for non-networked games. // Map resize has to become its own Game Action to properly solve this issue. // - bool buildState = gCheatsBuildInPauseMode; - gCheatsBuildInPauseMode = true; + bool buildState = GetGameState().Cheats.BuildInPauseMode; + GetGameState().Cheats.BuildInPauseMode = true; for (int32_t y = MAXIMUM_MAP_SIZE_BIG - COORDS_XY_STEP; y >= 0; y -= COORDS_XY_STEP) { @@ -1384,7 +1374,7 @@ void MapRemoveOutOfRangeElements() } // Reset cheat state - gCheatsBuildInPauseMode = buildState; + GetGameState().Cheats.BuildInPauseMode = buildState; } static void MapExtendBoundarySurfaceExtendTile(const SurfaceElement& sourceTile, SurfaceElement& destTile) @@ -1430,7 +1420,7 @@ static void MapExtendBoundarySurfaceExtendTile(const SurfaceElement& sourceTile, void MapExtendBoundarySurfaceY() { auto y = GetGameState().MapSize.y - 2; - for (auto x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) + for (auto x = 0; x < kMaximumMapSizeTechnical; x++) { auto existingTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y - 1 }); auto newTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }); @@ -1450,7 +1440,7 @@ void MapExtendBoundarySurfaceY() void MapExtendBoundarySurfaceX() { auto x = GetGameState().MapSize.x - 2; - for (auto y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) + for (auto y = 0; y < kMaximumMapSizeTechnical; y++) { auto existingTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x - 1, y }); auto newTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }); @@ -1556,12 +1546,13 @@ static void ClearElementAt(const CoordsXY& loc, TileElement** elementPtr) */ static void ClearElementsAt(const CoordsXY& loc) { + auto& gameState = GetGameState(); // Remove the spawn point (if there is one in the current tile) - gPeepSpawns.erase( + gameState.PeepSpawns.erase( std::remove_if( - gPeepSpawns.begin(), gPeepSpawns.end(), + gameState.PeepSpawns.begin(), gameState.PeepSpawns.end(), [loc](const CoordsXY& spawn) { return spawn.ToTileStart() == loc.ToTileStart(); }), - gPeepSpawns.end()); + gameState.PeepSpawns.end()); TileElement* tileElement = MapGetFirstElementAt(loc); if (tileElement == nullptr) @@ -1797,18 +1788,7 @@ static void MapInvalidateTileUnderZoom(int32_t x, int32_t y, int32_t z0, int32_t if (gOpenRCT2Headless) return; - int32_t x1, y1, x2, y2; - - x += 16; - y += 16; - auto screenCoord = Translate3DTo2D(GetCurrentRotation(), { x, y }); - - x1 = screenCoord.x - 32; - y1 = screenCoord.y - 32 - z1; - x2 = screenCoord.x + 32; - y2 = screenCoord.y + 32 - z0; - - ViewportsInvalidate({ { x1, y1 }, { x2, y2 } }, maxZoom); + ViewportsInvalidate(x, y, z0, z1, maxZoom); } /** diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index 8708ebc0cf..eb19182265 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -25,11 +25,11 @@ constexpr uint8_t kMaximumWaterHeight = 254; */ constexpr uint8_t kMapBaseZ = 7; -#define MINIMUM_MAP_SIZE_TECHNICAL 5 -#define MAXIMUM_MAP_SIZE_TECHNICAL 1001 -#define MINIMUM_MAP_SIZE_PRACTICAL (MINIMUM_MAP_SIZE_TECHNICAL - 2) -#define MAXIMUM_MAP_SIZE_PRACTICAL (MAXIMUM_MAP_SIZE_TECHNICAL - 2) -constexpr const int32_t MAXIMUM_MAP_SIZE_BIG = COORDS_XY_STEP * MAXIMUM_MAP_SIZE_TECHNICAL; +constexpr uint8_t kMinimumMapSizeTechnical = 5; +constexpr uint16_t kMaximumMapSizeTechnical = 1001; +constexpr int16_t kMinimumMapSizePractical = (kMinimumMapSizeTechnical - 2); +constexpr int16_t kMaximumMapSizePractical = (kMaximumMapSizeTechnical - 2); +constexpr const int32_t MAXIMUM_MAP_SIZE_BIG = COORDS_XY_STEP * kMaximumMapSizeTechnical; constexpr int32_t MAXIMUM_TILE_START_XY = MAXIMUM_MAP_SIZE_BIG - COORDS_XY_STEP; constexpr const int32_t LAND_HEIGHT_STEP = 2 * COORDS_Z_STEP; constexpr const int32_t WATER_HEIGHT_STEP = 2 * COORDS_Z_STEP; @@ -40,13 +40,10 @@ constexpr uint8_t ConstructionRightsClearanceSmall = 3; // Same as previous, but in big coords. constexpr const uint8_t ConstructionRightsClearanceBig = 3 * COORDS_Z_STEP; -#define MAP_MINIMUM_X_Y (-MAXIMUM_MAP_SIZE_TECHNICAL) +constexpr int16_t kMapMinimumXY = (-kMaximumMapSizeTechnical); constexpr uint32_t MAX_TILE_ELEMENTS_WITH_SPARE_ROOM = 0x1000000; constexpr uint32_t MAX_TILE_ELEMENTS = MAX_TILE_ELEMENTS_WITH_SPARE_ROOM - 512; -#define MAX_TILE_TILE_ELEMENT_POINTERS (MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL) - -#define TILE_UNDEFINED_TILE_ELEMENT NULL using PeepSpawn = CoordsXYZD; @@ -107,9 +104,6 @@ enum extern const std::array CoordsDirectionDelta; extern const TileCoordsXY TileDirectionDelta[]; -extern TileCoordsXY gWidePathTileLoopPosition; -extern uint16_t gGrassSceneryTileLoopPosition; - CoordsXY GetMapSizeUnits(); CoordsXY GetMapSizeMinus2(); CoordsXY GetMapSizeMaxXY(); @@ -122,7 +116,6 @@ extern CoordsXYZ gMapSelectArrowPosition; extern uint8_t gMapSelectArrowDirection; extern std::vector gMapSelectionTiles; -extern std::vector gPeepSpawns; // Used in the land tool window to enable mountain tool / land smoothing extern bool gLandMountainMode; diff --git a/src/openrct2/world/MapGen.cpp b/src/openrct2/world/MapGen.cpp index c035acd20c..b3a57e112c 100644 --- a/src/openrct2/world/MapGen.cpp +++ b/src/openrct2/world/MapGen.cpp @@ -693,8 +693,8 @@ bool MapGenLoadHeightmap(const utf8* path) try { auto image = Imaging::ReadFromFile(path, format); - auto width = std::min(image.Width, MAXIMUM_MAP_SIZE_PRACTICAL); - auto height = std::min(image.Height, MAXIMUM_MAP_SIZE_PRACTICAL); + auto width = std::min(image.Width, kMaximumMapSizePractical); + auto height = std::min(image.Height, kMaximumMapSizePractical); if (width != image.Width || height != image.Height) { ContextShowError(STR_HEIGHT_MAP_ERROR, STR_ERROR_HEIHGT_MAP_TOO_BIG, {}); diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 652c65fdb7..3263a2f4b8 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -47,11 +47,6 @@ using namespace OpenRCT2; -money64 gLandPrice; - -int16_t gParkRatingCasualtyPenalty; -uint32_t gGuestsInParkHistory[32]; - // If this value is more than or equal to 0, the park rating is forced to this value. Used for cheat static int32_t _forcedParkRating = -1; @@ -60,9 +55,10 @@ static int32_t _forcedParkRating = -1; */ static PeepSpawn* GetRandomPeepSpawn() { - if (!gPeepSpawns.empty()) + auto& gameState = GetGameState(); + if (!gameState.PeepSpawns.empty()) { - return &gPeepSpawns[ScenarioRand() % gPeepSpawns.size()]; + return &gameState.PeepSpawns[ScenarioRand() % gameState.PeepSpawns.size()]; } return nullptr; @@ -233,7 +229,7 @@ void Park::Initialise() { auto& gameState = GetGameState(); - Name = FormatStringID(STR_UNNAMED_PARK, nullptr); + Name = LanguageGetString(STR_UNNAMED_PARK); PluginStorage = {}; gameState.StaffHandymanColour = COLOUR_BRIGHT_RED; gameState.StaffMechanicColour = COLOUR_LIGHT_BLUE; @@ -241,7 +237,7 @@ void Park::Initialise() gameState.NumGuestsInPark = 0; gameState.NumGuestsInParkLastWeek = 0; gameState.NumGuestsHeadingForPark = 0; - gGuestChangeModifier = 0; + gameState.GuestChangeModifier = 0; gameState.ParkRating = 0; gameState.GuestGenerationProbability = 0; gameState.TotalRideValueForMoney = 0; @@ -258,7 +254,7 @@ void Park::Initialise() gameState.ParkEntranceFee = 10.00_GBP; - gPeepSpawns.clear(); + gameState.PeepSpawns.clear(); ParkEntranceReset(); gameState.ResearchPriorities = EnumsToFlags( @@ -273,7 +269,7 @@ void Park::Initialise() gameState.ScenarioObjective.Type = OBJECTIVE_GUESTS_BY; gameState.ScenarioObjective.Year = 4; gameState.ScenarioObjective.NumGuests = 1000; - gLandPrice = 90.00_GBP; + gameState.LandPrice = 90.00_GBP; gameState.ConstructionRightsPrice = 40.00_GBP; gameState.ParkFlags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES; ResetHistories(); @@ -460,7 +456,7 @@ int32_t Park::CalculateParkRating() const result -= 600 - (4 * (150 - std::min(150, litterCount))); } - result -= gParkRatingCasualtyPenalty; + result -= gameState.ParkRatingCasualtyPenalty; result = std::clamp(result, 0, 999); return result; } @@ -619,7 +615,7 @@ uint32_t Park::CalculateGuestGenerationProbability() const } // Reward or penalties for park awards - for (const auto& award : GetAwards()) + for (const auto& award : GetGameState().CurrentAwards) { // +/- 0.25% of the probability if (AwardIsPositive(award.Type)) @@ -729,7 +725,7 @@ void Park::ResetHistories() { auto& gameState = GetGameState(); std::fill(std::begin(gameState.ParkRatingHistory), std::end(gameState.ParkRatingHistory), ParkRatingHistoryUndefined); - std::fill(std::begin(gGuestsInParkHistory), std::end(gGuestsInParkHistory), GuestsInParkHistoryUndefined); + std::fill(std::begin(gameState.GuestsInParkHistory), std::end(gameState.GuestsInParkHistory), GuestsInParkHistoryUndefined); } void Park::UpdateHistories() @@ -746,13 +742,15 @@ void Park::UpdateHistories() guestChangeModifier = 0; } } - gGuestChangeModifier = guestChangeModifier; + gameState.GuestChangeModifier = guestChangeModifier; gameState.NumGuestsInParkLastWeek = gameState.NumGuestsInPark; // Update park rating, guests in park and current cash history HistoryPushRecord(gameState.ParkRatingHistory, gameState.ParkRating / 4); - HistoryPushRecord(gGuestsInParkHistory, gameState.NumGuestsInPark); - HistoryPushRecord(gCashHistory, FinanceGetCurrentCash() - gameState.BankLoan); + HistoryPushRecord(gameState.GuestsInParkHistory, gameState.NumGuestsInPark); + + constexpr auto cashHistorySize = std::extent_v; + HistoryPushRecord(gameState.CashHistory, FinanceGetCurrentCash() - gameState.BankLoan); // Update weekly profit history auto currentWeeklyProfit = gameState.WeeklyProfitAverageDividend; diff --git a/src/openrct2/world/Park.h b/src/openrct2/world/Park.h index c0858ff0fe..b11488dfa7 100644 --- a/src/openrct2/world/Park.h +++ b/src/openrct2/world/Park.h @@ -16,6 +16,7 @@ constexpr auto MAX_ENTRANCE_FEE = 999.00_GBP; constexpr uint8_t ParkRatingHistoryUndefined = std::numeric_limits::max(); constexpr uint32_t GuestsInParkHistoryUndefined = std::numeric_limits::max(); +constexpr uint8_t kParkRatingHistorySize = 32; constexpr uint8_t ParkNameMaxLength = 128; constexpr uint8_t ScenarioNameMaxLength = 128; constexpr uint16_t ScenarioDetailsNameMaxLength = 256; @@ -92,11 +93,6 @@ namespace OpenRCT2 }; } // namespace OpenRCT2 -extern money64 gLandPrice; - -extern int16_t gParkRatingCasualtyPenalty; -extern uint32_t gGuestsInParkHistory[32]; - void ParkSetForcedRating(int32_t rating); int32_t ParkGetForcedRating(); diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index 2bd2cee7e6..86418f2e83 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -180,7 +180,7 @@ void SmallSceneryElement::UpdateAge(const CoordsXY& sceneryPos) return; } - if (gCheatsDisablePlantAging && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_CAN_BE_WATERED)) + if (OpenRCT2::GetGameState().Cheats.DisablePlantAging && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_CAN_BE_WATERED)) { return; } @@ -315,7 +315,7 @@ bool IsSceneryAvailableToBuild(const ScenerySelection& item) return true; } - if (!gCheatsIgnoreResearchStatus) + if (!OpenRCT2::GetGameState().Cheats.IgnoreResearchStatus) { if (!SceneryIsInvented(item)) { @@ -323,7 +323,7 @@ bool IsSceneryAvailableToBuild(const ScenerySelection& item) } } - if (!gCheatsSandboxMode && !(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!OpenRCT2::GetGameState().Cheats.SandboxMode && !(gScreenFlags & SCREEN_FLAGS_EDITOR)) { if (IsSceneryItemRestricted(item)) { diff --git a/src/openrct2/world/Scenery.h b/src/openrct2/world/Scenery.h index eaa5d50cdd..b30c1795b4 100644 --- a/src/openrct2/world/Scenery.h +++ b/src/openrct2/world/Scenery.h @@ -15,8 +15,8 @@ #include -#define SCENERY_WITHER_AGE_THRESHOLD_1 0x28 -#define SCENERY_WITHER_AGE_THRESHOLD_2 0x37 +constexpr uint8_t kSceneryWitherAgeThreshold1 = 0x28; +constexpr uint8_t kSceneryWitherAgeThreshold2 = 0x37; enum { diff --git a/src/openrct2/world/SmallScenery.cpp b/src/openrct2/world/SmallScenery.cpp index 6c48010373..d154a5aacf 100644 --- a/src/openrct2/world/SmallScenery.cpp +++ b/src/openrct2/world/SmallScenery.cpp @@ -28,12 +28,12 @@ uint8_t SmallSceneryElement::GetSceneryQuadrant() const { - return (this->Type & TILE_ELEMENT_QUADRANT_MASK) >> 6; + return (this->Type & kTileElementQuadrantMask) >> 6; } void SmallSceneryElement::SetSceneryQuadrant(uint8_t newQuadrant) { - Type &= ~TILE_ELEMENT_QUADRANT_MASK; + Type &= ~kTileElementQuadrantMask; Type |= (newQuadrant << 6); } @@ -67,7 +67,7 @@ void SmallSceneryElement::IncreaseAge(const CoordsXY& sceneryPos) uint8_t newAge = age++; // Only invalidate tiles when scenery crosses the withering thresholds, and can be withered. - if (newAge == SCENERY_WITHER_AGE_THRESHOLD_1 || newAge == SCENERY_WITHER_AGE_THRESHOLD_2) + if (newAge == kSceneryWitherAgeThreshold1 || newAge == kSceneryWitherAgeThreshold2) { auto* sceneryEntry = GetEntry(); diff --git a/src/openrct2/world/Surface.cpp b/src/openrct2/world/Surface.cpp index 6340cb7fe3..015df092f2 100644 --- a/src/openrct2/world/Surface.cpp +++ b/src/openrct2/world/Surface.cpp @@ -192,24 +192,24 @@ void SurfaceElement::UpdateGrassLength(const CoordsXY& coords) uint8_t SurfaceElement::GetOwnership() const { - return (Ownership & TILE_ELEMENT_SURFACE_OWNERSHIP_MASK); + return (Ownership & kTileElementSurfaceOwnershipMask); } void SurfaceElement::SetOwnership(uint8_t newOwnership) { - Ownership &= ~TILE_ELEMENT_SURFACE_OWNERSHIP_MASK; - Ownership |= (newOwnership & TILE_ELEMENT_SURFACE_OWNERSHIP_MASK); + Ownership &= ~kTileElementSurfaceOwnershipMask; + Ownership |= (newOwnership & kTileElementSurfaceOwnershipMask); } uint8_t SurfaceElement::GetParkFences() const { - return (Ownership & TILE_ELEMENT_SURFACE_PARK_FENCE_MASK); + return (Ownership & kTileElementSurfaceParkFenceMask); } void SurfaceElement::SetParkFences(uint8_t newParkFences) { - Ownership &= ~TILE_ELEMENT_SURFACE_PARK_FENCE_MASK; - Ownership |= (newParkFences & TILE_ELEMENT_SURFACE_PARK_FENCE_MASK); + Ownership &= ~kTileElementSurfaceParkFenceMask; + Ownership |= (newParkFences & kTileElementSurfaceParkFenceMask); } uint8_t SurfaceElement::GetSlope() const diff --git a/src/openrct2/world/Surface.h b/src/openrct2/world/Surface.h index 266e96f2e3..04b3511b58 100644 --- a/src/openrct2/world/Surface.h +++ b/src/openrct2/world/Surface.h @@ -111,10 +111,10 @@ enum }; // Surface -#define TILE_ELEMENT_SURFACE_DIAGONAL_FLAG 0x10 // in TileElement.properties.surface.slope -#define TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK 0x0F // in TileElement.properties.surface.slope -#define TILE_ELEMENT_SURFACE_SLOPE_MASK \ - (TILE_ELEMENT_SURFACE_DIAGONAL_FLAG | TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK) // in TileElement.properties.surface.slope +constexpr uint8_t kTileElementSurfaceDiagonalFlag = 0x10; // in TileElement.properties.surface.slope +constexpr uint8_t kTileElementSurfaceRaisedCornersMask = 0x0F; // in TileElement.properties.surface.slope +constexpr uint8_t kTileElementSurfaceSlopeMask + = (kTileElementSurfaceDiagonalFlag | kTileElementSurfaceRaisedCornersMask); // in TileElement.properties.surface.slope -#define TILE_ELEMENT_SURFACE_OWNERSHIP_MASK 0xF0 -#define TILE_ELEMENT_SURFACE_PARK_FENCE_MASK 0x0F +constexpr uint8_t kTileElementSurfaceOwnershipMask = 0xF0; +constexpr uint8_t kTileElementSurfaceParkFenceMask = 0x0F; diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index d0d6a58b3d..52ce7c4a22 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -700,10 +700,10 @@ enum MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT = (1 << 7), }; -#define TILE_ELEMENT_QUADRANT_MASK 0b11000000 -#define TILE_ELEMENT_TYPE_MASK 0b00111100 -#define TILE_ELEMENT_DIRECTION_MASK 0b00000011 -#define TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK 0b00001111 +constexpr uint8_t kTileElementQuadrantMask = 0b11000000; +constexpr uint8_t kTileElementTypeMask = 0b00111100; +constexpr uint8_t kTileElementDirectionMask = 0b00000011; +constexpr uint8_t kTileElementOccupiedQuadrantsMask = 0b00001111; enum { diff --git a/src/openrct2/world/TileElementBase.cpp b/src/openrct2/world/TileElementBase.cpp index e25bb596a5..d06f672737 100644 --- a/src/openrct2/world/TileElementBase.cpp +++ b/src/openrct2/world/TileElementBase.cpp @@ -12,29 +12,29 @@ TileElementType TileElementBase::GetType() const { - return static_cast((this->Type & TILE_ELEMENT_TYPE_MASK) >> 2); + return static_cast((this->Type & kTileElementTypeMask) >> 2); } void TileElementBase::SetType(TileElementType newType) { - this->Type &= ~TILE_ELEMENT_TYPE_MASK; - this->Type |= ((EnumValue(newType) << 2) & TILE_ELEMENT_TYPE_MASK); + this->Type &= ~kTileElementTypeMask; + this->Type |= ((EnumValue(newType) << 2) & kTileElementTypeMask); } Direction TileElementBase::GetDirection() const { - return this->Type & TILE_ELEMENT_DIRECTION_MASK; + return this->Type & kTileElementDirectionMask; } void TileElementBase::SetDirection(Direction direction) { - this->Type &= ~TILE_ELEMENT_DIRECTION_MASK; - this->Type |= (direction & TILE_ELEMENT_DIRECTION_MASK); + this->Type &= ~kTileElementDirectionMask; + this->Type |= (direction & kTileElementDirectionMask); } Direction TileElementBase::GetDirectionWithOffset(uint8_t offset) const { - return ((this->Type & TILE_ELEMENT_DIRECTION_MASK) + offset) & TILE_ELEMENT_DIRECTION_MASK; + return ((this->Type & kTileElementDirectionMask) + offset) & kTileElementDirectionMask; } bool TileElementBase::IsLastForTile() const @@ -87,13 +87,13 @@ void TileElementBase::Remove() uint8_t TileElementBase::GetOccupiedQuadrants() const { - return Flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK; + return Flags & kTileElementOccupiedQuadrantsMask; } void TileElementBase::SetOccupiedQuadrants(uint8_t quadrants) { - Flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK; - Flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK); + Flags &= ~kTileElementOccupiedQuadrantsMask; + Flags |= (quadrants & kTileElementOccupiedQuadrantsMask); } int32_t TileElementBase::GetBaseZ() const diff --git a/src/openrct2/world/TileElementsView.h b/src/openrct2/world/TileElementsView.h index c4912b8564..a8bef7a87a 100644 --- a/src/openrct2/world/TileElementsView.h +++ b/src/openrct2/world/TileElementsView.h @@ -7,6 +7,8 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ +#pragma once + #include "Location.hpp" #include "Map.h" #include "TileElement.h" diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 7a76295e1e..ecbb9f6a31 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -219,7 +219,7 @@ namespace OpenRCT2::TileInspector case TileElementType::Path: if (tileElement->AsPath()->IsSloped()) { - newRotation = (tileElement->AsPath()->GetSlopeDirection() + 1) & TILE_ELEMENT_DIRECTION_MASK; + newRotation = (tileElement->AsPath()->GetSlopeDirection() + 1) & kTileElementDirectionMask; tileElement->AsPath()->SetSlopeDirection(newRotation); } pathEdges = tileElement->AsPath()->GetEdges(); diff --git a/src/openrct2/world/Wall.cpp b/src/openrct2/world/Wall.cpp index 44b07e1b01..f889baccfd 100644 --- a/src/openrct2/world/Wall.cpp +++ b/src/openrct2/world/Wall.cpp @@ -82,12 +82,12 @@ void WallRemoveIntersectingWalls(const CoordsXYRangedZ& wallPos, Direction direc uint8_t WallElement::GetSlope() const { - return (Type & TILE_ELEMENT_QUADRANT_MASK) >> 6; + return (Type & kTileElementQuadrantMask) >> 6; } void WallElement::SetSlope(uint8_t newSlope) { - Type &= ~TILE_ELEMENT_QUADRANT_MASK; + Type &= ~kTileElementQuadrantMask; Type |= (newSlope << 6); } diff --git a/test/tests/ImageImporterTests.cpp b/test/tests/ImageImporterTests.cpp index cfe50c4fa9..ec5d232f87 100644 --- a/test/tests/ImageImporterTests.cpp +++ b/test/tests/ImageImporterTests.cpp @@ -41,7 +41,8 @@ TEST_F(ImageImporterTests, Import_Logo) ImageImporter importer; auto image = Imaging::ReadFromFile(logoPath, IMAGE_FORMAT::PNG_32); - auto result = importer.Import(image, 3, 5, ImageImporter::Palette::OpenRCT2, ImageImporter::ImportFlags::RLE); + auto meta = ImageImportMeta{ .offset = { 3, 5 } }; + auto result = importer.Import(image, meta); ASSERT_EQ(result.Buffer.data(), result.Element.offset); ASSERT_EQ(128, result.Element.width); diff --git a/test/tests/PlayTests.cpp b/test/tests/PlayTests.cpp index 1c840be8cc..fafade06eb 100644 --- a/test/tests/PlayTests.cpp +++ b/test/tests/PlayTests.cpp @@ -116,7 +116,7 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds) execute(ferrisWheel.id, 0, true); // Ignore intensity to stimulate peeps to queue into ferris wheel - gCheatsIgnoreRideIntensity = true; + GetGameState().Cheats.IgnoreRideIntensity = true; // Insert a rich guest auto richGuest = gs->GetPark().GenerateGuest(); @@ -176,7 +176,7 @@ TEST_F(PlayTests, CarRideWithOneCarOnlyAcceptsTwoGuests) execute(carRide.id, 0, true); // Ignore intensity to stimulate peeps to queue into the ride - gCheatsIgnoreRideIntensity = true; + GetGameState().Cheats.IgnoreRideIntensity = true; // Create some guests std::vector guests; diff --git a/test/tests/TileElementsView.cpp b/test/tests/TileElementsView.cpp index c9924015e9..983ba2bf82 100644 --- a/test/tests/TileElementsView.cpp +++ b/test/tests/TileElementsView.cpp @@ -117,9 +117,9 @@ template bool CompareLists(const CoordsXY& pos) template void CheckMapTiles() { - for (int y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; ++y) + for (int y = 0; y < kMaximumMapSizeTechnical; ++y) { - for (int x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; ++x) + for (int x = 0; x < kMaximumMapSizeTechnical; ++x) { auto pos = TileCoordsXY(x, y).ToCoordsXY();